blob: 90bf0d3a830a384822204f341c51f5820ef6e325 [file] [log] [blame]
Thomas Gleixnerd0fa1172019-05-20 19:07:57 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
Takashi Iwai1d045db2011-07-07 18:23:21 +02005 * HD audio interface patch for Realtek ALC codecs
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
Kailang Yangdf694da2005-12-05 19:42:22 +01007 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * Takashi Iwai <tiwai@suse.de>
Jonathan Woithe409a3e92012-03-27 13:01:01 +103010 * Jonathan Woithe <jwoithe@just42.net>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/slab.h>
16#include <linux/pci.h>
Takashi Iwai08fb0d02013-01-10 17:33:58 +010017#include <linux/dmi.h>
Paul Gortmakerda155d52011-07-15 12:38:28 -040018#include <linux/module.h>
David Henningsson33f4acd2015-01-07 15:50:13 +010019#include <linux/input.h>
Kai-Heng Feng87dc3642020-04-30 21:52:07 +080020#include <linux/leds.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <sound/core.h>
Kailang Yang9ad0e492010-09-14 23:22:00 +020022#include <sound/jack.h>
Pierre-Louis Bossartbe57bff2018-08-22 15:24:57 -050023#include <sound/hda_codec.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include "hda_local.h"
Takashi Iwai23d30f22012-05-07 17:17:32 +020025#include "hda_auto_parser.h"
Takashi Iwai1835a0f2011-10-27 22:12:46 +020026#include "hda_jack.h"
Takashi Iwai08c189f2012-12-19 15:22:24 +010027#include "hda_generic.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Takashi Iwaicd63a5f2013-07-05 12:13:59 +020029/* keep halting ALC5505 DSP, for power saving */
30#define HALT_REALTEK_ALC5505
31
Takashi Iwai4a79ba32009-04-22 16:31:35 +020032/* extra amp-initialization sequence types */
33enum {
Takashi Iwai1c76aa52018-06-21 16:37:54 +020034 ALC_INIT_UNDEFINED,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020035 ALC_INIT_NONE,
36 ALC_INIT_DEFAULT,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020037};
38
David Henningsson73bdd592013-04-15 15:44:14 +020039enum {
40 ALC_HEADSET_MODE_UNKNOWN,
41 ALC_HEADSET_MODE_UNPLUGGED,
42 ALC_HEADSET_MODE_HEADSET,
43 ALC_HEADSET_MODE_MIC,
44 ALC_HEADSET_MODE_HEADPHONE,
45};
46
47enum {
48 ALC_HEADSET_TYPE_UNKNOWN,
49 ALC_HEADSET_TYPE_CTIA,
50 ALC_HEADSET_TYPE_OMTP,
51};
52
Hui Wangc7b60a82015-12-28 11:35:25 +080053enum {
54 ALC_KEY_MICMUTE_INDEX,
55};
56
Kailang Yangda00c242010-03-19 11:23:45 +010057struct alc_customize_define {
58 unsigned int sku_cfg;
59 unsigned char port_connectivity;
60 unsigned char check_sum;
61 unsigned char customization;
62 unsigned char external_amp;
63 unsigned int enable_pcbeep:1;
64 unsigned int platform_type:1;
65 unsigned int swap:1;
66 unsigned int override:1;
David Henningsson90622912010-10-14 14:50:18 +020067 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
Kailang Yangda00c242010-03-19 11:23:45 +010068};
69
Takashi Iwai766538a2020-06-18 13:08:41 +020070struct alc_coef_led {
71 unsigned int idx;
72 unsigned int mask;
73 unsigned int on;
74 unsigned int off;
75};
76
Linus Torvalds1da177e2005-04-16 15:20:36 -070077struct alc_spec {
Takashi Iwai08c189f2012-12-19 15:22:24 +010078 struct hda_gen_spec gen; /* must be at head */
Takashi Iwai23d30f22012-05-07 17:17:32 +020079
Linus Torvalds1da177e2005-04-16 15:20:36 -070080 /* codec parameterization */
Kailang Yangda00c242010-03-19 11:23:45 +010081 struct alc_customize_define cdefine;
Takashi Iwai08c189f2012-12-19 15:22:24 +010082 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
83
Takashi Iwai5579cd62018-06-19 22:22:41 +020084 /* GPIO bits */
85 unsigned int gpio_mask;
86 unsigned int gpio_dir;
87 unsigned int gpio_data;
Takashi Iwai215c8502018-06-19 22:34:26 +020088 bool gpio_write_delay; /* add a delay before writing gpio_data */
Takashi Iwai5579cd62018-06-19 22:22:41 +020089
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +020090 /* mute LED for HP laptops, see vref_mute_led_set() */
Takashi Iwai08fb0d02013-01-10 17:33:58 +010091 int mute_led_polarity;
Kai-Heng Fengdbd13172020-04-30 16:32:51 +080092 int micmute_led_polarity;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010093 hda_nid_t mute_led_nid;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +080094 hda_nid_t cap_mute_led_nid;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010095
Takashi Iwai0f32fd192014-11-19 12:16:14 +010096 unsigned int gpio_mute_led_mask;
97 unsigned int gpio_mic_led_mask;
Takashi Iwai766538a2020-06-18 13:08:41 +020098 struct alc_coef_led mute_led_coef;
99 struct alc_coef_led mic_led_coef;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +0100100
David Henningsson73bdd592013-04-15 15:44:14 +0200101 hda_nid_t headset_mic_pin;
102 hda_nid_t headphone_mic_pin;
103 int current_headset_mode;
104 int current_headset_type;
105
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100106 /* hooks */
107 void (*init_hook)(struct hda_codec *codec);
Takashi Iwai83012a72012-08-24 18:38:08 +0200108#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500109 void (*power_hook)(struct hda_codec *codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100110#endif
Takashi Iwai1c7161532011-04-07 10:37:16 +0200111 void (*shutup)(struct hda_codec *codec);
Takashi Iwai70a09762015-12-15 14:59:58 +0100112 void (*reboot_notify)(struct hda_codec *codec);
Takashi Iwaid922b512011-04-28 12:18:53 +0200113
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200114 int init_amp;
Takashi Iwaid433a672010-09-20 15:11:54 +0200115 int codec_variant; /* flag for other variants */
Kailang Yang97a26572013-11-29 00:35:26 -0500116 unsigned int has_alc5505_dsp:1;
117 unsigned int no_depop_delay:1;
Kailang Yang693abe12019-01-29 15:38:21 +0800118 unsigned int done_hp_init:1;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100119 unsigned int no_shutup_pins:1;
Kailang Yangd3ba58b2019-05-06 15:09:42 +0800120 unsigned int ultra_low_power:1;
Hui Wang476c02e2020-03-29 16:20:18 +0800121 unsigned int has_hs_key:1;
Kailang Yang92666d42020-11-19 17:04:21 +0800122 unsigned int no_internal_mic_pin:1;
Takashi Iwaie64f14f2009-01-20 18:32:55 +0100123
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200124 /* for PLL fix */
125 hda_nid_t pll_nid;
126 unsigned int pll_coef_idx, pll_coef_bit;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200127 unsigned int coef0;
David Henningsson33f4acd2015-01-07 15:50:13 +0100128 struct input_dev *kb_dev;
Hui Wangc7b60a82015-12-28 11:35:25 +0800129 u8 alc_mute_keycode_map[1];
Kailang Yangdf694da2005-12-05 19:42:22 +0100130};
131
Takashi Iwai23f0c042009-02-26 13:03:58 +0100132/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200133 * COEF access helper functions
134 */
135
136static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
137 unsigned int coef_idx)
138{
139 unsigned int val;
140
141 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
142 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
143 return val;
144}
145
146#define alc_read_coef_idx(codec, coef_idx) \
147 alc_read_coefex_idx(codec, 0x20, coef_idx)
148
149static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
150 unsigned int coef_idx, unsigned int coef_val)
151{
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
153 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
154}
155
156#define alc_write_coef_idx(codec, coef_idx, coef_val) \
157 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
158
Takashi Iwai98b24882014-08-18 13:47:50 +0200159static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 unsigned int coef_idx, unsigned int mask,
161 unsigned int bits_set)
162{
163 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
164
165 if (val != -1)
166 alc_write_coefex_idx(codec, nid, coef_idx,
167 (val & ~mask) | bits_set);
168}
169
170#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
171 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
172
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200173/* a special bypass for COEF 0; read the cached value at the second time */
174static unsigned int alc_get_coef0(struct hda_codec *codec)
175{
176 struct alc_spec *spec = codec->spec;
177
178 if (!spec->coef0)
179 spec->coef0 = alc_read_coef_idx(codec, 0);
180 return spec->coef0;
181}
182
Takashi Iwai54db6c32014-08-18 15:11:19 +0200183/* coef writes/updates batch */
184struct coef_fw {
185 unsigned char nid;
186 unsigned char idx;
187 unsigned short mask;
188 unsigned short val;
189};
190
191#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
192 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
193#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
194#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
195#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
196
197static void alc_process_coef_fw(struct hda_codec *codec,
198 const struct coef_fw *fw)
199{
200 for (; fw->nid; fw++) {
201 if (fw->mask == (unsigned short)-1)
202 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
203 else
204 alc_update_coefex_idx(codec, fw->nid, fw->idx,
205 fw->mask, fw->val);
206 }
207}
208
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200209/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200210 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100211 */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200212
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200213/* Enable GPIO mask and set output */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200214static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
215{
216 struct alc_spec *spec = codec->spec;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200217
Takashi Iwai5579cd62018-06-19 22:22:41 +0200218 spec->gpio_mask |= mask;
219 spec->gpio_dir |= mask;
220 spec->gpio_data |= mask;
221}
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200222
Takashi Iwai5579cd62018-06-19 22:22:41 +0200223static void alc_write_gpio_data(struct hda_codec *codec)
224{
225 struct alc_spec *spec = codec->spec;
226
227 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
228 spec->gpio_data);
229}
230
Takashi Iwaiaaf312d2018-06-19 22:28:22 +0200231static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
232 bool on)
233{
234 struct alc_spec *spec = codec->spec;
235 unsigned int oldval = spec->gpio_data;
236
237 if (on)
238 spec->gpio_data |= mask;
239 else
240 spec->gpio_data &= ~mask;
241 if (oldval != spec->gpio_data)
242 alc_write_gpio_data(codec);
243}
244
Takashi Iwai5579cd62018-06-19 22:22:41 +0200245static void alc_write_gpio(struct hda_codec *codec)
246{
247 struct alc_spec *spec = codec->spec;
248
249 if (!spec->gpio_mask)
250 return;
251
252 snd_hda_codec_write(codec, codec->core.afg, 0,
253 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
254 snd_hda_codec_write(codec, codec->core.afg, 0,
255 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
Takashi Iwai215c8502018-06-19 22:34:26 +0200256 if (spec->gpio_write_delay)
257 msleep(1);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200258 alc_write_gpio_data(codec);
259}
260
261static void alc_fixup_gpio(struct hda_codec *codec, int action,
262 unsigned int mask)
263{
264 if (action == HDA_FIXUP_ACT_PRE_PROBE)
265 alc_setup_gpio(codec, mask);
266}
267
268static void alc_fixup_gpio1(struct hda_codec *codec,
269 const struct hda_fixup *fix, int action)
270{
271 alc_fixup_gpio(codec, action, 0x01);
272}
273
274static void alc_fixup_gpio2(struct hda_codec *codec,
275 const struct hda_fixup *fix, int action)
276{
277 alc_fixup_gpio(codec, action, 0x02);
278}
279
280static void alc_fixup_gpio3(struct hda_codec *codec,
281 const struct hda_fixup *fix, int action)
282{
283 alc_fixup_gpio(codec, action, 0x03);
284}
Kailang Yangbdd148a2007-05-08 15:19:08 +0200285
Takashi Iwaiae065f12018-06-19 23:00:03 +0200286static void alc_fixup_gpio4(struct hda_codec *codec,
287 const struct hda_fixup *fix, int action)
288{
289 alc_fixup_gpio(codec, action, 0x04);
290}
291
Takashi Iwai8a503552020-06-18 13:08:32 +0200292static void alc_fixup_micmute_led(struct hda_codec *codec,
293 const struct hda_fixup *fix, int action)
294{
Jaroslav Kyselae65bf992021-03-17 18:29:43 +0100295 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai8a503552020-06-18 13:08:32 +0200296 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
297}
298
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200299/*
300 * Fix hardware PLL issue
301 * On some codecs, the analog PLL gating control must be off while
302 * the default value is 1.
303 */
304static void alc_fix_pll(struct hda_codec *codec)
305{
306 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200307
Takashi Iwai98b24882014-08-18 13:47:50 +0200308 if (spec->pll_nid)
309 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
310 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200311}
312
313static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
314 unsigned int coef_idx, unsigned int coef_bit)
315{
316 struct alc_spec *spec = codec->spec;
317 spec->pll_nid = nid;
318 spec->pll_coef_idx = coef_idx;
319 spec->pll_coef_bit = coef_bit;
320 alc_fix_pll(codec);
321}
322
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100323/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200324static void alc_update_knob_master(struct hda_codec *codec,
325 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100326{
327 unsigned int val;
328 struct snd_kcontrol *kctl;
329 struct snd_ctl_elem_value *uctl;
330
331 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
332 if (!kctl)
333 return;
334 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
335 if (!uctl)
336 return;
Takashi Iwai2ebab402016-02-09 10:23:52 +0100337 val = snd_hda_codec_read(codec, jack->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100338 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
339 val &= HDA_AMP_VOLMASK;
340 uctl->value.integer.value[0] = val;
341 uctl->value.integer.value[1] = val;
342 kctl->put(kctl, uctl);
343 kfree(uctl);
344}
345
David Henningsson29adc4b2012-09-25 11:31:00 +0200346static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100347{
David Henningsson29adc4b2012-09-25 11:31:00 +0200348 /* For some reason, the res given from ALC880 is broken.
349 Here we adjust it properly. */
350 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100351}
352
Kailang Yang394c97f2014-11-12 17:38:08 +0800353/* Change EAPD to verb control */
354static void alc_fill_eapd_coef(struct hda_codec *codec)
355{
356 int coef;
357
358 coef = alc_get_coef0(codec);
359
Takashi Iwai7639a062015-03-03 10:07:24 +0100360 switch (codec->core.vendor_id) {
Kailang Yang394c97f2014-11-12 17:38:08 +0800361 case 0x10ec0262:
362 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
363 break;
364 case 0x10ec0267:
365 case 0x10ec0268:
366 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
367 break;
368 case 0x10ec0269:
369 if ((coef & 0x00f0) == 0x0010)
370 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
371 if ((coef & 0x00f0) == 0x0020)
372 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
373 if ((coef & 0x00f0) == 0x0030)
374 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
375 break;
376 case 0x10ec0280:
377 case 0x10ec0284:
378 case 0x10ec0290:
379 case 0x10ec0292:
380 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
381 break;
Kailang Yang42314302016-02-03 15:03:50 +0800382 case 0x10ec0225:
Takashi Iwai44be77c2017-12-27 08:53:59 +0100383 case 0x10ec0295:
384 case 0x10ec0299:
385 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -0500386 fallthrough;
Takashi Iwai44be77c2017-12-27 08:53:59 +0100387 case 0x10ec0215:
Kailang Yang394c97f2014-11-12 17:38:08 +0800388 case 0x10ec0233:
Kailang Yangea04a1d2018-04-25 15:31:52 +0800389 case 0x10ec0235:
Thomas Hebbc4473742020-03-30 12:09:38 -0400390 case 0x10ec0236:
Kailang Yang7fbdcd82020-04-23 14:18:31 +0800391 case 0x10ec0245:
Kailang Yang394c97f2014-11-12 17:38:08 +0800392 case 0x10ec0255:
Thomas Hebbc4473742020-03-30 12:09:38 -0400393 case 0x10ec0256:
Kailang Yangf429e7e2017-12-05 15:38:24 +0800394 case 0x10ec0257:
Kailang Yang394c97f2014-11-12 17:38:08 +0800395 case 0x10ec0282:
396 case 0x10ec0283:
397 case 0x10ec0286:
398 case 0x10ec0288:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800399 case 0x10ec0285:
Kailang Yang506b62c2014-12-18 17:07:44 +0800400 case 0x10ec0298:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800401 case 0x10ec0289:
Kailang Yang1078bef2018-11-08 16:36:15 +0800402 case 0x10ec0300:
Kailang Yang394c97f2014-11-12 17:38:08 +0800403 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
404 break;
Kailang Yang3aabf942017-11-08 15:28:33 +0800405 case 0x10ec0275:
406 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
407 break;
Hui Wang88227022021-05-07 10:44:52 +0800408 case 0x10ec0287:
409 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
410 alc_write_coef_idx(codec, 0x8, 0x4ab7);
411 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800412 case 0x10ec0293:
413 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
414 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800415 case 0x10ec0234:
416 case 0x10ec0274:
417 case 0x10ec0294:
Kailang Yang6fbae352016-05-30 16:44:20 +0800418 case 0x10ec0700:
419 case 0x10ec0701:
420 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +0800421 case 0x10ec0711:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800422 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
423 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800424 case 0x10ec0662:
425 if ((coef & 0x00f0) == 0x0030)
426 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
427 break;
428 case 0x10ec0272:
429 case 0x10ec0273:
430 case 0x10ec0663:
431 case 0x10ec0665:
432 case 0x10ec0670:
433 case 0x10ec0671:
434 case 0x10ec0672:
435 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
436 break;
Kailang Yang9194a1e2020-01-07 17:22:19 +0800437 case 0x10ec0222:
Kailang Yangf0778872019-10-24 15:13:32 +0800438 case 0x10ec0623:
439 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
440 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800441 case 0x10ec0668:
442 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
443 break;
444 case 0x10ec0867:
445 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
446 break;
447 case 0x10ec0888:
448 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
449 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
450 break;
451 case 0x10ec0892:
Kailang Yange5782a52020-11-27 14:39:23 +0800452 case 0x10ec0897:
Kailang Yang394c97f2014-11-12 17:38:08 +0800453 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
454 break;
455 case 0x10ec0899:
456 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +0800457 case 0x10ec0b00:
Kailang Yang65553b12017-07-11 15:15:47 +0800458 case 0x10ec1168:
Kailang Yanga535ad52017-01-16 16:59:26 +0800459 case 0x10ec1220:
Kailang Yang394c97f2014-11-12 17:38:08 +0800460 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
461 break;
462 }
463}
464
Kailang Yangf9423e72008-05-27 12:32:25 +0200465/* additional initialization for ALC888 variants */
466static void alc888_coef_init(struct hda_codec *codec)
467{
Kailang Yang1df88742014-10-29 16:10:13 +0800468 switch (alc_get_coef0(codec) & 0x00f0) {
469 /* alc888-VA */
470 case 0x00:
471 /* alc888-VB */
472 case 0x10:
473 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
474 break;
475 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200476}
477
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100478/* turn on/off EAPD control (only if available) */
479static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
480{
481 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
482 return;
483 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
484 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
485 on ? 2 : 0);
486}
487
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200488/* turn on/off EAPD controls of the codec */
489static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
490{
491 /* We currently only handle front, HP */
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100492 static const hda_nid_t pins[] = {
Hui Wangaf95b412015-03-26 17:14:55 +0800493 0x0f, 0x10, 0x14, 0x15, 0x17, 0
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200494 };
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100495 const hda_nid_t *p;
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200496 for (p = pins; *p; p++)
497 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200498}
499
Kailang Yangdad31972019-05-10 16:28:57 +0800500static int find_ext_mic_pin(struct hda_codec *codec);
501
502static void alc_headset_mic_no_shutup(struct hda_codec *codec)
503{
504 const struct hda_pincfg *pin;
505 int mic_pin = find_ext_mic_pin(codec);
506 int i;
507
508 /* don't shut up pins when unloading the driver; otherwise it breaks
509 * the default pin setup at the next load of the driver
510 */
511 if (codec->bus->shutdown)
512 return;
513
514 snd_array_for_each(&codec->init_pins, i, pin) {
515 /* use read here for syncing after issuing each verb */
516 if (pin->nid != mic_pin)
517 snd_hda_codec_read(codec, pin->nid, 0,
518 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
519 }
520
521 codec->pins_shutup = 1;
522}
523
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100524static void alc_shutup_pins(struct hda_codec *codec)
525{
526 struct alc_spec *spec = codec->spec;
527
Kailang Yangdad31972019-05-10 16:28:57 +0800528 switch (codec->core.vendor_id) {
Kailang Yang66c5d712019-12-09 15:56:15 +0800529 case 0x10ec0283:
Kailang Yangdad31972019-05-10 16:28:57 +0800530 case 0x10ec0286:
531 case 0x10ec0288:
532 case 0x10ec0298:
533 alc_headset_mic_no_shutup(codec);
534 break;
535 default:
536 if (!spec->no_shutup_pins)
537 snd_hda_shutup_pins(codec);
538 break;
539 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100540}
541
Takashi Iwai1c7161532011-04-07 10:37:16 +0200542/* generic shutup callback;
Lars-Peter Clausen4ce8e6a2016-11-08 15:48:06 +0100543 * just turning off EAPD and a little pause for avoiding pop-noise
Takashi Iwai1c7161532011-04-07 10:37:16 +0200544 */
545static void alc_eapd_shutup(struct hda_codec *codec)
546{
Kailang Yang97a26572013-11-29 00:35:26 -0500547 struct alc_spec *spec = codec->spec;
548
Takashi Iwai1c7161532011-04-07 10:37:16 +0200549 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500550 if (!spec->no_depop_delay)
551 msleep(200);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100552 alc_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200553}
554
Takashi Iwai1d045db2011-07-07 18:23:21 +0200555/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200556static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200557{
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200558 alc_auto_setup_eapd(codec, true);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200559 alc_write_gpio(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200560 switch (type) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200561 case ALC_INIT_DEFAULT:
Takashi Iwai7639a062015-03-03 10:07:24 +0100562 switch (codec->core.vendor_id) {
Kailang Yangc9b58002007-10-16 14:30:01 +0200563 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200564 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200565 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200566 case 0x10ec0880:
567 case 0x10ec0882:
568 case 0x10ec0883:
569 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800570 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200571 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200572 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200573 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200574 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200575 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200576 break;
577 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200578}
Kailang Yangea1fb292008-08-26 12:58:38 +0200579
Takashi Iwai35a39f92019-02-01 11:19:50 +0100580/* get a primary headphone pin if available */
581static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
582{
583 if (spec->gen.autocfg.hp_pins[0])
584 return spec->gen.autocfg.hp_pins[0];
585 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
586 return spec->gen.autocfg.line_out_pins[0];
587 return 0;
588}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200589
590/*
591 * Realtek SSID verification
592 */
593
David Henningsson90622912010-10-14 14:50:18 +0200594/* Could be any non-zero and even value. When used as fixup, tells
595 * the driver to ignore any present sku defines.
596 */
597#define ALC_FIXUP_SKU_IGNORE (2)
598
Takashi Iwai23d30f22012-05-07 17:17:32 +0200599static void alc_fixup_sku_ignore(struct hda_codec *codec,
600 const struct hda_fixup *fix, int action)
601{
602 struct alc_spec *spec = codec->spec;
603 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
604 spec->cdefine.fixup = 1;
605 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
606 }
607}
608
Mengdong Linb5c66112013-11-29 00:35:35 -0500609static void alc_fixup_no_depop_delay(struct hda_codec *codec,
610 const struct hda_fixup *fix, int action)
611{
612 struct alc_spec *spec = codec->spec;
613
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500614 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500615 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500616 codec->depop_delay = 0;
617 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500618}
619
Kailang Yangda00c242010-03-19 11:23:45 +0100620static int alc_auto_parse_customize_define(struct hda_codec *codec)
621{
622 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100623 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100624 struct alc_spec *spec = codec->spec;
625
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200626 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
627
David Henningsson90622912010-10-14 14:50:18 +0200628 if (spec->cdefine.fixup) {
629 ass = spec->cdefine.sku_cfg;
630 if (ass == ALC_FIXUP_SKU_IGNORE)
631 return -1;
632 goto do_sku;
633 }
634
Takashi Iwai5100cd02014-02-15 10:03:19 +0100635 if (!codec->bus->pci)
636 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100637 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200638 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100639 goto do_sku;
640
641 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100642 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100643 nid = 0x17;
644 ass = snd_hda_codec_get_pincfg(codec, nid);
645
646 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100647 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100648 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100649 return -1;
650 }
651
652 /* check sum */
653 tmp = 0;
654 for (i = 1; i < 16; i++) {
655 if ((ass >> i) & 1)
656 tmp++;
657 }
658 if (((ass >> 16) & 0xf) != tmp)
659 return -1;
660
661 spec->cdefine.port_connectivity = ass >> 30;
662 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
663 spec->cdefine.check_sum = (ass >> 16) & 0xf;
664 spec->cdefine.customization = ass >> 8;
665do_sku:
666 spec->cdefine.sku_cfg = ass;
667 spec->cdefine.external_amp = (ass & 0x38) >> 3;
668 spec->cdefine.platform_type = (ass & 0x4) >> 2;
669 spec->cdefine.swap = (ass & 0x2) >> 1;
670 spec->cdefine.override = ass & 0x1;
671
Takashi Iwai4e76a882014-02-25 12:21:03 +0100672 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100673 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100674 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100675 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100676 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
677 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
678 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
679 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
680 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
681 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
682 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100683
684 return 0;
685}
686
Takashi Iwai08c189f2012-12-19 15:22:24 +0100687/* return the position of NID in the list, or -1 if not found */
688static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
689{
690 int i;
691 for (i = 0; i < nums; i++)
692 if (list[i] == nid)
693 return i;
694 return -1;
695}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200696/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200697static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
698{
Takashi Iwai21268962011-07-07 15:01:13 +0200699 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200700}
701
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200702/* check subsystem ID and set up device-specific initialization;
703 * return 1 if initialized, 0 if invalid SSID
704 */
705/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
706 * 31 ~ 16 : Manufacture ID
707 * 15 ~ 8 : SKU ID
708 * 7 ~ 0 : Assembly ID
709 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
710 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100711static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200712{
713 unsigned int ass, tmp, i;
714 unsigned nid;
715 struct alc_spec *spec = codec->spec;
716
David Henningsson90622912010-10-14 14:50:18 +0200717 if (spec->cdefine.fixup) {
718 ass = spec->cdefine.sku_cfg;
719 if (ass == ALC_FIXUP_SKU_IGNORE)
720 return 0;
721 goto do_sku;
722 }
723
Takashi Iwai7639a062015-03-03 10:07:24 +0100724 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100725 if (codec->bus->pci &&
726 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200727 goto do_sku;
728
729 /* invalid SSID, check the special NID pin defcfg instead */
730 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400731 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200732 * 29~21 : reserve
733 * 20 : PCBEEP input
734 * 19~16 : Check sum (15:1)
735 * 15~1 : Custom
736 * 0 : override
737 */
738 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100739 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200740 nid = 0x17;
741 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100742 codec_dbg(codec,
743 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200744 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100745 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200746 return 0;
747 if ((ass >> 30) != 1) /* no physical connection */
748 return 0;
749
750 /* check sum */
751 tmp = 0;
752 for (i = 1; i < 16; i++) {
753 if ((ass >> i) & 1)
754 tmp++;
755 }
756 if (((ass >> 16) & 0xf) != tmp)
757 return 0;
758do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100759 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100760 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200761 /*
762 * 0 : override
763 * 1 : Swap Jack
764 * 2 : 0 --> Desktop, 1 --> Laptop
765 * 3~5 : External Amplifier control
766 * 7~6 : Reserved
767 */
768 tmp = (ass & 0x38) >> 3; /* external Amp control */
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200769 if (spec->init_amp == ALC_INIT_UNDEFINED) {
770 switch (tmp) {
771 case 1:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200772 alc_setup_gpio(codec, 0x01);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200773 break;
774 case 3:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200775 alc_setup_gpio(codec, 0x02);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200776 break;
777 case 7:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200778 alc_setup_gpio(codec, 0x03);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200779 break;
780 case 5:
781 default:
782 spec->init_amp = ALC_INIT_DEFAULT;
783 break;
784 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200785 }
786
787 /* is laptop or Desktop and enable the function "Mute internal speaker
788 * when the external headphone out jack is plugged"
789 */
790 if (!(ass & 0x8000))
791 return 1;
792 /*
793 * 10~8 : Jack location
794 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
795 * 14~13: Resvered
796 * 15 : 1 --> enable the function "Mute internal speaker
797 * when the external headphone out jack is plugged"
798 */
Takashi Iwai35a39f92019-02-01 11:19:50 +0100799 if (!alc_get_hp_pin(spec)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200800 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200801 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100802 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100803 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
804 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200805 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100806 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200807 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200808 return 1;
809}
Kailang Yangea1fb292008-08-26 12:58:38 +0200810
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200811/* Check the validity of ALC subsystem-id
812 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
813static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200814{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100815 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200816 struct alc_spec *spec = codec->spec;
Takashi Iwai67791202020-04-18 21:06:39 +0200817 if (spec->init_amp == ALC_INIT_UNDEFINED) {
818 codec_dbg(codec,
819 "realtek: Enable default setup for auto mode as fallback\n");
820 spec->init_amp = ALC_INIT_DEFAULT;
821 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200822 }
Takashi Iwai21268962011-07-07 15:01:13 +0200823}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200824
Takashi Iwai41e41f12005-06-08 14:48:49 +0200825/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200826 */
827
David Henningsson9d36a7d2014-10-07 10:18:42 +0200828static void alc_fixup_inv_dmic(struct hda_codec *codec,
829 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200830{
831 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100832
David Henningsson9d36a7d2014-10-07 10:18:42 +0200833 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200834}
835
Takashi Iwai603c4012008-07-30 15:01:44 +0200836
Takashi Iwai2eab6942012-12-18 15:30:41 +0100837static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700838{
Takashi Iwaia5cb4632018-06-20 12:50:11 +0200839 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700840
Takashi Iwai08c189f2012-12-19 15:22:24 +0100841 err = snd_hda_gen_build_controls(codec);
842 if (err < 0)
843 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844
Takashi Iwai1727a772013-01-10 09:52:52 +0100845 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100846 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700847}
848
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200849
Linus Torvalds1da177e2005-04-16 15:20:36 -0700850/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100851 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200852 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200853
Takashi Iwaic9af7532019-05-10 11:01:43 +0200854static void alc_pre_init(struct hda_codec *codec)
855{
856 alc_fill_eapd_coef(codec);
857}
858
Kailang Yangaeac1a02019-05-16 16:10:44 +0800859#define is_s3_resume(codec) \
860 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
Takashi Iwaic9af7532019-05-10 11:01:43 +0200861#define is_s4_resume(codec) \
862 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
863
Linus Torvalds1da177e2005-04-16 15:20:36 -0700864static int alc_init(struct hda_codec *codec)
865{
866 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200867
Takashi Iwaic9af7532019-05-10 11:01:43 +0200868 /* hibernation resume needs the full chip initialization */
869 if (is_s4_resume(codec))
870 alc_pre_init(codec);
871
Takashi Iwai546bb672012-03-07 08:37:19 +0100872 if (spec->init_hook)
873 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100874
Takashi Iwai89781d02019-08-30 12:03:38 +0200875 spec->gen.skip_verbs = 1; /* applied in below */
Kailang Yang607ca3b2019-04-26 16:35:41 +0800876 snd_hda_gen_init(codec);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200877 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200878 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai89781d02019-08-30 12:03:38 +0200879 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200880
Takashi Iwai1727a772013-01-10 09:52:52 +0100881 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200882
Linus Torvalds1da177e2005-04-16 15:20:36 -0700883 return 0;
884}
885
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100886static inline void alc_shutup(struct hda_codec *codec)
887{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200888 struct alc_spec *spec = codec->spec;
889
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200890 if (!snd_hda_get_bool_hint(codec, "shutup"))
891 return; /* disabled explicitly by hints */
892
Takashi Iwai1c7161532011-04-07 10:37:16 +0200893 if (spec && spec->shutup)
894 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200895 else
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100896 alc_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100897}
898
Takashi Iwai70a09762015-12-15 14:59:58 +0100899static void alc_reboot_notify(struct hda_codec *codec)
900{
901 struct alc_spec *spec = codec->spec;
902
903 if (spec && spec->reboot_notify)
904 spec->reboot_notify(codec);
905 else
906 alc_shutup(codec);
907}
908
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100909#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700910
Takashi Iwai83012a72012-08-24 18:38:08 +0200911#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500912static void alc_power_eapd(struct hda_codec *codec)
913{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200914 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500915}
916
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200917static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100918{
919 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100920 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100921 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500922 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100923 return 0;
924}
925#endif
926
Takashi Iwai2a439522011-07-26 09:52:50 +0200927#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100928static int alc_resume(struct hda_codec *codec)
929{
Kailang Yang97a26572013-11-29 00:35:26 -0500930 struct alc_spec *spec = codec->spec;
931
932 if (!spec->no_depop_delay)
933 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100934 codec->patch_ops.init(codec);
Takashi Iwai1a462be2020-01-09 10:01:04 +0100935 snd_hda_regmap_sync(codec);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200936 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100937 return 0;
938}
Takashi Iwaie044c392008-10-27 16:56:24 +0100939#endif
940
Linus Torvalds1da177e2005-04-16 15:20:36 -0700941/*
942 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200943static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700944 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100945 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700946 .init = alc_init,
947 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200948 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200949#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100950 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100951 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100952 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200953#endif
Takashi Iwai70a09762015-12-15 14:59:58 +0100954 .reboot_notify = alc_reboot_notify,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700955};
956
David Henningsson29adc4b2012-09-25 11:31:00 +0200957
Takashi Iwaided255b2015-10-01 17:59:43 +0200958#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100959
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200960/*
Kailang Yang4b016932013-11-28 11:55:09 +0100961 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200962 */
963struct alc_codec_rename_table {
964 unsigned int vendor_id;
965 unsigned short coef_mask;
966 unsigned short coef_bits;
967 const char *name;
968};
969
Kailang Yang4b016932013-11-28 11:55:09 +0100970struct alc_codec_rename_pci_table {
971 unsigned int codec_vendor_id;
972 unsigned short pci_subvendor;
973 unsigned short pci_subdevice;
974 const char *name;
975};
976
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100977static const struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800978 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200979 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
980 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
981 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
982 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
983 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
984 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
985 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200986 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800987 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200988 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
989 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
990 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
991 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
992 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
993 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
994 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
995 { } /* terminator */
996};
997
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100998static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
Kailang Yang4b016932013-11-28 11:55:09 +0100999 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1000 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1001 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +08001002 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +01001003 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +08001004 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +01001005 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1006 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001007 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1008 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +08001009 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +08001010 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +08001011 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +08001012 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +08001013 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +08001014 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001015 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1016 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1017 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1018 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1019 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1020 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1021 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1022 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1023 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1024 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1025 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +01001026 { } /* terminator */
1027};
1028
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001029static int alc_codec_rename_from_preset(struct hda_codec *codec)
1030{
1031 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +01001032 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001033
1034 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001035 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001036 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02001037 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001038 return alc_codec_rename(codec, p->name);
1039 }
Kailang Yang4b016932013-11-28 11:55:09 +01001040
Takashi Iwai5100cd02014-02-15 10:03:19 +01001041 if (!codec->bus->pci)
1042 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +01001043 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001044 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +01001045 continue;
1046 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1047 continue;
1048 if (!q->pci_subdevice ||
1049 q->pci_subdevice == codec->bus->pci->subsystem_device)
1050 return alc_codec_rename(codec, q->name);
1051 }
1052
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001053 return 0;
1054}
1055
Takashi Iwaie4770622011-07-08 11:11:35 +02001056
1057/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001058 * Digital-beep handlers
1059 */
1060#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001061
1062/* additional beep mixers; private_value will be overwritten */
1063static const struct snd_kcontrol_new alc_beep_mixer[] = {
1064 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1065 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1066};
1067
1068/* set up and create beep controls */
1069static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1070 int idx, int dir)
1071{
1072 struct snd_kcontrol_new *knew;
1073 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1074 int i;
1075
1076 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1077 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1078 &alc_beep_mixer[i]);
1079 if (!knew)
1080 return -ENOMEM;
1081 knew->private_value = beep_amp;
1082 }
1083 return 0;
1084}
Takashi Iwai1d045db2011-07-07 18:23:21 +02001085
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001086static const struct snd_pci_quirk beep_allow_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +02001087 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -07001088 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001089 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +01001090 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001091 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1092 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1093 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +01001094 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001095 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001096 /* denylist -- no beep available */
Takashi Iwai051c78a2019-08-22 09:58:07 +02001097 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1098 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001099 {}
1100};
1101
1102static inline int has_cdefine_beep(struct hda_codec *codec)
1103{
1104 struct alc_spec *spec = codec->spec;
1105 const struct snd_pci_quirk *q;
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001106 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001107 if (q)
1108 return q->value;
1109 return spec->cdefine.enable_pcbeep;
1110}
1111#else
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001112#define set_beep_amp(spec, nid, idx, dir) 0
Takashi Iwai1d045db2011-07-07 18:23:21 +02001113#define has_cdefine_beep(codec) 0
1114#endif
1115
1116/* parse the BIOS configuration and set up the alc_spec */
1117/* return 1 if successful, 0 if the proper config is not found,
1118 * or a negative error code
1119 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001120static int alc_parse_auto_config(struct hda_codec *codec,
1121 const hda_nid_t *ignore_nids,
1122 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001123{
1124 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001125 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001126 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001127
Takashi Iwai53c334a2011-08-23 18:27:14 +02001128 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1129 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001130 if (err < 0)
1131 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001132
1133 if (ssid_nids)
1134 alc_ssid_check(codec, ssid_nids);
1135
Takashi Iwai08c189f2012-12-19 15:22:24 +01001136 err = snd_hda_gen_parse_auto_config(codec, cfg);
1137 if (err < 0)
1138 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001139
Takashi Iwai1d045db2011-07-07 18:23:21 +02001140 return 1;
1141}
1142
Takashi Iwai3de95172012-05-07 18:03:15 +02001143/* common preparation job for alc_spec */
1144static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1145{
1146 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1147 int err;
1148
1149 if (!spec)
1150 return -ENOMEM;
1151 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001152 snd_hda_gen_spec_init(&spec->gen);
1153 spec->gen.mixer_nid = mixer_nid;
1154 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001155 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001156 /* FIXME: do we need this for all Realtek codec models? */
1157 codec->spdif_status_reset = 1;
Kai Vehmanena6e7d0a2020-10-12 13:27:04 +03001158 codec->forced_resume = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001159 codec->patch_ops = alc_patch_ops;
Takashi Iwai3de95172012-05-07 18:03:15 +02001160
1161 err = alc_codec_rename_from_preset(codec);
1162 if (err < 0) {
1163 kfree(spec);
1164 return err;
1165 }
1166 return 0;
1167}
1168
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001169static int alc880_parse_auto_config(struct hda_codec *codec)
1170{
1171 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001172 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001173 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1174}
1175
Takashi Iwai1d045db2011-07-07 18:23:21 +02001176/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001177 * ALC880 fix-ups
1178 */
1179enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001180 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001181 ALC880_FIXUP_GPIO2,
1182 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001183 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001184 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001185 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001186 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001187 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001188 ALC880_FIXUP_VOL_KNOB,
1189 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001190 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001191 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001192 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001193 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001194 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001195 ALC880_FIXUP_3ST_BASE,
1196 ALC880_FIXUP_3ST,
1197 ALC880_FIXUP_3ST_DIG,
1198 ALC880_FIXUP_5ST_BASE,
1199 ALC880_FIXUP_5ST,
1200 ALC880_FIXUP_5ST_DIG,
1201 ALC880_FIXUP_6ST_BASE,
1202 ALC880_FIXUP_6ST,
1203 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001204 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001205};
1206
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001207/* enable the volume-knob widget support on NID 0x21 */
1208static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001209 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001210{
Takashi Iwai1727a772013-01-10 09:52:52 +01001211 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001212 snd_hda_jack_detect_enable_callback(codec, 0x21,
1213 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001214}
1215
Takashi Iwai1727a772013-01-10 09:52:52 +01001216static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001217 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001218 .type = HDA_FIXUP_FUNC,
1219 .v.func = alc_fixup_gpio1,
Takashi Iwai411225a2012-02-20 17:48:19 +01001220 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001221 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001222 .type = HDA_FIXUP_FUNC,
1223 .v.func = alc_fixup_gpio2,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001224 },
1225 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001226 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001227 .v.verbs = (const struct hda_verb[]) {
1228 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1229 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1230 { }
1231 },
1232 .chained = true,
1233 .chain_id = ALC880_FIXUP_GPIO2,
1234 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001235 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001236 .type = HDA_FIXUP_PINS,
1237 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001238 /* disable bogus unused pins */
1239 { 0x16, 0x411111f0 },
1240 { 0x18, 0x411111f0 },
1241 { 0x1a, 0x411111f0 },
1242 { }
1243 }
1244 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001245 [ALC880_FIXUP_LG_LW25] = {
1246 .type = HDA_FIXUP_PINS,
1247 .v.pins = (const struct hda_pintbl[]) {
1248 { 0x1a, 0x0181344f }, /* line-in */
1249 { 0x1b, 0x0321403f }, /* headphone */
1250 { }
1251 }
1252 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001253 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001254 .type = HDA_FIXUP_PINS,
1255 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001256 /* disable bogus unused pins */
1257 { 0x17, 0x411111f0 },
1258 { }
1259 },
1260 .chained = true,
1261 .chain_id = ALC880_FIXUP_GPIO2,
1262 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001263 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001264 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001265 .v.verbs = (const struct hda_verb[]) {
1266 /* change to EAPD mode */
1267 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1268 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1269 {}
1270 },
1271 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001272 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001273 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001274 .v.verbs = (const struct hda_verb[]) {
1275 /* change to EAPD mode */
1276 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1277 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1278 {}
1279 },
1280 .chained = true,
1281 .chain_id = ALC880_FIXUP_GPIO2,
1282 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001283 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001284 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001285 .v.func = alc880_fixup_vol_knob,
1286 },
1287 [ALC880_FIXUP_FUJITSU] = {
1288 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001289 .type = HDA_FIXUP_PINS,
1290 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001291 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001292 { 0x15, 0x99030120 }, /* speaker */
1293 { 0x16, 0x99030130 }, /* bass speaker */
1294 { 0x17, 0x411111f0 }, /* N/A */
1295 { 0x18, 0x411111f0 }, /* N/A */
1296 { 0x19, 0x01a19950 }, /* mic-in */
1297 { 0x1a, 0x411111f0 }, /* N/A */
1298 { 0x1b, 0x411111f0 }, /* N/A */
1299 { 0x1c, 0x411111f0 }, /* N/A */
1300 { 0x1d, 0x411111f0 }, /* N/A */
1301 { 0x1e, 0x01454140 }, /* SPDIF out */
1302 { }
1303 },
1304 .chained = true,
1305 .chain_id = ALC880_FIXUP_VOL_KNOB,
1306 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001307 [ALC880_FIXUP_F1734] = {
1308 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001309 .type = HDA_FIXUP_PINS,
1310 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001311 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001312 { 0x15, 0x99030120 }, /* speaker */
1313 { 0x16, 0x411111f0 }, /* N/A */
1314 { 0x17, 0x411111f0 }, /* N/A */
1315 { 0x18, 0x411111f0 }, /* N/A */
1316 { 0x19, 0x01a19950 }, /* mic-in */
1317 { 0x1a, 0x411111f0 }, /* N/A */
1318 { 0x1b, 0x411111f0 }, /* N/A */
1319 { 0x1c, 0x411111f0 }, /* N/A */
1320 { 0x1d, 0x411111f0 }, /* N/A */
1321 { 0x1e, 0x411111f0 }, /* N/A */
1322 { }
1323 },
1324 .chained = true,
1325 .chain_id = ALC880_FIXUP_VOL_KNOB,
1326 },
Takashi Iwai817de922012-02-20 17:20:48 +01001327 [ALC880_FIXUP_UNIWILL] = {
1328 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001329 .type = HDA_FIXUP_PINS,
1330 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001331 { 0x14, 0x0121411f }, /* HP */
1332 { 0x15, 0x99030120 }, /* speaker */
1333 { 0x16, 0x99030130 }, /* bass speaker */
1334 { }
1335 },
1336 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001337 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001338 .type = HDA_FIXUP_PINS,
1339 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001340 /* disable bogus unused pins */
1341 { 0x17, 0x411111f0 },
1342 { 0x19, 0x411111f0 },
1343 { 0x1b, 0x411111f0 },
1344 { 0x1f, 0x411111f0 },
1345 { }
1346 }
1347 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001348 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001349 .type = HDA_FIXUP_PINS,
1350 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001351 /* set up the whole pins as BIOS is utterly broken */
1352 { 0x14, 0x99030120 }, /* speaker */
1353 { 0x15, 0x0121411f }, /* HP */
1354 { 0x16, 0x411111f0 }, /* N/A */
1355 { 0x17, 0x411111f0 }, /* N/A */
1356 { 0x18, 0x01a19950 }, /* mic-in */
1357 { 0x19, 0x411111f0 }, /* N/A */
1358 { 0x1a, 0x01813031 }, /* line-in */
1359 { 0x1b, 0x411111f0 }, /* N/A */
1360 { 0x1c, 0x411111f0 }, /* N/A */
1361 { 0x1d, 0x411111f0 }, /* N/A */
1362 { 0x1e, 0x0144111e }, /* SPDIF */
1363 { }
1364 }
1365 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001366 [ALC880_FIXUP_ASUS_W5A] = {
1367 .type = HDA_FIXUP_PINS,
1368 .v.pins = (const struct hda_pintbl[]) {
1369 /* set up the whole pins as BIOS is utterly broken */
1370 { 0x14, 0x0121411f }, /* HP */
1371 { 0x15, 0x411111f0 }, /* N/A */
1372 { 0x16, 0x411111f0 }, /* N/A */
1373 { 0x17, 0x411111f0 }, /* N/A */
1374 { 0x18, 0x90a60160 }, /* mic */
1375 { 0x19, 0x411111f0 }, /* N/A */
1376 { 0x1a, 0x411111f0 }, /* N/A */
1377 { 0x1b, 0x411111f0 }, /* N/A */
1378 { 0x1c, 0x411111f0 }, /* N/A */
1379 { 0x1d, 0x411111f0 }, /* N/A */
1380 { 0x1e, 0xb743111e }, /* SPDIF out */
1381 { }
1382 },
1383 .chained = true,
1384 .chain_id = ALC880_FIXUP_GPIO1,
1385 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001386 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001387 .type = HDA_FIXUP_PINS,
1388 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001389 { 0x14, 0x01014010 }, /* line-out */
1390 { 0x15, 0x411111f0 }, /* N/A */
1391 { 0x16, 0x411111f0 }, /* N/A */
1392 { 0x17, 0x411111f0 }, /* N/A */
1393 { 0x18, 0x01a19c30 }, /* mic-in */
1394 { 0x19, 0x0121411f }, /* HP */
1395 { 0x1a, 0x01813031 }, /* line-in */
1396 { 0x1b, 0x02a19c40 }, /* front-mic */
1397 { 0x1c, 0x411111f0 }, /* N/A */
1398 { 0x1d, 0x411111f0 }, /* N/A */
1399 /* 0x1e is filled in below */
1400 { 0x1f, 0x411111f0 }, /* N/A */
1401 { }
1402 }
1403 },
1404 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001405 .type = HDA_FIXUP_PINS,
1406 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001407 { 0x1e, 0x411111f0 }, /* N/A */
1408 { }
1409 },
1410 .chained = true,
1411 .chain_id = ALC880_FIXUP_3ST_BASE,
1412 },
1413 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001414 .type = HDA_FIXUP_PINS,
1415 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001416 { 0x1e, 0x0144111e }, /* SPDIF */
1417 { }
1418 },
1419 .chained = true,
1420 .chain_id = ALC880_FIXUP_3ST_BASE,
1421 },
1422 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001423 .type = HDA_FIXUP_PINS,
1424 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001425 { 0x14, 0x01014010 }, /* front */
1426 { 0x15, 0x411111f0 }, /* N/A */
1427 { 0x16, 0x01011411 }, /* CLFE */
1428 { 0x17, 0x01016412 }, /* surr */
1429 { 0x18, 0x01a19c30 }, /* mic-in */
1430 { 0x19, 0x0121411f }, /* HP */
1431 { 0x1a, 0x01813031 }, /* line-in */
1432 { 0x1b, 0x02a19c40 }, /* front-mic */
1433 { 0x1c, 0x411111f0 }, /* N/A */
1434 { 0x1d, 0x411111f0 }, /* N/A */
1435 /* 0x1e is filled in below */
1436 { 0x1f, 0x411111f0 }, /* N/A */
1437 { }
1438 }
1439 },
1440 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001441 .type = HDA_FIXUP_PINS,
1442 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001443 { 0x1e, 0x411111f0 }, /* N/A */
1444 { }
1445 },
1446 .chained = true,
1447 .chain_id = ALC880_FIXUP_5ST_BASE,
1448 },
1449 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001450 .type = HDA_FIXUP_PINS,
1451 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001452 { 0x1e, 0x0144111e }, /* SPDIF */
1453 { }
1454 },
1455 .chained = true,
1456 .chain_id = ALC880_FIXUP_5ST_BASE,
1457 },
1458 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001459 .type = HDA_FIXUP_PINS,
1460 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001461 { 0x14, 0x01014010 }, /* front */
1462 { 0x15, 0x01016412 }, /* surr */
1463 { 0x16, 0x01011411 }, /* CLFE */
1464 { 0x17, 0x01012414 }, /* side */
1465 { 0x18, 0x01a19c30 }, /* mic-in */
1466 { 0x19, 0x02a19c40 }, /* front-mic */
1467 { 0x1a, 0x01813031 }, /* line-in */
1468 { 0x1b, 0x0121411f }, /* HP */
1469 { 0x1c, 0x411111f0 }, /* N/A */
1470 { 0x1d, 0x411111f0 }, /* N/A */
1471 /* 0x1e is filled in below */
1472 { 0x1f, 0x411111f0 }, /* N/A */
1473 { }
1474 }
1475 },
1476 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001477 .type = HDA_FIXUP_PINS,
1478 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001479 { 0x1e, 0x411111f0 }, /* N/A */
1480 { }
1481 },
1482 .chained = true,
1483 .chain_id = ALC880_FIXUP_6ST_BASE,
1484 },
1485 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001486 .type = HDA_FIXUP_PINS,
1487 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001488 { 0x1e, 0x0144111e }, /* SPDIF */
1489 { }
1490 },
1491 .chained = true,
1492 .chain_id = ALC880_FIXUP_6ST_BASE,
1493 },
Takashi Iwai53971452013-01-23 18:21:37 +01001494 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1495 .type = HDA_FIXUP_PINS,
1496 .v.pins = (const struct hda_pintbl[]) {
1497 { 0x1b, 0x0121401f }, /* HP with jack detect */
1498 { }
1499 },
1500 .chained_before = true,
1501 .chain_id = ALC880_FIXUP_6ST_BASE,
1502 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001503};
1504
1505static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001506 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001507 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001508 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001509 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001510 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001511 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001512 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001513 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001514 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001515 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001516 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001517 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001518 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001519 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001520 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001521 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001522 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001523 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001524 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1525 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1526 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001527 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001528 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001529
1530 /* Below is the copied entries from alc880_quirks.c.
1531 * It's not quite sure whether BIOS sets the correct pin-config table
1532 * on these machines, thus they are kept to be compatible with
1533 * the old static quirks. Once when it's confirmed to work without
1534 * these overrides, it'd be better to remove.
1535 */
1536 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1537 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1538 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1539 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1540 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1541 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1542 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1543 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1544 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1545 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1546 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1547 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1548 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1549 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1550 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1551 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1552 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1553 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1554 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1555 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1556 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1557 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1558 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1559 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1560 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1561 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1562 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1563 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1564 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1565 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1566 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1567 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1568 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1569 /* default Intel */
1570 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1571 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1572 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1573 {}
1574};
1575
Takashi Iwai1727a772013-01-10 09:52:52 +01001576static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001577 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1578 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1579 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1580 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1581 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1582 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001583 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001584 {}
1585};
1586
1587
1588/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001589 * OK, here we have finally the patch for ALC880
1590 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001591static int patch_alc880(struct hda_codec *codec)
1592{
1593 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001594 int err;
1595
Takashi Iwai3de95172012-05-07 18:03:15 +02001596 err = alc_alloc_spec(codec, 0x0b);
1597 if (err < 0)
1598 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001599
Takashi Iwai3de95172012-05-07 18:03:15 +02001600 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001601 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001602 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001603
Takashi Iwai225068a2015-05-29 10:42:14 +02001604 codec->patch_ops.unsol_event = alc880_unsol_event;
1605
Takashi Iwaic9af7532019-05-10 11:01:43 +02001606 alc_pre_init(codec);
1607
Takashi Iwai1727a772013-01-10 09:52:52 +01001608 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001609 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001610 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001611
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001612 /* automatic parse from the BIOS config */
1613 err = alc880_parse_auto_config(codec);
1614 if (err < 0)
1615 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001616
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001617 if (!spec->gen.no_analog) {
1618 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1619 if (err < 0)
1620 goto error;
1621 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001622
Takashi Iwai1727a772013-01-10 09:52:52 +01001623 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001624
Takashi Iwai1d045db2011-07-07 18:23:21 +02001625 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001626
1627 error:
1628 alc_free(codec);
1629 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001630}
1631
1632
1633/*
1634 * ALC260 support
1635 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001636static int alc260_parse_auto_config(struct hda_codec *codec)
1637{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001638 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001639 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1640 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001641}
1642
Takashi Iwai1d045db2011-07-07 18:23:21 +02001643/*
1644 * Pin config fixes
1645 */
1646enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001647 ALC260_FIXUP_HP_DC5750,
1648 ALC260_FIXUP_HP_PIN_0F,
1649 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001650 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001651 ALC260_FIXUP_GPIO1_TOGGLE,
1652 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001653 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001654 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001655 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001656 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001657 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001658};
1659
Takashi Iwai20f7d922012-02-16 12:35:16 +01001660static void alc260_gpio1_automute(struct hda_codec *codec)
1661{
1662 struct alc_spec *spec = codec->spec;
Takashi Iwaiaaf312d2018-06-19 22:28:22 +02001663
1664 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001665}
1666
1667static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001668 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001669{
1670 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001671 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001672 /* although the machine has only one output pin, we need to
1673 * toggle GPIO1 according to the jack state
1674 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001675 spec->gen.automute_hook = alc260_gpio1_automute;
1676 spec->gen.detect_hp = 1;
1677 spec->gen.automute_speaker = 1;
1678 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001679 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001680 snd_hda_gen_hp_automute);
Takashi Iwai5579cd62018-06-19 22:22:41 +02001681 alc_setup_gpio(codec, 0x01);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001682 }
1683}
1684
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001685static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001686 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001687{
1688 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001689 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001690 { 0x0f, 0x02214000 }, /* HP/speaker */
1691 { 0x12, 0x90a60160 }, /* int mic */
1692 { 0x13, 0x02a19000 }, /* ext mic */
1693 { 0x18, 0x01446000 }, /* SPDIF out */
1694 /* disable bogus I/O pins */
1695 { 0x10, 0x411111f0 },
1696 { 0x11, 0x411111f0 },
1697 { 0x14, 0x411111f0 },
1698 { 0x15, 0x411111f0 },
1699 { 0x16, 0x411111f0 },
1700 { 0x17, 0x411111f0 },
1701 { 0x19, 0x411111f0 },
1702 { }
1703 };
1704
1705 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001706 case HDA_FIXUP_ACT_PRE_PROBE:
1707 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001708 spec->init_amp = ALC_INIT_NONE;
1709 break;
1710 }
1711}
1712
Takashi Iwai39aedee2013-01-10 17:10:40 +01001713static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1714 const struct hda_fixup *fix, int action)
1715{
1716 struct alc_spec *spec = codec->spec;
Takashi Iwai1c76aa52018-06-21 16:37:54 +02001717 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001718 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001719}
1720
1721static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1722 const struct hda_fixup *fix, int action)
1723{
1724 struct alc_spec *spec = codec->spec;
1725 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001726 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001727 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001728 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001729}
1730
Takashi Iwai1727a772013-01-10 09:52:52 +01001731static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001732 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001733 .type = HDA_FIXUP_PINS,
1734 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001735 { 0x11, 0x90130110 }, /* speaker */
1736 { }
1737 }
1738 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001739 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001740 .type = HDA_FIXUP_PINS,
1741 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001742 { 0x0f, 0x01214000 }, /* HP */
1743 { }
1744 }
1745 },
1746 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001747 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001748 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001749 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1750 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001751 { }
1752 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001753 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001754 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001755 .type = HDA_FIXUP_FUNC,
1756 .v.func = alc_fixup_gpio1,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001757 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001758 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001759 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001760 .v.func = alc260_fixup_gpio1_toggle,
1761 .chained = true,
1762 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1763 },
1764 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001765 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001766 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001767 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1768 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001769 { }
1770 },
1771 .chained = true,
1772 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1773 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001774 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001775 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001776 .v.func = alc260_fixup_gpio1_toggle,
1777 .chained = true,
1778 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001779 },
1780 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001781 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001782 .v.func = alc260_fixup_kn1,
1783 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001784 [ALC260_FIXUP_FSC_S7020] = {
1785 .type = HDA_FIXUP_FUNC,
1786 .v.func = alc260_fixup_fsc_s7020,
1787 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001788 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1789 .type = HDA_FIXUP_FUNC,
1790 .v.func = alc260_fixup_fsc_s7020_jwse,
1791 .chained = true,
1792 .chain_id = ALC260_FIXUP_FSC_S7020,
1793 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001794 [ALC260_FIXUP_VAIO_PINS] = {
1795 .type = HDA_FIXUP_PINS,
1796 .v.pins = (const struct hda_pintbl[]) {
1797 /* Pin configs are missing completely on some VAIOs */
1798 { 0x0f, 0x01211020 },
1799 { 0x10, 0x0001003f },
1800 { 0x11, 0x411111f0 },
1801 { 0x12, 0x01a15930 },
1802 { 0x13, 0x411111f0 },
1803 { 0x14, 0x411111f0 },
1804 { 0x15, 0x411111f0 },
1805 { 0x16, 0x411111f0 },
1806 { 0x17, 0x411111f0 },
1807 { 0x18, 0x411111f0 },
1808 { 0x19, 0x411111f0 },
1809 { }
1810 }
1811 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001812};
1813
1814static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001815 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001816 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001817 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001818 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001819 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001820 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001821 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001822 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001823 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001824 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001825 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001826 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001827 {}
1828};
1829
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001830static const struct hda_model_fixup alc260_fixup_models[] = {
1831 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1832 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1833 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1834 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1835 {}
1836};
1837
Takashi Iwai1d045db2011-07-07 18:23:21 +02001838/*
1839 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001840static int patch_alc260(struct hda_codec *codec)
1841{
1842 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001843 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001844
Takashi Iwai3de95172012-05-07 18:03:15 +02001845 err = alc_alloc_spec(codec, 0x07);
1846 if (err < 0)
1847 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001848
Takashi Iwai3de95172012-05-07 18:03:15 +02001849 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001850 /* as quite a few machines require HP amp for speaker outputs,
1851 * it's easier to enable it unconditionally; even if it's unneeded,
1852 * it's almost harmless.
1853 */
1854 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001855 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001856
Takashi Iwai225068a2015-05-29 10:42:14 +02001857 spec->shutup = alc_eapd_shutup;
1858
Takashi Iwaic9af7532019-05-10 11:01:43 +02001859 alc_pre_init(codec);
1860
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001861 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1862 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001863 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001864
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001865 /* automatic parse from the BIOS config */
1866 err = alc260_parse_auto_config(codec);
1867 if (err < 0)
1868 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001869
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001870 if (!spec->gen.no_analog) {
1871 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1872 if (err < 0)
1873 goto error;
1874 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001875
Takashi Iwai1727a772013-01-10 09:52:52 +01001876 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001877
Takashi Iwai1d045db2011-07-07 18:23:21 +02001878 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001879
1880 error:
1881 alc_free(codec);
1882 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001883}
1884
1885
1886/*
1887 * ALC882/883/885/888/889 support
1888 *
1889 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1890 * configuration. Each pin widget can choose any input DACs and a mixer.
1891 * Each ADC is connected from a mixer of all inputs. This makes possible
1892 * 6-channel independent captures.
1893 *
1894 * In addition, an independent DAC for the multi-playback (not used in this
1895 * driver yet).
1896 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001897
1898/*
1899 * Pin config fixes
1900 */
1901enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001902 ALC882_FIXUP_ABIT_AW9D_MAX,
1903 ALC882_FIXUP_LENOVO_Y530,
1904 ALC882_FIXUP_PB_M5210,
1905 ALC882_FIXUP_ACER_ASPIRE_7736,
1906 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001907 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001908 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001909 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001910 ALC888_FIXUP_EEE1601,
PeiSen Hou4841b8e2021-02-02 10:30:22 +01001911 ALC886_FIXUP_EAPD,
Takashi Iwai177943a32011-11-09 12:55:18 +01001912 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001913 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001914 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001915 ALC882_FIXUP_GPIO1,
1916 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001917 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001918 ALC889_FIXUP_COEF,
1919 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001920 ALC882_FIXUP_ACER_ASPIRE_4930G,
1921 ALC882_FIXUP_ACER_ASPIRE_8930G,
1922 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001923 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001924 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001925 ALC889_FIXUP_MBP_VREF,
1926 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001927 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001928 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001929 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001930 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001931 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001932 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001933 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001934 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001935 ALC1220_FIXUP_GB_DUAL_CODECS,
Peisen0202f5c2017-10-26 10:35:36 +08001936 ALC1220_FIXUP_CLEVO_P950,
Richard Sailer80690a22019-04-02 15:52:04 +02001937 ALC1220_FIXUP_CLEVO_PB51ED,
1938 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
Jian-Hong Panca184352020-10-07 13:22:25 +08001939 ALC887_FIXUP_ASUS_AUDIO,
1940 ALC887_FIXUP_ASUS_HMIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001941};
1942
Takashi Iwai68ef0562011-11-09 18:24:44 +01001943static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001944 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001945{
Takashi Iwai1727a772013-01-10 09:52:52 +01001946 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001947 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001948 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001949}
1950
Takashi Iwai56710872011-11-14 17:42:11 +01001951/* set up GPIO at initialization */
1952static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001953 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001954{
Takashi Iwai215c8502018-06-19 22:34:26 +02001955 struct alc_spec *spec = codec->spec;
1956
1957 spec->gpio_write_delay = true;
1958 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001959}
1960
Takashi Iwai02a237b2012-02-13 15:25:07 +01001961/* Fix the connection of some pins for ALC889:
1962 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1963 * work correctly (bko#42740)
1964 */
1965static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001966 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001967{
Takashi Iwai1727a772013-01-10 09:52:52 +01001968 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001969 /* fake the connections during parsing the tree */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001970 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1971 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1972 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1973 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1974 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1975 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001976 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001977 /* restore the connections */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001978 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1979 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1980 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1981 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1982 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001983 }
1984}
1985
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001986/* Set VREF on HP pin */
1987static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001988 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001989{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001990 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001991 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001992 int i;
1993
Takashi Iwai1727a772013-01-10 09:52:52 +01001994 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001995 return;
1996 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1997 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1998 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1999 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01002000 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002001 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02002002 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01002003 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002004 break;
2005 }
2006}
2007
Takashi Iwai0756f092013-12-04 13:59:45 +01002008static void alc889_fixup_mac_pins(struct hda_codec *codec,
2009 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002010{
2011 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002012 int i;
2013
Takashi Iwai0756f092013-12-04 13:59:45 +01002014 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002015 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01002016 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002017 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02002018 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002019 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01002020 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002021}
2022
Takashi Iwai0756f092013-12-04 13:59:45 +01002023/* Set VREF on speaker pins on imac91 */
2024static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2025 const struct hda_fixup *fix, int action)
2026{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002027 static const hda_nid_t nids[] = { 0x18, 0x1a };
Takashi Iwai0756f092013-12-04 13:59:45 +01002028
2029 if (action == HDA_FIXUP_ACT_INIT)
2030 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2031}
2032
Adrien Vergée7729a42014-01-24 14:56:14 -05002033/* Set VREF on speaker pins on mba11 */
2034static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2035 const struct hda_fixup *fix, int action)
2036{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002037 static const hda_nid_t nids[] = { 0x18 };
Adrien Vergée7729a42014-01-24 14:56:14 -05002038
2039 if (action == HDA_FIXUP_ACT_INIT)
2040 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2041}
2042
Takashi Iwai0756f092013-12-04 13:59:45 +01002043/* Set VREF on speaker pins on mba21 */
2044static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2045 const struct hda_fixup *fix, int action)
2046{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002047 static const hda_nid_t nids[] = { 0x18, 0x19 };
Takashi Iwai0756f092013-12-04 13:59:45 +01002048
2049 if (action == HDA_FIXUP_ACT_INIT)
2050 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2051}
2052
Takashi Iwaie427c232012-07-29 10:04:08 +02002053/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09002054 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2055 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02002056 */
2057static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01002058 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02002059{
2060 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002061 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01002062 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002063 spec->gen.no_multi_io = 1;
2064 }
Takashi Iwaie427c232012-07-29 10:04:08 +02002065}
2066
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002067static void alc_fixup_bass_chmap(struct hda_codec *codec,
2068 const struct hda_fixup *fix, int action);
2069
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002070/* For dual-codec configuration, we need to disable some features to avoid
2071 * conflicts of kctls and PCM streams
2072 */
2073static void alc_fixup_dual_codecs(struct hda_codec *codec,
2074 const struct hda_fixup *fix, int action)
2075{
2076 struct alc_spec *spec = codec->spec;
2077
2078 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2079 return;
2080 /* disable vmaster */
2081 spec->gen.suppress_vmaster = 1;
2082 /* auto-mute and auto-mic switch don't work with multiple codecs */
2083 spec->gen.suppress_auto_mute = 1;
2084 spec->gen.suppress_auto_mic = 1;
2085 /* disable aamix as well */
2086 spec->gen.mixer_nid = 0;
2087 /* add location prefix to avoid conflicts */
2088 codec->force_pin_prefix = 1;
2089}
2090
2091static void rename_ctl(struct hda_codec *codec, const char *oldname,
2092 const char *newname)
2093{
2094 struct snd_kcontrol *kctl;
2095
2096 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2097 if (kctl)
2098 strcpy(kctl->id.name, newname);
2099}
2100
2101static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2102 const struct hda_fixup *fix,
2103 int action)
2104{
2105 alc_fixup_dual_codecs(codec, fix, action);
2106 switch (action) {
2107 case HDA_FIXUP_ACT_PRE_PROBE:
2108 /* override card longname to provide a unique UCM profile */
2109 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2110 break;
2111 case HDA_FIXUP_ACT_BUILD:
2112 /* rename Capture controls depending on the codec */
2113 rename_ctl(codec, "Capture Volume",
2114 codec->addr == 0 ?
2115 "Rear-Panel Capture Volume" :
2116 "Front-Panel Capture Volume");
2117 rename_ctl(codec, "Capture Switch",
2118 codec->addr == 0 ?
2119 "Rear-Panel Capture Switch" :
2120 "Front-Panel Capture Switch");
2121 break;
2122 }
2123}
2124
Peisen0202f5c2017-10-26 10:35:36 +08002125static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2126 const struct hda_fixup *fix,
2127 int action)
2128{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002129 static const hda_nid_t conn1[] = { 0x0c };
Peisen0202f5c2017-10-26 10:35:36 +08002130
2131 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2132 return;
2133
2134 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2135 /* We therefore want to make sure 0x14 (front headphone) and
2136 * 0x1b (speakers) use the stereo DAC 0x02
2137 */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002138 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2139 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
Peisen0202f5c2017-10-26 10:35:36 +08002140}
2141
Jeremy Soller7f665b12019-02-13 10:56:19 -07002142static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2143 const struct hda_fixup *fix, int action);
2144
Richard Sailer80690a22019-04-02 15:52:04 +02002145static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002146 const struct hda_fixup *fix,
2147 int action)
2148{
2149 alc1220_fixup_clevo_p950(codec, fix, action);
2150 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2151}
2152
Jian-Hong Panca184352020-10-07 13:22:25 +08002153static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2154 struct hda_jack_callback *jack)
2155{
2156 struct alc_spec *spec = codec->spec;
2157 unsigned int vref;
2158
2159 snd_hda_gen_hp_automute(codec, jack);
2160
2161 if (spec->gen.hp_jack_present)
2162 vref = AC_PINCTL_VREF_80;
2163 else
2164 vref = AC_PINCTL_VREF_HIZ;
2165 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2166}
2167
2168static void alc887_fixup_asus_jack(struct hda_codec *codec,
2169 const struct hda_fixup *fix, int action)
2170{
2171 struct alc_spec *spec = codec->spec;
2172 if (action != HDA_FIXUP_ACT_PROBE)
2173 return;
2174 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2175 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2176}
2177
Takashi Iwai1727a772013-01-10 09:52:52 +01002178static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002179 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002180 .type = HDA_FIXUP_PINS,
2181 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002182 { 0x15, 0x01080104 }, /* side */
2183 { 0x16, 0x01011012 }, /* rear */
2184 { 0x17, 0x01016011 }, /* clfe */
2185 { }
2186 }
2187 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002188 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002189 .type = HDA_FIXUP_PINS,
2190 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002191 { 0x15, 0x99130112 }, /* rear int speakers */
2192 { 0x16, 0x99130111 }, /* subwoofer */
2193 { }
2194 }
2195 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002196 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002197 .type = HDA_FIXUP_PINCTLS,
2198 .v.pins = (const struct hda_pintbl[]) {
2199 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002200 {}
2201 }
2202 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002203 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002204 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002205 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002206 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002207 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002208 .type = HDA_FIXUP_PINS,
2209 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002210 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2211 { }
2212 }
2213 },
Marton Balint8f239212012-03-05 21:33:23 +01002214 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002215 .type = HDA_FIXUP_PINS,
2216 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002217 { 0x1c, 0x993301f0 }, /* CD */
2218 { }
2219 }
2220 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002221 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2222 .type = HDA_FIXUP_PINS,
2223 .v.pins = (const struct hda_pintbl[]) {
2224 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2225 { }
2226 },
2227 .chained = true,
2228 .chain_id = ALC889_FIXUP_CD,
2229 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002230 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002231 .type = HDA_FIXUP_PINS,
2232 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002233 { 0x17, 0x90170111 }, /* hidden surround speaker */
2234 { }
2235 }
2236 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002237 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002238 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002239 .v.verbs = (const struct hda_verb[]) {
2240 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2241 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2242 { }
2243 }
Takashi Iwai177943a32011-11-09 12:55:18 +01002244 },
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002245 [ALC886_FIXUP_EAPD] = {
2246 .type = HDA_FIXUP_VERBS,
2247 .v.verbs = (const struct hda_verb[]) {
2248 /* change to EAPD mode */
2249 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2250 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2251 { }
2252 }
2253 },
Takashi Iwai177943a32011-11-09 12:55:18 +01002254 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002255 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a32011-11-09 12:55:18 +01002256 .v.verbs = (const struct hda_verb[]) {
2257 /* change to EAPD mode */
2258 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2259 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2260 { }
2261 }
2262 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002263 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002264 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002265 .v.verbs = (const struct hda_verb[]) {
2266 /* change to EAPD mode */
2267 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2268 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2269 { }
2270 }
2271 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002272 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002273 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002274 .v.verbs = (const struct hda_verb[]) {
2275 /* eanable EAPD on Acer laptops */
2276 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2277 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2278 { }
2279 }
2280 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002281 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002282 .type = HDA_FIXUP_FUNC,
2283 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002284 },
2285 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002286 .type = HDA_FIXUP_FUNC,
2287 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002288 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002289 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002290 .type = HDA_FIXUP_FUNC,
2291 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002292 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002293 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002294 .type = HDA_FIXUP_FUNC,
2295 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002296 .chained = true,
2297 .chain_id = ALC882_FIXUP_EAPD,
2298 },
2299 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002300 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002301 .v.func = alc889_fixup_coef,
2302 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002303 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002304 .type = HDA_FIXUP_PINS,
2305 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002306 { 0x16, 0x99130111 }, /* CLFE speaker */
2307 { 0x17, 0x99130112 }, /* surround speaker */
2308 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002309 },
2310 .chained = true,
2311 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002312 },
2313 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002314 .type = HDA_FIXUP_PINS,
2315 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002316 { 0x16, 0x99130111 }, /* CLFE speaker */
2317 { 0x1b, 0x99130112 }, /* surround speaker */
2318 { }
2319 },
2320 .chained = true,
2321 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2322 },
2323 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2324 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002325 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002326 .v.verbs = (const struct hda_verb[]) {
2327 /* Enable all DACs */
2328 /* DAC DISABLE/MUTE 1? */
2329 /* setting bits 1-5 disables DAC nids 0x02-0x06
2330 * apparently. Init=0x38 */
2331 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2332 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2333 /* DAC DISABLE/MUTE 2? */
2334 /* some bit here disables the other DACs.
2335 * Init=0x4900 */
2336 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2337 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2338 /* DMIC fix
2339 * This laptop has a stereo digital microphone.
2340 * The mics are only 1cm apart which makes the stereo
2341 * useless. However, either the mic or the ALC889
2342 * makes the signal become a difference/sum signal
2343 * instead of standard stereo, which is annoying.
2344 * So instead we flip this bit which makes the
2345 * codec replicate the sum signal to both channels,
2346 * turning it into a normal mono mic.
2347 */
2348 /* DMIC_CONTROL? Init value = 0x0001 */
2349 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2350 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2351 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2352 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2353 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002354 },
2355 .chained = true,
2356 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002357 },
Takashi Iwai56710872011-11-14 17:42:11 +01002358 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002359 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002360 .v.func = alc885_fixup_macpro_gpio,
2361 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002362 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002363 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002364 .v.func = alc889_fixup_dac_route,
2365 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002366 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002367 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002368 .v.func = alc889_fixup_mbp_vref,
2369 .chained = true,
2370 .chain_id = ALC882_FIXUP_GPIO1,
2371 },
2372 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002373 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002374 .v.func = alc889_fixup_imac91_vref,
2375 .chained = true,
2376 .chain_id = ALC882_FIXUP_GPIO1,
2377 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002378 [ALC889_FIXUP_MBA11_VREF] = {
2379 .type = HDA_FIXUP_FUNC,
2380 .v.func = alc889_fixup_mba11_vref,
2381 .chained = true,
2382 .chain_id = ALC889_FIXUP_MBP_VREF,
2383 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002384 [ALC889_FIXUP_MBA21_VREF] = {
2385 .type = HDA_FIXUP_FUNC,
2386 .v.func = alc889_fixup_mba21_vref,
2387 .chained = true,
2388 .chain_id = ALC889_FIXUP_MBP_VREF,
2389 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002390 [ALC889_FIXUP_MP11_VREF] = {
2391 .type = HDA_FIXUP_FUNC,
2392 .v.func = alc889_fixup_mba11_vref,
2393 .chained = true,
2394 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2395 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002396 [ALC889_FIXUP_MP41_VREF] = {
2397 .type = HDA_FIXUP_FUNC,
2398 .v.func = alc889_fixup_mbp_vref,
2399 .chained = true,
2400 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2401 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002402 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002403 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002404 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002405 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002406 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002407 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002408 .v.func = alc882_fixup_no_primary_hp,
2409 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002410 [ALC887_FIXUP_ASUS_BASS] = {
2411 .type = HDA_FIXUP_PINS,
2412 .v.pins = (const struct hda_pintbl[]) {
2413 {0x16, 0x99130130}, /* bass speaker */
2414 {}
2415 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002416 .chained = true,
2417 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2418 },
2419 [ALC887_FIXUP_BASS_CHMAP] = {
2420 .type = HDA_FIXUP_FUNC,
2421 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002422 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002423 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2424 .type = HDA_FIXUP_FUNC,
2425 .v.func = alc1220_fixup_gb_dual_codecs,
2426 },
Peisen0202f5c2017-10-26 10:35:36 +08002427 [ALC1220_FIXUP_CLEVO_P950] = {
2428 .type = HDA_FIXUP_FUNC,
2429 .v.func = alc1220_fixup_clevo_p950,
2430 },
Richard Sailer80690a22019-04-02 15:52:04 +02002431 [ALC1220_FIXUP_CLEVO_PB51ED] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002432 .type = HDA_FIXUP_FUNC,
Richard Sailer80690a22019-04-02 15:52:04 +02002433 .v.func = alc1220_fixup_clevo_pb51ed,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002434 },
Richard Sailer80690a22019-04-02 15:52:04 +02002435 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002436 .type = HDA_FIXUP_PINS,
2437 .v.pins = (const struct hda_pintbl[]) {
2438 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2439 {}
2440 },
2441 .chained = true,
Richard Sailer80690a22019-04-02 15:52:04 +02002442 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002443 },
Jian-Hong Panca184352020-10-07 13:22:25 +08002444 [ALC887_FIXUP_ASUS_AUDIO] = {
2445 .type = HDA_FIXUP_PINS,
2446 .v.pins = (const struct hda_pintbl[]) {
2447 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2448 { 0x19, 0x22219420 },
2449 {}
2450 },
2451 },
2452 [ALC887_FIXUP_ASUS_HMIC] = {
2453 .type = HDA_FIXUP_FUNC,
2454 .v.func = alc887_fixup_asus_jack,
2455 .chained = true,
2456 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2457 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002458};
2459
2460static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002461 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2462 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002463 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002464 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2465 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2466 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2467 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002468 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2469 ALC882_FIXUP_ACER_ASPIRE_4930G),
2470 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2471 ALC882_FIXUP_ACER_ASPIRE_4930G),
2472 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2473 ALC882_FIXUP_ACER_ASPIRE_8930G),
2474 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2475 ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaib2650472021-04-28 13:26:52 +02002476 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2477 ALC882_FIXUP_ACER_ASPIRE_4930G),
2478 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002479 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2480 ALC882_FIXUP_ACER_ASPIRE_4930G),
2481 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2482 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002483 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2484 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002485 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002486 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002487 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a32011-11-09 12:55:18 +01002488 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002489 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002490 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Jian-Hong Panca184352020-10-07 13:22:25 +08002491 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002492 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002493 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002494 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaib7529c12021-04-28 13:26:53 +02002495 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2496 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002497 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002498 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002499 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002500
2501 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002502 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2503 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2504 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002505 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002506 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2507 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002508 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2509 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002510 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002511 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002512 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002513 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2514 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002515 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002516 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2517 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2518 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002519 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002520 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002521 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2522 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002523 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002524
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002525 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002526 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002527 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002528 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Christian Lachner0d45e862020-02-23 10:24:16 +01002529 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
Christian Lachnerd9e8fe02020-05-18 07:38:44 +02002530 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia0b03952020-06-16 15:21:50 +02002531 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia655e2b2020-02-17 16:19:47 +01002532 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai09926202020-12-20 09:09:43 +01002533 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai1d3aa4a2020-04-08 15:56:45 +02002534 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7dafba32020-02-12 09:10:47 +01002535 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaicc5049a2020-02-18 09:09:15 +01002536 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002537 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai26af1772021-03-03 15:23:46 +01002538 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwai63691582017-05-22 16:32:46 +02002539 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002540 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002541 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
PeiSen Hou259eb822020-05-19 08:50:12 +02002542 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002543 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2544 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2545 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002546 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002547 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2548 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002549 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Hou259eb822020-05-19 08:50:12 +02002550 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2551 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Takashi Iwai13e1a4c2021-04-28 13:26:54 +02002552 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2553 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2554 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2555 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2556 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2557 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2558 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2559 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2560 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2561 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2562 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2563 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002564 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2565 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002566 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002567 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002568 {}
2569};
2570
Takashi Iwai1727a772013-01-10 09:52:52 +01002571static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002572 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2573 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2574 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2575 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2576 {.id = ALC889_FIXUP_CD, .name = "cd"},
2577 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2578 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2579 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2580 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2581 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2582 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2583 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2584 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2585 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2586 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002587 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2588 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2589 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002590 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2591 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2592 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2593 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2594 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2595 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2596 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2597 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002598 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002599 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002600 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002601 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002602 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002603 {}
2604};
2605
Hui Wang119b75c2021-05-22 11:47:41 +08002606static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2607 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2608 {0x14, 0x01014010},
2609 {0x15, 0x01011012},
2610 {0x16, 0x01016011},
2611 {0x18, 0x01a19040},
2612 {0x19, 0x02a19050},
2613 {0x1a, 0x0181304f},
2614 {0x1b, 0x0221401f},
2615 {0x1e, 0x01456130}),
2616 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2617 {0x14, 0x01015010},
2618 {0x15, 0x01011012},
2619 {0x16, 0x01011011},
2620 {0x18, 0x01a11040},
2621 {0x19, 0x02a19050},
2622 {0x1a, 0x0181104f},
2623 {0x1b, 0x0221401f},
2624 {0x1e, 0x01451130}),
2625 {}
2626};
2627
Takashi Iwai1d045db2011-07-07 18:23:21 +02002628/*
2629 * BIOS auto configuration
2630 */
2631/* almost identical with ALC880 parser... */
2632static int alc882_parse_auto_config(struct hda_codec *codec)
2633{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002634 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002635 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2636 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002637}
2638
Takashi Iwai1d045db2011-07-07 18:23:21 +02002639/*
2640 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002641static int patch_alc882(struct hda_codec *codec)
2642{
2643 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002644 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002645
Takashi Iwai3de95172012-05-07 18:03:15 +02002646 err = alc_alloc_spec(codec, 0x0b);
2647 if (err < 0)
2648 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002649
Takashi Iwai3de95172012-05-07 18:03:15 +02002650 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002651
Takashi Iwai7639a062015-03-03 10:07:24 +01002652 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002653 case 0x10ec0882:
2654 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002655 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +08002656 case 0x10ec0b00:
Kailang Yanga535ad52017-01-16 16:59:26 +08002657 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002658 break;
2659 default:
2660 /* ALC883 and variants */
2661 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2662 break;
2663 }
2664
Takashi Iwaic9af7532019-05-10 11:01:43 +02002665 alc_pre_init(codec);
2666
Takashi Iwai1727a772013-01-10 09:52:52 +01002667 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002668 alc882_fixups);
Hui Wang119b75c2021-05-22 11:47:41 +08002669 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +01002670 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002671
2672 alc_auto_parse_customize_define(codec);
2673
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002674 if (has_cdefine_beep(codec))
2675 spec->gen.beep_nid = 0x01;
2676
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002677 /* automatic parse from the BIOS config */
2678 err = alc882_parse_auto_config(codec);
2679 if (err < 0)
2680 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002681
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002682 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2683 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2684 if (err < 0)
2685 goto error;
2686 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002687
Takashi Iwai1727a772013-01-10 09:52:52 +01002688 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002689
Takashi Iwai1d045db2011-07-07 18:23:21 +02002690 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002691
2692 error:
2693 alc_free(codec);
2694 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002695}
2696
2697
2698/*
2699 * ALC262 support
2700 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002701static int alc262_parse_auto_config(struct hda_codec *codec)
2702{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002703 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002704 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2705 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002706}
2707
2708/*
2709 * Pin config fixes
2710 */
2711enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002712 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002713 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002714 ALC262_FIXUP_HP_Z200,
2715 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002716 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002717 ALC262_FIXUP_BENQ,
2718 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002719 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002720 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002721};
2722
Takashi Iwai1727a772013-01-10 09:52:52 +01002723static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002724 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002725 .type = HDA_FIXUP_PINS,
2726 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002727 { 0x14, 0x99130110 }, /* speaker */
2728 { 0x15, 0x0221142f }, /* front HP */
2729 { 0x1b, 0x0121141f }, /* rear HP */
2730 { }
2731 }
2732 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002733 [ALC262_FIXUP_FSC_S7110] = {
2734 .type = HDA_FIXUP_PINS,
2735 .v.pins = (const struct hda_pintbl[]) {
2736 { 0x15, 0x90170110 }, /* speaker */
2737 { }
2738 },
2739 .chained = true,
2740 .chain_id = ALC262_FIXUP_BENQ,
2741 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002742 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002743 .type = HDA_FIXUP_PINS,
2744 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002745 { 0x16, 0x99130120 }, /* internal speaker */
2746 { }
2747 }
2748 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002749 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002750 .type = HDA_FIXUP_PINS,
2751 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002752 { 0x14, 0x1993e1f0 }, /* int AUX */
2753 { }
2754 }
2755 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002756 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002757 .type = HDA_FIXUP_PINCTLS,
2758 .v.pins = (const struct hda_pintbl[]) {
2759 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002760 {}
2761 },
2762 .chained = true,
2763 .chain_id = ALC262_FIXUP_BENQ,
2764 },
2765 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002766 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002767 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002768 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2769 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2770 {}
2771 }
2772 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002773 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002774 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002775 .v.verbs = (const struct hda_verb[]) {
2776 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2777 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2778 {}
2779 }
2780 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002781 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002782 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002783 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002784 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002785 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2786 .type = HDA_FIXUP_FUNC,
2787 .v.func = alc_fixup_no_depop_delay,
2788 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002789};
2790
2791static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002792 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002793 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002794 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002795 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002796 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002797 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002798 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002799 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2800 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002801 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002802 {}
2803};
2804
Takashi Iwai1727a772013-01-10 09:52:52 +01002805static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002806 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002807 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2808 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2809 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2810 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2811 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2812 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2813 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2814 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002815 {}
2816};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002817
Takashi Iwai1d045db2011-07-07 18:23:21 +02002818/*
2819 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002820static int patch_alc262(struct hda_codec *codec)
2821{
2822 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002823 int err;
2824
Takashi Iwai3de95172012-05-07 18:03:15 +02002825 err = alc_alloc_spec(codec, 0x0b);
2826 if (err < 0)
2827 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002828
Takashi Iwai3de95172012-05-07 18:03:15 +02002829 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002830 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002831
Takashi Iwai225068a2015-05-29 10:42:14 +02002832 spec->shutup = alc_eapd_shutup;
2833
Takashi Iwai1d045db2011-07-07 18:23:21 +02002834#if 0
2835 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2836 * under-run
2837 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002838 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002839#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002840 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2841
Takashi Iwaic9af7532019-05-10 11:01:43 +02002842 alc_pre_init(codec);
2843
Takashi Iwai1727a772013-01-10 09:52:52 +01002844 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002845 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002846 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002847
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002848 alc_auto_parse_customize_define(codec);
2849
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002850 if (has_cdefine_beep(codec))
2851 spec->gen.beep_nid = 0x01;
2852
Takashi Iwai42399f72011-11-07 17:18:44 +01002853 /* automatic parse from the BIOS config */
2854 err = alc262_parse_auto_config(codec);
2855 if (err < 0)
2856 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002857
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002858 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2859 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2860 if (err < 0)
2861 goto error;
2862 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002863
Takashi Iwai1727a772013-01-10 09:52:52 +01002864 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002865
Takashi Iwai1d045db2011-07-07 18:23:21 +02002866 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002867
2868 error:
2869 alc_free(codec);
2870 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002871}
2872
2873/*
2874 * ALC268
2875 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002876/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002877static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2878 struct snd_ctl_elem_value *ucontrol)
2879{
2880 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2881 unsigned long pval;
2882 int err;
2883
2884 mutex_lock(&codec->control_mutex);
2885 pval = kcontrol->private_value;
2886 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2887 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2888 if (err >= 0) {
2889 kcontrol->private_value = (pval & ~0xff) | 0x10;
2890 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2891 }
2892 kcontrol->private_value = pval;
2893 mutex_unlock(&codec->control_mutex);
2894 return err;
2895}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002896
2897static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2898 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002899 {
2900 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2901 .name = "Beep Playback Switch",
2902 .subdevice = HDA_SUBDEV_AMP_FLAG,
2903 .info = snd_hda_mixer_amp_switch_info,
2904 .get = snd_hda_mixer_amp_switch_get,
2905 .put = alc268_beep_switch_put,
2906 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2907 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002908};
2909
2910/* set PCBEEP vol = 0, mute connections */
2911static const struct hda_verb alc268_beep_init_verbs[] = {
2912 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2913 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2914 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2915 { }
2916};
2917
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002918enum {
2919 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002920 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002921 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002922};
2923
Takashi Iwai1727a772013-01-10 09:52:52 +01002924static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002925 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002926 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002927 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002928 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002929 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002930 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002931 .v.verbs = (const struct hda_verb[]) {
2932 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2933 {}
2934 }
2935 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002936 [ALC268_FIXUP_SPDIF] = {
2937 .type = HDA_FIXUP_PINS,
2938 .v.pins = (const struct hda_pintbl[]) {
2939 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2940 {}
2941 }
2942 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002943};
2944
Takashi Iwai1727a772013-01-10 09:52:52 +01002945static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002946 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002947 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02002948 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002949 {}
2950};
2951
2952static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002953 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002954 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002955 /* below is codec SSID since multiple Toshiba laptops have the
2956 * same PCI SSID 1179:ff00
2957 */
2958 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002959 {}
2960};
2961
Takashi Iwai1d045db2011-07-07 18:23:21 +02002962/*
2963 * BIOS auto configuration
2964 */
2965static int alc268_parse_auto_config(struct hda_codec *codec)
2966{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002967 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002968 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002969}
2970
Takashi Iwai1d045db2011-07-07 18:23:21 +02002971/*
2972 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002973static int patch_alc268(struct hda_codec *codec)
2974{
2975 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002976 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002977
Takashi Iwai1d045db2011-07-07 18:23:21 +02002978 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002979 err = alc_alloc_spec(codec, 0);
2980 if (err < 0)
2981 return err;
2982
2983 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02002984 if (has_cdefine_beep(codec))
2985 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002986
Takashi Iwai225068a2015-05-29 10:42:14 +02002987 spec->shutup = alc_eapd_shutup;
2988
Takashi Iwaic9af7532019-05-10 11:01:43 +02002989 alc_pre_init(codec);
2990
Takashi Iwai1727a772013-01-10 09:52:52 +01002991 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2992 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002993
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002994 /* automatic parse from the BIOS config */
2995 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002996 if (err < 0)
2997 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002998
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002999 if (err > 0 && !spec->gen.no_analog &&
3000 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02003001 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3002 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3003 &alc268_beep_mixer[i])) {
3004 err = -ENOMEM;
3005 goto error;
3006 }
3007 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003008 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003009 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3010 /* override the amp caps for beep generator */
3011 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3012 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3013 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3014 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3015 (0 << AC_AMPCAP_MUTE_SHIFT));
3016 }
3017
Takashi Iwai1727a772013-01-10 09:52:52 +01003018 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02003019
Takashi Iwai1d045db2011-07-07 18:23:21 +02003020 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02003021
3022 error:
3023 alc_free(codec);
3024 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003025}
3026
3027/*
3028 * ALC269
3029 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003030
Takashi Iwai1d045db2011-07-07 18:23:21 +02003031static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003032 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003033};
3034
3035static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003036 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003037};
3038
Takashi Iwai1d045db2011-07-07 18:23:21 +02003039/* different alc269-variants */
3040enum {
3041 ALC269_TYPE_ALC269VA,
3042 ALC269_TYPE_ALC269VB,
3043 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02003044 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01003045 ALC269_TYPE_ALC280,
3046 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02003047 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01003048 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08003049 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02003050 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08003051 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003052 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08003053 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08003054 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08003055 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08003056 ALC269_TYPE_ALC225,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003057 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08003058 ALC269_TYPE_ALC300,
Kailang Yangf0778872019-10-24 15:13:32 +08003059 ALC269_TYPE_ALC623,
Kailang Yang6fbae352016-05-30 16:44:20 +08003060 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02003061};
3062
3063/*
3064 * BIOS auto configuration
3065 */
3066static int alc269_parse_auto_config(struct hda_codec *codec)
3067{
Takashi Iwai1d045db2011-07-07 18:23:21 +02003068 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003069 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3070 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3071 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02003072 const hda_nid_t *ssids;
3073
3074 switch (spec->codec_variant) {
3075 case ALC269_TYPE_ALC269VA:
3076 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01003077 case ALC269_TYPE_ALC280:
3078 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08003079 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003080 ssids = alc269va_ssids;
3081 break;
3082 case ALC269_TYPE_ALC269VB:
3083 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01003084 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02003085 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02003086 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08003087 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003088 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08003089 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08003090 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08003091 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08003092 case ALC269_TYPE_ALC225:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003093 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08003094 case ALC269_TYPE_ALC300:
Kailang Yangf0778872019-10-24 15:13:32 +08003095 case ALC269_TYPE_ALC623:
Kailang Yang6fbae352016-05-30 16:44:20 +08003096 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003097 ssids = alc269_ssids;
3098 break;
3099 default:
3100 ssids = alc269_ssids;
3101 break;
3102 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02003103
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003104 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003105}
3106
Hui Wang476c02e2020-03-29 16:20:18 +08003107static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3108 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3109 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3110 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3111 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3112 {}
3113};
3114
3115static void alc_headset_btn_callback(struct hda_codec *codec,
3116 struct hda_jack_callback *jack)
3117{
3118 int report = 0;
3119
3120 if (jack->unsol_res & (7 << 13))
3121 report |= SND_JACK_BTN_0;
3122
3123 if (jack->unsol_res & (1 << 16 | 3 << 8))
3124 report |= SND_JACK_BTN_1;
3125
3126 /* Volume up key */
3127 if (jack->unsol_res & (7 << 23))
3128 report |= SND_JACK_BTN_2;
3129
3130 /* Volume down key */
3131 if (jack->unsol_res & (7 << 10))
3132 report |= SND_JACK_BTN_3;
3133
Hui Wang04f77912021-03-05 17:26:08 +08003134 snd_hda_jack_set_button_state(codec, jack->nid, report);
Hui Wang476c02e2020-03-29 16:20:18 +08003135}
3136
3137static void alc_disable_headset_jack_key(struct hda_codec *codec)
3138{
3139 struct alc_spec *spec = codec->spec;
3140
3141 if (!spec->has_hs_key)
3142 return;
3143
3144 switch (codec->core.vendor_id) {
3145 case 0x10ec0215:
3146 case 0x10ec0225:
3147 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003148 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003149 case 0x10ec0295:
3150 case 0x10ec0289:
3151 case 0x10ec0299:
3152 alc_write_coef_idx(codec, 0x48, 0x0);
3153 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3154 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3155 break;
3156 case 0x10ec0236:
3157 case 0x10ec0256:
3158 alc_write_coef_idx(codec, 0x48, 0x0);
3159 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3160 break;
3161 }
3162}
3163
3164static void alc_enable_headset_jack_key(struct hda_codec *codec)
3165{
3166 struct alc_spec *spec = codec->spec;
3167
3168 if (!spec->has_hs_key)
3169 return;
3170
3171 switch (codec->core.vendor_id) {
3172 case 0x10ec0215:
3173 case 0x10ec0225:
3174 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003175 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003176 case 0x10ec0295:
3177 case 0x10ec0289:
3178 case 0x10ec0299:
3179 alc_write_coef_idx(codec, 0x48, 0xd011);
3180 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3181 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3182 break;
3183 case 0x10ec0236:
3184 case 0x10ec0256:
3185 alc_write_coef_idx(codec, 0x48, 0xd011);
3186 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3187 break;
3188 }
3189}
3190
3191static void alc_fixup_headset_jack(struct hda_codec *codec,
3192 const struct hda_fixup *fix, int action)
3193{
3194 struct alc_spec *spec = codec->spec;
Hui Wang04f77912021-03-05 17:26:08 +08003195 hda_nid_t hp_pin;
Hui Wang476c02e2020-03-29 16:20:18 +08003196
3197 switch (action) {
3198 case HDA_FIXUP_ACT_PRE_PROBE:
3199 spec->has_hs_key = 1;
3200 snd_hda_jack_detect_enable_callback(codec, 0x55,
3201 alc_headset_btn_callback);
Hui Wang476c02e2020-03-29 16:20:18 +08003202 break;
Hui Wang04f77912021-03-05 17:26:08 +08003203 case HDA_FIXUP_ACT_BUILD:
3204 hp_pin = alc_get_hp_pin(spec);
3205 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3206 alc_headset_btn_keymap,
3207 hp_pin))
3208 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3209 false, SND_JACK_HEADSET,
3210 alc_headset_btn_keymap);
3211
Hui Wang476c02e2020-03-29 16:20:18 +08003212 alc_enable_headset_jack_key(codec);
3213 break;
3214 }
3215}
3216
Kailang Yang1387e2d2012-11-08 10:23:18 +01003217static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003218{
Takashi Iwai98b24882014-08-18 13:47:50 +02003219 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003220}
3221
3222static void alc269_shutup(struct hda_codec *codec)
3223{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003224 struct alc_spec *spec = codec->spec;
3225
Kailang Yang1387e2d2012-11-08 10:23:18 +01003226 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3227 alc269vb_toggle_power_output(codec, 0);
3228 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3229 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003230 msleep(150);
3231 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003232 alc_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003233}
3234
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003235static const struct coef_fw alc282_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003236 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08003237 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003238 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3239 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3240 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3241 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3242 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3243 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3244 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3245 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3246 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3247 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3248 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3249 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3250 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3251 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3252 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3253 WRITE_COEF(0x63, 0x2902), /* PLL */
3254 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3255 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3256 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3257 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3258 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3259 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3260 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3261 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3262 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3263 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3264 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3265 {}
3266};
3267
Kailang Yangcb149cb2014-03-18 16:45:32 +08003268static void alc282_restore_default_value(struct hda_codec *codec)
3269{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003270 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08003271}
3272
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003273static void alc282_init(struct hda_codec *codec)
3274{
3275 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003276 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003277 bool hp_pin_sense;
3278 int coef78;
3279
Kailang Yangcb149cb2014-03-18 16:45:32 +08003280 alc282_restore_default_value(codec);
3281
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003282 if (!hp_pin)
3283 return;
3284 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3285 coef78 = alc_read_coef_idx(codec, 0x78);
3286
3287 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3288 /* Headphone capless set to high power mode */
3289 alc_write_coef_idx(codec, 0x78, 0x9004);
3290
3291 if (hp_pin_sense)
3292 msleep(2);
3293
3294 snd_hda_codec_write(codec, hp_pin, 0,
3295 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3296
3297 if (hp_pin_sense)
3298 msleep(85);
3299
3300 snd_hda_codec_write(codec, hp_pin, 0,
3301 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3302
3303 if (hp_pin_sense)
3304 msleep(100);
3305
3306 /* Headphone capless set to normal mode */
3307 alc_write_coef_idx(codec, 0x78, coef78);
3308}
3309
3310static void alc282_shutup(struct hda_codec *codec)
3311{
3312 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003313 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003314 bool hp_pin_sense;
3315 int coef78;
3316
3317 if (!hp_pin) {
3318 alc269_shutup(codec);
3319 return;
3320 }
3321
3322 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3323 coef78 = alc_read_coef_idx(codec, 0x78);
3324 alc_write_coef_idx(codec, 0x78, 0x9004);
3325
3326 if (hp_pin_sense)
3327 msleep(2);
3328
3329 snd_hda_codec_write(codec, hp_pin, 0,
3330 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3331
3332 if (hp_pin_sense)
3333 msleep(85);
3334
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003335 if (!spec->no_shutup_pins)
3336 snd_hda_codec_write(codec, hp_pin, 0,
3337 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003338
3339 if (hp_pin_sense)
3340 msleep(100);
3341
3342 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003343 alc_shutup_pins(codec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003344 alc_write_coef_idx(codec, 0x78, coef78);
3345}
3346
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003347static const struct coef_fw alc283_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003348 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003349 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003350 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3351 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3352 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3353 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3354 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3355 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3356 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3357 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3358 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3359 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3360 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3361 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3362 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3363 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3364 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3365 WRITE_COEF(0x2e, 0x2902), /* PLL */
3366 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3367 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3368 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3369 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3370 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3371 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3372 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3373 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3374 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3375 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3376 WRITE_COEF(0x49, 0x0), /* test mode */
3377 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3378 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3379 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003380 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003381 {}
3382};
3383
Kailang Yang6bd55b02014-03-17 13:51:27 +08003384static void alc283_restore_default_value(struct hda_codec *codec)
3385{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003386 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003387}
3388
Kailang Yang2af02be2013-08-22 10:03:50 +02003389static void alc283_init(struct hda_codec *codec)
3390{
3391 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003392 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003393 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003394
Kailang Yang6bd55b02014-03-17 13:51:27 +08003395 alc283_restore_default_value(codec);
3396
Kailang Yang2af02be2013-08-22 10:03:50 +02003397 if (!hp_pin)
3398 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003399
3400 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003401 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3402
3403 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3404 /* Headphone capless set to high power mode */
3405 alc_write_coef_idx(codec, 0x43, 0x9004);
3406
3407 snd_hda_codec_write(codec, hp_pin, 0,
3408 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3409
3410 if (hp_pin_sense)
3411 msleep(85);
3412
3413 snd_hda_codec_write(codec, hp_pin, 0,
3414 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3415
3416 if (hp_pin_sense)
3417 msleep(85);
3418 /* Index 0x46 Combo jack auto switch control 2 */
3419 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003420 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003421 /* Headphone capless set to normal mode */
3422 alc_write_coef_idx(codec, 0x43, 0x9614);
3423}
3424
3425static void alc283_shutup(struct hda_codec *codec)
3426{
3427 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003428 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003429 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003430
3431 if (!hp_pin) {
3432 alc269_shutup(codec);
3433 return;
3434 }
3435
3436 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3437
3438 alc_write_coef_idx(codec, 0x43, 0x9004);
3439
Harsha Priyab450b172014-10-09 11:04:56 +00003440 /*depop hp during suspend*/
3441 alc_write_coef_idx(codec, 0x06, 0x2100);
3442
Kailang Yang2af02be2013-08-22 10:03:50 +02003443 snd_hda_codec_write(codec, hp_pin, 0,
3444 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3445
3446 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003447 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003448
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003449 if (!spec->no_shutup_pins)
3450 snd_hda_codec_write(codec, hp_pin, 0,
3451 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003452
Takashi Iwai98b24882014-08-18 13:47:50 +02003453 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003454
3455 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003456 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003457 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003458 alc_shutup_pins(codec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003459 alc_write_coef_idx(codec, 0x43, 0x9614);
3460}
3461
Kailang Yang4a219ef2017-06-16 16:54:35 +08003462static void alc256_init(struct hda_codec *codec)
3463{
3464 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003465 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003466 bool hp_pin_sense;
3467
3468 if (!hp_pin)
Kailang Yang6447c962019-05-08 16:27:03 +08003469 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003470
3471 msleep(30);
3472
3473 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3474
3475 if (hp_pin_sense)
3476 msleep(2);
3477
3478 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yang6447c962019-05-08 16:27:03 +08003479 if (spec->ultra_low_power) {
3480 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3481 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3482 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3483 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3484 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3485 msleep(30);
3486 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003487
3488 snd_hda_codec_write(codec, hp_pin, 0,
3489 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3490
Kailang Yang6447c962019-05-08 16:27:03 +08003491 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003492 msleep(85);
3493
3494 snd_hda_codec_write(codec, hp_pin, 0,
3495 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3496
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_update_coef_idx(codec, 0x46, 3 << 12, 0);
3501 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003502 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3503 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Thomas Hebbc4473742020-03-30 12:09:38 -04003504 /*
3505 * Expose headphone mic (or possibly Line In on some machines) instead
3506 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3507 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3508 * this register.
3509 */
3510 alc_write_coef_idx(codec, 0x36, 0x5757);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003511}
3512
3513static void alc256_shutup(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 Yang4a219ef2017-06-16 16:54:35 +08003517 bool hp_pin_sense;
3518
Kailang Yang6447c962019-05-08 16:27:03 +08003519 if (!hp_pin)
3520 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003521
3522 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3523
3524 if (hp_pin_sense)
3525 msleep(2);
3526
3527 snd_hda_codec_write(codec, hp_pin, 0,
3528 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3529
Kailang Yang6447c962019-05-08 16:27:03 +08003530 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003531 msleep(85);
3532
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003533 /* 3k pull low control for Headset jack. */
3534 /* NOTE: call this before clearing the pin, otherwise codec stalls */
Hui Wang3f742492020-09-14 14:51:18 +08003535 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3536 * when booting with headset plugged. So skip setting it for the codec alc257
3537 */
3538 if (codec->core.vendor_id != 0x10ec0257)
3539 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003540
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003541 if (!spec->no_shutup_pins)
3542 snd_hda_codec_write(codec, hp_pin, 0,
3543 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003544
Kailang Yang6447c962019-05-08 16:27:03 +08003545 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003546 msleep(100);
3547
3548 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003549 alc_shutup_pins(codec);
Kailang Yang6447c962019-05-08 16:27:03 +08003550 if (spec->ultra_low_power) {
3551 msleep(50);
3552 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3553 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3554 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3555 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3556 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3557 msleep(30);
3558 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003559}
3560
Kailang Yangda911b12018-01-05 16:50:08 +08003561static void alc225_init(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
3567 if (!hp_pin)
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003568 hp_pin = 0x21;
Kailang Yangda911b12018-01-05 16:50:08 +08003569 msleep(30);
3570
3571 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3572 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3573
3574 if (hp1_pin_sense || hp2_pin_sense)
3575 msleep(2);
3576
3577 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003578 if (spec->ultra_low_power) {
3579 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3580 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3581 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3582 msleep(30);
3583 }
Kailang Yangda911b12018-01-05 16:50:08 +08003584
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003585 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003586 snd_hda_codec_write(codec, hp_pin, 0,
3587 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3588 if (hp2_pin_sense)
3589 snd_hda_codec_write(codec, 0x16, 0,
3590 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3591
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003592 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003593 msleep(85);
3594
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003595 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003596 snd_hda_codec_write(codec, hp_pin, 0,
3597 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3598 if (hp2_pin_sense)
3599 snd_hda_codec_write(codec, 0x16, 0,
3600 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3601
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003602 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003603 msleep(100);
3604
3605 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3606 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3607}
3608
3609static void alc225_shutup(struct hda_codec *codec)
3610{
3611 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003612 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003613 bool hp1_pin_sense, hp2_pin_sense;
3614
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003615 if (!hp_pin)
3616 hp_pin = 0x21;
Hui Wang476c02e2020-03-29 16:20:18 +08003617
3618 alc_disable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003619 /* 3k pull low control for Headset jack. */
3620 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3621
3622 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3623 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3624
3625 if (hp1_pin_sense || hp2_pin_sense)
3626 msleep(2);
3627
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003628 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003629 snd_hda_codec_write(codec, hp_pin, 0,
3630 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3631 if (hp2_pin_sense)
3632 snd_hda_codec_write(codec, 0x16, 0,
3633 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3634
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003635 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003636 msleep(85);
3637
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003638 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003639 snd_hda_codec_write(codec, hp_pin, 0,
3640 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3641 if (hp2_pin_sense)
3642 snd_hda_codec_write(codec, 0x16, 0,
3643 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3644
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003645 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003646 msleep(100);
3647
3648 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003649 alc_shutup_pins(codec);
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003650 if (spec->ultra_low_power) {
3651 msleep(50);
3652 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3653 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3654 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3655 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3656 msleep(30);
3657 }
Hui Wang476c02e2020-03-29 16:20:18 +08003658
3659 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3660 alc_enable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003661}
3662
Kailang Yangc2d6af52017-06-21 14:50:54 +08003663static void alc_default_init(struct hda_codec *codec)
3664{
3665 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003666 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003667 bool hp_pin_sense;
3668
3669 if (!hp_pin)
3670 return;
3671
3672 msleep(30);
3673
3674 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3675
3676 if (hp_pin_sense)
3677 msleep(2);
3678
3679 snd_hda_codec_write(codec, hp_pin, 0,
3680 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3681
3682 if (hp_pin_sense)
3683 msleep(85);
3684
3685 snd_hda_codec_write(codec, hp_pin, 0,
3686 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3687
3688 if (hp_pin_sense)
3689 msleep(100);
3690}
3691
3692static void alc_default_shutup(struct hda_codec *codec)
3693{
3694 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003695 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003696 bool hp_pin_sense;
3697
3698 if (!hp_pin) {
3699 alc269_shutup(codec);
3700 return;
3701 }
3702
3703 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3704
3705 if (hp_pin_sense)
3706 msleep(2);
3707
3708 snd_hda_codec_write(codec, hp_pin, 0,
3709 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3710
3711 if (hp_pin_sense)
3712 msleep(85);
3713
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003714 if (!spec->no_shutup_pins)
3715 snd_hda_codec_write(codec, hp_pin, 0,
3716 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003717
3718 if (hp_pin_sense)
3719 msleep(100);
3720
3721 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003722 alc_shutup_pins(codec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003723}
3724
Kailang Yang693abe12019-01-29 15:38:21 +08003725static void alc294_hp_init(struct hda_codec *codec)
3726{
3727 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003728 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang693abe12019-01-29 15:38:21 +08003729 int i, val;
3730
3731 if (!hp_pin)
3732 return;
3733
3734 snd_hda_codec_write(codec, hp_pin, 0,
3735 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3736
3737 msleep(100);
3738
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003739 if (!spec->no_shutup_pins)
3740 snd_hda_codec_write(codec, hp_pin, 0,
3741 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang693abe12019-01-29 15:38:21 +08003742
3743 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3744 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3745
3746 /* Wait for depop procedure finish */
3747 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3748 for (i = 0; i < 20 && val & 0x0080; i++) {
3749 msleep(50);
3750 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3751 }
3752 /* Set HP depop to auto mode */
3753 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3754 msleep(50);
3755}
3756
3757static void alc294_init(struct hda_codec *codec)
3758{
3759 struct alc_spec *spec = codec->spec;
3760
Takashi Iwaif6ef4e02019-01-29 14:14:51 +01003761 /* required only at boot or S4 resume time */
3762 if (!spec->done_hp_init ||
3763 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
Kailang Yang693abe12019-01-29 15:38:21 +08003764 alc294_hp_init(codec);
3765 spec->done_hp_init = true;
3766 }
3767 alc_default_init(codec);
3768}
3769
Kailang Yangad60d502013-06-28 12:03:01 +02003770static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3771 unsigned int val)
3772{
3773 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3774 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3775 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3776}
3777
3778static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3779{
3780 unsigned int val;
3781
3782 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3783 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3784 & 0xffff;
3785 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3786 << 16;
3787 return val;
3788}
3789
3790static void alc5505_dsp_halt(struct hda_codec *codec)
3791{
3792 unsigned int val;
3793
3794 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3795 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3796 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3797 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3798 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3799 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3800 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3801 val = alc5505_coef_get(codec, 0x6220);
3802 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3803}
3804
3805static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3806{
3807 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3808 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3809 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3810 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3811 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3812 alc5505_coef_set(codec, 0x880c, 0x00000004);
3813}
3814
3815static void alc5505_dsp_init(struct hda_codec *codec)
3816{
3817 unsigned int val;
3818
3819 alc5505_dsp_halt(codec);
3820 alc5505_dsp_back_from_halt(codec);
3821 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3822 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3823 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3824 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3825 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3826 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3827 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3828 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3829 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3830 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3831 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3832 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3833 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3834
3835 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3836 if (val <= 3)
3837 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3838 else
3839 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3840
3841 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3842 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3843 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3844 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3845 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3846 alc5505_coef_set(codec, 0x880c, 0x00000003);
3847 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003848
3849#ifdef HALT_REALTEK_ALC5505
3850 alc5505_dsp_halt(codec);
3851#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003852}
3853
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003854#ifdef HALT_REALTEK_ALC5505
Pierre-Louis Bossart8a718212020-01-11 15:47:35 -06003855#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3856#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003857#else
3858#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3859#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3860#endif
3861
Takashi Iwai2a439522011-07-26 09:52:50 +02003862#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003863static int alc269_suspend(struct hda_codec *codec)
3864{
3865 struct alc_spec *spec = codec->spec;
3866
3867 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003868 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003869 return alc_suspend(codec);
3870}
3871
Takashi Iwai1d045db2011-07-07 18:23:21 +02003872static int alc269_resume(struct hda_codec *codec)
3873{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003874 struct alc_spec *spec = codec->spec;
3875
Kailang Yang1387e2d2012-11-08 10:23:18 +01003876 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3877 alc269vb_toggle_power_output(codec, 0);
3878 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003879 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003880 msleep(150);
3881 }
3882
3883 codec->patch_ops.init(codec);
3884
Kailang Yang1387e2d2012-11-08 10:23:18 +01003885 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3886 alc269vb_toggle_power_output(codec, 1);
3887 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003888 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003889 msleep(200);
3890 }
3891
Takashi Iwai1a462be2020-01-09 10:01:04 +01003892 snd_hda_regmap_sync(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003893 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003894
3895 /* on some machine, the BIOS will clear the codec gpio data when enter
3896 * suspend, and won't restore the data after resume, so we restore it
3897 * in the driver.
3898 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003899 if (spec->gpio_data)
3900 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003901
Kailang Yangad60d502013-06-28 12:03:01 +02003902 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003903 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003904
Takashi Iwai1d045db2011-07-07 18:23:21 +02003905 return 0;
3906}
Takashi Iwai2a439522011-07-26 09:52:50 +02003907#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003908
David Henningsson108cc102012-07-20 10:37:25 +02003909static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003910 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003911{
3912 struct alc_spec *spec = codec->spec;
3913
Takashi Iwai1727a772013-01-10 09:52:52 +01003914 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003915 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3916}
3917
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01003918static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3919 const struct hda_fixup *fix,
3920 int action)
3921{
3922 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3923 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3924
3925 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3926 snd_hda_codec_set_pincfg(codec, 0x19,
3927 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3928 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3929}
3930
Takashi Iwai1d045db2011-07-07 18:23:21 +02003931static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003932 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003933{
Takashi Iwai98b24882014-08-18 13:47:50 +02003934 if (action == HDA_FIXUP_ACT_INIT)
3935 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003936}
3937
David Henningsson7c478f02013-10-11 10:18:46 +02003938static void alc269_fixup_headset_mic(struct hda_codec *codec,
3939 const struct hda_fixup *fix, int action)
3940{
3941 struct alc_spec *spec = codec->spec;
3942
3943 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3944 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3945}
3946
Takashi Iwai1d045db2011-07-07 18:23:21 +02003947static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003948 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003949{
3950 static const struct hda_verb verbs[] = {
3951 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3952 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3953 {}
3954 };
3955 unsigned int cfg;
3956
Takashi Iwai7639a062015-03-03 10:07:24 +01003957 if (strcmp(codec->core.chip_name, "ALC271X") &&
3958 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02003959 return;
3960 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3961 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3962 snd_hda_sequence_write(codec, verbs);
3963}
3964
Takashi Iwaic8426b22021-04-07 11:57:30 +02003965/* Fix the speaker amp after resume, etc */
3966static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
3967 const struct hda_fixup *fix,
3968 int action)
3969{
3970 if (action == HDA_FIXUP_ACT_INIT)
3971 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
3972}
3973
Takashi Iwai017f2a12011-07-09 14:42:25 +02003974static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003975 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003976{
3977 struct alc_spec *spec = codec->spec;
3978
Takashi Iwai1727a772013-01-10 09:52:52 +01003979 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003980 return;
3981
3982 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3983 * fix the sample rate of analog I/O to 44.1kHz
3984 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003985 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3986 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02003987}
3988
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003989static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003990 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003991{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003992 /* The digital-mic unit sends PDM (differential signal) instead of
3993 * the standard PCM, thus you can't record a valid mono stream as is.
3994 * Below is a workaround specific to ALC269 to control the dmic
3995 * signal source as mono.
3996 */
Takashi Iwai98b24882014-08-18 13:47:50 +02003997 if (action == HDA_FIXUP_ACT_INIT)
3998 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003999}
4000
Takashi Iwai24519912011-08-16 15:08:49 +02004001static void alc269_quanta_automute(struct hda_codec *codec)
4002{
Takashi Iwai08c189f2012-12-19 15:22:24 +01004003 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02004004
Takashi Iwai1687ccc2014-08-18 13:49:35 +02004005 alc_write_coef_idx(codec, 0x0c, 0x680);
4006 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02004007}
4008
4009static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004010 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02004011{
4012 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01004013 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02004014 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01004015 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02004016}
4017
David Henningssond240d1d2013-04-15 12:50:02 +02004018static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02004019 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02004020{
4021 struct alc_spec *spec = codec->spec;
4022 int vref;
4023 msleep(200);
4024 snd_hda_gen_hp_automute(codec, jack);
4025
4026 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4027 msleep(100);
4028 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4029 vref);
4030 msleep(500);
4031 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4032 vref);
4033}
4034
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02004035/*
4036 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4037 */
4038struct hda_alc298_mbxinit {
4039 unsigned char value_0x23;
4040 unsigned char value_0x25;
4041};
4042
4043static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4044 const struct hda_alc298_mbxinit *initval,
4045 bool first)
4046{
4047 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4048 alc_write_coef_idx(codec, 0x26, 0xb000);
4049
4050 if (first)
4051 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4052
4053 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4054 alc_write_coef_idx(codec, 0x26, 0xf000);
4055 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4056
4057 if (initval->value_0x23 != 0x1e)
4058 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4059
4060 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4061 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4062}
4063
4064static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4065 const struct hda_fixup *fix,
4066 int action)
4067{
4068 /* Initialization magic */
4069 static const struct hda_alc298_mbxinit dac_init[] = {
4070 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4071 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4072 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4073 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4074 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4075 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4076 {0x2f, 0x00},
4077 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4078 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4079 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4080 {}
4081 };
4082 const struct hda_alc298_mbxinit *seq;
4083
4084 if (action != HDA_FIXUP_ACT_INIT)
4085 return;
4086
4087 /* Start */
4088 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4089 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4090 alc_write_coef_idx(codec, 0x26, 0xf000);
4091 alc_write_coef_idx(codec, 0x22, 0x31);
4092 alc_write_coef_idx(codec, 0x23, 0x0b);
4093 alc_write_coef_idx(codec, 0x25, 0x00);
4094 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4095 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4096
4097 for (seq = dac_init; seq->value_0x23; seq++)
4098 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4099}
4100
David Henningssond240d1d2013-04-15 12:50:02 +02004101static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4102 const struct hda_fixup *fix, int action)
4103{
4104 struct alc_spec *spec = codec->spec;
4105 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4106 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4107 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4108 }
4109}
4110
Takashi Iwai766538a2020-06-18 13:08:41 +02004111static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4112 bool polarity, bool on)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004113{
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004114 unsigned int pinval;
4115
Takashi Iwai766538a2020-06-18 13:08:41 +02004116 if (!pin)
4117 return;
4118 if (polarity)
4119 on = !on;
4120 pinval = snd_hda_codec_get_pin_target(codec, pin);
Takashi Iwai415d5552014-04-03 11:51:21 +02004121 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwai766538a2020-06-18 13:08:41 +02004122 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4123 /* temporarily power up/down for setting VREF */
4124 snd_hda_power_up_pm(codec);
4125 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4126 snd_hda_power_down_pm(codec);
4127}
Takashi Iwai1d045db2011-07-07 18:23:21 +02004128
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004129/* update mute-LED according to the speaker mute state via mic VREF pin */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004130static int vref_mute_led_set(struct led_classdev *led_cdev,
4131 enum led_brightness brightness)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004132{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004133 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004134 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004135
Takashi Iwai766538a2020-06-18 13:08:41 +02004136 alc_update_vref_led(codec, spec->mute_led_nid,
4137 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004138 return 0;
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004139}
4140
David Henningssond5b6b652013-11-06 10:50:44 +01004141/* Make sure the led works even in runtime suspend */
4142static unsigned int led_power_filter(struct hda_codec *codec,
4143 hda_nid_t nid,
4144 unsigned int power_state)
4145{
4146 struct alc_spec *spec = codec->spec;
4147
Hui Wang50dd9052014-07-08 17:56:15 +08004148 if (power_state != AC_PWRST_D3 || nid == 0 ||
4149 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01004150 return power_state;
4151
4152 /* Set pin ctl again, it might have just been set to 0 */
4153 snd_hda_set_pin_ctl(codec, nid,
4154 snd_hda_codec_get_pin_target(codec, nid));
4155
Takashi Iwaicffd3962015-04-09 10:30:25 +02004156 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01004157}
4158
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004159static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4160 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004161{
4162 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004163 const struct dmi_device *dev = NULL;
4164
4165 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4166 return;
4167
4168 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4169 int pol, pin;
4170 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4171 continue;
4172 if (pin < 0x0a || pin >= 0x10)
4173 break;
4174 spec->mute_led_polarity = pol;
4175 spec->mute_led_nid = pin - 0x0a + 0x18;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004176 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004177 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01004178 codec_dbg(codec,
4179 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004180 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004181 break;
4182 }
4183}
4184
Takashi Iwai85c467d2018-05-29 11:38:38 +02004185static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4186 const struct hda_fixup *fix,
4187 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01004188{
4189 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004190
David Henningssond06ac142013-02-18 11:41:55 +01004191 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4192 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004193 spec->mute_led_nid = pin;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004194 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004195 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01004196 }
4197}
4198
Takashi Iwai85c467d2018-05-29 11:38:38 +02004199static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4200 const struct hda_fixup *fix, int action)
4201{
4202 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4203}
4204
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004205static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4206 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004207{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004208 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004209}
4210
Tom Briden7f783bd2017-03-25 10:12:01 +00004211static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4212 const struct hda_fixup *fix, int action)
4213{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004214 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00004215}
4216
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004217/* update LED status via GPIO */
4218static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004219 int polarity, bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004220{
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004221 if (polarity)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004222 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02004223 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004224}
4225
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004226/* turn on/off mute LED via GPIO per vmaster hook */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004227static int gpio_mute_led_set(struct led_classdev *led_cdev,
4228 enum led_brightness brightness)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004229{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004230 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004231 struct alc_spec *spec = codec->spec;
4232
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004233 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004234 spec->mute_led_polarity, !brightness);
4235 return 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004236}
4237
4238/* turn on/off mic-mute LED via GPIO per capture hook */
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004239static int micmute_led_set(struct led_classdev *led_cdev,
4240 enum led_brightness brightness)
4241{
4242 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4243 struct alc_spec *spec = codec->spec;
4244
4245 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
Hui Wang40469062020-08-11 20:24:30 +08004246 spec->micmute_led_polarity, !brightness);
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004247 return 0;
4248}
4249
Takashi Iwai01e4a272018-06-19 22:47:30 +02004250/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4251static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4252 int action,
4253 unsigned int mute_mask,
4254 unsigned int micmute_mask)
4255{
4256 struct alc_spec *spec = codec->spec;
4257
4258 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4259
4260 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4261 return;
4262 if (mute_mask) {
4263 spec->gpio_mute_led_mask = mute_mask;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004264 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004265 }
4266 if (micmute_mask) {
4267 spec->gpio_mic_led_mask = micmute_mask;
Takashi Iwai7cdf8c42020-06-18 13:08:31 +02004268 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004269 }
4270}
4271
Jeremy Szue7d66cf2021-03-16 15:46:24 +08004272static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4273 const struct hda_fixup *fix, int action)
4274{
4275 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4276}
4277
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004278static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4279 const struct hda_fixup *fix, int action)
4280{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004281 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004282}
4283
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004284static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4285 const struct hda_fixup *fix, int action)
4286{
Kai-Heng Feng3e0650a2020-04-30 16:32:52 +08004287 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004288}
4289
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004290static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4291 const struct hda_fixup *fix, int action)
4292{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004293 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004294}
4295
Kailang Yanga0ccbc52020-11-06 15:20:38 +08004296static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4297 const struct hda_fixup *fix, int action)
4298{
4299 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4300}
4301
Takashi Iwai8a503552020-06-18 13:08:32 +02004302/* turn on/off mic-mute LED per capture hook via VREF change */
4303static int vref_micmute_led_set(struct led_classdev *led_cdev,
4304 enum led_brightness brightness)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004305{
Takashi Iwai8a503552020-06-18 13:08:32 +02004306 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004307 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004308
Takashi Iwai766538a2020-06-18 13:08:41 +02004309 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4310 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004311 return 0;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004312}
4313
4314static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4315 const struct hda_fixup *fix, int action)
4316{
4317 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004318
Takashi Iwai01e4a272018-06-19 22:47:30 +02004319 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004320 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02004321 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4322 * enable headphone amp
4323 */
4324 spec->gpio_mask |= 0x10;
4325 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004326 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004327 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Hui Wang50dd9052014-07-08 17:56:15 +08004328 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004329 }
4330}
4331
David Henningsson7a5255f2014-10-30 08:26:01 +01004332static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4333 const struct hda_fixup *fix, int action)
4334{
David Henningsson7a5255f2014-10-30 08:26:01 +01004335 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01004336
Takashi Iwai01e4a272018-06-19 22:47:30 +02004337 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01004338 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01004339 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004340 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
David Henningsson7a5255f2014-10-30 08:26:01 +01004341 codec->power_filter = led_power_filter;
4342 }
4343}
4344
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01004345/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4346 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4347 */
4348static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4349 const struct hda_fixup *fix, int action)
4350{
4351 struct alc_spec *spec = codec->spec;
4352
4353 switch (action) {
4354 case HDA_FIXUP_ACT_PRE_PROBE:
4355 spec->gpio_mask |= 0x01;
4356 spec->gpio_dir |= 0x01;
4357 break;
4358 case HDA_FIXUP_ACT_INIT:
4359 /* need to toggle GPIO to enable the amp */
4360 alc_update_gpio_data(codec, 0x01, true);
4361 msleep(100);
4362 alc_update_gpio_data(codec, 0x01, false);
4363 break;
4364 }
4365}
4366
Takashi Iwai622464c2021-05-04 11:18:02 +02004367/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4368static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4369 struct hda_codec *codec,
4370 struct snd_pcm_substream *substream,
4371 int action)
4372{
4373 switch (action) {
4374 case HDA_GEN_PCM_ACT_PREPARE:
4375 alc_update_gpio_data(codec, 0x04, true);
4376 break;
4377 case HDA_GEN_PCM_ACT_CLEANUP:
4378 alc_update_gpio_data(codec, 0x04, false);
4379 break;
4380 }
4381}
4382
4383static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4384 const struct hda_fixup *fix,
4385 int action)
4386{
4387 struct alc_spec *spec = codec->spec;
4388
4389 if (action == HDA_FIXUP_ACT_PROBE) {
4390 spec->gpio_mask |= 0x04;
4391 spec->gpio_dir |= 0x04;
4392 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4393 }
4394}
4395
Takashi Iwai766538a2020-06-18 13:08:41 +02004396static void alc_update_coef_led(struct hda_codec *codec,
4397 struct alc_coef_led *led,
4398 bool polarity, bool on)
Kailang Yang431e76c2020-04-07 14:40:20 +08004399{
Takashi Iwai766538a2020-06-18 13:08:41 +02004400 if (polarity)
4401 on = !on;
4402 /* temporarily power up/down for setting COEF bit */
4403 alc_update_coef_idx(codec, led->idx, led->mask,
4404 on ? led->on : led->off);
4405}
4406
Kailang Yang431e76c2020-04-07 14:40:20 +08004407/* update mute-LED according to the speaker mute state via COEF bit */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004408static int coef_mute_led_set(struct led_classdev *led_cdev,
4409 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004410{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004411 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004412 struct alc_spec *spec = codec->spec;
4413
Takashi Iwai766538a2020-06-18 13:08:41 +02004414 alc_update_coef_led(codec, &spec->mute_led_coef,
4415 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004416 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004417}
4418
4419static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4420 const struct hda_fixup *fix,
4421 int action)
4422{
4423 struct alc_spec *spec = codec->spec;
4424
4425 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4426 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004427 spec->mute_led_coef.idx = 0x0b;
4428 spec->mute_led_coef.mask = 1 << 3;
4429 spec->mute_led_coef.on = 1 << 3;
4430 spec->mute_led_coef.off = 0;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004431 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004432 }
4433}
4434
Kailang Yang24164f42020-04-07 14:52:42 +08004435static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4436 const struct hda_fixup *fix,
4437 int action)
4438{
4439 struct alc_spec *spec = codec->spec;
4440
4441 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4442 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004443 spec->mute_led_coef.idx = 0x34;
4444 spec->mute_led_coef.mask = 1 << 5;
4445 spec->mute_led_coef.on = 0;
4446 spec->mute_led_coef.off = 1 << 5;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004447 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004448 }
4449}
4450
Kailang Yang431e76c2020-04-07 14:40:20 +08004451/* turn on/off mic-mute LED per capture hook by coef bit */
Takashi Iwai8a503552020-06-18 13:08:32 +02004452static int coef_micmute_led_set(struct led_classdev *led_cdev,
4453 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004454{
Takashi Iwai8a503552020-06-18 13:08:32 +02004455 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004456 struct alc_spec *spec = codec->spec;
4457
Takashi Iwai766538a2020-06-18 13:08:41 +02004458 alc_update_coef_led(codec, &spec->mic_led_coef,
4459 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004460 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004461}
4462
4463static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4464 const struct hda_fixup *fix, int action)
4465{
4466 struct alc_spec *spec = codec->spec;
4467
4468 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004469 spec->mic_led_coef.idx = 0x19;
4470 spec->mic_led_coef.mask = 1 << 13;
4471 spec->mic_led_coef.on = 1 << 13;
4472 spec->mic_led_coef.off = 0;
Takashi Iwai8a503552020-06-18 13:08:32 +02004473 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004474 }
4475}
4476
Kailang Yang24164f42020-04-07 14:52:42 +08004477static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4478 const struct hda_fixup *fix, int action)
4479{
4480 struct alc_spec *spec = codec->spec;
4481
4482 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004483 spec->mic_led_coef.idx = 0x35;
4484 spec->mic_led_coef.mask = 3 << 2;
4485 spec->mic_led_coef.on = 2 << 2;
4486 spec->mic_led_coef.off = 1 << 2;
Takashi Iwai8a503552020-06-18 13:08:32 +02004487 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004488 }
4489}
4490
Kailang Yang431e76c2020-04-07 14:40:20 +08004491static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4492 const struct hda_fixup *fix, int action)
4493{
4494 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4495 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4496}
4497
Kailang Yang24164f42020-04-07 14:52:42 +08004498static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4499 const struct hda_fixup *fix, int action)
4500{
4501 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4502 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4503}
4504
Jonas Witschel75b62ab2021-04-16 12:58:54 +02004505static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4506 const struct hda_fixup *fix, int action)
4507{
4508 struct alc_spec *spec = codec->spec;
4509
4510 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4511 spec->cap_mute_led_nid = 0x1a;
4512 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4513 codec->power_filter = led_power_filter;
4514 }
4515}
4516
4517static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4518 const struct hda_fixup *fix, int action)
4519{
4520 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4521 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4522}
4523
Takashi Iwai6a30aba2018-04-27 17:17:35 +02004524#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01004525static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4526 struct hda_jack_callback *event)
4527{
4528 struct alc_spec *spec = codec->spec;
4529
4530 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4531 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08004532 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01004533 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08004534 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01004535 input_sync(spec->kb_dev);
4536}
David Henningsson33f4acd2015-01-07 15:50:13 +01004537
Kailang3694cb22015-12-28 11:35:24 +08004538static int alc_register_micmute_input_device(struct hda_codec *codec)
4539{
4540 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08004541 int i;
Kailang3694cb22015-12-28 11:35:24 +08004542
4543 spec->kb_dev = input_allocate_device();
4544 if (!spec->kb_dev) {
4545 codec_err(codec, "Out of memory (input_allocate_device)\n");
4546 return -ENOMEM;
4547 }
Hui Wangc7b60a82015-12-28 11:35:25 +08004548
4549 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4550
Kailang3694cb22015-12-28 11:35:24 +08004551 spec->kb_dev->name = "Microphone Mute Button";
4552 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08004553 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4554 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4555 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4556 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4557 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08004558
4559 if (input_register_device(spec->kb_dev)) {
4560 codec_err(codec, "input_register_device failed\n");
4561 input_free_device(spec->kb_dev);
4562 spec->kb_dev = NULL;
4563 return -ENOMEM;
4564 }
4565
4566 return 0;
4567}
4568
Takashi Iwai01e4a272018-06-19 22:47:30 +02004569/* GPIO1 = set according to SKU external amp
4570 * GPIO2 = mic mute hotkey
4571 * GPIO3 = mute LED
4572 * GPIO4 = mic mute LED
4573 */
David Henningsson33f4acd2015-01-07 15:50:13 +01004574static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4575 const struct hda_fixup *fix, int action)
4576{
David Henningsson33f4acd2015-01-07 15:50:13 +01004577 struct alc_spec *spec = codec->spec;
4578
Takashi Iwai01e4a272018-06-19 22:47:30 +02004579 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01004580 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004581 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004582 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01004583 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01004584
Takashi Iwai01e4a272018-06-19 22:47:30 +02004585 spec->gpio_mask |= 0x06;
4586 spec->gpio_dir |= 0x02;
4587 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01004588 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01004589 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01004590 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01004591 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01004592 return;
4593 }
4594
4595 if (!spec->kb_dev)
4596 return;
4597
4598 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01004599 case HDA_FIXUP_ACT_FREE:
4600 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01004601 spec->kb_dev = NULL;
4602 }
David Henningsson33f4acd2015-01-07 15:50:13 +01004603}
4604
Takashi Iwai01e4a272018-06-19 22:47:30 +02004605/* Line2 = mic mute hotkey
4606 * GPIO2 = mic mute LED
4607 */
Kailang3694cb22015-12-28 11:35:24 +08004608static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4609 const struct hda_fixup *fix, int action)
4610{
Kailang3694cb22015-12-28 11:35:24 +08004611 struct alc_spec *spec = codec->spec;
4612
Takashi Iwai01e4a272018-06-19 22:47:30 +02004613 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08004614 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004615 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004616 if (alc_register_micmute_input_device(codec) != 0)
4617 return;
4618
Kailang3694cb22015-12-28 11:35:24 +08004619 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4620 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08004621 return;
4622 }
4623
4624 if (!spec->kb_dev)
4625 return;
4626
4627 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08004628 case HDA_FIXUP_ACT_FREE:
4629 input_unregister_device(spec->kb_dev);
4630 spec->kb_dev = NULL;
4631 }
4632}
Takashi Iwaic4696522018-01-15 10:44:35 +01004633#else /* INPUT */
4634#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4635#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4636#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004637
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004638static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4639 const struct hda_fixup *fix, int action)
4640{
4641 struct alc_spec *spec = codec->spec;
4642
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004643 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004644 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004645 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004646 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004647 }
4648}
4649
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004650static const struct coef_fw alc225_pre_hsmode[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004651 UPDATE_COEF(0x4a, 1<<8, 0),
4652 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4653 UPDATE_COEF(0x63, 3<<14, 3<<14),
4654 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4655 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4656 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4657 UPDATE_COEF(0x4a, 3<<10, 0),
4658 {}
4659};
4660
David Henningsson73bdd592013-04-15 15:44:14 +02004661static void alc_headset_mode_unplugged(struct hda_codec *codec)
4662{
Kailang Yang92666d42020-11-19 17:04:21 +08004663 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004664 static const struct coef_fw coef0255[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004665 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02004666 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4667 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4668 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4669 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4670 {}
4671 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004672 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004673 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
Kailang Yang717f43d2019-05-31 17:16:53 +08004674 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4675 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4676 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4677 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
Kailang Yange69e7e02016-05-30 15:58:28 +08004678 {}
4679 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004680 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004681 WRITE_COEF(0x1b, 0x0c0b),
4682 WRITE_COEF(0x45, 0xc429),
4683 UPDATE_COEF(0x35, 0x4000, 0),
4684 WRITE_COEF(0x06, 0x2104),
4685 WRITE_COEF(0x1a, 0x0001),
4686 WRITE_COEF(0x26, 0x0004),
4687 WRITE_COEF(0x32, 0x42a3),
4688 {}
4689 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004690 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004691 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4692 UPDATE_COEF(0x50, 0x2000, 0x2000),
4693 UPDATE_COEF(0x56, 0x0006, 0x0006),
4694 UPDATE_COEF(0x66, 0x0008, 0),
4695 UPDATE_COEF(0x67, 0x2000, 0),
4696 {}
4697 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004698 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004699 UPDATE_COEF(0x19, 0x1300, 0x0300),
4700 {}
4701 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004702 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004703 WRITE_COEF(0x76, 0x000e),
4704 WRITE_COEF(0x6c, 0x2400),
4705 WRITE_COEF(0x18, 0x7308),
4706 WRITE_COEF(0x6b, 0xc429),
4707 {}
4708 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004709 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004710 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4711 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4712 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4713 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4714 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4715 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4716 {}
4717 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004718 static const struct coef_fw coef0668[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004719 WRITE_COEF(0x15, 0x0d40),
4720 WRITE_COEF(0xb7, 0x802b),
4721 {}
4722 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004723 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004724 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004725 {}
4726 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004727 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004728 UPDATE_COEF(0x4a, 0x0100, 0),
4729 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4730 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4731 UPDATE_COEF(0x4a, 0x0010, 0),
4732 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4733 WRITE_COEF(0x45, 0x5289),
4734 UPDATE_COEF(0x4a, 0x0c00, 0),
4735 {}
4736 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004737
Kailang Yang92666d42020-11-19 17:04:21 +08004738 if (spec->no_internal_mic_pin) {
4739 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4740 return;
4741 }
4742
Takashi Iwai7639a062015-03-03 10:07:24 +01004743 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004744 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004745 alc_process_coef_fw(codec, coef0255);
4746 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004747 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004748 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004749 alc_process_coef_fw(codec, coef0256);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004750 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004751 case 0x10ec0234:
4752 case 0x10ec0274:
4753 case 0x10ec0294:
4754 alc_process_coef_fw(codec, coef0274);
4755 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004756 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004757 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004758 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004759 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004760 case 0x10ec0286:
4761 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004762 alc_process_coef_fw(codec, coef0288);
4763 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004764 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004765 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004766 alc_process_coef_fw(codec, coef0288);
4767 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004768 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004769 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004770 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004771 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004772 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004773 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004774 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004775 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004776 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004777 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004778 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004779 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004780 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004781 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004782 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004783 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004784 alc_process_coef_fw(codec, coef0225);
4785 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004786 case 0x10ec0867:
4787 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4788 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004789 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004790 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004791}
4792
4793
4794static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4795 hda_nid_t mic_pin)
4796{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004797 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004798 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4799 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4800 {}
4801 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004802 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004803 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4804 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4805 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4806 {}
4807 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004808 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004809 UPDATE_COEF(0x35, 0, 1<<14),
4810 WRITE_COEF(0x06, 0x2100),
4811 WRITE_COEF(0x1a, 0x0021),
4812 WRITE_COEF(0x26, 0x008c),
4813 {}
4814 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004815 static const struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004816 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004817 UPDATE_COEF(0x50, 0x2000, 0),
4818 UPDATE_COEF(0x56, 0x0006, 0),
4819 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4820 UPDATE_COEF(0x66, 0x0008, 0x0008),
4821 UPDATE_COEF(0x67, 0x2000, 0x2000),
4822 {}
4823 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004824 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004825 WRITE_COEF(0x19, 0xa208),
4826 WRITE_COEF(0x2e, 0xacf0),
4827 {}
4828 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004829 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004830 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4831 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4832 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4833 {}
4834 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004835 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004836 WRITE_COEF(0xb7, 0x802b),
4837 WRITE_COEF(0xb5, 0x1040),
4838 UPDATE_COEF(0xc3, 0, 1<<12),
4839 {}
4840 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004841 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004842 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4843 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4844 UPDATE_COEF(0x63, 3<<14, 0),
4845 {}
4846 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004847 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004848 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4849 UPDATE_COEF(0x4a, 0x0010, 0),
4850 UPDATE_COEF(0x6b, 0xf000, 0),
4851 {}
4852 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004853
Takashi Iwai7639a062015-03-03 10:07:24 +01004854 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004855 case 0x10ec0255:
4856 alc_write_coef_idx(codec, 0x45, 0xc489);
4857 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004858 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004859 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4860 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08004861 case 0x10ec0236:
4862 case 0x10ec0256:
4863 alc_write_coef_idx(codec, 0x45, 0xc489);
4864 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4865 alc_process_coef_fw(codec, coef0256);
4866 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4867 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004868 case 0x10ec0234:
4869 case 0x10ec0274:
4870 case 0x10ec0294:
4871 alc_write_coef_idx(codec, 0x45, 0x4689);
4872 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4873 alc_process_coef_fw(codec, coef0274);
4874 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4875 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004876 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004877 case 0x10ec0283:
4878 alc_write_coef_idx(codec, 0x45, 0xc429);
4879 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004880 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004881 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4882 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004883 case 0x10ec0286:
4884 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004885 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004886 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4887 alc_process_coef_fw(codec, coef0288);
4888 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4889 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004890 case 0x10ec0292:
4891 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004892 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004893 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004894 case 0x10ec0293:
4895 /* Set to TRS mode */
4896 alc_write_coef_idx(codec, 0x45, 0xc429);
4897 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004898 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004899 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4900 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004901 case 0x10ec0867:
4902 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -05004903 fallthrough;
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004904 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004905 case 0x10ec0662:
4906 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4907 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4908 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004909 case 0x10ec0668:
4910 alc_write_coef_idx(codec, 0x11, 0x0001);
4911 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004912 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004913 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4914 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004915 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004916 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004917 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004918 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004919 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004920 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004921 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004922 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4923 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4924 alc_process_coef_fw(codec, coef0225);
4925 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4926 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004927 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004928 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004929}
4930
4931static void alc_headset_mode_default(struct hda_codec *codec)
4932{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004933 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004934 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4935 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4936 UPDATE_COEF(0x49, 3<<8, 0<<8),
4937 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4938 UPDATE_COEF(0x63, 3<<14, 0),
4939 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01004940 {}
4941 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004942 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004943 WRITE_COEF(0x45, 0xc089),
4944 WRITE_COEF(0x45, 0xc489),
4945 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4946 WRITE_COEF(0x49, 0x0049),
4947 {}
4948 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004949 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004950 WRITE_COEF(0x45, 0xc489),
4951 WRITE_COEFEX(0x57, 0x03, 0x0da3),
4952 WRITE_COEF(0x49, 0x0049),
4953 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4954 WRITE_COEF(0x06, 0x6100),
4955 {}
4956 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004957 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004958 WRITE_COEF(0x06, 0x2100),
4959 WRITE_COEF(0x32, 0x4ea3),
4960 {}
4961 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004962 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004963 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4964 UPDATE_COEF(0x50, 0x2000, 0x2000),
4965 UPDATE_COEF(0x56, 0x0006, 0x0006),
4966 UPDATE_COEF(0x66, 0x0008, 0),
4967 UPDATE_COEF(0x67, 0x2000, 0),
4968 {}
4969 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004970 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004971 WRITE_COEF(0x76, 0x000e),
4972 WRITE_COEF(0x6c, 0x2400),
4973 WRITE_COEF(0x6b, 0xc429),
4974 WRITE_COEF(0x18, 0x7308),
4975 {}
4976 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004977 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004978 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4979 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4980 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4981 {}
4982 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004983 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004984 WRITE_COEF(0x11, 0x0041),
4985 WRITE_COEF(0x15, 0x0d40),
4986 WRITE_COEF(0xb7, 0x802b),
4987 {}
4988 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004989 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004990 WRITE_COEF(0x45, 0x4289),
4991 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4992 UPDATE_COEF(0x6b, 0x0f00, 0),
4993 UPDATE_COEF(0x49, 0x0300, 0x0300),
4994 {}
4995 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004996
Takashi Iwai7639a062015-03-03 10:07:24 +01004997 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08004998 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01004999 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005000 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005001 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005002 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005003 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005004 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01005005 alc_process_coef_fw(codec, coef0225);
5006 break;
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005007 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005008 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005009 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08005010 case 0x10ec0236:
5011 case 0x10ec0256:
5012 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5013 alc_write_coef_idx(codec, 0x45, 0xc089);
5014 msleep(50);
5015 alc_process_coef_fw(codec, coef0256);
5016 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005017 case 0x10ec0234:
5018 case 0x10ec0274:
5019 case 0x10ec0294:
5020 alc_process_coef_fw(codec, coef0274);
5021 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005022 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005023 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005024 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005025 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005026 case 0x10ec0286:
5027 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005028 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08005029 alc_process_coef_fw(codec, coef0288);
5030 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005031 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005032 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005033 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005034 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005035 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005036 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005037 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005038 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005039 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005040 case 0x10ec0867:
5041 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5042 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005043 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005044 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005045}
5046
5047/* Iphone type */
5048static void alc_headset_mode_ctia(struct hda_codec *codec)
5049{
Kailang Yang89542932017-07-17 15:03:43 +08005050 int val;
5051
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005052 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005053 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5054 WRITE_COEF(0x1b, 0x0c2b),
5055 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5056 {}
5057 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005058 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005059 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005060 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005061 {}
5062 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005063 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005064 WRITE_COEF(0x45, 0xd429),
5065 WRITE_COEF(0x1b, 0x0c2b),
5066 WRITE_COEF(0x32, 0x4ea3),
5067 {}
5068 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005069 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005070 UPDATE_COEF(0x50, 0x2000, 0x2000),
5071 UPDATE_COEF(0x56, 0x0006, 0x0006),
5072 UPDATE_COEF(0x66, 0x0008, 0),
5073 UPDATE_COEF(0x67, 0x2000, 0),
5074 {}
5075 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005076 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005077 WRITE_COEF(0x6b, 0xd429),
5078 WRITE_COEF(0x76, 0x0008),
5079 WRITE_COEF(0x18, 0x7388),
5080 {}
5081 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005082 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005083 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5084 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5085 {}
5086 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005087 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005088 WRITE_COEF(0x11, 0x0001),
5089 WRITE_COEF(0x15, 0x0d60),
5090 WRITE_COEF(0xc3, 0x0000),
5091 {}
5092 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005093 static const struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005094 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005095 UPDATE_COEF(0x63, 3<<14, 2<<14),
5096 {}
5097 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005098 static const struct coef_fw coef0225_2[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08005099 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5100 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005101 {}
5102 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005103
Takashi Iwai7639a062015-03-03 10:07:24 +01005104 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005105 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005106 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005107 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005108 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005109 case 0x10ec0256:
5110 alc_process_coef_fw(codec, coef0256);
5111 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005112 case 0x10ec0234:
5113 case 0x10ec0274:
5114 case 0x10ec0294:
5115 alc_write_coef_idx(codec, 0x45, 0xd689);
5116 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005117 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005118 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005119 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005120 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005121 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005122 val = alc_read_coef_idx(codec, 0x50);
5123 if (val & (1 << 12)) {
5124 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5125 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5126 msleep(300);
5127 } else {
5128 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5129 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5130 msleep(300);
5131 }
5132 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005133 case 0x10ec0286:
5134 case 0x10ec0288:
5135 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5136 msleep(300);
5137 alc_process_coef_fw(codec, coef0288);
5138 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005139 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005140 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005141 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005142 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005143 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005144 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005145 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005146 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005147 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005148 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005149 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005150 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005151 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005152 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005153 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005154 val = alc_read_coef_idx(codec, 0x45);
5155 if (val & (1 << 9))
5156 alc_process_coef_fw(codec, coef0225_2);
5157 else
5158 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005159 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005160 case 0x10ec0867:
5161 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5162 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005163 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005164 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005165}
5166
5167/* Nokia type */
5168static void alc_headset_mode_omtp(struct hda_codec *codec)
5169{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005170 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005171 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5172 WRITE_COEF(0x1b, 0x0c2b),
5173 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5174 {}
5175 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005176 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005177 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005178 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005179 {}
5180 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005181 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005182 WRITE_COEF(0x45, 0xe429),
5183 WRITE_COEF(0x1b, 0x0c2b),
5184 WRITE_COEF(0x32, 0x4ea3),
5185 {}
5186 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005187 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005188 UPDATE_COEF(0x50, 0x2000, 0x2000),
5189 UPDATE_COEF(0x56, 0x0006, 0x0006),
5190 UPDATE_COEF(0x66, 0x0008, 0),
5191 UPDATE_COEF(0x67, 0x2000, 0),
5192 {}
5193 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005194 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005195 WRITE_COEF(0x6b, 0xe429),
5196 WRITE_COEF(0x76, 0x0008),
5197 WRITE_COEF(0x18, 0x7388),
5198 {}
5199 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005200 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005201 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5202 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5203 {}
5204 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005205 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005206 WRITE_COEF(0x11, 0x0001),
5207 WRITE_COEF(0x15, 0x0d50),
5208 WRITE_COEF(0xc3, 0x0000),
5209 {}
5210 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005211 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005212 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005213 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005214 {}
5215 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005216
Takashi Iwai7639a062015-03-03 10:07:24 +01005217 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005218 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005219 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005220 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005221 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005222 case 0x10ec0256:
5223 alc_process_coef_fw(codec, coef0256);
5224 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005225 case 0x10ec0234:
5226 case 0x10ec0274:
5227 case 0x10ec0294:
5228 alc_write_coef_idx(codec, 0x45, 0xe689);
5229 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005230 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005231 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005232 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005233 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005234 case 0x10ec0298:
5235 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08005236 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5237 msleep(300);
5238 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005239 case 0x10ec0286:
5240 case 0x10ec0288:
5241 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5242 msleep(300);
5243 alc_process_coef_fw(codec, coef0288);
5244 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005245 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005246 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005247 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005248 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005249 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005250 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005251 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005252 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005253 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005254 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005255 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005256 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005257 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005258 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005259 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005260 alc_process_coef_fw(codec, coef0225);
5261 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005262 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005263 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005264}
5265
5266static void alc_determine_headset_type(struct hda_codec *codec)
5267{
5268 int val;
5269 bool is_ctia = false;
5270 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005271 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005272 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5273 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5274 conteol) */
5275 {}
5276 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005277 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005278 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5279 {}
5280 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005281 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08005282 UPDATE_COEF(0x50, 0x2000, 0x2000),
5283 UPDATE_COEF(0x56, 0x0006, 0x0006),
5284 UPDATE_COEF(0x66, 0x0008, 0),
5285 UPDATE_COEF(0x67, 0x2000, 0),
5286 UPDATE_COEF(0x19, 0x1300, 0x1300),
5287 {}
5288 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005289 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005290 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5291 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5292 {}
5293 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005294 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005295 WRITE_COEF(0x11, 0x0001),
5296 WRITE_COEF(0xb7, 0x802b),
5297 WRITE_COEF(0x15, 0x0d60),
5298 WRITE_COEF(0xc3, 0x0c00),
5299 {}
5300 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005301 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005302 UPDATE_COEF(0x4a, 0x0010, 0),
5303 UPDATE_COEF(0x4a, 0x8000, 0),
5304 WRITE_COEF(0x45, 0xd289),
5305 UPDATE_COEF(0x49, 0x0300, 0x0300),
5306 {}
5307 };
David Henningsson73bdd592013-04-15 15:44:14 +02005308
Kailang Yang92666d42020-11-19 17:04:21 +08005309 if (spec->no_internal_mic_pin) {
5310 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5311 return;
5312 }
5313
Takashi Iwai7639a062015-03-03 10:07:24 +01005314 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005315 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005316 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005317 msleep(300);
5318 val = alc_read_coef_idx(codec, 0x46);
5319 is_ctia = (val & 0x0070) == 0x0070;
5320 break;
Kailang Yang717f43d2019-05-31 17:16:53 +08005321 case 0x10ec0236:
5322 case 0x10ec0256:
5323 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5324 alc_write_coef_idx(codec, 0x06, 0x6104);
5325 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5326
5327 snd_hda_codec_write(codec, 0x21, 0,
5328 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5329 msleep(80);
5330 snd_hda_codec_write(codec, 0x21, 0,
5331 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5332
5333 alc_process_coef_fw(codec, coef0255);
5334 msleep(300);
5335 val = alc_read_coef_idx(codec, 0x46);
5336 is_ctia = (val & 0x0070) == 0x0070;
5337
5338 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5339 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5340
5341 snd_hda_codec_write(codec, 0x21, 0,
5342 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5343 msleep(80);
5344 snd_hda_codec_write(codec, 0x21, 0,
5345 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5346 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005347 case 0x10ec0234:
5348 case 0x10ec0274:
5349 case 0x10ec0294:
5350 alc_process_coef_fw(codec, coef0274);
Hui Wangfebf22562021-03-20 17:15:41 +08005351 msleep(850);
Kailang Yang71683c32017-06-20 16:33:50 +08005352 val = alc_read_coef_idx(codec, 0x46);
5353 is_ctia = (val & 0x00f0) == 0x00f0;
5354 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005355 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005356 case 0x10ec0283:
5357 alc_write_coef_idx(codec, 0x45, 0xd029);
5358 msleep(300);
5359 val = alc_read_coef_idx(codec, 0x46);
5360 is_ctia = (val & 0x0070) == 0x0070;
5361 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005362 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005363 snd_hda_codec_write(codec, 0x21, 0,
5364 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5365 msleep(100);
5366 snd_hda_codec_write(codec, 0x21, 0,
5367 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5368 msleep(200);
5369
5370 val = alc_read_coef_idx(codec, 0x50);
5371 if (val & (1 << 12)) {
5372 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5373 alc_process_coef_fw(codec, coef0288);
5374 msleep(350);
5375 val = alc_read_coef_idx(codec, 0x50);
5376 is_ctia = (val & 0x0070) == 0x0070;
5377 } else {
5378 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5379 alc_process_coef_fw(codec, coef0288);
5380 msleep(350);
5381 val = alc_read_coef_idx(codec, 0x50);
5382 is_ctia = (val & 0x0070) == 0x0070;
5383 }
5384 alc_process_coef_fw(codec, coef0298);
5385 snd_hda_codec_write(codec, 0x21, 0,
5386 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5387 msleep(75);
5388 snd_hda_codec_write(codec, 0x21, 0,
5389 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5390 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005391 case 0x10ec0286:
5392 case 0x10ec0288:
5393 alc_process_coef_fw(codec, coef0288);
5394 msleep(350);
5395 val = alc_read_coef_idx(codec, 0x50);
5396 is_ctia = (val & 0x0070) == 0x0070;
5397 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005398 case 0x10ec0292:
5399 alc_write_coef_idx(codec, 0x6b, 0xd429);
5400 msleep(300);
5401 val = alc_read_coef_idx(codec, 0x6c);
5402 is_ctia = (val & 0x001c) == 0x001c;
5403 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005404 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005405 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005406 msleep(300);
5407 val = alc_read_coef_idx(codec, 0x46);
5408 is_ctia = (val & 0x0070) == 0x0070;
5409 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005410 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005411 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005412 msleep(300);
5413 val = alc_read_coef_idx(codec, 0xbe);
5414 is_ctia = (val & 0x1c02) == 0x1c02;
5415 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005416 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005417 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005418 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005419 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005420 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005421 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08005422 snd_hda_codec_write(codec, 0x21, 0,
5423 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5424 msleep(80);
5425 snd_hda_codec_write(codec, 0x21, 0,
5426 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5427
Kailang Yang5a367672017-07-21 15:23:53 +08005428 alc_process_coef_fw(codec, alc225_pre_hsmode);
5429 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5430 val = alc_read_coef_idx(codec, 0x45);
5431 if (val & (1 << 9)) {
5432 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5433 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5434 msleep(800);
5435 val = alc_read_coef_idx(codec, 0x46);
5436 is_ctia = (val & 0x00f0) == 0x00f0;
5437 } else {
5438 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5439 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5440 msleep(800);
5441 val = alc_read_coef_idx(codec, 0x46);
5442 is_ctia = (val & 0x00f0) == 0x00f0;
5443 }
5444 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5445 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5446 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08005447
5448 snd_hda_codec_write(codec, 0x21, 0,
5449 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5450 msleep(80);
5451 snd_hda_codec_write(codec, 0x21, 0,
5452 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005453 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005454 case 0x10ec0867:
5455 is_ctia = true;
5456 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005457 }
5458
Takashi Iwai4e76a882014-02-25 12:21:03 +01005459 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02005460 is_ctia ? "yes" : "no");
5461 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5462}
5463
5464static void alc_update_headset_mode(struct hda_codec *codec)
5465{
5466 struct alc_spec *spec = codec->spec;
5467
5468 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
Takashi Iwai35a39f92019-02-01 11:19:50 +01005469 hda_nid_t hp_pin = alc_get_hp_pin(spec);
David Henningsson73bdd592013-04-15 15:44:14 +02005470
5471 int new_headset_mode;
5472
5473 if (!snd_hda_jack_detect(codec, hp_pin))
5474 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5475 else if (mux_pin == spec->headset_mic_pin)
5476 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5477 else if (mux_pin == spec->headphone_mic_pin)
5478 new_headset_mode = ALC_HEADSET_MODE_MIC;
5479 else
5480 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5481
David Henningsson5959a6b2013-11-12 11:10:57 +01005482 if (new_headset_mode == spec->current_headset_mode) {
5483 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005484 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01005485 }
David Henningsson73bdd592013-04-15 15:44:14 +02005486
5487 switch (new_headset_mode) {
5488 case ALC_HEADSET_MODE_UNPLUGGED:
5489 alc_headset_mode_unplugged(codec);
Kailang Yangaeac1a02019-05-16 16:10:44 +08005490 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5491 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02005492 spec->gen.hp_jack_present = false;
5493 break;
5494 case ALC_HEADSET_MODE_HEADSET:
5495 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5496 alc_determine_headset_type(codec);
5497 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5498 alc_headset_mode_ctia(codec);
5499 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5500 alc_headset_mode_omtp(codec);
5501 spec->gen.hp_jack_present = true;
5502 break;
5503 case ALC_HEADSET_MODE_MIC:
5504 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5505 spec->gen.hp_jack_present = false;
5506 break;
5507 case ALC_HEADSET_MODE_HEADPHONE:
5508 alc_headset_mode_default(codec);
5509 spec->gen.hp_jack_present = true;
5510 break;
5511 }
5512 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5513 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5514 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005515 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02005516 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5517 PIN_VREFHIZ);
5518 }
5519 spec->current_headset_mode = new_headset_mode;
5520
5521 snd_hda_gen_update_outputs(codec);
5522}
5523
5524static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01005525 struct snd_kcontrol *kcontrol,
5526 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02005527{
5528 alc_update_headset_mode(codec);
5529}
5530
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005531static void alc_update_headset_jack_cb(struct hda_codec *codec,
5532 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02005533{
David Henningsson73bdd592013-04-15 15:44:14 +02005534 snd_hda_gen_hp_automute(codec, jack);
Hui Wange54f30b2021-03-20 17:15:42 +08005535 alc_update_headset_mode(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005536}
5537
5538static void alc_probe_headset_mode(struct hda_codec *codec)
5539{
5540 int i;
5541 struct alc_spec *spec = codec->spec;
5542 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5543
5544 /* Find mic pins */
5545 for (i = 0; i < cfg->num_inputs; i++) {
5546 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5547 spec->headset_mic_pin = cfg->inputs[i].pin;
5548 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5549 spec->headphone_mic_pin = cfg->inputs[i].pin;
5550 }
5551
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02005552 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02005553 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5554 spec->gen.automute_hook = alc_update_headset_mode;
5555 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5556}
5557
5558static void alc_fixup_headset_mode(struct hda_codec *codec,
5559 const struct hda_fixup *fix, int action)
5560{
5561 struct alc_spec *spec = codec->spec;
5562
5563 switch (action) {
5564 case HDA_FIXUP_ACT_PRE_PROBE:
5565 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5566 break;
5567 case HDA_FIXUP_ACT_PROBE:
5568 alc_probe_headset_mode(codec);
5569 break;
5570 case HDA_FIXUP_ACT_INIT:
Kailang Yangaeac1a02019-05-16 16:10:44 +08005571 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5572 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5573 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5574 }
David Henningsson73bdd592013-04-15 15:44:14 +02005575 alc_update_headset_mode(codec);
5576 break;
5577 }
5578}
5579
5580static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5581 const struct hda_fixup *fix, int action)
5582{
5583 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5584 struct alc_spec *spec = codec->spec;
5585 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5586 }
5587 else
5588 alc_fixup_headset_mode(codec, fix, action);
5589}
5590
Kailang Yang31278992014-03-03 15:27:22 +08005591static void alc255_set_default_jack_type(struct hda_codec *codec)
5592{
5593 /* Set to iphone type */
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005594 static const struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005595 WRITE_COEF(0x1b, 0x880b),
5596 WRITE_COEF(0x45, 0xd089),
5597 WRITE_COEF(0x1b, 0x080b),
5598 WRITE_COEF(0x46, 0x0004),
5599 WRITE_COEF(0x1b, 0x0c0b),
5600 {}
5601 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005602 static const struct coef_fw alc256fw[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005603 WRITE_COEF(0x1b, 0x884b),
5604 WRITE_COEF(0x45, 0xd089),
5605 WRITE_COEF(0x1b, 0x084b),
5606 WRITE_COEF(0x46, 0x0004),
5607 WRITE_COEF(0x1b, 0x0c4b),
5608 {}
5609 };
5610 switch (codec->core.vendor_id) {
5611 case 0x10ec0255:
5612 alc_process_coef_fw(codec, alc255fw);
5613 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08005614 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005615 case 0x10ec0256:
5616 alc_process_coef_fw(codec, alc256fw);
5617 break;
5618 }
Kailang Yang31278992014-03-03 15:27:22 +08005619 msleep(30);
5620}
5621
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005622static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5623 const struct hda_fixup *fix, int action)
5624{
5625 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08005626 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005627 }
5628 alc_fixup_headset_mode(codec, fix, action);
5629}
5630
Kailang Yang31278992014-03-03 15:27:22 +08005631static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5632 const struct hda_fixup *fix, int action)
5633{
5634 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5635 struct alc_spec *spec = codec->spec;
5636 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5637 alc255_set_default_jack_type(codec);
5638 }
5639 else
5640 alc_fixup_headset_mode(codec, fix, action);
5641}
5642
Kailang Yange1e62b92015-04-08 16:01:22 +08005643static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5644 struct hda_jack_callback *jack)
5645{
5646 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08005647
5648 alc_update_headset_jack_cb(codec, jack);
5649 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02005650 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08005651}
5652
5653static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5654 const struct hda_fixup *fix, int action)
5655{
5656 alc_fixup_headset_mode(codec, fix, action);
5657 if (action == HDA_FIXUP_ACT_PROBE) {
5658 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02005659 /* toggled via hp_automute_hook */
5660 spec->gpio_mask |= 0x40;
5661 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08005662 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5663 }
5664}
5665
Hui Wang493a52a2014-01-14 14:07:36 +08005666static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5667 const struct hda_fixup *fix, int action)
5668{
5669 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5670 struct alc_spec *spec = codec->spec;
5671 spec->gen.auto_mute_via_amp = 1;
5672 }
5673}
5674
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005675static void alc_fixup_no_shutup(struct hda_codec *codec,
5676 const struct hda_fixup *fix, int action)
5677{
Takashi Iwaiefe55732018-06-15 11:55:02 +02005678 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005679 struct alc_spec *spec = codec->spec;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01005680 spec->no_shutup_pins = 1;
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005681 }
5682}
5683
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005684static void alc_fixup_disable_aamix(struct hda_codec *codec,
5685 const struct hda_fixup *fix, int action)
5686{
5687 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5688 struct alc_spec *spec = codec->spec;
5689 /* Disable AA-loopback as it causes white noise */
5690 spec->gen.mixer_nid = 0;
5691 }
5692}
5693
Takashi Iwai7f57d802015-09-24 17:36:51 +02005694/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5695static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5696 const struct hda_fixup *fix, int action)
5697{
5698 static const struct hda_pintbl pincfgs[] = {
5699 { 0x16, 0x21211010 }, /* dock headphone */
5700 { 0x19, 0x21a11010 }, /* dock mic */
5701 { }
5702 };
5703 struct alc_spec *spec = codec->spec;
5704
5705 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Hui Wang871b9062019-08-14 12:09:08 +08005706 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
Takashi Iwai7f57d802015-09-24 17:36:51 +02005707 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5708 codec->power_save_node = 0; /* avoid click noises */
5709 snd_hda_apply_pincfgs(codec, pincfgs);
5710 }
5711}
5712
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005713static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5714 const struct hda_fixup *fix, int action)
5715{
5716 static const struct hda_pintbl pincfgs[] = {
5717 { 0x17, 0x21211010 }, /* dock headphone */
5718 { 0x19, 0x21a11010 }, /* dock mic */
5719 { }
5720 };
5721 struct alc_spec *spec = codec->spec;
5722
5723 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5724 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005725 snd_hda_apply_pincfgs(codec, pincfgs);
5726 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005727 /* Enable DOCK device */
5728 snd_hda_codec_write(codec, 0x17, 0,
5729 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5730 /* Enable DOCK device */
5731 snd_hda_codec_write(codec, 0x19, 0,
5732 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005733 }
5734}
5735
Takashi Iwai399c01a2020-05-26 08:24:06 +02005736static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5737 const struct hda_fixup *fix, int action)
5738{
5739 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5740 * the speaker output becomes too low by some reason on Thinkpads with
5741 * ALC298 codec
5742 */
5743 static const hda_nid_t preferred_pairs[] = {
5744 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5745 0
5746 };
5747 struct alc_spec *spec = codec->spec;
5748
5749 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5750 spec->gen.preferred_dacs = preferred_pairs;
5751}
5752
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02005753static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5754 const struct hda_fixup *fix, int action)
5755{
5756 static const hda_nid_t preferred_pairs[] = {
5757 0x17, 0x02, 0x21, 0x03, 0
5758 };
5759 struct alc_spec *spec = codec->spec;
5760
5761 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5762 spec->gen.preferred_dacs = preferred_pairs;
5763}
5764
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005765static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005766{
5767 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01005768 int hp_pin = alc_get_hp_pin(spec);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005769
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005770 /* Prevent pop noises when headphones are plugged in */
5771 snd_hda_codec_write(codec, hp_pin, 0,
5772 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5773 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005774}
5775
5776static void alc_fixup_dell_xps13(struct hda_codec *codec,
5777 const struct hda_fixup *fix, int action)
5778{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005779 struct alc_spec *spec = codec->spec;
5780 struct hda_input_mux *imux = &spec->gen.input_mux;
5781 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005782
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005783 switch (action) {
5784 case HDA_FIXUP_ACT_PRE_PROBE:
5785 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5786 * it causes a click noise at start up
5787 */
5788 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005789 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005790 break;
5791 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005792 /* Make the internal mic the default input source. */
5793 for (i = 0; i < imux->num_items; i++) {
5794 if (spec->gen.imux_pins[i] == 0x12) {
5795 spec->gen.cur_mux[0] = i;
5796 break;
5797 }
5798 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005799 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005800 }
5801}
5802
David Henningsson1f8b46c2015-05-12 14:38:15 +02005803static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5804 const struct hda_fixup *fix, int action)
5805{
5806 struct alc_spec *spec = codec->spec;
5807
5808 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5809 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5810 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005811
5812 /* Disable boost for mic-in permanently. (This code is only called
5813 from quirks that guarantee that the headphone is at NID 0x1b.) */
5814 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5815 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005816 } else
5817 alc_fixup_headset_mode(codec, fix, action);
5818}
5819
David Henningsson73bdd592013-04-15 15:44:14 +02005820static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5821 const struct hda_fixup *fix, int action)
5822{
5823 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005824 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005825 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005826 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5827 }
5828 alc_fixup_headset_mode(codec, fix, action);
5829}
5830
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005831/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5832static int find_ext_mic_pin(struct hda_codec *codec)
5833{
5834 struct alc_spec *spec = codec->spec;
5835 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5836 hda_nid_t nid;
5837 unsigned int defcfg;
5838 int i;
5839
5840 for (i = 0; i < cfg->num_inputs; i++) {
5841 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5842 continue;
5843 nid = cfg->inputs[i].pin;
5844 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5845 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5846 continue;
5847 return nid;
5848 }
5849
5850 return 0;
5851}
5852
Dylan Reid08a978d2012-11-18 22:56:40 -08005853static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005854 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005855 int action)
5856{
5857 struct alc_spec *spec = codec->spec;
5858
Takashi Iwai0db75792013-01-23 13:57:20 +01005859 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005860 int mic_pin = find_ext_mic_pin(codec);
Takashi Iwai35a39f92019-02-01 11:19:50 +01005861 int hp_pin = alc_get_hp_pin(spec);
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005862
5863 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005864 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005865 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005866 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005867}
David Henningsson693b6132012-06-22 19:12:10 +02005868
David Henningsson3e0d6112013-04-22 14:30:14 +02005869static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5870 const struct hda_fixup *fix,
5871 int action)
5872{
5873 struct alc_spec *spec = codec->spec;
5874 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5875 int i;
5876
5877 /* The mic boosts on level 2 and 3 are too noisy
5878 on the internal mic input.
5879 Therefore limit the boost to 0 or 1. */
5880
5881 if (action != HDA_FIXUP_ACT_PROBE)
5882 return;
5883
5884 for (i = 0; i < cfg->num_inputs; i++) {
5885 hda_nid_t nid = cfg->inputs[i].pin;
5886 unsigned int defcfg;
5887 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5888 continue;
5889 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5890 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5891 continue;
5892
5893 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5894 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5895 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5896 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5897 (0 << AC_AMPCAP_MUTE_SHIFT));
5898 }
5899}
5900
Kailang Yangcd217a62013-08-22 10:15:24 +02005901static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005902 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005903{
5904 struct alc_spec *spec = codec->spec;
5905 int vref;
5906
5907 msleep(200);
5908 snd_hda_gen_hp_automute(codec, jack);
5909
5910 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5911
5912 msleep(600);
5913 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5914 vref);
5915}
5916
Kailang Yangcd217a62013-08-22 10:15:24 +02005917static void alc283_fixup_chromebook(struct hda_codec *codec,
5918 const struct hda_fixup *fix, int action)
5919{
5920 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005921
5922 switch (action) {
5923 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005924 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005925 /* Disable AA-loopback as it causes white noise */
5926 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08005927 break;
5928 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08005929 /* MIC2-VREF control */
5930 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005931 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08005932 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02005933 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08005934 break;
5935 }
5936}
5937
5938static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5939 const struct hda_fixup *fix, int action)
5940{
5941 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08005942
5943 switch (action) {
5944 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02005945 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5946 break;
5947 case HDA_FIXUP_ACT_INIT:
5948 /* MIC2-VREF control */
5949 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005950 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02005951 break;
5952 }
5953}
5954
Takashi Iwai7bba2152013-09-06 15:45:38 +02005955/* mute tablet speaker pin (0x14) via dock plugging in addition */
5956static void asus_tx300_automute(struct hda_codec *codec)
5957{
5958 struct alc_spec *spec = codec->spec;
5959 snd_hda_gen_update_outputs(codec);
5960 if (snd_hda_jack_detect(codec, 0x1b))
5961 spec->gen.mute_bits |= (1ULL << 0x14);
5962}
5963
5964static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5965 const struct hda_fixup *fix, int action)
5966{
5967 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005968 static const struct hda_pintbl dock_pins[] = {
5969 { 0x1b, 0x21114000 }, /* dock speaker pin */
5970 {}
5971 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02005972
5973 switch (action) {
5974 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02005975 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02005976 /* TX300 needs to set up GPIO2 for the speaker amp */
5977 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02005978 snd_hda_apply_pincfgs(codec, dock_pins);
5979 spec->gen.auto_mute_via_amp = 1;
5980 spec->gen.automute_hook = asus_tx300_automute;
5981 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005982 snd_hda_gen_hp_automute);
5983 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02005984 case HDA_FIXUP_ACT_PROBE:
5985 spec->init_amp = ALC_INIT_DEFAULT;
5986 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005987 case HDA_FIXUP_ACT_BUILD:
5988 /* this is a bit tricky; give more sane names for the main
5989 * (tablet) speaker and the dock speaker, respectively
5990 */
Takashi Iwai56798e62017-04-11 08:10:52 +02005991 rename_ctl(codec, "Speaker Playback Switch",
5992 "Dock Speaker Playback Switch");
5993 rename_ctl(codec, "Bass Speaker Playback Switch",
5994 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02005995 break;
5996 }
5997}
5998
David Henningsson338cae52013-10-07 10:39:59 +02005999static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6000 const struct hda_fixup *fix, int action)
6001{
David Henningsson0f4881d2013-12-20 16:08:13 +01006002 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6003 /* DAC node 0x03 is giving mono output. We therefore want to
6004 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6005 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006006 static const hda_nid_t conn1[] = { 0x0c };
6007 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6008 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
David Henningsson0f4881d2013-12-20 16:08:13 +01006009 }
David Henningsson338cae52013-10-07 10:39:59 +02006010}
6011
Hui Wangdd9aa332016-08-01 10:20:32 +08006012static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6013 const struct hda_fixup *fix, int action)
6014{
6015 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6016 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6017 we can't adjust the speaker's volume since this node does not has
6018 Amp-out capability. we change the speaker's route to:
6019 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6020 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6021 speaker's volume now. */
6022
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006023 static const hda_nid_t conn1[] = { 0x0c };
6024 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
Hui Wangdd9aa332016-08-01 10:20:32 +08006025 }
6026}
6027
Takashi Iwaie312a862018-03-06 12:14:17 +01006028/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6029static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6030 const struct hda_fixup *fix, int action)
6031{
6032 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006033 static const hda_nid_t conn[] = { 0x02, 0x03 };
6034 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Takashi Iwaie312a862018-03-06 12:14:17 +01006035 }
6036}
6037
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006038/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6039static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6040 const struct hda_fixup *fix, int action)
6041{
6042 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006043 static const hda_nid_t conn[] = { 0x02 };
6044 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006045 }
6046}
6047
Keith Packard98973f22015-07-15 12:14:39 -07006048/* Hook to update amp GPIO4 for automute */
6049static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6050 struct hda_jack_callback *jack)
6051{
6052 struct alc_spec *spec = codec->spec;
6053
6054 snd_hda_gen_hp_automute(codec, jack);
6055 /* mute_led_polarity is set to 0, so we pass inverted value here */
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08006056 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6057 !spec->gen.hp_jack_present);
Keith Packard98973f22015-07-15 12:14:39 -07006058}
6059
6060/* Manage GPIOs for HP EliteBook Folio 9480m.
6061 *
6062 * GPIO4 is the headphone amplifier power control
6063 * GPIO3 is the audio output mute indicator LED
6064 */
6065
6066static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6067 const struct hda_fixup *fix,
6068 int action)
6069{
6070 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07006071
Takashi Iwai01e4a272018-06-19 22:47:30 +02006072 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07006073 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02006074 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6075 spec->gpio_mask |= 0x10;
6076 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07006077 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07006078 }
6079}
6080
Takashi Iwaiae065f12018-06-19 23:00:03 +02006081static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6082 const struct hda_fixup *fix,
6083 int action)
6084{
6085 struct alc_spec *spec = codec->spec;
6086
6087 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6088 spec->gpio_mask |= 0x04;
6089 spec->gpio_dir |= 0x04;
6090 /* set data bit low */
6091 }
6092}
6093
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006094/* Quirk for Thinkpad X1 7th and 8th Gen
6095 * The following fixed routing needed
6096 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6097 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6098 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6099 */
6100static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6101 const struct hda_fixup *fix, int action)
6102{
6103 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6104 static const hda_nid_t preferred_pairs[] = {
6105 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6106 };
6107 struct alc_spec *spec = codec->spec;
6108
6109 switch (action) {
6110 case HDA_FIXUP_ACT_PRE_PROBE:
6111 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6112 spec->gen.preferred_dacs = preferred_pairs;
6113 break;
6114 case HDA_FIXUP_ACT_BUILD:
6115 /* The generic parser creates somewhat unintuitive volume ctls
6116 * with the fixed routing above, and the shared DAC2 may be
6117 * confusing for PA.
6118 * Rename those to unique names so that PA doesn't touch them
6119 * and use only Master volume.
6120 */
6121 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6122 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6123 break;
6124 }
6125}
6126
Kailang Yangca169cc2017-04-25 16:17:40 +08006127static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6128 const struct hda_fixup *fix,
6129 int action)
6130{
6131 alc_fixup_dual_codecs(codec, fix, action);
6132 switch (action) {
6133 case HDA_FIXUP_ACT_PRE_PROBE:
6134 /* override card longname to provide a unique UCM profile */
6135 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6136 break;
6137 case HDA_FIXUP_ACT_BUILD:
6138 /* rename Capture controls depending on the codec */
6139 rename_ctl(codec, "Capture Volume",
6140 codec->addr == 0 ?
6141 "Rear-Panel Capture Volume" :
6142 "Front-Panel Capture Volume");
6143 rename_ctl(codec, "Capture Switch",
6144 codec->addr == 0 ?
6145 "Rear-Panel Capture Switch" :
6146 "Front-Panel Capture Switch");
6147 break;
6148 }
6149}
6150
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006151static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6152 const struct hda_fixup *fix, int action)
6153{
6154 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6155 return;
6156
6157 codec->power_save_node = 1;
6158}
6159
Kailang Yang92266652017-12-14 15:28:58 +08006160/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6161static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6162 const struct hda_fixup *fix, int action)
6163{
6164 struct alc_spec *spec = codec->spec;
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006165 static const hda_nid_t preferred_pairs[] = {
Kailang Yang92266652017-12-14 15:28:58 +08006166 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6167 0
6168 };
6169
6170 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6171 return;
6172
6173 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang0700d3d2019-04-26 16:13:54 +08006174 spec->gen.auto_mute_via_amp = 1;
6175 codec->power_save_node = 0;
Kailang Yang92266652017-12-14 15:28:58 +08006176}
6177
Takashi Iwaic84bfed2020-11-27 15:11:04 +01006178/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6179static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6180 const struct hda_fixup *fix, int action)
6181{
6182 static const hda_nid_t preferred_pairs[] = {
6183 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6184 };
6185 struct alc_spec *spec = codec->spec;
6186
6187 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6188 spec->gen.preferred_dacs = preferred_pairs;
6189 spec->gen.obey_preferred_dacs = 1;
6190 }
6191}
6192
Hui Wangc4cfcf62018-11-26 14:17:16 +08006193/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6194static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6195 const struct hda_fixup *fix, int action)
6196{
6197 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6198 return;
6199
6200 snd_hda_override_wcaps(codec, 0x03, 0);
6201}
6202
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006203static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6204{
6205 switch (codec->core.vendor_id) {
6206 case 0x10ec0274:
6207 case 0x10ec0294:
6208 case 0x10ec0225:
6209 case 0x10ec0295:
6210 case 0x10ec0299:
6211 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6212 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6213 break;
6214 case 0x10ec0235:
6215 case 0x10ec0236:
6216 case 0x10ec0255:
6217 case 0x10ec0256:
6218 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6219 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6220 break;
6221 }
6222}
6223
Kailang Yang8983eb62019-04-03 15:31:49 +08006224static void alc295_fixup_chromebook(struct hda_codec *codec,
6225 const struct hda_fixup *fix, int action)
6226{
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006227 struct alc_spec *spec = codec->spec;
6228
Kailang Yang8983eb62019-04-03 15:31:49 +08006229 switch (action) {
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006230 case HDA_FIXUP_ACT_PRE_PROBE:
6231 spec->ultra_low_power = true;
6232 break;
Kailang Yang8983eb62019-04-03 15:31:49 +08006233 case HDA_FIXUP_ACT_INIT:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006234 alc_combo_jack_hp_jd_restart(codec);
Kailang Yang8983eb62019-04-03 15:31:49 +08006235 break;
6236 }
6237}
6238
Kailang Yangd1dd4212019-01-09 17:05:24 +08006239static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6240 const struct hda_fixup *fix, int action)
6241{
6242 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6243 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6244}
6245
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006246
6247static void alc294_gx502_toggle_output(struct hda_codec *codec,
6248 struct hda_jack_callback *cb)
6249{
6250 /* The Windows driver sets the codec up in a very different way where
6251 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6252 */
6253 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6254 alc_write_coef_idx(codec, 0x10, 0x8a20);
6255 else
6256 alc_write_coef_idx(codec, 0x10, 0x0a20);
6257}
6258
6259static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6260 const struct hda_fixup *fix, int action)
6261{
6262 /* Pin 0x21: headphones/headset mic */
6263 if (!is_jack_detectable(codec, 0x21))
6264 return;
6265
6266 switch (action) {
6267 case HDA_FIXUP_ACT_PRE_PROBE:
6268 snd_hda_jack_detect_enable_callback(codec, 0x21,
6269 alc294_gx502_toggle_output);
6270 break;
6271 case HDA_FIXUP_ACT_INIT:
6272 /* Make sure to start in a correct state, i.e. if
6273 * headphones have been plugged in before powering up the system
6274 */
6275 alc294_gx502_toggle_output(codec, NULL);
6276 break;
6277 }
6278}
6279
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05006280static void alc294_gu502_toggle_output(struct hda_codec *codec,
6281 struct hda_jack_callback *cb)
6282{
6283 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6284 * responsible from changes between speakers and headphones
6285 */
6286 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6287 alc_write_coef_idx(codec, 0x10, 0x8420);
6288 else
6289 alc_write_coef_idx(codec, 0x10, 0x0a20);
6290}
6291
6292static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6293 const struct hda_fixup *fix, int action)
6294{
6295 if (!is_jack_detectable(codec, 0x21))
6296 return;
6297
6298 switch (action) {
6299 case HDA_FIXUP_ACT_PRE_PROBE:
6300 snd_hda_jack_detect_enable_callback(codec, 0x21,
6301 alc294_gu502_toggle_output);
6302 break;
6303 case HDA_FIXUP_ACT_INIT:
6304 alc294_gu502_toggle_output(codec, NULL);
6305 break;
6306 }
6307}
6308
Kailang Yang56496252020-07-29 15:09:27 +08006309static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6310 const struct hda_fixup *fix, int action)
6311{
6312 if (action != HDA_FIXUP_ACT_INIT)
6313 return;
6314
6315 msleep(100);
6316 alc_write_coef_idx(codec, 0x65, 0x0);
6317}
6318
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006319static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6320 const struct hda_fixup *fix, int action)
6321{
6322 switch (action) {
6323 case HDA_FIXUP_ACT_INIT:
6324 alc_combo_jack_hp_jd_restart(codec);
6325 break;
6326 }
6327}
6328
Kailang Yang92666d42020-11-19 17:04:21 +08006329static void alc_fixup_no_int_mic(struct hda_codec *codec,
6330 const struct hda_fixup *fix, int action)
6331{
6332 struct alc_spec *spec = codec->spec;
6333
6334 switch (action) {
6335 case HDA_FIXUP_ACT_PRE_PROBE:
6336 /* Mic RING SLEEVE swap for combo jack */
6337 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6338 spec->no_internal_mic_pin = true;
6339 break;
6340 case HDA_FIXUP_ACT_INIT:
6341 alc_combo_jack_hp_jd_restart(codec);
6342 break;
6343 }
6344}
6345
Takashi Iwaib317b032014-01-08 11:44:21 +01006346/* for hda_fixup_thinkpad_acpi() */
6347#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01006348
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006349static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6350 const struct hda_fixup *fix, int action)
6351{
6352 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6353 hda_fixup_thinkpad_acpi(codec, fix, action);
6354}
6355
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006356/* for alc295_fixup_hp_top_speakers */
6357#include "hp_x360_helper.c"
6358
Takashi Iwai26928ca2021-04-16 10:12:11 +02006359/* for alc285_fixup_ideapad_s740_coef() */
6360#include "ideapad_s740_helper.c"
6361
Takashi Iwai1d045db2011-07-07 18:23:21 +02006362enum {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006363 ALC269_FIXUP_GPIO2,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006364 ALC269_FIXUP_SONY_VAIO,
6365 ALC275_FIXUP_SONY_VAIO_GPIO2,
6366 ALC269_FIXUP_DELL_M101Z,
6367 ALC269_FIXUP_SKU_IGNORE,
6368 ALC269_FIXUP_ASUS_G73JW,
6369 ALC269_FIXUP_LENOVO_EAPD,
6370 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006371 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006372 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006373 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006374 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02006375 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02006376 ALC269_FIXUP_QUANTA_MUTE,
6377 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02006378 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006379 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006380 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006381 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02006382 ALC269_FIXUP_AMIC,
6383 ALC269_FIXUP_DMIC,
6384 ALC269VB_FIXUP_AMIC,
6385 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006386 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01006387 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006388 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00006389 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006390 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006391 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6392 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02006393 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02006394 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwaib590b382020-05-14 18:05:33 +02006395 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006396 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02006397 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02006398 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02006399 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6400 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02006401 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08006402 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02006403 ALC269_FIXUP_HEADSET_MODE,
6404 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02006405 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02006406 ALC269_FIXUP_ASUS_X101_FUNC,
6407 ALC269_FIXUP_ASUS_X101_VERB,
6408 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08006409 ALC271_FIXUP_AMIC_MIC2,
6410 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006411 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07006412 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02006413 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01006414 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01006415 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01006416 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02006417 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02006418 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08006419 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006420 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02006421 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02006422 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01006423 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6424 ALC290_FIXUP_SUBWOOFER,
6425 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006426 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01006427 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06006428 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06006429 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006430 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08006431 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006432 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08006433 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08006434 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006435 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01006436 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02006437 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006438 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02006439 ALC282_FIXUP_ASPIRE_V5_PINS,
Takashi Iwaic8426b22021-04-07 11:57:30 +02006440 ALC269VB_FIXUP_ASPIRE_E1_COEF,
David Henningsson7a5255f2014-10-30 08:26:01 +01006441 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006442 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01006443 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01006444 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006445 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07006446 ALC280_FIXUP_HP_9480M,
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01006447 ALC245_FIXUP_HP_X360_AMP,
Kailang Yange1e62b92015-04-08 16:01:22 +08006448 ALC288_FIXUP_DELL_HEADSET_MODE,
6449 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08006450 ALC288_FIXUP_DELL_XPS_13,
6451 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai5fab5822020-01-05 09:11:19 +01006452 ALC292_FIXUP_DELL_E7X_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006453 ALC292_FIXUP_DELL_E7X,
6454 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01006455 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
James McDonnell54324222019-09-16 14:53:38 +00006456 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
Kailang Yang977e6272015-05-18 15:31:20 +08006457 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08006458 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08006459 ALC275_FIXUP_DELL_XPS,
Hui Wang23adc192015-12-08 12:27:18 +08006460 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08006461 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006462 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006463 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01006464 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01006465 ALC295_FIXUP_DISABLE_DAC3,
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006466 ALC285_FIXUP_SPEAKER2_TO_DAC1,
Takashi Iwaif8839822016-02-25 14:31:59 +01006467 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08006468 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02006469 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08006470 ALC298_FIXUP_SPK_VOLUME,
Kailang Yangf86de9b2020-10-23 14:46:47 +08006471 ALC298_FIXUP_LENOVO_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006472 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006473 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006474 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06006475 ALC256_FIXUP_ASUS_HEADSET_MODE,
6476 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006477 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06006478 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6479 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08006480 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08006481 ALC233_FIXUP_ACER_HEADSET_MIC,
Hui Wangf33f79f2017-07-07 12:08:29 +08006482 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08006483 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006484 ALC225_FIXUP_S3_POP_NOISE,
PeiSen Houb84e8432017-09-01 15:11:56 +08006485 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08006486 ALC274_FIXUP_DELL_BIND_DACS,
6487 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Takashi Iwai399c01a2020-05-26 08:24:06 +02006488 ALC298_FIXUP_TPT470_DOCK_FIX,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006489 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08006490 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006491 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006492 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006493 ALC298_FIXUP_HUAWEI_MBX_STEREO,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006494 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08006495 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08006496 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006497 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08006498 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08006499 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006500 ALC294_FIXUP_ASUS_HEADSET_MIC,
6501 ALC294_FIXUP_ASUS_SPK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07006502 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Hui Wangc8c6ee62019-02-14 11:41:33 +08006503 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08006504 ALC255_FIXUP_ACER_HEADSET_MIC,
Kailang Yang10f5b1b2019-02-21 16:10:22 +08006505 ALC295_FIXUP_CHROME_BOOK,
Kailang Yang8983eb62019-04-03 15:31:49 +08006506 ALC225_FIXUP_HEADSET_JACK,
Kailang Yang136824e2019-03-14 16:22:45 +08006507 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6508 ALC225_FIXUP_WYSE_AUTO_MUTE,
6509 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08006510 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
Daniel Drake8c8967a2019-10-17 16:15:01 +08006511 ALC256_FIXUP_ASUS_HEADSET_MIC,
Jian-Hong Pane1037352019-03-22 11:37:18 +08006512 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01006513 ALC299_FIXUP_PREDATOR_SPK,
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02006514 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
Kailang Yange79c2262019-12-19 14:12:15 +08006515 ALC289_FIXUP_DELL_SPK2,
6516 ALC289_FIXUP_DUAL_SPK,
Chris Chiu48e01502019-12-30 11:11:18 +08006517 ALC294_FIXUP_SPK2_TO_DAC1,
6518 ALC294_FIXUP_ASUS_DUAL_SPK,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006519 ALC285_FIXUP_THINKPAD_X1_GEN7,
Kailang Yang76f7dec2020-02-10 16:30:26 +08006520 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08006521 ALC294_FIXUP_ASUS_HPE,
Takashi Iwai1b94e592020-05-12 09:32:03 +02006522 ALC294_FIXUP_ASUS_COEF_1B,
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006523 ALC294_FIXUP_ASUS_GX502_HP,
6524 ALC294_FIXUP_ASUS_GX502_PINS,
6525 ALC294_FIXUP_ASUS_GX502_VERBS,
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05006526 ALC294_FIXUP_ASUS_GU502_HP,
6527 ALC294_FIXUP_ASUS_GU502_PINS,
6528 ALC294_FIXUP_ASUS_GU502_VERBS,
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08006529 ALC285_FIXUP_HP_GPIO_LED,
Kailang Yang431e76c2020-04-07 14:40:20 +08006530 ALC285_FIXUP_HP_MUTE_LED,
Jeremy Szue7d66cf2021-03-16 15:46:24 +08006531 ALC236_FIXUP_HP_GPIO_LED,
Kailang Yang24164f42020-04-07 14:52:42 +08006532 ALC236_FIXUP_HP_MUTE_LED,
Jonas Witschel75b62ab2021-04-16 12:58:54 +02006533 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
Mike Pozulp14425f12020-05-09 20:28:37 -07006534 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
Chris Chiu9e433422020-05-12 14:15:24 +08006535 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08006536 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08006537 ALC269VC_FIXUP_ACER_HEADSET_MIC,
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08006538 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
Armas Spann293a92c2020-07-24 16:08:37 +02006539 ALC289_FIXUP_ASUS_GA401,
Armas Spann4b43d052020-07-24 16:06:16 +02006540 ALC289_FIXUP_ASUS_GA502,
Jian-Hong Panf50a1212020-07-13 14:04:22 +08006541 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
Kailang Yang56496252020-07-29 15:09:27 +08006542 ALC285_FIXUP_HP_GPIO_AMP_INIT,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08006543 ALC269_FIXUP_CZC_B20,
6544 ALC269_FIXUP_CZC_TMI,
6545 ALC269_FIXUP_CZC_L101,
6546 ALC269_FIXUP_LEMOTE_A1802,
6547 ALC269_FIXUP_LEMOTE_A190X,
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08006548 ALC256_FIXUP_INTEL_NUC8_RUGGED,
Phil Calvind1ee66c2021-04-15 18:01:29 -04006549 ALC233_FIXUP_INTEL_NUC8_DMIC,
6550 ALC233_FIXUP_INTEL_NUC8_BOOST,
Werner Sembach73e71612021-03-02 19:04:14 +01006551 ALC256_FIXUP_INTEL_NUC10,
Hui Wangfc19d552020-09-09 10:00:41 +08006552 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
Hui Wang13468bf2020-09-28 16:01:17 +08006553 ALC274_FIXUP_HP_MIC,
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006554 ALC274_FIXUP_HP_HEADSET_MIC,
Takashi Iwai622464c2021-05-04 11:18:02 +02006555 ALC274_FIXUP_HP_ENVY_GPIO,
Kailang Yangef9ce662020-11-03 15:40:35 +08006556 ALC256_FIXUP_ASUS_HPE,
Kailang Yang446b8182020-11-02 15:00:12 +08006557 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Kailang Yanga0ccbc52020-11-06 15:20:38 +08006558 ALC287_FIXUP_HP_GPIO_LED,
Kailang Yang9e885772020-11-03 15:30:51 +08006559 ALC256_FIXUP_HP_HEADSET_MIC,
Kailang Yang92666d42020-11-19 17:04:21 +08006560 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
Chris Chiu34cdf402020-12-16 20:52:00 +08006561 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
Chris Chiu495dc762021-01-14 16:27:28 +08006562 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
Chris Chiud0e18562021-02-26 09:04:40 +08006563 ALC256_FIXUP_ACER_HEADSET_MIC,
Takashi Iwai26928ca2021-04-16 10:12:11 +02006564 ALC285_FIXUP_IDEAPAD_S740_COEF,
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08006565 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02006566 ALC295_FIXUP_ASUS_DACS,
Takashi Iwai5d84b532021-05-04 14:18:32 +02006567 ALC295_FIXUP_HP_OMEN,
Elia Devitof2be77f2021-05-11 14:46:49 +02006568 ALC285_FIXUP_HP_SPECTRE_X360,
Hui Wang9ebaef02021-05-22 12:26:45 +08006569 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03006570 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006571};
6572
Takashi Iwai1727a772013-01-10 09:52:52 +01006573static const struct hda_fixup alc269_fixups[] = {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006574 [ALC269_FIXUP_GPIO2] = {
6575 .type = HDA_FIXUP_FUNC,
6576 .v.func = alc_fixup_gpio2,
6577 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006578 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01006579 .type = HDA_FIXUP_PINCTLS,
6580 .v.pins = (const struct hda_pintbl[]) {
6581 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02006582 {}
6583 }
6584 },
6585 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02006586 .type = HDA_FIXUP_FUNC,
6587 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006588 .chained = true,
6589 .chain_id = ALC269_FIXUP_SONY_VAIO
6590 },
6591 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006592 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006593 .v.verbs = (const struct hda_verb[]) {
6594 /* Enables internal speaker */
6595 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6596 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6597 {}
6598 }
6599 },
6600 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006601 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02006602 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006603 },
6604 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006605 .type = HDA_FIXUP_PINS,
6606 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02006607 { 0x17, 0x99130111 }, /* subwoofer */
6608 { }
6609 }
6610 },
6611 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006612 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006613 .v.verbs = (const struct hda_verb[]) {
6614 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6615 {}
6616 }
6617 },
6618 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006619 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006620 .v.func = alc269_fixup_hweq,
6621 .chained = true,
6622 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
6623 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006624 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
6625 .type = HDA_FIXUP_FUNC,
6626 .v.func = alc_fixup_disable_aamix,
6627 .chained = true,
6628 .chain_id = ALC269_FIXUP_SONY_VAIO
6629 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006630 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006631 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006632 .v.func = alc271_fixup_dmic,
6633 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02006634 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006635 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006636 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02006637 .chained = true,
6638 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02006639 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006640 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006641 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006642 .v.func = alc269_fixup_stereo_dmic,
6643 },
David Henningsson7c478f02013-10-11 10:18:46 +02006644 [ALC269_FIXUP_HEADSET_MIC] = {
6645 .type = HDA_FIXUP_FUNC,
6646 .v.func = alc269_fixup_headset_mic,
6647 },
Takashi Iwai24519912011-08-16 15:08:49 +02006648 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006649 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02006650 .v.func = alc269_fixup_quanta_mute,
6651 },
6652 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006653 .type = HDA_FIXUP_PINS,
6654 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02006655 { 0x1a, 0x2101103f }, /* dock line-out */
6656 { 0x1b, 0x23a11040 }, /* dock mic-in */
6657 { }
6658 },
6659 .chained = true,
6660 .chain_id = ALC269_FIXUP_QUANTA_MUTE
6661 },
David Henningsson2041d562014-06-13 11:15:44 +02006662 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
6663 .type = HDA_FIXUP_PINS,
6664 .v.pins = (const struct hda_pintbl[]) {
6665 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
6666 { }
6667 },
6668 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006669 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
6670 .type = HDA_FIXUP_PINS,
6671 .v.pins = (const struct hda_pintbl[]) {
6672 { 0x21, 0x0221102f }, /* HP out */
6673 { }
6674 },
6675 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006676 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
6677 .type = HDA_FIXUP_FUNC,
6678 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6679 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006680 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
6681 .type = HDA_FIXUP_FUNC,
6682 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
6683 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02006684 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006685 .type = HDA_FIXUP_PINS,
6686 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006687 { 0x14, 0x99130110 }, /* speaker */
6688 { 0x15, 0x0121401f }, /* HP out */
6689 { 0x18, 0x01a19c20 }, /* mic */
6690 { 0x19, 0x99a3092f }, /* int-mic */
6691 { }
6692 },
6693 },
6694 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006695 .type = HDA_FIXUP_PINS,
6696 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006697 { 0x12, 0x99a3092f }, /* int-mic */
6698 { 0x14, 0x99130110 }, /* speaker */
6699 { 0x15, 0x0121401f }, /* HP out */
6700 { 0x18, 0x01a19c20 }, /* mic */
6701 { }
6702 },
6703 },
6704 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006705 .type = HDA_FIXUP_PINS,
6706 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006707 { 0x14, 0x99130110 }, /* speaker */
6708 { 0x18, 0x01a19c20 }, /* mic */
6709 { 0x19, 0x99a3092f }, /* int-mic */
6710 { 0x21, 0x0121401f }, /* HP out */
6711 { }
6712 },
6713 },
David Henningsson2267ea92012-01-03 08:45:56 +01006714 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006715 .type = HDA_FIXUP_PINS,
6716 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006717 { 0x12, 0x99a3092f }, /* int-mic */
6718 { 0x14, 0x99130110 }, /* speaker */
6719 { 0x18, 0x01a19c20 }, /* mic */
6720 { 0x21, 0x0121401f }, /* HP out */
6721 { }
6722 },
6723 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006724 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006725 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006726 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01006727 },
David Henningssond06ac142013-02-18 11:41:55 +01006728 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
6729 .type = HDA_FIXUP_FUNC,
6730 .v.func = alc269_fixup_hp_mute_led_mic1,
6731 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006732 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006733 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006734 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01006735 },
Tom Briden7f783bd2017-03-25 10:12:01 +00006736 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
6737 .type = HDA_FIXUP_FUNC,
6738 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006739 .chained = true,
6740 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00006741 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006742 [ALC269_FIXUP_HP_GPIO_LED] = {
6743 .type = HDA_FIXUP_FUNC,
6744 .v.func = alc269_fixup_hp_gpio_led,
6745 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006746 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
6747 .type = HDA_FIXUP_FUNC,
6748 .v.func = alc269_fixup_hp_gpio_mic1_led,
6749 },
6750 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
6751 .type = HDA_FIXUP_FUNC,
6752 .v.func = alc269_fixup_hp_line1_mic1_led,
6753 },
David Henningsson693b6132012-06-22 19:12:10 +02006754 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006755 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02006756 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02006757 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006758 [ALC269_FIXUP_NO_SHUTUP] = {
6759 .type = HDA_FIXUP_FUNC,
6760 .v.func = alc_fixup_no_shutup,
6761 },
David Henningsson108cc102012-07-20 10:37:25 +02006762 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006763 .type = HDA_FIXUP_PINS,
6764 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02006765 { 0x19, 0x23a11040 }, /* dock mic */
6766 { 0x1b, 0x2121103f }, /* dock headphone */
6767 { }
6768 },
6769 .chained = true,
6770 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
6771 },
Takashi Iwaib590b382020-05-14 18:05:33 +02006772 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
6773 .type = HDA_FIXUP_FUNC,
6774 .v.func = alc269_fixup_limit_int_mic_boost,
6775 .chained = true,
6776 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
6777 },
David Henningsson108cc102012-07-20 10:37:25 +02006778 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006779 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02006780 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01006781 .chained = true,
6782 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02006783 },
David Henningsson73bdd592013-04-15 15:44:14 +02006784 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6785 .type = HDA_FIXUP_PINS,
6786 .v.pins = (const struct hda_pintbl[]) {
6787 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6788 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6789 { }
6790 },
6791 .chained = true,
6792 .chain_id = ALC269_FIXUP_HEADSET_MODE
6793 },
6794 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6795 .type = HDA_FIXUP_PINS,
6796 .v.pins = (const struct hda_pintbl[]) {
6797 { 0x16, 0x21014020 }, /* dock line out */
6798 { 0x19, 0x21a19030 }, /* dock mic */
6799 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6800 { }
6801 },
6802 .chained = true,
6803 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6804 },
David Henningsson338cae52013-10-07 10:39:59 +02006805 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
6806 .type = HDA_FIXUP_PINS,
6807 .v.pins = (const struct hda_pintbl[]) {
6808 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6809 { }
6810 },
6811 .chained = true,
6812 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6813 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08006814 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
6815 .type = HDA_FIXUP_PINS,
6816 .v.pins = (const struct hda_pintbl[]) {
6817 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6818 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6819 { }
6820 },
6821 .chained = true,
6822 .chain_id = ALC269_FIXUP_HEADSET_MODE
6823 },
David Henningsson73bdd592013-04-15 15:44:14 +02006824 [ALC269_FIXUP_HEADSET_MODE] = {
6825 .type = HDA_FIXUP_FUNC,
6826 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08006827 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006828 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02006829 },
6830 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6831 .type = HDA_FIXUP_FUNC,
6832 .v.func = alc_fixup_headset_mode_no_hp_mic,
6833 },
Takashi Iwai78197172015-06-27 10:21:13 +02006834 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
6835 .type = HDA_FIXUP_PINS,
6836 .v.pins = (const struct hda_pintbl[]) {
6837 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
6838 { }
6839 },
6840 .chained = true,
6841 .chain_id = ALC269_FIXUP_HEADSET_MODE,
6842 },
David Henningsson88cfcf82013-10-11 10:18:45 +02006843 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
6844 .type = HDA_FIXUP_PINS,
6845 .v.pins = (const struct hda_pintbl[]) {
6846 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6847 { }
6848 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02006849 .chained = true,
6850 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02006851 },
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006852 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006853 .type = HDA_FIXUP_PINS,
6854 .v.pins = (const struct hda_pintbl[]) {
6855 {0x12, 0x90a60130},
6856 {0x13, 0x40000000},
6857 {0x14, 0x90170110},
6858 {0x18, 0x411111f0},
6859 {0x19, 0x04a11040},
6860 {0x1a, 0x411111f0},
6861 {0x1b, 0x90170112},
6862 {0x1d, 0x40759a05},
6863 {0x1e, 0x411111f0},
6864 {0x21, 0x04211020},
6865 { }
6866 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05006867 .chained = true,
6868 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006869 },
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006870 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
6871 .type = HDA_FIXUP_FUNC,
6872 .v.func = alc298_fixup_huawei_mbx_stereo,
6873 .chained = true,
6874 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
6875 },
David Henningssond240d1d2013-04-15 12:50:02 +02006876 [ALC269_FIXUP_ASUS_X101_FUNC] = {
6877 .type = HDA_FIXUP_FUNC,
6878 .v.func = alc269_fixup_x101_headset_mic,
6879 },
6880 [ALC269_FIXUP_ASUS_X101_VERB] = {
6881 .type = HDA_FIXUP_VERBS,
6882 .v.verbs = (const struct hda_verb[]) {
6883 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
6884 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
6885 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
6886 { }
6887 },
6888 .chained = true,
6889 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
6890 },
6891 [ALC269_FIXUP_ASUS_X101] = {
6892 .type = HDA_FIXUP_PINS,
6893 .v.pins = (const struct hda_pintbl[]) {
6894 { 0x18, 0x04a1182c }, /* Headset mic */
6895 { }
6896 },
6897 .chained = true,
6898 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6899 },
Dylan Reid08a978d2012-11-18 22:56:40 -08006900 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006901 .type = HDA_FIXUP_PINS,
6902 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08006903 { 0x14, 0x99130110 }, /* speaker */
6904 { 0x19, 0x01a19c20 }, /* mic */
6905 { 0x1b, 0x99a7012f }, /* int-mic */
6906 { 0x21, 0x0121401f }, /* HP out */
6907 { }
6908 },
6909 },
6910 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006911 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08006912 .v.func = alc271_hp_gate_mic_jack,
6913 .chained = true,
6914 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6915 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006916 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6917 .type = HDA_FIXUP_FUNC,
6918 .v.func = alc269_fixup_limit_int_mic_boost,
6919 .chained = true,
6920 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6921 },
Dylan Reid42397002013-04-05 14:58:22 -07006922 [ALC269_FIXUP_ACER_AC700] = {
6923 .type = HDA_FIXUP_PINS,
6924 .v.pins = (const struct hda_pintbl[]) {
6925 { 0x12, 0x99a3092f }, /* int-mic */
6926 { 0x14, 0x99130110 }, /* speaker */
6927 { 0x18, 0x03a11c20 }, /* mic */
6928 { 0x1e, 0x0346101e }, /* SPDIF1 */
6929 { 0x21, 0x0321101f }, /* HP out */
6930 { }
6931 },
6932 .chained = true,
6933 .chain_id = ALC271_FIXUP_DMIC,
6934 },
David Henningsson3e0d6112013-04-22 14:30:14 +02006935 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6936 .type = HDA_FIXUP_FUNC,
6937 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01006938 .chained = true,
6939 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02006940 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01006941 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6942 .type = HDA_FIXUP_FUNC,
6943 .v.func = alc269_fixup_limit_int_mic_boost,
6944 .chained = true,
6945 .chain_id = ALC269VB_FIXUP_DMIC,
6946 },
Takashi Iwai23870832013-11-29 14:13:12 +01006947 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6948 .type = HDA_FIXUP_VERBS,
6949 .v.verbs = (const struct hda_verb[]) {
6950 /* class-D output amp +5dB */
6951 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6952 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6953 {}
6954 },
6955 .chained = true,
6956 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6957 },
David Henningsson8e35cd42013-11-06 11:20:01 +01006958 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6959 .type = HDA_FIXUP_FUNC,
6960 .v.func = alc269_fixup_limit_int_mic_boost,
6961 .chained = true,
6962 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6963 },
Anisse Astier02b504d2013-06-03 11:53:10 +02006964 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6965 .type = HDA_FIXUP_PINS,
6966 .v.pins = (const struct hda_pintbl[]) {
6967 { 0x12, 0x99a3092f }, /* int-mic */
6968 { 0x18, 0x03a11d20 }, /* mic */
6969 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6970 { }
6971 },
6972 },
Kailang Yangcd217a62013-08-22 10:15:24 +02006973 [ALC283_FIXUP_CHROME_BOOK] = {
6974 .type = HDA_FIXUP_FUNC,
6975 .v.func = alc283_fixup_chromebook,
6976 },
Kailang Yang0202e992013-12-02 15:20:15 +08006977 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6978 .type = HDA_FIXUP_FUNC,
6979 .v.func = alc283_fixup_sense_combo_jack,
6980 .chained = true,
6981 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6982 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02006983 [ALC282_FIXUP_ASUS_TX300] = {
6984 .type = HDA_FIXUP_FUNC,
6985 .v.func = alc282_fixup_asus_tx300,
6986 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02006987 [ALC283_FIXUP_INT_MIC] = {
6988 .type = HDA_FIXUP_VERBS,
6989 .v.verbs = (const struct hda_verb[]) {
6990 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6991 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6992 { }
6993 },
6994 .chained = true,
6995 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6996 },
David Henningsson0f4881d2013-12-20 16:08:13 +01006997 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6998 .type = HDA_FIXUP_PINS,
6999 .v.pins = (const struct hda_pintbl[]) {
7000 { 0x17, 0x90170112 }, /* subwoofer */
7001 { }
7002 },
7003 .chained = true,
7004 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7005 },
7006 [ALC290_FIXUP_SUBWOOFER] = {
7007 .type = HDA_FIXUP_PINS,
7008 .v.pins = (const struct hda_pintbl[]) {
7009 { 0x17, 0x90170112 }, /* subwoofer */
7010 { }
7011 },
7012 .chained = true,
7013 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7014 },
David Henningsson338cae52013-10-07 10:39:59 +02007015 [ALC290_FIXUP_MONO_SPEAKERS] = {
7016 .type = HDA_FIXUP_FUNC,
7017 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01007018 },
7019 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7020 .type = HDA_FIXUP_FUNC,
7021 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02007022 .chained = true,
7023 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7024 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01007025 [ALC269_FIXUP_THINKPAD_ACPI] = {
7026 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02007027 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02007028 .chained = true,
7029 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01007030 },
David Henningsson56f27012016-01-11 09:33:14 +01007031 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7032 .type = HDA_FIXUP_FUNC,
7033 .v.func = alc_fixup_inv_dmic,
7034 .chained = true,
7035 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7036 },
Chris Chiu5824ce82017-02-28 14:17:11 -06007037 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
Hui Wang17d30462019-06-14 16:44:12 +08007038 .type = HDA_FIXUP_PINS,
7039 .v.pins = (const struct hda_pintbl[]) {
7040 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7041 { }
Chris Chiu5824ce82017-02-28 14:17:11 -06007042 },
7043 .chained = true,
Hui Wang17d30462019-06-14 16:44:12 +08007044 .chain_id = ALC255_FIXUP_HEADSET_MODE
Chris Chiu5824ce82017-02-28 14:17:11 -06007045 },
Chris Chiu615966a2017-02-28 14:17:12 -06007046 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7047 .type = HDA_FIXUP_PINS,
7048 .v.pins = (const struct hda_pintbl[]) {
7049 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7050 { }
7051 },
7052 .chained = true,
7053 .chain_id = ALC255_FIXUP_HEADSET_MODE
7054 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007055 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7056 .type = HDA_FIXUP_PINS,
7057 .v.pins = (const struct hda_pintbl[]) {
7058 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7059 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7060 { }
7061 },
7062 .chained = true,
7063 .chain_id = ALC255_FIXUP_HEADSET_MODE
7064 },
Kailang Yang31278992014-03-03 15:27:22 +08007065 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7066 .type = HDA_FIXUP_PINS,
7067 .v.pins = (const struct hda_pintbl[]) {
7068 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7069 { }
7070 },
7071 .chained = true,
7072 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7073 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007074 [ALC255_FIXUP_HEADSET_MODE] = {
7075 .type = HDA_FIXUP_FUNC,
7076 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08007077 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007078 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007079 },
Kailang Yang31278992014-03-03 15:27:22 +08007080 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7081 .type = HDA_FIXUP_FUNC,
7082 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7083 },
Kailang Yanga22aa262014-04-23 17:34:28 +08007084 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7085 .type = HDA_FIXUP_PINS,
7086 .v.pins = (const struct hda_pintbl[]) {
7087 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7088 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7089 { }
7090 },
7091 .chained = true,
7092 .chain_id = ALC269_FIXUP_HEADSET_MODE
7093 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02007094 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02007095 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02007096 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02007097 .chained = true,
7098 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7099 },
Takashi Iwai9a811232015-12-09 15:17:43 +01007100 [ALC292_FIXUP_TPT440] = {
7101 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01007102 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01007103 .chained = true,
7104 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7105 },
Anisse Astierabaa22742016-08-24 09:14:13 +02007106 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01007107 .type = HDA_FIXUP_PINS,
7108 .v.pins = (const struct hda_pintbl[]) {
7109 { 0x19, 0x04a110f0 },
7110 { },
7111 },
7112 },
Takashi Iwaib3802782018-11-26 17:47:46 +01007113 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08007114 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007115 .v.func = alc_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08007116 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007117 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7118 .type = HDA_FIXUP_PINS,
7119 .v.pins = (const struct hda_pintbl[]) {
7120 { 0x12, 0x90a60130 },
7121 { 0x14, 0x90170110 },
7122 { 0x17, 0x40000008 },
7123 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02007124 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007125 { 0x1a, 0x411111f0 },
7126 { 0x1b, 0x411111f0 },
7127 { 0x1d, 0x40f89b2d },
7128 { 0x1e, 0x411111f0 },
7129 { 0x21, 0x0321101f },
7130 { },
7131 },
7132 },
Takashi Iwaic8426b22021-04-07 11:57:30 +02007133 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7134 .type = HDA_FIXUP_FUNC,
7135 .v.func = alc269vb_fixup_aspire_e1_coef,
7136 },
David Henningsson7a5255f2014-10-30 08:26:01 +01007137 [ALC280_FIXUP_HP_GPIO4] = {
7138 .type = HDA_FIXUP_FUNC,
7139 .v.func = alc280_fixup_hp_gpio4,
7140 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08007141 [ALC286_FIXUP_HP_GPIO_LED] = {
7142 .type = HDA_FIXUP_FUNC,
7143 .v.func = alc286_fixup_hp_gpio_led,
7144 },
David Henningsson33f4acd2015-01-07 15:50:13 +01007145 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7146 .type = HDA_FIXUP_FUNC,
7147 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7148 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01007149 [ALC280_FIXUP_HP_DOCK_PINS] = {
7150 .type = HDA_FIXUP_PINS,
7151 .v.pins = (const struct hda_pintbl[]) {
7152 { 0x1b, 0x21011020 }, /* line-out */
7153 { 0x1a, 0x01a1903c }, /* headset mic */
7154 { 0x18, 0x2181103f }, /* line-in */
7155 { },
7156 },
7157 .chained = true,
7158 .chain_id = ALC280_FIXUP_HP_GPIO4
7159 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01007160 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7161 .type = HDA_FIXUP_PINS,
7162 .v.pins = (const struct hda_pintbl[]) {
7163 { 0x1b, 0x21011020 }, /* line-out */
7164 { 0x18, 0x2181103f }, /* line-in */
7165 { },
7166 },
7167 .chained = true,
7168 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7169 },
Keith Packard98973f22015-07-15 12:14:39 -07007170 [ALC280_FIXUP_HP_9480M] = {
7171 .type = HDA_FIXUP_FUNC,
7172 .v.func = alc280_fixup_hp_9480m,
7173 },
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01007174 [ALC245_FIXUP_HP_X360_AMP] = {
7175 .type = HDA_FIXUP_FUNC,
7176 .v.func = alc245_fixup_hp_x360_amp,
7177 },
Kailang Yange1e62b92015-04-08 16:01:22 +08007178 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7179 .type = HDA_FIXUP_FUNC,
7180 .v.func = alc_fixup_headset_mode_dell_alc288,
7181 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007182 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08007183 },
7184 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7185 .type = HDA_FIXUP_PINS,
7186 .v.pins = (const struct hda_pintbl[]) {
7187 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7188 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7189 { }
7190 },
7191 .chained = true,
7192 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7193 },
Hui Wang831bfdf92015-06-26 12:35:17 +08007194 [ALC288_FIXUP_DISABLE_AAMIX] = {
7195 .type = HDA_FIXUP_FUNC,
7196 .v.func = alc_fixup_disable_aamix,
7197 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02007198 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08007199 },
7200 [ALC288_FIXUP_DELL_XPS_13] = {
7201 .type = HDA_FIXUP_FUNC,
7202 .v.func = alc_fixup_dell_xps13,
7203 .chained = true,
7204 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7205 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007206 [ALC292_FIXUP_DISABLE_AAMIX] = {
7207 .type = HDA_FIXUP_FUNC,
7208 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08007209 .chained = true,
7210 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007211 },
David Henningssonc04017e2015-12-15 14:44:03 +01007212 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7213 .type = HDA_FIXUP_FUNC,
7214 .v.func = alc_fixup_disable_aamix,
7215 .chained = true,
7216 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7217 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007218 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007219 .type = HDA_FIXUP_FUNC,
7220 .v.func = alc_fixup_dell_xps13,
7221 .chained = true,
7222 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7223 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007224 [ALC292_FIXUP_DELL_E7X] = {
7225 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007226 .v.func = alc_fixup_micmute_led,
Takashi Iwai5fab5822020-01-05 09:11:19 +01007227 /* micmute fixup must be applied at last */
7228 .chained_before = true,
7229 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7230 },
James McDonnell54324222019-09-16 14:53:38 +00007231 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7232 .type = HDA_FIXUP_PINS,
7233 .v.pins = (const struct hda_pintbl[]) {
7234 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7235 { }
7236 },
7237 .chained_before = true,
7238 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7239 },
Kailang Yang977e6272015-05-18 15:31:20 +08007240 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7241 .type = HDA_FIXUP_PINS,
7242 .v.pins = (const struct hda_pintbl[]) {
7243 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7244 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7245 { }
7246 },
7247 .chained = true,
7248 .chain_id = ALC269_FIXUP_HEADSET_MODE
7249 },
Hui Wang2f726ae2017-03-31 10:31:40 +08007250 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7251 .type = HDA_FIXUP_PINS,
7252 .v.pins = (const struct hda_pintbl[]) {
7253 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7254 { }
7255 },
7256 .chained = true,
7257 .chain_id = ALC269_FIXUP_HEADSET_MODE
7258 },
Kailang Yang6ed11312015-10-26 15:37:39 +08007259 [ALC275_FIXUP_DELL_XPS] = {
7260 .type = HDA_FIXUP_VERBS,
7261 .v.verbs = (const struct hda_verb[]) {
7262 /* Enables internal speaker */
7263 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7264 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7265 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7266 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7267 {}
7268 }
7269 },
Hui Wang23adc192015-12-08 12:27:18 +08007270 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7271 .type = HDA_FIXUP_FUNC,
7272 .v.func = alc_fixup_disable_aamix,
7273 .chained = true,
7274 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7275 },
Kailang3694cb22015-12-28 11:35:24 +08007276 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7277 .type = HDA_FIXUP_FUNC,
7278 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7279 },
Phil Calvind1ee66c2021-04-15 18:01:29 -04007280 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7281 .type = HDA_FIXUP_FUNC,
7282 .v.func = alc_fixup_inv_dmic,
7283 .chained = true,
7284 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7285 },
7286 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7287 .type = HDA_FIXUP_FUNC,
7288 .v.func = alc269_fixup_limit_int_mic_boost
7289 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007290 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7291 .type = HDA_FIXUP_FUNC,
7292 .v.func = alc_fixup_disable_aamix,
7293 .chained = true,
7294 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7295 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08007296 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7297 .type = HDA_FIXUP_FUNC,
7298 .v.func = alc_fixup_disable_mic_vref,
7299 .chained = true,
7300 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7301 },
David Henningsson2ae95572016-02-25 09:37:05 +01007302 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7303 .type = HDA_FIXUP_VERBS,
7304 .v.verbs = (const struct hda_verb[]) {
7305 /* Disable pass-through path for FRONT 14h */
7306 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7307 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7308 {}
7309 },
7310 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08007311 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01007312 },
Takashi Iwaif8839822016-02-25 14:31:59 +01007313 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7314 .type = HDA_FIXUP_FUNC,
7315 .v.func = alc_fixup_disable_aamix,
7316 .chained = true,
7317 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7318 },
Hui Wange549d192016-04-01 11:00:15 +08007319 [ALC221_FIXUP_HP_FRONT_MIC] = {
7320 .type = HDA_FIXUP_PINS,
7321 .v.pins = (const struct hda_pintbl[]) {
7322 { 0x19, 0x02a19020 }, /* Front Mic */
7323 { }
7324 },
7325 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02007326 [ALC292_FIXUP_TPT460] = {
7327 .type = HDA_FIXUP_FUNC,
7328 .v.func = alc_fixup_tpt440_dock,
7329 .chained = true,
7330 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7331 },
Hui Wangdd9aa332016-08-01 10:20:32 +08007332 [ALC298_FIXUP_SPK_VOLUME] = {
7333 .type = HDA_FIXUP_FUNC,
7334 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08007335 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08007336 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08007337 },
Kailang Yangf86de9b2020-10-23 14:46:47 +08007338 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7339 .type = HDA_FIXUP_FUNC,
7340 .v.func = alc298_fixup_speaker_volume,
7341 },
Takashi Iwaie312a862018-03-06 12:14:17 +01007342 [ALC295_FIXUP_DISABLE_DAC3] = {
7343 .type = HDA_FIXUP_FUNC,
7344 .v.func = alc295_fixup_disable_dac3,
7345 },
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007346 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7347 .type = HDA_FIXUP_FUNC,
7348 .v.func = alc285_fixup_speaker2_to_dac1,
Hui Wangc37c0ab2020-02-19 13:23:06 +08007349 .chained = true,
7350 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007351 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007352 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7353 .type = HDA_FIXUP_PINS,
7354 .v.pins = (const struct hda_pintbl[]) {
7355 { 0x1b, 0x90170151 },
7356 { }
7357 },
7358 .chained = true,
7359 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7360 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01007361 [ALC269_FIXUP_ATIV_BOOK_8] = {
7362 .type = HDA_FIXUP_FUNC,
7363 .v.func = alc_fixup_auto_mute_via_amp,
7364 .chained = true,
7365 .chain_id = ALC269_FIXUP_NO_SHUTUP
7366 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08007367 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7368 .type = HDA_FIXUP_PINS,
7369 .v.pins = (const struct hda_pintbl[]) {
7370 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7371 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7372 { }
7373 },
7374 .chained = true,
7375 .chain_id = ALC269_FIXUP_HEADSET_MODE
7376 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06007377 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7378 .type = HDA_FIXUP_FUNC,
7379 .v.func = alc_fixup_headset_mode,
7380 },
7381 [ALC256_FIXUP_ASUS_MIC] = {
7382 .type = HDA_FIXUP_PINS,
7383 .v.pins = (const struct hda_pintbl[]) {
7384 { 0x13, 0x90a60160 }, /* use as internal mic */
7385 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7386 { }
7387 },
7388 .chained = true,
7389 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7390 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06007391 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02007392 .type = HDA_FIXUP_FUNC,
7393 /* Set up GPIO2 for the speaker amp */
7394 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06007395 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06007396 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7397 .type = HDA_FIXUP_PINS,
7398 .v.pins = (const struct hda_pintbl[]) {
7399 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7400 { }
7401 },
7402 .chained = true,
7403 .chain_id = ALC269_FIXUP_HEADSET_MIC
7404 },
7405 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7406 .type = HDA_FIXUP_VERBS,
7407 .v.verbs = (const struct hda_verb[]) {
7408 /* Enables internal speaker */
7409 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7410 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7411 {}
7412 },
7413 .chained = true,
7414 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7415 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007416 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7417 .type = HDA_FIXUP_FUNC,
7418 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08007419 .chained = true,
7420 .chain_id = ALC269_FIXUP_GPIO2
Kailang Yangca169cc2017-04-25 16:17:40 +08007421 },
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007422 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7423 .type = HDA_FIXUP_VERBS,
7424 .v.verbs = (const struct hda_verb[]) {
7425 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7426 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7427 { }
7428 },
7429 .chained = true,
7430 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7431 },
Hui Wangf33f79f2017-07-07 12:08:29 +08007432 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7433 .type = HDA_FIXUP_PINS,
7434 .v.pins = (const struct hda_pintbl[]) {
7435 /* Change the mic location from front to right, otherwise there are
7436 two front mics with the same name, pulseaudio can't handle them.
7437 This is just a temporary workaround, after applying this fixup,
7438 there will be one "Front Mic" and one "Mic" in this machine.
7439 */
7440 { 0x1a, 0x04a19040 },
7441 { }
7442 },
7443 },
Kailang Yang5f364132017-07-25 16:28:16 +08007444 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7445 .type = HDA_FIXUP_PINS,
7446 .v.pins = (const struct hda_pintbl[]) {
7447 { 0x16, 0x0101102f }, /* Rear Headset HP */
7448 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7449 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7450 { 0x1b, 0x02011020 },
7451 { }
7452 },
7453 .chained = true,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08007454 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7455 },
7456 [ALC225_FIXUP_S3_POP_NOISE] = {
7457 .type = HDA_FIXUP_FUNC,
7458 .v.func = alc225_fixup_s3_pop_noise,
7459 .chained = true,
Kailang Yang5f364132017-07-25 16:28:16 +08007460 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7461 },
PeiSen Houb84e8432017-09-01 15:11:56 +08007462 [ALC700_FIXUP_INTEL_REFERENCE] = {
7463 .type = HDA_FIXUP_VERBS,
7464 .v.verbs = (const struct hda_verb[]) {
7465 /* Enables internal speaker */
7466 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7467 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7468 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7469 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7470 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7471 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7472 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7473 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7474 {}
7475 }
7476 },
Kailang Yang92266652017-12-14 15:28:58 +08007477 [ALC274_FIXUP_DELL_BIND_DACS] = {
7478 .type = HDA_FIXUP_FUNC,
7479 .v.func = alc274_fixup_bind_dacs,
7480 .chained = true,
7481 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7482 },
7483 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7484 .type = HDA_FIXUP_PINS,
7485 .v.pins = (const struct hda_pintbl[]) {
7486 { 0x1b, 0x0401102f },
7487 { }
7488 },
7489 .chained = true,
7490 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7491 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007492 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007493 .type = HDA_FIXUP_FUNC,
7494 .v.func = alc_fixup_tpt470_dock,
7495 .chained = true,
7496 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7497 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007498 [ALC298_FIXUP_TPT470_DOCK] = {
7499 .type = HDA_FIXUP_FUNC,
7500 .v.func = alc_fixup_tpt470_dacs,
7501 .chained = true,
7502 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7503 },
Kailang Yangae104a22018-02-05 16:07:20 +08007504 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7505 .type = HDA_FIXUP_PINS,
7506 .v.pins = (const struct hda_pintbl[]) {
7507 { 0x14, 0x0201101f },
7508 { }
7509 },
7510 .chained = true,
7511 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7512 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007513 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7514 .type = HDA_FIXUP_PINS,
7515 .v.pins = (const struct hda_pintbl[]) {
7516 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7517 { }
7518 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08007519 .chained = true,
7520 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007521 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007522 [ALC295_FIXUP_HP_X360] = {
7523 .type = HDA_FIXUP_FUNC,
7524 .v.func = alc295_fixup_hp_top_speakers,
7525 .chained = true,
7526 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08007527 },
7528 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7529 .type = HDA_FIXUP_PINS,
7530 .v.pins = (const struct hda_pintbl[]) {
7531 { 0x19, 0x0181313f},
7532 { }
7533 },
7534 .chained = true,
7535 .chain_id = ALC269_FIXUP_HEADSET_MIC
7536 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08007537 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7538 .type = HDA_FIXUP_FUNC,
7539 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08007540 .chained = true,
7541 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08007542 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05007543 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7544 .type = HDA_FIXUP_FUNC,
7545 .v.func = alc_fixup_auto_mute_via_amp,
7546 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08007547 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7548 .type = HDA_FIXUP_PINS,
7549 .v.pins = (const struct hda_pintbl[]) {
7550 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7551 { }
7552 },
7553 .chained = true,
7554 .chain_id = ALC269_FIXUP_HEADSET_MIC
7555 },
Chris Chiud8ae4582018-12-07 17:17:11 +08007556 [ALC294_FIXUP_ASUS_MIC] = {
7557 .type = HDA_FIXUP_PINS,
7558 .v.pins = (const struct hda_pintbl[]) {
7559 { 0x13, 0x90a60160 }, /* use as internal mic */
7560 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7561 { }
7562 },
7563 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007564 .chain_id = ALC269_FIXUP_HEADSET_MIC
Chris Chiud8ae4582018-12-07 17:17:11 +08007565 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007566 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7567 .type = HDA_FIXUP_PINS,
7568 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08007569 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007570 { }
7571 },
7572 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007573 .chain_id = ALC269_FIXUP_HEADSET_MIC
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007574 },
7575 [ALC294_FIXUP_ASUS_SPK] = {
7576 .type = HDA_FIXUP_VERBS,
7577 .v.verbs = (const struct hda_verb[]) {
7578 /* Set EAPD high */
7579 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7580 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
Kailang Yang473fbe132020-07-16 14:42:33 +08007581 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7582 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007583 { }
7584 },
7585 .chained = true,
7586 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7587 },
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007588 [ALC295_FIXUP_CHROME_BOOK] = {
Kailang Yange8547472018-11-28 15:32:45 +08007589 .type = HDA_FIXUP_FUNC,
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007590 .v.func = alc295_fixup_chromebook,
Kailang Yang8983eb62019-04-03 15:31:49 +08007591 .chained = true,
7592 .chain_id = ALC225_FIXUP_HEADSET_JACK
7593 },
7594 [ALC225_FIXUP_HEADSET_JACK] = {
7595 .type = HDA_FIXUP_FUNC,
7596 .v.func = alc_fixup_headset_jack,
Kailang Yange8547472018-11-28 15:32:45 +08007597 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07007598 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7599 .type = HDA_FIXUP_PINS,
7600 .v.pins = (const struct hda_pintbl[]) {
7601 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7602 { }
7603 },
7604 .chained = true,
7605 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7606 },
Hui Wangc8c6ee62019-02-14 11:41:33 +08007607 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7608 .type = HDA_FIXUP_VERBS,
7609 .v.verbs = (const struct hda_verb[]) {
7610 /* Disable PCBEEP-IN passthrough */
7611 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7612 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7613 { }
7614 },
7615 .chained = true,
7616 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
7617 },
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08007618 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
7619 .type = HDA_FIXUP_PINS,
7620 .v.pins = (const struct hda_pintbl[]) {
7621 { 0x19, 0x03a11130 },
7622 { 0x1a, 0x90a60140 }, /* use as internal mic */
7623 { }
7624 },
7625 .chained = true,
7626 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7627 },
Kailang Yang136824e2019-03-14 16:22:45 +08007628 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
7629 .type = HDA_FIXUP_PINS,
7630 .v.pins = (const struct hda_pintbl[]) {
7631 { 0x16, 0x01011020 }, /* Rear Line out */
7632 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
7633 { }
7634 },
7635 .chained = true,
7636 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
7637 },
7638 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
7639 .type = HDA_FIXUP_FUNC,
7640 .v.func = alc_fixup_auto_mute_via_amp,
7641 .chained = true,
7642 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
7643 },
7644 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
7645 .type = HDA_FIXUP_FUNC,
7646 .v.func = alc_fixup_disable_mic_vref,
7647 .chained = true,
7648 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7649 },
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08007650 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
7651 .type = HDA_FIXUP_VERBS,
7652 .v.verbs = (const struct hda_verb[]) {
7653 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
7654 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
7655 { }
7656 },
7657 .chained = true,
7658 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
7659 },
Daniel Drake8c8967a2019-10-17 16:15:01 +08007660 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
7661 .type = HDA_FIXUP_PINS,
7662 .v.pins = (const struct hda_pintbl[]) {
7663 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7664 { }
7665 },
7666 .chained = true,
7667 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7668 },
Jian-Hong Pane1037352019-03-22 11:37:18 +08007669 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7670 .type = HDA_FIXUP_PINS,
7671 .v.pins = (const struct hda_pintbl[]) {
7672 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7673 { }
7674 },
7675 .chained = true,
7676 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7677 },
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007678 [ALC299_FIXUP_PREDATOR_SPK] = {
7679 .type = HDA_FIXUP_PINS,
7680 .v.pins = (const struct hda_pintbl[]) {
7681 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
7682 { }
7683 }
7684 },
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02007685 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
7686 .type = HDA_FIXUP_PINS,
7687 .v.pins = (const struct hda_pintbl[]) {
7688 { 0x19, 0x04a11040 },
7689 { 0x21, 0x04211020 },
7690 { }
7691 },
7692 .chained = true,
7693 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7694 },
Kailang Yange79c2262019-12-19 14:12:15 +08007695 [ALC289_FIXUP_DELL_SPK2] = {
7696 .type = HDA_FIXUP_PINS,
7697 .v.pins = (const struct hda_pintbl[]) {
7698 { 0x17, 0x90170130 }, /* bass spk */
7699 { }
7700 },
7701 .chained = true,
7702 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
7703 },
7704 [ALC289_FIXUP_DUAL_SPK] = {
7705 .type = HDA_FIXUP_FUNC,
7706 .v.func = alc285_fixup_speaker2_to_dac1,
7707 .chained = true,
7708 .chain_id = ALC289_FIXUP_DELL_SPK2
7709 },
Chris Chiu48e01502019-12-30 11:11:18 +08007710 [ALC294_FIXUP_SPK2_TO_DAC1] = {
7711 .type = HDA_FIXUP_FUNC,
7712 .v.func = alc285_fixup_speaker2_to_dac1,
7713 .chained = true,
7714 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7715 },
7716 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007717 .type = HDA_FIXUP_FUNC,
7718 /* The GPIO must be pulled to initialize the AMP */
7719 .v.func = alc_fixup_gpio4,
7720 .chained = true,
Chris Chiu48e01502019-12-30 11:11:18 +08007721 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
Jian-Hong Pan436e2552019-11-25 17:34:06 +08007722 },
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007723 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
7724 .type = HDA_FIXUP_FUNC,
7725 .v.func = alc285_fixup_thinkpad_x1_gen7,
7726 .chained = true,
7727 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7728 },
Kailang Yang76f7dec2020-02-10 16:30:26 +08007729 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
7730 .type = HDA_FIXUP_FUNC,
7731 .v.func = alc_fixup_headset_jack,
7732 .chained = true,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02007733 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
Kailang Yang76f7dec2020-02-10 16:30:26 +08007734 },
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08007735 [ALC294_FIXUP_ASUS_HPE] = {
7736 .type = HDA_FIXUP_VERBS,
7737 .v.verbs = (const struct hda_verb[]) {
7738 /* Set EAPD high */
7739 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7740 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
7741 { }
7742 },
7743 .chained = true,
7744 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7745 },
Luke D Jonesc3cdf182020-09-07 20:19:59 +12007746 [ALC294_FIXUP_ASUS_GX502_PINS] = {
7747 .type = HDA_FIXUP_PINS,
7748 .v.pins = (const struct hda_pintbl[]) {
7749 { 0x19, 0x03a11050 }, /* front HP mic */
7750 { 0x1a, 0x01a11830 }, /* rear external mic */
7751 { 0x21, 0x03211020 }, /* front HP out */
7752 { }
7753 },
7754 .chained = true,
7755 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
7756 },
7757 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
7758 .type = HDA_FIXUP_VERBS,
7759 .v.verbs = (const struct hda_verb[]) {
7760 /* set 0x15 to HP-OUT ctrl */
7761 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7762 /* unmute the 0x15 amp */
7763 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7764 { }
7765 },
7766 .chained = true,
7767 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
7768 },
7769 [ALC294_FIXUP_ASUS_GX502_HP] = {
7770 .type = HDA_FIXUP_FUNC,
7771 .v.func = alc294_fixup_gx502_hp,
7772 },
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05007773 [ALC294_FIXUP_ASUS_GU502_PINS] = {
7774 .type = HDA_FIXUP_PINS,
7775 .v.pins = (const struct hda_pintbl[]) {
7776 { 0x19, 0x01a11050 }, /* rear HP mic */
7777 { 0x1a, 0x01a11830 }, /* rear external mic */
7778 { 0x21, 0x012110f0 }, /* rear HP out */
7779 { }
7780 },
7781 .chained = true,
7782 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
7783 },
7784 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
7785 .type = HDA_FIXUP_VERBS,
7786 .v.verbs = (const struct hda_verb[]) {
7787 /* set 0x15 to HP-OUT ctrl */
7788 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
7789 /* unmute the 0x15 amp */
7790 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
7791 /* set 0x1b to HP-OUT */
7792 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
7793 { }
7794 },
7795 .chained = true,
7796 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
7797 },
7798 [ALC294_FIXUP_ASUS_GU502_HP] = {
7799 .type = HDA_FIXUP_FUNC,
7800 .v.func = alc294_fixup_gu502_hp,
7801 },
Takashi Iwai1b94e592020-05-12 09:32:03 +02007802 [ALC294_FIXUP_ASUS_COEF_1B] = {
7803 .type = HDA_FIXUP_VERBS,
7804 .v.verbs = (const struct hda_verb[]) {
7805 /* Set bit 10 to correct noisy output after reboot from
7806 * Windows 10 (due to pop noise reduction?)
7807 */
7808 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
7809 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
7810 { }
7811 },
7812 },
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08007813 [ALC285_FIXUP_HP_GPIO_LED] = {
7814 .type = HDA_FIXUP_FUNC,
7815 .v.func = alc285_fixup_hp_gpio_led,
7816 },
Kailang Yang431e76c2020-04-07 14:40:20 +08007817 [ALC285_FIXUP_HP_MUTE_LED] = {
7818 .type = HDA_FIXUP_FUNC,
7819 .v.func = alc285_fixup_hp_mute_led,
7820 },
Jeremy Szue7d66cf2021-03-16 15:46:24 +08007821 [ALC236_FIXUP_HP_GPIO_LED] = {
7822 .type = HDA_FIXUP_FUNC,
7823 .v.func = alc236_fixup_hp_gpio_led,
7824 },
Kailang Yang24164f42020-04-07 14:52:42 +08007825 [ALC236_FIXUP_HP_MUTE_LED] = {
7826 .type = HDA_FIXUP_FUNC,
7827 .v.func = alc236_fixup_hp_mute_led,
7828 },
Jonas Witschel75b62ab2021-04-16 12:58:54 +02007829 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
7830 .type = HDA_FIXUP_FUNC,
7831 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
7832 },
Mike Pozulp14425f12020-05-09 20:28:37 -07007833 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
7834 .type = HDA_FIXUP_VERBS,
7835 .v.verbs = (const struct hda_verb[]) {
7836 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
7837 { }
7838 },
7839 },
Chris Chiu9e433422020-05-12 14:15:24 +08007840 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7841 .type = HDA_FIXUP_PINS,
7842 .v.pins = (const struct hda_pintbl[]) {
7843 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7844 { }
7845 },
7846 .chained = true,
7847 .chain_id = ALC269_FIXUP_HEADSET_MODE
7848 },
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08007849 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
7850 .type = HDA_FIXUP_PINS,
7851 .v.pins = (const struct hda_pintbl[]) {
7852 { 0x14, 0x90100120 }, /* use as internal speaker */
7853 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
7854 { 0x1a, 0x01011020 }, /* use as line out */
7855 { },
7856 },
7857 .chained = true,
7858 .chain_id = ALC269_FIXUP_HEADSET_MIC
7859 },
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08007860 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
7861 .type = HDA_FIXUP_PINS,
7862 .v.pins = (const struct hda_pintbl[]) {
7863 { 0x18, 0x02a11030 }, /* use as headset mic */
7864 { }
7865 },
7866 .chained = true,
7867 .chain_id = ALC269_FIXUP_HEADSET_MIC
7868 },
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08007869 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
7870 .type = HDA_FIXUP_PINS,
7871 .v.pins = (const struct hda_pintbl[]) {
7872 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
7873 { }
7874 },
7875 .chained = true,
7876 .chain_id = ALC269_FIXUP_HEADSET_MIC
7877 },
Armas Spann293a92c2020-07-24 16:08:37 +02007878 [ALC289_FIXUP_ASUS_GA401] = {
Takashi Iwaic84bfed2020-11-27 15:11:04 +01007879 .type = HDA_FIXUP_FUNC,
7880 .v.func = alc289_fixup_asus_ga401,
7881 .chained = true,
7882 .chain_id = ALC289_FIXUP_ASUS_GA502,
Armas Spannff536642020-07-11 13:05:57 +02007883 },
Armas Spann4b43d052020-07-24 16:06:16 +02007884 [ALC289_FIXUP_ASUS_GA502] = {
7885 .type = HDA_FIXUP_PINS,
7886 .v.pins = (const struct hda_pintbl[]) {
7887 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
7888 { }
7889 },
7890 },
Jian-Hong Panf50a1212020-07-13 14:04:22 +08007891 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
7892 .type = HDA_FIXUP_PINS,
7893 .v.pins = (const struct hda_pintbl[]) {
7894 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
7895 { }
7896 },
7897 .chained = true,
7898 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7899 },
Kailang Yang56496252020-07-29 15:09:27 +08007900 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
7901 .type = HDA_FIXUP_FUNC,
7902 .v.func = alc285_fixup_hp_gpio_amp_init,
7903 .chained = true,
7904 .chain_id = ALC285_FIXUP_HP_GPIO_LED
7905 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08007906 [ALC269_FIXUP_CZC_B20] = {
7907 .type = HDA_FIXUP_PINS,
7908 .v.pins = (const struct hda_pintbl[]) {
7909 { 0x12, 0x411111f0 },
7910 { 0x14, 0x90170110 }, /* speaker */
7911 { 0x15, 0x032f1020 }, /* HP out */
7912 { 0x17, 0x411111f0 },
7913 { 0x18, 0x03ab1040 }, /* mic */
7914 { 0x19, 0xb7a7013f },
7915 { 0x1a, 0x0181305f },
7916 { 0x1b, 0x411111f0 },
7917 { 0x1d, 0x411111f0 },
7918 { 0x1e, 0x411111f0 },
7919 { }
7920 },
7921 .chain_id = ALC269_FIXUP_DMIC,
7922 },
7923 [ALC269_FIXUP_CZC_TMI] = {
7924 .type = HDA_FIXUP_PINS,
7925 .v.pins = (const struct hda_pintbl[]) {
7926 { 0x12, 0x4000c000 },
7927 { 0x14, 0x90170110 }, /* speaker */
7928 { 0x15, 0x0421401f }, /* HP out */
7929 { 0x17, 0x411111f0 },
7930 { 0x18, 0x04a19020 }, /* mic */
7931 { 0x19, 0x411111f0 },
7932 { 0x1a, 0x411111f0 },
7933 { 0x1b, 0x411111f0 },
7934 { 0x1d, 0x40448505 },
7935 { 0x1e, 0x411111f0 },
7936 { 0x20, 0x8000ffff },
7937 { }
7938 },
7939 .chain_id = ALC269_FIXUP_DMIC,
7940 },
7941 [ALC269_FIXUP_CZC_L101] = {
7942 .type = HDA_FIXUP_PINS,
7943 .v.pins = (const struct hda_pintbl[]) {
7944 { 0x12, 0x40000000 },
7945 { 0x14, 0x01014010 }, /* speaker */
7946 { 0x15, 0x411111f0 }, /* HP out */
7947 { 0x16, 0x411111f0 },
7948 { 0x18, 0x01a19020 }, /* mic */
7949 { 0x19, 0x02a19021 },
7950 { 0x1a, 0x0181302f },
7951 { 0x1b, 0x0221401f },
7952 { 0x1c, 0x411111f0 },
7953 { 0x1d, 0x4044c601 },
7954 { 0x1e, 0x411111f0 },
7955 { }
7956 },
7957 .chain_id = ALC269_FIXUP_DMIC,
7958 },
7959 [ALC269_FIXUP_LEMOTE_A1802] = {
7960 .type = HDA_FIXUP_PINS,
7961 .v.pins = (const struct hda_pintbl[]) {
7962 { 0x12, 0x40000000 },
7963 { 0x14, 0x90170110 }, /* speaker */
7964 { 0x17, 0x411111f0 },
7965 { 0x18, 0x03a19040 }, /* mic1 */
7966 { 0x19, 0x90a70130 }, /* mic2 */
7967 { 0x1a, 0x411111f0 },
7968 { 0x1b, 0x411111f0 },
7969 { 0x1d, 0x40489d2d },
7970 { 0x1e, 0x411111f0 },
7971 { 0x20, 0x0003ffff },
7972 { 0x21, 0x03214020 },
7973 { }
7974 },
7975 .chain_id = ALC269_FIXUP_DMIC,
7976 },
7977 [ALC269_FIXUP_LEMOTE_A190X] = {
7978 .type = HDA_FIXUP_PINS,
7979 .v.pins = (const struct hda_pintbl[]) {
7980 { 0x14, 0x99130110 }, /* speaker */
7981 { 0x15, 0x0121401f }, /* HP out */
7982 { 0x18, 0x01a19c20 }, /* rear mic */
7983 { 0x19, 0x99a3092f }, /* front mic */
7984 { 0x1b, 0x0201401f }, /* front lineout */
7985 { }
7986 },
7987 .chain_id = ALC269_FIXUP_DMIC,
7988 },
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08007989 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
7990 .type = HDA_FIXUP_PINS,
7991 .v.pins = (const struct hda_pintbl[]) {
7992 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7993 { }
7994 },
7995 .chained = true,
7996 .chain_id = ALC269_FIXUP_HEADSET_MODE
7997 },
Werner Sembach73e71612021-03-02 19:04:14 +01007998 [ALC256_FIXUP_INTEL_NUC10] = {
7999 .type = HDA_FIXUP_PINS,
8000 .v.pins = (const struct hda_pintbl[]) {
8001 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8002 { }
8003 },
8004 .chained = true,
8005 .chain_id = ALC269_FIXUP_HEADSET_MODE
8006 },
Hui Wangfc19d552020-09-09 10:00:41 +08008007 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8008 .type = HDA_FIXUP_VERBS,
8009 .v.verbs = (const struct hda_verb[]) {
8010 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8011 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8012 { }
8013 },
8014 .chained = true,
Takashi Iwaic84bfed2020-11-27 15:11:04 +01008015 .chain_id = ALC289_FIXUP_ASUS_GA502
Hui Wangfc19d552020-09-09 10:00:41 +08008016 },
Hui Wang13468bf2020-09-28 16:01:17 +08008017 [ALC274_FIXUP_HP_MIC] = {
8018 .type = HDA_FIXUP_VERBS,
8019 .v.verbs = (const struct hda_verb[]) {
8020 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8021 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8022 { }
8023 },
8024 },
Kailang Yang8a8de09c2020-10-27 16:46:38 +08008025 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8026 .type = HDA_FIXUP_FUNC,
8027 .v.func = alc274_fixup_hp_headset_mic,
8028 .chained = true,
8029 .chain_id = ALC274_FIXUP_HP_MIC
8030 },
Takashi Iwai622464c2021-05-04 11:18:02 +02008031 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8032 .type = HDA_FIXUP_FUNC,
8033 .v.func = alc274_fixup_hp_envy_gpio,
8034 },
Kailang Yangef9ce662020-11-03 15:40:35 +08008035 [ALC256_FIXUP_ASUS_HPE] = {
8036 .type = HDA_FIXUP_VERBS,
8037 .v.verbs = (const struct hda_verb[]) {
8038 /* Set EAPD high */
8039 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8040 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8041 { }
8042 },
8043 .chained = true,
8044 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8045 },
Kailang Yang446b8182020-11-02 15:00:12 +08008046 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8047 .type = HDA_FIXUP_FUNC,
8048 .v.func = alc_fixup_headset_jack,
8049 .chained = true,
8050 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8051 },
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008052 [ALC287_FIXUP_HP_GPIO_LED] = {
8053 .type = HDA_FIXUP_FUNC,
8054 .v.func = alc287_fixup_hp_gpio_led,
8055 },
Kailang Yang9e885772020-11-03 15:30:51 +08008056 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8057 .type = HDA_FIXUP_FUNC,
8058 .v.func = alc274_fixup_hp_headset_mic,
8059 },
Kailang Yang92666d42020-11-19 17:04:21 +08008060 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8061 .type = HDA_FIXUP_FUNC,
8062 .v.func = alc_fixup_no_int_mic,
8063 .chained = true,
8064 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8065 },
Chris Chiu34cdf402020-12-16 20:52:00 +08008066 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8067 .type = HDA_FIXUP_PINS,
8068 .v.pins = (const struct hda_pintbl[]) {
8069 { 0x1b, 0x411111f0 },
8070 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8071 { },
8072 },
8073 .chained = true,
8074 .chain_id = ALC269_FIXUP_HEADSET_MODE
8075 },
Chris Chiu495dc762021-01-14 16:27:28 +08008076 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8077 .type = HDA_FIXUP_FUNC,
8078 .v.func = alc269_fixup_limit_int_mic_boost,
8079 .chained = true,
8080 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8081 },
Chris Chiud0e18562021-02-26 09:04:40 +08008082 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8083 .type = HDA_FIXUP_PINS,
8084 .v.pins = (const struct hda_pintbl[]) {
8085 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8086 { 0x1a, 0x90a1092f }, /* use as internal mic */
8087 { }
8088 },
8089 .chained = true,
8090 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8091 },
Takashi Iwai26928ca2021-04-16 10:12:11 +02008092 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8093 .type = HDA_FIXUP_FUNC,
8094 .v.func = alc285_fixup_ideapad_s740_coef,
8095 .chained = true,
8096 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8097 },
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008098 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8099 .type = HDA_FIXUP_FUNC,
8100 .v.func = alc269_fixup_limit_int_mic_boost,
8101 .chained = true,
8102 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8103 },
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008104 [ALC295_FIXUP_ASUS_DACS] = {
8105 .type = HDA_FIXUP_FUNC,
8106 .v.func = alc295_fixup_asus_dacs,
8107 },
Takashi Iwai5d84b532021-05-04 14:18:32 +02008108 [ALC295_FIXUP_HP_OMEN] = {
8109 .type = HDA_FIXUP_PINS,
8110 .v.pins = (const struct hda_pintbl[]) {
8111 { 0x12, 0xb7a60130 },
8112 { 0x13, 0x40000000 },
8113 { 0x14, 0x411111f0 },
8114 { 0x16, 0x411111f0 },
8115 { 0x17, 0x90170110 },
8116 { 0x18, 0x411111f0 },
8117 { 0x19, 0x02a11030 },
8118 { 0x1a, 0x411111f0 },
8119 { 0x1b, 0x04a19030 },
8120 { 0x1d, 0x40600001 },
8121 { 0x1e, 0x411111f0 },
8122 { 0x21, 0x03211020 },
8123 {}
8124 },
8125 .chained = true,
8126 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8127 },
Elia Devitof2be77f2021-05-11 14:46:49 +02008128 [ALC285_FIXUP_HP_SPECTRE_X360] = {
8129 .type = HDA_FIXUP_PINS,
8130 .v.pins = (const struct hda_pintbl[]) {
8131 { 0x14, 0x90170110 }, /* enable top speaker */
8132 {}
8133 },
8134 .chained = true,
8135 .chain_id = ALC285_FIXUP_SPEAKER2_TO_DAC1,
8136 },
Hui Wang9ebaef02021-05-22 12:26:45 +08008137 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8138 .type = HDA_FIXUP_FUNC,
8139 .v.func = alc285_fixup_ideapad_s740_coef,
8140 .chained = true,
8141 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8142 },
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03008143 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8144 .type = HDA_FIXUP_FUNC,
8145 .v.func = alc_fixup_no_shutup,
8146 .chained = true,
8147 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8148 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02008149};
8150
8151static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01008152 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02008153 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8154 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008155 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02008156 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008157 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8158 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05008159 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01008160 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02008161 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Takashi Iwai433f8942021-04-28 13:26:56 +02008162 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
Takashi Iwaic8426b22021-04-07 11:57:30 +02008163 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
Chris Chiu13be30f2020-12-22 23:04:59 +08008164 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
Chris Chiu705b65f2018-12-05 14:48:54 +08008165 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08008166 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01008167 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiu495dc762021-01-14 16:27:28 +08008168 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
Chris Chiuc7531e32019-03-21 17:17:31 +08008169 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8170 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiu13be30f2020-12-22 23:04:59 +08008171 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8172 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008173 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08008174 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08008175 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiud0e18562021-02-26 09:04:40 +08008176 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08008177 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8178 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8179 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Chris Chiud0e18562021-02-26 09:04:40 +08008180 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pan2733cce2019-03-21 16:39:04 +08008181 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08008182 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08008183 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Panf50a1212020-07-13 14:04:22 +08008184 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
David Henningssonaaedfb42013-08-16 14:09:02 +02008185 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08008186 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01008187 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01008188 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02008189 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8190 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008191 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02008192 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8193 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8194 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01008195 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8196 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01008197 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02008198 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008199 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08008200 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8201 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08008202 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02008203 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02008204 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08008205 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08008206 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8207 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01008208 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8209 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8210 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8211 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8212 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08008213 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08008214 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01008215 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08008216 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08008217 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwai493de342017-02-28 17:27:57 +01008218 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008219 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Kailang Yang5f364132017-07-25 16:28:16 +08008220 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08008221 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8222 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08008223 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8224 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08008225 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yang136824e2019-03-14 16:22:45 +08008226 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
Kailang Yangda484d02019-03-14 15:50:59 +08008227 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08008228 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yange79c2262019-12-19 14:12:15 +08008229 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008230 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Kailang Yang78def222020-02-20 15:21:54 +08008231 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8232 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
Kailang Yang92666d42020-11-19 17:04:21 +08008233 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8234 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
Kailang Yangc1e89522020-12-23 15:34:57 +08008235 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yanga22aa262014-04-23 17:34:28 +08008236 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8237 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01008238 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008239 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01008240 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
Hui Wang7976eb42015-02-13 11:14:41 +08008241 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008242 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008243 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008244 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8245 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8246 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8247 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008248 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8249 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8250 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8251 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008252 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008253 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8254 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8255 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8256 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8257 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008258 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008259 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008260 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08008261 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008262 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8263 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8264 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008265 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8266 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8267 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8268 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8269 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008270 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008271 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008272 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008273 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008274 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08008275 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008276 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008277 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008278 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008279 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8280 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8281 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8282 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8283 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008284 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008285 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8286 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008287 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8288 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8289 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8290 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang8a02b162014-06-13 17:16:31 +08008291 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8292 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8293 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8294 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008295 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8296 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Kailang Yang1c9d9df2021-04-20 14:17:34 +08008297 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8298 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
Takashi Iwai563785e2018-11-12 09:43:12 +01008299 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08008300 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01008301 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Takashi Iwaiaeedad22020-11-28 10:00:15 +01008302 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008303 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8304 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05008305 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai190d0382019-08-13 17:39:56 +02008306 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai5d84b532021-05-04 14:18:32 +02008307 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
Sam Bazleyd33cd422019-09-01 03:31:30 +01008308 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Elia Devitof2be77f2021-05-11 14:46:49 +02008309 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008310 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Takashi Iwai622464c2021-05-04 11:18:02 +02008311 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
Kai-Heng Fenga5980982020-12-30 20:56:35 +08008312 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008313 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
Jonas Witschel75b62ab2021-04-16 12:58:54 +02008314 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Kailang Yang56496252020-07-29 15:09:27 +08008315 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Qiu Wenbo08befca2020-10-02 20:44:54 +08008316 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang431e76c2020-04-07 14:40:20 +08008317 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang24164f42020-04-07 14:52:42 +08008318 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Jeremy Szu91bc1562021-01-06 21:05:46 +08008319 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8320 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8321 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8322 ALC285_FIXUP_HP_GPIO_AMP_INIT),
Manuel Jiménez48422952020-12-29 15:38:56 +01008323 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
Jeremy Szue7d66cf2021-03-16 15:46:24 +08008324 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Jeremy Szu417eadf2021-03-30 19:44:27 +08008325 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008326 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8327 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01008328 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
Jeremy Szu53b861b2021-03-16 17:42:35 +08008329 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuca688332021-03-16 14:54:50 +08008330 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008331 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008332 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02008333 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02008334 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01008335 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008336 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008337 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02008338 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008339 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008340 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Chris Chiu5cfca592020-12-07 15:27:55 +08008341 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008342 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8343 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008344 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008345 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008346 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01008347 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01008348 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02008349 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008350 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
Chris Chiu48e01502019-12-30 11:11:18 +08008351 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008352 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
Daniel Drake8c8967a2019-10-17 16:15:01 +08008353 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
Adam Barber4963d662020-04-10 17:00:32 +08008354 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
Kailang Yang158ae2f2020-07-16 15:21:59 +08008355 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan5de3b942021-01-22 13:47:06 +08008356 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08008357 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan7900e812020-05-12 14:15:28 +08008358 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai017f2a12011-07-09 14:42:25 +02008359 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06008360 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai1b94e592020-05-12 09:32:03 +02008361 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
David Henningsson693b6132012-06-22 19:12:10 +02008362 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06008363 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008364 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008365 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Kailang Yangef9ce662020-11-03 15:40:35 +08008366 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
Armas Spann4b43d052020-07-24 16:06:16 +02008367 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05008368 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
Luke D Jones76fae612021-04-19 15:04:11 +12008369 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
Armas Spann293a92c2020-07-24 16:08:37 +02008370 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
Chris Chiueeed4cd2017-02-28 14:17:15 -06008371 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02008372 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8373 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8374 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8375 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02008376 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008377 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8378 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8379 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02008380 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwaicab561f2021-04-28 13:26:59 +02008381 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8382 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai24519912011-08-16 15:08:49 +02008383 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02008384 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02008385 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01008386 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
Takashi Iwaic656f742021-04-28 13:27:01 +02008387 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
David Henningsson2041d562014-06-13 11:15:44 +02008388 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08008389 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
Takashi Iwaic656f742021-04-28 13:27:01 +02008390 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
PeiSen Hou6fa38ef2020-07-27 13:56:47 +02008391 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
PeiSen Houce2e79b2020-12-31 11:57:28 +01008392 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8393 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09008394 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02008395 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Mike Pozulp14425f12020-05-09 20:28:37 -07008396 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8397 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Mike Pozulpf70fff82020-08-13 21:53:44 -07008398 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Adrien Crivelli8bcea6c2020-08-26 17:40:14 +09008399 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01008400 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Joonho Wohn568e4e82020-07-18 17:23:15 +09008401 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Takashi Iwaic656f742021-04-28 13:27:01 +02008402 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Anisse Astierabaa22742016-08-24 09:14:13 +02008403 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
8404 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01008405 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
Chris Chiu6ca653e2020-12-22 23:04:58 +08008406 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008407 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller89e3a562019-01-30 16:12:31 -07008408 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008409 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8410 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8411 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8412 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8413 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8414 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8415 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8416 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8417 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8418 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8419 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8420 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8421 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8422 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8423 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8424 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008425 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008426 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008427 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8428 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008429 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8430 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8431 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8432 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8433 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008434 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8435 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8436 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8437 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008438 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8439 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8440 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8441 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8442 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller80a50522019-05-07 17:11:08 -04008443 SND_PCI_QUIRK(0x1558, 0x8550, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller891afcf2019-05-10 10:15:07 -04008444 SND_PCI_QUIRK(0x1558, 0x8551, "System76 Gazelle (gaze14)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8445 SND_PCI_QUIRK(0x1558, 0x8560, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
8446 SND_PCI_QUIRK(0x1558, 0x8561, "System76 Gazelle (gaze14)", ALC269_FIXUP_HEADSET_MIC),
Eckhart Mohr48698c92021-03-02 17:25:22 +01008447 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008448 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8449 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8450 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8451 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8452 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8453 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8454 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008455 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01008456 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8457 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8458 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL53RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02008459 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL5XNU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8460 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8461 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8462 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8463 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8464 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
8465 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Kailang Yangca169cc2017-04-25 16:17:40 +08008466 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03008467 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008468 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
8469 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
8470 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
8471 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
8472 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwaif552ff52021-04-28 13:27:00 +02008473 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwaib590b382020-05-14 18:05:33 +02008474 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
Felix Kaechelec8415a42012-08-06 23:02:01 +02008475 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02008476 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02008477 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02008478 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01008479 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02008480 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02008481 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05008482 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02008483 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01008484 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02008485 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01008486 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07008487 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02008488 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008489 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8490 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02008491 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02008492 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008493 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
8494 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8495 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01008496 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008497 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8498 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8499 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01008500 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Benjamin Poirier9774dc22020-07-03 17:00:04 +09008501 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Hans de Goedeca707b32020-04-02 19:43:11 +02008502 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Kailang Yang446b8182020-11-02 15:00:12 +08008503 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
8504 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
Kailang3694cb22015-12-28 11:35:24 +08008505 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08008506 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08008507 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Dennis Wassenbergbef33e12019-06-28 10:54:53 +02008508 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08008509 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08008510 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08008511 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang2a36c162019-09-04 13:53:27 +08008512 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Aaron Ma8a6c55d2019-10-24 19:44:39 +08008513 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
8514 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Kailang Yangf86de9b2020-10-23 14:46:47 +08008515 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
Takashi Iwai26928ca2021-04-16 10:12:11 +02008516 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
Hui Wang9ebaef02021-05-22 12:26:45 +08008517 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
David Henningsson56f27012016-01-11 09:33:14 +01008518 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01008519 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Michał Wadowski56df90b2019-05-14 16:58:00 +02008520 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaif552ff52021-04-28 13:27:00 +02008521 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
David Henningssona4a9e082013-08-16 14:09:01 +02008522 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02008523 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02008524 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008525 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02008526 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01008527 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02008528 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02008529 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08008530 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008531 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02008532 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02008533 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008534 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8535 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8536 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02008537 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08008538 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
8539 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008540 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008541 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008542 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
8543 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
8544 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
Anisse Astier02b504d2013-06-03 11:53:10 +02008545 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaic656f742021-04-28 13:27:01 +02008546 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
8547 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
Hui Wangfc19d552020-09-09 10:00:41 +08008548 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Xiaoliang Yub95bc122021-03-16 00:49:00 +08008549 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang695d1ec2019-11-21 10:54:27 +08008550 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
Xiaoliang Yue1c86212021-03-13 07:54:53 +08008551 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Phil Calvind1ee66c2021-04-15 18:01:29 -04008552 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08008553 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
Werner Sembach73e71612021-03-02 19:04:14 +01008554 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008555
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01008556#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02008557 /* Below is a quirk table taken from the old code.
8558 * Basically the device should work as is without the fixup table.
8559 * If BIOS doesn't give a proper info, enable the corresponding
8560 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008561 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02008562 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
8563 ALC269_FIXUP_AMIC),
8564 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02008565 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
8566 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
8567 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
8568 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
8569 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
8570 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
8571 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
8572 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
8573 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
8574 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
8575 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
8576 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
8577 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
8578 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
8579 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
8580 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
8581 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
8582 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
8583 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
8584 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
8585 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
8586 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
8587 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
8588 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
8589 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
8590 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
8591 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
8592 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
8593 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
8594 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
8595 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
8596 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
8597 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
8598 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
8599 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
8600 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
8601 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
8602 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
8603#endif
8604 {}
8605};
8606
David Henningsson214eef72014-07-22 14:09:35 +02008607static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
8608 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
8609 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
8610 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
8611 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04008612 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
David Henningsson214eef72014-07-22 14:09:35 +02008613 {}
8614};
8615
Takashi Iwai1727a772013-01-10 09:52:52 +01008616static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02008617 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
8618 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02008619 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
8620 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
8621 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02008622 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02008623 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
8624 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02008625 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwaib590b382020-05-14 18:05:33 +02008626 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008627 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008628 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02008629 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
8630 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008631 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
8632 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08008633 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08008634 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02008635 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01008636 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02008637 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwai399c01a2020-05-26 08:24:06 +02008638 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008639 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02008640 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02008641 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008642 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
8643 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
8644 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
8645 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
8646 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
8647 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
8648 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
8649 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
8650 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
8651 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
8652 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
8653 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
8654 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
8655 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
8656 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
8657 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
8658 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
8659 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
8660 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
8661 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
8662 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
8663 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
8664 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
8665 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
8666 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
8667 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
8668 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
8669 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
8670 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
8671 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
8672 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
8673 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
8674 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
8675 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
8676 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
8677 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
8678 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
8679 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
8680 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
8681 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01008682 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008683 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
Takashi Iwaic8426b22021-04-07 11:57:30 +02008684 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008685 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
8686 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
8687 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
8688 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
8689 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
8690 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
8691 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
8692 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
8693 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
8694 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
8695 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
8696 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
8697 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
8698 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008699 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
8700 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
8701 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08008702 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008703 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01008704 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02008705 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
8706 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
8707 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
8708 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
8709 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
8710 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
8711 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
8712 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
8713 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
8714 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
8715 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
8716 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
8717 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
8718 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
8719 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
8720 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
8721 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yang8983eb62019-04-03 15:31:49 +08008722 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
8723 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008724 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02008725 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02008726 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
Mike Pozulp23dc9582020-08-16 21:32:17 -07008727 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
Hui Wangfc19d552020-09-09 10:00:41 +08008728 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
Hui Wang13468bf2020-09-28 16:01:17 +08008729 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01008730 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
Takashi Iwai5d84b532021-05-04 14:18:32 +02008731 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
Elia Devitof2be77f2021-05-11 14:46:49 +02008732 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
Hui Wang9ebaef02021-05-22 12:26:45 +08008733 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03008734 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02008735 {}
8736};
Kailang Yangcfc5a842016-02-03 15:20:39 +08008737#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08008738 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02008739
Hui Wange8191a82015-04-24 13:39:59 +08008740#define ALC256_STANDARD_PINS \
8741 {0x12, 0x90a60140}, \
8742 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08008743 {0x21, 0x02211020}
8744
David Henningssonfea185e2014-09-03 10:23:04 +02008745#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008746 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08008747
David Henningssonfea185e2014-09-03 10:23:04 +02008748#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08008749 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02008750
8751#define ALC292_STANDARD_PINS \
8752 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08008753 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08008754
Hui Wang3f6409702016-09-11 11:26:16 +08008755#define ALC295_STANDARD_PINS \
8756 {0x12, 0xb7a60130}, \
8757 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08008758 {0x21, 0x04211020}
8759
Woodrow Shen703867e2015-08-05 12:34:12 +08008760#define ALC298_STANDARD_PINS \
8761 {0x12, 0x90a60130}, \
8762 {0x21, 0x03211020}
8763
Hui Wange1918932014-05-26 16:22:44 +08008764static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08008765 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
8766 {0x14, 0x01014020},
8767 {0x17, 0x90170110},
8768 {0x18, 0x02a11030},
8769 {0x19, 0x0181303F},
8770 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06008771 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8772 {0x12, 0x90a601c0},
8773 {0x14, 0x90171120},
8774 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06008775 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8776 {0x14, 0x90170110},
8777 {0x1b, 0x90a70130},
8778 {0x21, 0x03211020}),
8779 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
8780 {0x1a, 0x90a70130},
8781 {0x1b, 0x90170110},
8782 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01008783 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008784 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008785 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008786 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01008787 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08008788 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08008789 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08008790 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08008791 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8792 ALC225_STANDARD_PINS,
8793 {0x12, 0xb7a60150},
8794 {0x14, 0x901701a0}),
8795 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8796 ALC225_STANDARD_PINS,
8797 {0x12, 0xb7a60150},
8798 {0x14, 0x901701b0}),
8799 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
8800 ALC225_STANDARD_PINS,
8801 {0x12, 0xb7a60130},
8802 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05008803 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
8804 {0x1b, 0x01111010},
8805 {0x1e, 0x01451130},
8806 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08008807 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
8808 {0x12, 0x90a60140},
8809 {0x14, 0x90170110},
8810 {0x19, 0x02a11030},
8811 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08008812 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8813 {0x14, 0x90170110},
8814 {0x19, 0x02a11030},
8815 {0x1a, 0x02a11040},
8816 {0x1b, 0x01014020},
8817 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08008818 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8819 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08008820 {0x19, 0x02a11030},
8821 {0x1a, 0x02a11040},
8822 {0x1b, 0x01011020},
8823 {0x21, 0x0221101f}),
8824 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
8825 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08008826 {0x19, 0x02a11020},
8827 {0x1a, 0x02a11030},
8828 {0x21, 0x0221101f}),
Kailang Yang92666d42020-11-19 17:04:21 +08008829 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
8830 {0x21, 0x02211010}),
Kailang Yang9e885772020-11-03 15:30:51 +08008831 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8832 {0x14, 0x90170110},
8833 {0x19, 0x02a11020},
8834 {0x21, 0x02211030}),
Hui Wangc77900e2014-09-03 11:31:07 +08008835 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08008836 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08008837 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02008838 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08008839 {0x14, 0x90170130},
8840 {0x21, 0x02211040}),
8841 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008842 {0x12, 0x90a60140},
8843 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02008844 {0x21, 0x02211020}),
8845 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8846 {0x12, 0x90a60160},
8847 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008848 {0x21, 0x02211030}),
8849 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08008850 {0x14, 0x90170110},
8851 {0x1b, 0x02011020},
8852 {0x21, 0x0221101f}),
8853 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08008854 {0x14, 0x90170110},
8855 {0x1b, 0x01011020},
8856 {0x21, 0x0221101f}),
8857 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02008858 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02008859 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02008860 {0x21, 0x0221103f}),
8861 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08008862 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08008863 {0x1b, 0x01011020},
8864 {0x21, 0x0221103f}),
8865 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8866 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08008867 {0x1b, 0x02011020},
8868 {0x21, 0x0221103f}),
8869 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008870 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008871 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008872 {0x21, 0x0221105f}),
8873 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08008874 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008875 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08008876 {0x21, 0x0221101f}),
8877 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02008878 {0x12, 0x90a60160},
8879 {0x14, 0x90170120},
8880 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008881 {0x21, 0x0321102f}),
8882 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8883 {0x12, 0x90a60160},
8884 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008885 {0x21, 0x02211040}),
8886 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8887 {0x12, 0x90a60160},
8888 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02008889 {0x21, 0x02211050}),
8890 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8891 {0x12, 0x90a60170},
8892 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02008893 {0x21, 0x02211030}),
8894 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8895 {0x12, 0x90a60170},
8896 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02008897 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08008898 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08008899 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08008900 {0x14, 0x90171130},
8901 {0x21, 0x02211040}),
8902 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8903 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08008904 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08008905 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02008906 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02008907 {0x12, 0x90a60180},
8908 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02008909 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08008910 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8911 {0x12, 0x90a60180},
8912 {0x14, 0x90170120},
8913 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08008914 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
8915 {0x1b, 0x01011020},
8916 {0x21, 0x02211010}),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008917 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8918 {0x14, 0x90170110},
8919 {0x1b, 0x90a70130},
8920 {0x21, 0x04211020}),
8921 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
8922 {0x14, 0x90170110},
8923 {0x1b, 0x90a70130},
8924 {0x21, 0x03211020}),
Jian-Hong Pane1037352019-03-22 11:37:18 +08008925 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiua806ef12019-03-22 11:37:20 +08008926 {0x12, 0x90a60130},
8927 {0x14, 0x90170110},
8928 {0x21, 0x03211020}),
8929 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan6ac371a2019-03-22 11:37:22 +08008930 {0x12, 0x90a60130},
8931 {0x14, 0x90170110},
8932 {0x21, 0x04211020}),
8933 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pane1037352019-03-22 11:37:18 +08008934 {0x1a, 0x90a70130},
8935 {0x1b, 0x90170110},
8936 {0x21, 0x03211020}),
Kailang Yang9e885772020-11-03 15:30:51 +08008937 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
8938 {0x14, 0x90170110},
8939 {0x19, 0x02a11020},
8940 {0x21, 0x0221101f}),
Kailang Yang8a8de09c2020-10-27 16:46:38 +08008941 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
8942 {0x17, 0x90170110},
8943 {0x19, 0x03a11030},
8944 {0x21, 0x03211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01008945 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
8946 {0x12, 0x90a60130},
David Henningssoncf51eb92014-10-30 08:26:02 +01008947 {0x14, 0x90170110},
8948 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08008949 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08008950 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
8951 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08008952 {0x14, 0x90170110},
8953 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08008954 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08008955 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08008956 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02008957 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008958 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02008959 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02008960 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02008961 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08008962 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008963 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008964 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008965 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08008966 {0x21, 0x03211040}),
8967 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008968 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008969 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008970 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08008971 {0x21, 0x03211020}),
8972 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02008973 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08008974 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08008975 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08008976 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08008977 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02008978 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08008979 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08008980 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08008981 {0x21, 0x04211020}),
Chris Chiu34cdf402020-12-16 20:52:00 +08008982 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
8983 ALC282_STANDARD_PINS,
8984 {0x12, 0x90a609c0},
8985 {0x18, 0x03a11830},
8986 {0x19, 0x04a19831},
8987 {0x1a, 0x0481303f},
8988 {0x1b, 0x04211020},
8989 {0x21, 0x0321101f}),
8990 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
8991 ALC282_STANDARD_PINS,
8992 {0x12, 0x90a60940},
8993 {0x18, 0x03a11830},
8994 {0x19, 0x04a19831},
8995 {0x1a, 0x0481303f},
8996 {0x1b, 0x04211020},
8997 {0x21, 0x0321101f}),
David Henningsson76c21322014-06-24 14:46:54 +02008998 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02008999 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02009000 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02009001 {0x21, 0x0321101f}),
9002 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9003 {0x12, 0x90a60160},
9004 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009005 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08009006 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009007 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08009008 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08009009 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08009010 {0x21, 0x0321101f}),
Hui Wangc8c6ee62019-02-14 11:41:33 +08009011 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Sami Loone266fd992021-05-01 12:07:53 +02009012 {0x12, 0x90a60130},
9013 {0x14, 0x90170110},
9014 {0x19, 0x04a11040},
9015 {0x21, 0x04211020}),
9016 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9017 {0x14, 0x90170110},
9018 {0x19, 0x04a11040},
9019 {0x1d, 0x40600001},
9020 {0x21, 0x04211020}),
9021 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Hui Wangc4cfcf62018-11-26 14:17:16 +08009022 {0x14, 0x90170110},
9023 {0x19, 0x04a11040},
9024 {0x21, 0x04211020}),
Hui Wangc72b9bf2020-12-05 13:11:30 +08009025 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9026 {0x14, 0x90170110},
9027 {0x17, 0x90170111},
9028 {0x19, 0x03a11030},
9029 {0x21, 0x03211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08009030 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9031 {0x12, 0x90a60130},
9032 {0x17, 0x90170110},
9033 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02009034 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08009035 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08009036 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08009037 {0x21, 0x0321101f}),
Hui Wange4442bc2014-09-03 11:31:09 +08009038 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009039 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009040 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08009041 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08009042 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009043 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009044 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009045 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08009046 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08009047 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009048 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009049 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009050 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009051 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009052 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009053 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009054 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009055 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08009056 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009057 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009058 {0x14, 0x90170110},
9059 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009060 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08009061 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009062 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009063 {0x14, 0x90170110},
9064 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009065 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009066 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009067 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009068 {0x14, 0x90170110},
9069 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009070 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08009071 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009072 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08009073 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08009074 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08009075 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08009076 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009077 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08009078 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08009079 {0x16, 0x01014020},
9080 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08009081 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02009082 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009083 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08009084 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02009085 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009086 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02009087 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02009088 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08009089 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02009090 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009091 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08009092 {0x13, 0x90a60140}),
Jian-Hong Paneeacd802020-11-24 17:20:25 +08009093 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9094 {0x17, 0x90170110},
9095 {0x21, 0x04211020}),
Chris Chiud8ae4582018-12-07 17:17:11 +08009096 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9097 {0x14, 0x90170110},
9098 {0x1b, 0x90a70130},
9099 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08009100 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9101 {0x12, 0x90a60130},
9102 {0x17, 0x90170110},
Jian-Hong Pan8bb37a22019-02-21 17:00:18 +08009103 {0x21, 0x03211020}),
9104 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9105 {0x12, 0x90a60130},
9106 {0x17, 0x90170110},
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08009107 {0x21, 0x04211020}),
Takashi Iwai3887c262019-04-30 15:10:01 +02009108 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9109 {0x12, 0x90a60130},
9110 {0x17, 0x90170110},
9111 {0x21, 0x03211020}),
Chris Chiu9e433422020-05-12 14:15:24 +08009112 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Panad97d662020-05-12 14:15:26 +08009113 {0x12, 0x90a60120},
9114 {0x17, 0x90170110},
9115 {0x21, 0x04211030}),
9116 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiu9e433422020-05-12 14:15:24 +08009117 {0x12, 0x90a60130},
9118 {0x17, 0x90170110},
9119 {0x21, 0x03211020}),
9120 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9121 {0x12, 0x90a60130},
9122 {0x17, 0x90170110},
9123 {0x21, 0x03211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08009124 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Kailang Yang0a29c572019-04-24 16:34:25 +08009125 {0x14, 0x90170110},
9126 {0x21, 0x04211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08009127 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9128 {0x14, 0x90170110},
9129 {0x21, 0x04211030}),
Hui Wang3f6409702016-09-11 11:26:16 +08009130 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08009131 ALC295_STANDARD_PINS,
9132 {0x17, 0x21014020},
9133 {0x18, 0x21a19030}),
9134 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9135 ALC295_STANDARD_PINS,
9136 {0x17, 0x21014040},
9137 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08009138 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9139 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08009140 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08009141 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02009142 {0x17, 0x90170110}),
9143 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9144 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08009145 {0x17, 0x90170140}),
9146 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9147 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02009148 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08009149 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9150 {0x12, 0xb7a60140},
9151 {0x13, 0xb7a60150},
9152 {0x17, 0x90170110},
9153 {0x1a, 0x03011020},
9154 {0x21, 0x03211030}),
James McDonnell54324222019-09-16 14:53:38 +00009155 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9156 {0x12, 0xb7a60140},
9157 {0x17, 0x90170110},
9158 {0x1a, 0x03a11030},
9159 {0x21, 0x03211020}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08009160 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9161 ALC225_STANDARD_PINS,
9162 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08009163 {0x17, 0x90170110}),
Hui Wang573fcbf2020-06-08 19:55:41 +08009164 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9165 {0x14, 0x01014010},
9166 {0x17, 0x90170120},
9167 {0x18, 0x02a11030},
9168 {0x19, 0x02a1103f},
9169 {0x21, 0x0221101f}),
Hui Wange1918932014-05-26 16:22:44 +08009170 {}
9171};
Takashi Iwai1d045db2011-07-07 18:23:21 +02009172
Hui Wang7c0a6932019-08-16 14:27:40 +08009173/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9174 * more machines, don't need to match all valid pins, just need to match
9175 * all the pins defined in the tbl. Just because of this reason, it is possible
9176 * that a single machine matches multiple tbls, so there is one limitation:
9177 * at most one tbl is allowed to define for the same vendor and same codec
9178 */
9179static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9180 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9181 {0x19, 0x40000000},
9182 {0x1b, 0x40000000}),
Hui Wangaed8c7f2019-11-21 10:26:43 +08009183 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9184 {0x19, 0x40000000},
9185 {0x1a, 0x40000000}),
Hui Wangd64ebdb2019-11-21 10:26:44 +08009186 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9187 {0x19, 0x40000000},
9188 {0x1a, 0x40000000}),
Hui Wang5815bdf2019-12-11 13:13:21 +08009189 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9190 {0x19, 0x40000000},
9191 {0x1a, 0x40000000}),
Hui Wang7c0a6932019-08-16 14:27:40 +08009192 {}
9193};
9194
Takashi Iwai546bb672012-03-07 08:37:19 +01009195static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02009196{
Kailang Yang526af6e2012-03-07 08:25:20 +01009197 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009198 int val;
9199
Kailang Yang526af6e2012-03-07 08:25:20 +01009200 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01009201 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01009202
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009203 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009204 alc_write_coef_idx(codec, 0xf, 0x960b);
9205 alc_write_coef_idx(codec, 0xe, 0x8817);
9206 }
9207
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009208 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009209 alc_write_coef_idx(codec, 0xf, 0x960b);
9210 alc_write_coef_idx(codec, 0xe, 0x8814);
9211 }
9212
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009213 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009214 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02009215 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009216 }
9217
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009218 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009219 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009220 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009221 /* Capless ramp up clock control */
9222 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9223 }
9224 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009225 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009226 /* Class D power on reset */
9227 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9228 }
9229 }
9230
Takashi Iwai98b24882014-08-18 13:47:50 +02009231 /* HP */
9232 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009233}
9234
9235/*
9236 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009237static int patch_alc269(struct hda_codec *codec)
9238{
9239 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02009240 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009241
Takashi Iwai3de95172012-05-07 18:03:15 +02009242 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009243 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02009244 return err;
9245
9246 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01009247 spec->gen.shared_mic_vref_pin = 0x18;
Kailang Yang317d9312019-05-23 14:43:04 +08009248 codec->power_save_node = 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009249
Takashi Iwai225068a2015-05-29 10:42:14 +02009250#ifdef CONFIG_PM
9251 codec->patch_ops.suspend = alc269_suspend;
9252 codec->patch_ops.resume = alc269_resume;
9253#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08009254 spec->shutup = alc_default_shutup;
9255 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02009256
Takashi Iwai7639a062015-03-03 10:07:24 +01009257 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01009258 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009259 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009260 switch (alc_get_coef0(codec) & 0x00f0) {
9261 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009262 if (codec->bus->pci &&
9263 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009264 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009265 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009266 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009267 break;
9268 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009269 if (codec->bus->pci &&
9270 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009271 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009272 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009273 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009274 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02009275 case 0x0030:
9276 spec->codec_variant = ALC269_TYPE_ALC269VD;
9277 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009278 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009279 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009280 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009281 if (err < 0)
9282 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08009283 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01009284 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009285 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01009286 break;
9287
9288 case 0x10ec0280:
9289 case 0x10ec0290:
9290 spec->codec_variant = ALC269_TYPE_ALC280;
9291 break;
9292 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01009293 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08009294 spec->shutup = alc282_shutup;
9295 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01009296 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02009297 case 0x10ec0233:
9298 case 0x10ec0283:
9299 spec->codec_variant = ALC269_TYPE_ALC283;
9300 spec->shutup = alc283_shutup;
9301 spec->init_hook = alc283_init;
9302 break;
Kailang Yang065380f2013-01-10 10:25:48 +01009303 case 0x10ec0284:
9304 case 0x10ec0292:
9305 spec->codec_variant = ALC269_TYPE_ALC284;
9306 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02009307 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08009308 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02009309 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02009310 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08009311 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02009312 spec->codec_variant = ALC269_TYPE_ALC286;
9313 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08009314 case 0x10ec0298:
9315 spec->codec_variant = ALC269_TYPE_ALC298;
9316 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08009317 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009318 case 0x10ec0255:
9319 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08009320 spec->shutup = alc256_shutup;
9321 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009322 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08009323 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08009324 case 0x10ec0256:
9325 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08009326 spec->shutup = alc256_shutup;
9327 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02009328 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yang4344aec2014-12-17 17:39:05 +08009329 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009330 case 0x10ec0257:
9331 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08009332 spec->shutup = alc256_shutup;
9333 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009334 spec->gen.mixer_nid = 0;
9335 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009336 case 0x10ec0215:
Kailang Yang7fbdcd82020-04-23 14:18:31 +08009337 case 0x10ec0245:
Kailang Yang0a6f0602017-06-30 16:00:48 +08009338 case 0x10ec0285:
Kailang Yang630e3612020-05-27 14:10:26 +08009339 case 0x10ec0287:
Kailang Yang0a6f0602017-06-30 16:00:48 +08009340 case 0x10ec0289:
9341 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08009342 spec->shutup = alc225_shutup;
9343 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009344 spec->gen.mixer_nid = 0;
9345 break;
Kailang Yang42314302016-02-03 15:03:50 +08009346 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08009347 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08009348 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08009349 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08009350 spec->shutup = alc225_shutup;
9351 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01009352 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08009353 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009354 case 0x10ec0234:
9355 case 0x10ec0274:
9356 case 0x10ec0294:
9357 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08009358 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08009359 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +08009360 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009361 break;
Kailang Yang1078bef2018-11-08 16:36:15 +08009362 case 0x10ec0300:
9363 spec->codec_variant = ALC269_TYPE_ALC300;
9364 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009365 break;
Kailang Yangf0778872019-10-24 15:13:32 +08009366 case 0x10ec0623:
9367 spec->codec_variant = ALC269_TYPE_ALC623;
9368 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08009369 case 0x10ec0700:
9370 case 0x10ec0701:
9371 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +08009372 case 0x10ec0711:
Kailang Yang6fbae352016-05-30 16:44:20 +08009373 spec->codec_variant = ALC269_TYPE_ALC700;
9374 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08009375 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +08009376 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +08009377 break;
9378
Takashi Iwai1d045db2011-07-07 18:23:21 +02009379 }
9380
Kailang Yangad60d502013-06-28 12:03:01 +02009381 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05009382 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02009383 spec->init_hook = alc5505_dsp_init;
9384 }
9385
Takashi Iwaic9af7532019-05-10 11:01:43 +02009386 alc_pre_init(codec);
9387
Takashi Iwaiefe55732018-06-15 11:55:02 +02009388 snd_hda_pick_fixup(codec, alc269_fixup_models,
9389 alc269_fixup_tbl, alc269_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +08009390 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
Hui Wang7c0a6932019-08-16 14:27:40 +08009391 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
Takashi Iwaiefe55732018-06-15 11:55:02 +02009392 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
9393 alc269_fixups);
9394 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
9395
9396 alc_auto_parse_customize_define(codec);
9397
9398 if (has_cdefine_beep(codec))
9399 spec->gen.beep_nid = 0x01;
9400
Takashi Iwaia4297b52011-08-23 18:40:12 +02009401 /* automatic parse from the BIOS config */
9402 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009403 if (err < 0)
9404 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009405
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009406 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
9407 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
9408 if (err < 0)
9409 goto error;
9410 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009411
Takashi Iwai1727a772013-01-10 09:52:52 +01009412 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009413
Takashi Iwai1d045db2011-07-07 18:23:21 +02009414 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009415
9416 error:
9417 alc_free(codec);
9418 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009419}
9420
9421/*
9422 * ALC861
9423 */
9424
Takashi Iwai1d045db2011-07-07 18:23:21 +02009425static int alc861_parse_auto_config(struct hda_codec *codec)
9426{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009427 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009428 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
9429 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009430}
9431
Takashi Iwai1d045db2011-07-07 18:23:21 +02009432/* Pin config fixes */
9433enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009434 ALC861_FIXUP_FSC_AMILO_PI1505,
9435 ALC861_FIXUP_AMP_VREF_0F,
9436 ALC861_FIXUP_NO_JACK_DETECT,
9437 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009438 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009439};
9440
Takashi Iwai31150f22012-01-30 10:54:08 +01009441/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
9442static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009443 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01009444{
9445 struct alc_spec *spec = codec->spec;
9446 unsigned int val;
9447
Takashi Iwai1727a772013-01-10 09:52:52 +01009448 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01009449 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01009450 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01009451 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
9452 val |= AC_PINCTL_IN_EN;
9453 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02009454 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01009455 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01009456}
9457
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009458/* suppress the jack-detection */
9459static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009460 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009461{
Takashi Iwai1727a772013-01-10 09:52:52 +01009462 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009463 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02009464}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009465
Takashi Iwai1727a772013-01-10 09:52:52 +01009466static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009467 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009468 .type = HDA_FIXUP_PINS,
9469 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009470 { 0x0b, 0x0221101f }, /* HP */
9471 { 0x0f, 0x90170310 }, /* speaker */
9472 { }
9473 }
9474 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009475 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009476 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01009477 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01009478 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009479 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009480 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009481 .v.func = alc_fixup_no_jack_detect,
9482 },
9483 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009484 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009485 .v.func = alc861_fixup_asus_amp_vref_0f,
9486 .chained = true,
9487 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009488 },
9489 [ALC660_FIXUP_ASUS_W7J] = {
9490 .type = HDA_FIXUP_VERBS,
9491 .v.verbs = (const struct hda_verb[]) {
9492 /* ASUS W7J needs a magic pin setup on unused NID 0x10
9493 * for enabling outputs
9494 */
9495 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
9496 { }
9497 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009498 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009499};
9500
9501static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01009502 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01009503 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009504 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
9505 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
9506 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
Takashi Iwaidefce242021-04-28 13:27:03 +02009507 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01009508 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009509 {}
9510};
9511
9512/*
9513 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009514static int patch_alc861(struct hda_codec *codec)
9515{
9516 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009517 int err;
9518
Takashi Iwai3de95172012-05-07 18:03:15 +02009519 err = alc_alloc_spec(codec, 0x15);
9520 if (err < 0)
9521 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009522
Takashi Iwai3de95172012-05-07 18:03:15 +02009523 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009524 if (has_cdefine_beep(codec))
9525 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009526
Takashi Iwai225068a2015-05-29 10:42:14 +02009527#ifdef CONFIG_PM
9528 spec->power_hook = alc_power_eapd;
9529#endif
9530
Takashi Iwaic9af7532019-05-10 11:01:43 +02009531 alc_pre_init(codec);
9532
Takashi Iwai1727a772013-01-10 09:52:52 +01009533 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
9534 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009535
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009536 /* automatic parse from the BIOS config */
9537 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009538 if (err < 0)
9539 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009540
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009541 if (!spec->gen.no_analog) {
9542 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
9543 if (err < 0)
9544 goto error;
9545 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009546
Takashi Iwai1727a772013-01-10 09:52:52 +01009547 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009548
Takashi Iwai1d045db2011-07-07 18:23:21 +02009549 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009550
9551 error:
9552 alc_free(codec);
9553 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009554}
9555
9556/*
9557 * ALC861-VD support
9558 *
9559 * Based on ALC882
9560 *
9561 * In addition, an independent DAC
9562 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009563static int alc861vd_parse_auto_config(struct hda_codec *codec)
9564{
Takashi Iwai1d045db2011-07-07 18:23:21 +02009565 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009566 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9567 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009568}
9569
Takashi Iwai1d045db2011-07-07 18:23:21 +02009570enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009571 ALC660VD_FIX_ASUS_GPIO1,
9572 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009573};
9574
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009575/* exclude VREF80 */
9576static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009577 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009578{
Takashi Iwai1727a772013-01-10 09:52:52 +01009579 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01009580 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
9581 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009582 }
9583}
9584
Takashi Iwaidf73d832018-06-19 23:05:47 +02009585/* reset GPIO1 */
9586static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
9587 const struct hda_fixup *fix, int action)
9588{
9589 struct alc_spec *spec = codec->spec;
9590
9591 if (action == HDA_FIXUP_ACT_PRE_PROBE)
9592 spec->gpio_mask |= 0x02;
9593 alc_fixup_gpio(codec, action, 0x01);
9594}
9595
Takashi Iwai1727a772013-01-10 09:52:52 +01009596static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009597 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +02009598 .type = HDA_FIXUP_FUNC,
9599 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +02009600 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009601 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009602 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009603 .v.func = alc861vd_fixup_dallas,
9604 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02009605};
9606
9607static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009608 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009609 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02009610 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009611 {}
9612};
9613
Takashi Iwai1d045db2011-07-07 18:23:21 +02009614/*
9615 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009616static int patch_alc861vd(struct hda_codec *codec)
9617{
9618 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009619 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009620
Takashi Iwai3de95172012-05-07 18:03:15 +02009621 err = alc_alloc_spec(codec, 0x0b);
9622 if (err < 0)
9623 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009624
Takashi Iwai3de95172012-05-07 18:03:15 +02009625 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02009626 if (has_cdefine_beep(codec))
9627 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009628
Takashi Iwai225068a2015-05-29 10:42:14 +02009629 spec->shutup = alc_eapd_shutup;
9630
Takashi Iwaic9af7532019-05-10 11:01:43 +02009631 alc_pre_init(codec);
9632
Takashi Iwai1727a772013-01-10 09:52:52 +01009633 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
9634 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009635
Takashi Iwaicb4e4822011-08-23 17:34:25 +02009636 /* automatic parse from the BIOS config */
9637 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009638 if (err < 0)
9639 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009640
Takashi Iwaifea80fa2018-06-20 12:52:46 +02009641 if (!spec->gen.no_analog) {
9642 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
9643 if (err < 0)
9644 goto error;
9645 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02009646
Takashi Iwai1727a772013-01-10 09:52:52 +01009647 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01009648
Takashi Iwai1d045db2011-07-07 18:23:21 +02009649 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009650
9651 error:
9652 alc_free(codec);
9653 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009654}
9655
9656/*
9657 * ALC662 support
9658 *
9659 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
9660 * configuration. Each pin widget can choose any input DACs and a mixer.
9661 * Each ADC is connected from a mixer of all inputs. This makes possible
9662 * 6-channel independent captures.
9663 *
9664 * In addition, an independent DAC for the multi-playback (not used in this
9665 * driver yet).
9666 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009667
9668/*
9669 * BIOS auto configuration
9670 */
9671
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009672static int alc662_parse_auto_config(struct hda_codec *codec)
9673{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02009674 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009675 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
9676 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
9677 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02009678
Takashi Iwai7639a062015-03-03 10:07:24 +01009679 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
9680 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
9681 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009682 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01009683 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02009684 ssids = alc662_ssids;
9685 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02009686}
9687
Todd Broch6be79482010-12-07 16:51:05 -08009688static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01009689 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009690{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01009691 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01009692 return;
Todd Broch6be79482010-12-07 16:51:05 -08009693 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
9694 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
9695 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
9696 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
9697 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01009698 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08009699}
9700
Takashi Iwai8e383952013-10-30 17:41:12 +01009701static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
9702 { .channels = 2,
9703 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
9704 { .channels = 4,
9705 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
9706 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
9707 { }
9708};
9709
9710/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01009711static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01009712 const struct hda_fixup *fix, int action)
9713{
9714 if (action == HDA_FIXUP_ACT_BUILD) {
9715 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +01009716 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +01009717 }
9718}
9719
Takashi Iwaibf686652014-01-13 16:18:25 +01009720/* avoid D3 for keeping GPIO up */
9721static unsigned int gpio_led_power_filter(struct hda_codec *codec,
9722 hda_nid_t nid,
9723 unsigned int power_state)
9724{
9725 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +02009726 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +01009727 return AC_PWRST_D0;
9728 return power_state;
9729}
9730
Takashi Iwai3e887f32014-01-10 17:50:58 +01009731static void alc662_fixup_led_gpio1(struct hda_codec *codec,
9732 const struct hda_fixup *fix, int action)
9733{
9734 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009735
Takashi Iwai01e4a272018-06-19 22:47:30 +02009736 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +01009737 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01009738 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +01009739 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01009740 }
9741}
9742
Kailang Yangc6790c82016-11-25 16:15:17 +08009743static void alc662_usi_automute_hook(struct hda_codec *codec,
9744 struct hda_jack_callback *jack)
9745{
9746 struct alc_spec *spec = codec->spec;
9747 int vref;
9748 msleep(200);
9749 snd_hda_gen_hp_automute(codec, jack);
9750
9751 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
9752 msleep(100);
9753 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
9754 vref);
9755}
9756
9757static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
9758 const struct hda_fixup *fix, int action)
9759{
9760 struct alc_spec *spec = codec->spec;
9761 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
9762 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9763 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
9764 }
9765}
9766
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009767static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
9768 struct hda_jack_callback *cb)
9769{
9770 /* surround speakers at 0x1b already get muted automatically when
9771 * headphones are plugged in, but we have to mute/unmute the remaining
9772 * channels manually:
9773 * 0x15 - front left/front right
9774 * 0x18 - front center/ LFE
9775 */
9776 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
9777 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
9778 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
9779 } else {
9780 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
9781 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
9782 }
9783}
9784
9785static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
9786 const struct hda_fixup *fix, int action)
9787{
9788 /* Pin 0x1b: shared headphones jack and surround speakers */
9789 if (!is_jack_detectable(codec, 0x1b))
9790 return;
9791
9792 switch (action) {
9793 case HDA_FIXUP_ACT_PRE_PROBE:
9794 snd_hda_jack_detect_enable_callback(codec, 0x1b,
9795 alc662_aspire_ethos_mute_speakers);
Takashi Iwai336820c2019-11-28 21:26:30 +01009796 /* subwoofer needs an extra GPIO setting to become audible */
9797 alc_setup_gpio(codec, 0x02);
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009798 break;
9799 case HDA_FIXUP_ACT_INIT:
9800 /* Make sure to start in a correct state, i.e. if
9801 * headphones have been plugged in before powering up the system
9802 */
9803 alc662_aspire_ethos_mute_speakers(codec, NULL);
9804 break;
9805 }
9806}
9807
Kailang Yang5af290282020-01-17 14:04:01 +08009808static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
9809 const struct hda_fixup *fix, int action)
9810{
9811 struct alc_spec *spec = codec->spec;
9812
9813 static const struct hda_pintbl pincfgs[] = {
9814 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
9815 { 0x1b, 0x0181304f },
9816 { }
9817 };
9818
9819 switch (action) {
9820 case HDA_FIXUP_ACT_PRE_PROBE:
9821 spec->gen.mixer_nid = 0;
9822 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
9823 snd_hda_apply_pincfgs(codec, pincfgs);
9824 break;
9825 case HDA_FIXUP_ACT_INIT:
9826 alc_write_coef_idx(codec, 0x19, 0xa054);
9827 break;
9828 }
9829}
9830
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01009831static const struct coef_fw alc668_coefs[] = {
Kailang Yangf3f91852014-10-24 15:43:46 +08009832 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
9833 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
9834 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
9835 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
9836 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
9837 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
9838 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
9839 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
9840 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
9841 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
9842 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
9843 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
9844 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
9845 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
9846 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
9847 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
9848 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
9849 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
9850 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
9851 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
9852 {}
9853};
9854
9855static void alc668_restore_default_value(struct hda_codec *codec)
9856{
9857 alc_process_coef_fw(codec, alc668_coefs);
9858}
9859
David Henningsson6cb3b702010-09-09 08:51:44 +02009860enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04009861 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01009862 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009863 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08009864 ALC272_FIXUP_MARIO,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009865 ALC662_FIXUP_CZC_ET26,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009866 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02009867 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009868 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02009869 ALC662_FIXUP_ASUS_MODE1,
9870 ALC662_FIXUP_ASUS_MODE2,
9871 ALC662_FIXUP_ASUS_MODE3,
9872 ALC662_FIXUP_ASUS_MODE4,
9873 ALC662_FIXUP_ASUS_MODE5,
9874 ALC662_FIXUP_ASUS_MODE6,
9875 ALC662_FIXUP_ASUS_MODE7,
9876 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01009877 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02009878 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02009879 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009880 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02009881 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02009882 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +02009883 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009884 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01009885 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01009886 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01009887 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08009888 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02009889 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02009890 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02009891 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02009892 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07009893 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02009894 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +02009895 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +08009896 ALC891_FIXUP_HEADSET_MODE,
9897 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08009898 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +02009899 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +08009900 ALC662_FIXUP_USI_FUNC,
9901 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +08009902 ALC662_FIXUP_LENOVO_MULTI_CODECS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009903 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +02009904 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
Kailang Yang5af290282020-01-17 14:04:01 +08009905 ALC671_FIXUP_HP_HEADSET_MIC2,
Jian-Hong Pand858c702020-03-17 16:28:07 +08009906 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
Jian-Hong Pana1244582020-03-17 16:28:09 +08009907 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
David Henningsson6cb3b702010-09-09 08:51:44 +02009908};
9909
Takashi Iwai1727a772013-01-10 09:52:52 +01009910static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04009911 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009912 .type = HDA_FIXUP_PINS,
9913 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04009914 { 0x15, 0x99130112 }, /* subwoofer */
9915 { }
9916 }
9917 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01009918 [ALC662_FIXUP_LED_GPIO1] = {
9919 .type = HDA_FIXUP_FUNC,
9920 .v.func = alc662_fixup_led_gpio1,
9921 },
David Henningsson6cb3b702010-09-09 08:51:44 +02009922 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009923 .type = HDA_FIXUP_PINS,
9924 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02009925 { 0x17, 0x99130112 }, /* subwoofer */
9926 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01009927 },
9928 .chained = true,
9929 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02009930 },
Todd Broch6be79482010-12-07 16:51:05 -08009931 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009932 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01009933 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009934 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009935 [ALC662_FIXUP_CZC_ET26] = {
9936 .type = HDA_FIXUP_PINS,
9937 .v.pins = (const struct hda_pintbl[]) {
9938 {0x12, 0x403cc000},
9939 {0x14, 0x90170110}, /* speaker */
9940 {0x15, 0x411111f0},
9941 {0x16, 0x411111f0},
9942 {0x18, 0x01a19030}, /* mic */
9943 {0x19, 0x90a7013f}, /* int-mic */
9944 {0x1a, 0x01014020},
9945 {0x1b, 0x0121401f},
9946 {0x1c, 0x411111f0},
9947 {0x1d, 0x411111f0},
9948 {0x1e, 0x40478e35},
9949 {}
9950 },
9951 .chained = true,
9952 .chain_id = ALC662_FIXUP_SKU_IGNORE
9953 },
Anisse Astierd2ebd472011-01-20 12:36:21 +01009954 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009955 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +01009956 .v.verbs = (const struct hda_verb[]) {
9957 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
9958 {}
9959 }
9960 },
David Henningsson94024cd2011-04-29 14:10:55 +02009961 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009962 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02009963 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +02009964 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009965 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009966 .type = HDA_FIXUP_PINS,
9967 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02009968 { 0x14, 0x0221201f }, /* HP out */
9969 { }
9970 },
9971 .chained = true,
9972 .chain_id = ALC662_FIXUP_SKU_IGNORE
9973 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02009974 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009975 .type = HDA_FIXUP_PINS,
9976 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02009977 { 0x14, 0x99130110 }, /* speaker */
9978 { 0x18, 0x01a19c20 }, /* mic */
9979 { 0x19, 0x99a3092f }, /* int-mic */
9980 { 0x21, 0x0121401f }, /* HP out */
9981 { }
9982 },
9983 .chained = true,
9984 .chain_id = ALC662_FIXUP_SKU_IGNORE
9985 },
9986 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009987 .type = HDA_FIXUP_PINS,
9988 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +02009989 { 0x14, 0x99130110 }, /* speaker */
9990 { 0x18, 0x01a19820 }, /* mic */
9991 { 0x19, 0x99a3092f }, /* int-mic */
9992 { 0x1b, 0x0121401f }, /* HP out */
9993 { }
9994 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02009995 .chained = true,
9996 .chain_id = ALC662_FIXUP_SKU_IGNORE
9997 },
9998 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01009999 .type = HDA_FIXUP_PINS,
10000 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010001 { 0x14, 0x99130110 }, /* speaker */
10002 { 0x15, 0x0121441f }, /* HP */
10003 { 0x18, 0x01a19840 }, /* mic */
10004 { 0x19, 0x99a3094f }, /* int-mic */
10005 { 0x21, 0x01211420 }, /* HP2 */
10006 { }
10007 },
10008 .chained = true,
10009 .chain_id = ALC662_FIXUP_SKU_IGNORE
10010 },
10011 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010012 .type = HDA_FIXUP_PINS,
10013 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010014 { 0x14, 0x99130110 }, /* speaker */
10015 { 0x16, 0x99130111 }, /* speaker */
10016 { 0x18, 0x01a19840 }, /* mic */
10017 { 0x19, 0x99a3094f }, /* int-mic */
10018 { 0x21, 0x0121441f }, /* HP */
10019 { }
10020 },
10021 .chained = true,
10022 .chain_id = ALC662_FIXUP_SKU_IGNORE
10023 },
10024 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010025 .type = HDA_FIXUP_PINS,
10026 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010027 { 0x14, 0x99130110 }, /* speaker */
10028 { 0x15, 0x0121441f }, /* HP */
10029 { 0x16, 0x99130111 }, /* speaker */
10030 { 0x18, 0x01a19840 }, /* mic */
10031 { 0x19, 0x99a3094f }, /* int-mic */
10032 { }
10033 },
10034 .chained = true,
10035 .chain_id = ALC662_FIXUP_SKU_IGNORE
10036 },
10037 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010038 .type = HDA_FIXUP_PINS,
10039 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010040 { 0x14, 0x99130110 }, /* speaker */
10041 { 0x15, 0x01211420 }, /* HP2 */
10042 { 0x18, 0x01a19840 }, /* mic */
10043 { 0x19, 0x99a3094f }, /* int-mic */
10044 { 0x1b, 0x0121441f }, /* HP */
10045 { }
10046 },
10047 .chained = true,
10048 .chain_id = ALC662_FIXUP_SKU_IGNORE
10049 },
10050 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010051 .type = HDA_FIXUP_PINS,
10052 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010053 { 0x14, 0x99130110 }, /* speaker */
10054 { 0x17, 0x99130111 }, /* speaker */
10055 { 0x18, 0x01a19840 }, /* mic */
10056 { 0x19, 0x99a3094f }, /* int-mic */
10057 { 0x1b, 0x01214020 }, /* HP */
10058 { 0x21, 0x0121401f }, /* HP */
10059 { }
10060 },
10061 .chained = true,
10062 .chain_id = ALC662_FIXUP_SKU_IGNORE
10063 },
10064 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010065 .type = HDA_FIXUP_PINS,
10066 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010067 { 0x14, 0x99130110 }, /* speaker */
10068 { 0x12, 0x99a30970 }, /* int-mic */
10069 { 0x15, 0x01214020 }, /* HP */
10070 { 0x17, 0x99130111 }, /* speaker */
10071 { 0x18, 0x01a19840 }, /* mic */
10072 { 0x21, 0x0121401f }, /* HP */
10073 { }
10074 },
10075 .chained = true,
10076 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +020010077 },
Takashi Iwai1565cc32012-02-13 12:03:25 +010010078 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010079 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +010010080 .v.func = alc_fixup_no_jack_detect,
10081 },
David Henningssonedfe3bf2012-06-12 13:15:12 +020010082 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010083 .type = HDA_FIXUP_PINS,
10084 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +020010085 { 0x1b, 0x02214020 }, /* Front HP */
10086 { }
10087 }
10088 },
Takashi Iwai125821a2012-06-22 14:30:29 +020010089 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010090 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +020010091 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +020010092 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010093 [ALC668_FIXUP_DELL_XPS13] = {
10094 .type = HDA_FIXUP_FUNC,
10095 .v.func = alc_fixup_dell_xps13,
10096 .chained = true,
10097 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10098 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +020010099 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10100 .type = HDA_FIXUP_FUNC,
10101 .v.func = alc_fixup_disable_aamix,
10102 .chained = true,
10103 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10104 },
Hui Wang493a52a2014-01-14 14:07:36 +080010105 [ALC668_FIXUP_AUTO_MUTE] = {
10106 .type = HDA_FIXUP_FUNC,
10107 .v.func = alc_fixup_auto_mute_via_amp,
10108 .chained = true,
10109 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10110 },
David Henningsson1f8b46c2015-05-12 14:38:15 +020010111 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10112 .type = HDA_FIXUP_PINS,
10113 .v.pins = (const struct hda_pintbl[]) {
10114 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10115 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10116 { }
10117 },
10118 .chained = true,
10119 .chain_id = ALC662_FIXUP_HEADSET_MODE
10120 },
10121 [ALC662_FIXUP_HEADSET_MODE] = {
10122 .type = HDA_FIXUP_FUNC,
10123 .v.func = alc_fixup_headset_mode_alc662,
10124 },
David Henningsson73bdd592013-04-15 15:44:14 +020010125 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10126 .type = HDA_FIXUP_PINS,
10127 .v.pins = (const struct hda_pintbl[]) {
10128 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10129 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10130 { }
10131 },
10132 .chained = true,
10133 .chain_id = ALC668_FIXUP_HEADSET_MODE
10134 },
10135 [ALC668_FIXUP_HEADSET_MODE] = {
10136 .type = HDA_FIXUP_FUNC,
10137 .v.func = alc_fixup_headset_mode_alc668,
10138 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010139 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +010010140 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010141 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +010010142 .chained = true,
10143 .chain_id = ALC662_FIXUP_ASUS_MODE4
10144 },
David Henningsson61a75f12014-02-07 09:31:08 +010010145 [ALC662_FIXUP_BASS_16] = {
10146 .type = HDA_FIXUP_PINS,
10147 .v.pins = (const struct hda_pintbl[]) {
10148 {0x16, 0x80106111}, /* bass speaker */
10149 {}
10150 },
10151 .chained = true,
10152 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10153 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010154 [ALC662_FIXUP_BASS_1A] = {
10155 .type = HDA_FIXUP_PINS,
10156 .v.pins = (const struct hda_pintbl[]) {
10157 {0x1a, 0x80106111}, /* bass speaker */
10158 {}
10159 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010160 .chained = true,
10161 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010162 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010163 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010164 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010165 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010166 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010167 [ALC662_FIXUP_ASUS_Nx50] = {
10168 .type = HDA_FIXUP_FUNC,
10169 .v.func = alc_fixup_auto_mute_via_amp,
10170 .chained = true,
10171 .chain_id = ALC662_FIXUP_BASS_1A
10172 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010173 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10174 .type = HDA_FIXUP_FUNC,
10175 .v.func = alc_fixup_headset_mode_alc668,
10176 .chain_id = ALC662_FIXUP_BASS_CHMAP
10177 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010178 [ALC668_FIXUP_ASUS_Nx51] = {
10179 .type = HDA_FIXUP_PINS,
10180 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010181 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10182 { 0x1a, 0x90170151 }, /* bass speaker */
10183 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010184 {}
10185 },
10186 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010187 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010188 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010189 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +020010190 .type = HDA_FIXUP_VERBS,
10191 .v.verbs = (const struct hda_verb[]) {
10192 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10193 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10194 {}
10195 },
10196 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010197 [ALC668_FIXUP_ASUS_G751] = {
10198 .type = HDA_FIXUP_PINS,
10199 .v.pins = (const struct hda_pintbl[]) {
10200 { 0x16, 0x0421101f }, /* HP */
10201 {}
10202 },
10203 .chained = true,
10204 .chain_id = ALC668_FIXUP_MIC_COEF
10205 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010206 [ALC891_FIXUP_HEADSET_MODE] = {
10207 .type = HDA_FIXUP_FUNC,
10208 .v.func = alc_fixup_headset_mode,
10209 },
10210 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10211 .type = HDA_FIXUP_PINS,
10212 .v.pins = (const struct hda_pintbl[]) {
10213 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10214 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10215 { }
10216 },
10217 .chained = true,
10218 .chain_id = ALC891_FIXUP_HEADSET_MODE
10219 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010220 [ALC662_FIXUP_ACER_VERITON] = {
10221 .type = HDA_FIXUP_PINS,
10222 .v.pins = (const struct hda_pintbl[]) {
10223 { 0x15, 0x50170120 }, /* no internal speaker */
10224 { }
10225 }
10226 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010227 [ALC892_FIXUP_ASROCK_MOBO] = {
10228 .type = HDA_FIXUP_PINS,
10229 .v.pins = (const struct hda_pintbl[]) {
10230 { 0x15, 0x40f000f0 }, /* disabled */
10231 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010232 { }
10233 }
10234 },
Kailang Yangc6790c82016-11-25 16:15:17 +080010235 [ALC662_FIXUP_USI_FUNC] = {
10236 .type = HDA_FIXUP_FUNC,
10237 .v.func = alc662_fixup_usi_headset_mic,
10238 },
10239 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10240 .type = HDA_FIXUP_PINS,
10241 .v.pins = (const struct hda_pintbl[]) {
10242 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10243 { 0x18, 0x01a1903d },
10244 { }
10245 },
10246 .chained = true,
10247 .chain_id = ALC662_FIXUP_USI_FUNC
10248 },
Kailang Yangca169cc2017-04-25 16:17:40 +080010249 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10250 .type = HDA_FIXUP_FUNC,
10251 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10252 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010253 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10254 .type = HDA_FIXUP_FUNC,
10255 .v.func = alc662_fixup_aspire_ethos_hp,
10256 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010257 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10258 .type = HDA_FIXUP_PINS,
10259 .v.pins = (const struct hda_pintbl[]) {
10260 { 0x15, 0x92130110 }, /* front speakers */
10261 { 0x18, 0x99130111 }, /* center/subwoofer */
10262 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10263 { }
10264 },
10265 .chained = true,
Takashi Iwai336820c2019-11-28 21:26:30 +010010266 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010267 },
Kailang Yang5af290282020-01-17 14:04:01 +080010268 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10269 .type = HDA_FIXUP_FUNC,
10270 .v.func = alc671_fixup_hp_headset_mic2,
10271 },
Jian-Hong Pand858c702020-03-17 16:28:07 +080010272 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10273 .type = HDA_FIXUP_PINS,
10274 .v.pins = (const struct hda_pintbl[]) {
10275 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10276 { }
10277 },
10278 .chained = true,
10279 .chain_id = ALC662_FIXUP_USI_FUNC
10280 },
Jian-Hong Pana1244582020-03-17 16:28:09 +080010281 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10282 .type = HDA_FIXUP_PINS,
10283 .v.pins = (const struct hda_pintbl[]) {
10284 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10285 { 0x1b, 0x0221144f },
10286 { }
10287 },
10288 .chained = true,
10289 .chain_id = ALC662_FIXUP_USI_FUNC
10290 },
David Henningsson6cb3b702010-09-09 08:51:44 +020010291};
10292
Takashi Iwaia9111322011-05-02 11:30:18 +020010293static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010294 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +020010295 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +010010296 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +010010297 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +020010298 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +020010299 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +020010300 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -040010301 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
Takashi Iwai9edeb112021-04-28 13:27:02 +020010302 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
Jian-Hong Pana1244582020-03-17 16:28:09 +080010303 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
Jian-Hong Pand858c702020-03-17 16:28:07 +080010304 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
David Henningsson73bdd592013-04-15 15:44:14 +020010305 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10306 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +020010307 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010308 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +020010309 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +010010310 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +010010311 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +080010312 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
10313 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +080010314 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010315 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Jeremy Szu148ebf542020-10-08 18:56:44 +080010316 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
Kaho Ng2da2dc92016-05-09 00:27:49 +080010317 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +020010318 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010319 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +020010320 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
Takashi Iwai9edeb112021-04-28 13:27:02 +020010321 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
David Henningsson8e54b4a2014-02-07 09:31:07 +010010322 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +010010323 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010324 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
10325 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Takashi Iwaic7efff92017-01-04 21:38:16 +010010326 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +010010327 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +010010328 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +010010329 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +020010330 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -050010331 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +080010332 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +080010333 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +060010334 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +020010335 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010336 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +020010337 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010338 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010339 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
Anisse Astierd2ebd472011-01-20 12:36:21 +010010340 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +020010341
10342#if 0
10343 /* Below is a quirk table taken from the old code.
10344 * Basically the device should work as is without the fixup table.
10345 * If BIOS doesn't give a proper info, enable the corresponding
10346 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +020010347 */
Takashi Iwai53c334a2011-08-23 18:27:14 +020010348 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
10349 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
10350 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
10351 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
10352 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10353 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10354 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10355 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
10356 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
10357 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10358 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
10359 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
10360 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
10361 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
10362 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
10363 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10364 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
10365 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
10366 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10367 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10368 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10369 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10370 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
10371 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
10372 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
10373 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10374 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
10375 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
10376 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10377 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
10378 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10379 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10380 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
10381 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
10382 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
10383 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
10384 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
10385 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
10386 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
10387 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
10388 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
10389 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
10390 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10391 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
10392 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
10393 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
10394 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
10395 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
10396 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
10397 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
10398#endif
David Henningsson6cb3b702010-09-09 08:51:44 +020010399 {}
10400};
10401
Takashi Iwai1727a772013-01-10 09:52:52 +010010402static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010403 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
10404 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -080010405 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010406 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +020010407 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
10408 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
10409 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
10410 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
10411 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
10412 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
10413 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
10414 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010415 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +020010416 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010417 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +020010418 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010419 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
10420 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
10421 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
10422 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
10423 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
10424 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
10425 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
10426 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +020010427 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020010428 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
10429 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
10430 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
10431 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
10432 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +020010433 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010434 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
Todd Broch6be79482010-12-07 16:51:05 -080010435 {}
10436};
David Henningsson6cb3b702010-09-09 08:51:44 +020010437
Hui Wang532895c2014-05-29 15:59:19 +080010438static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010439 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10440 {0x17, 0x02211010},
10441 {0x18, 0x01a19030},
10442 {0x1a, 0x01813040},
10443 {0x21, 0x01014020}),
Hui Wang4b4e0e32019-07-16 15:21:34 +080010444 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
10445 {0x16, 0x01813030},
10446 {0x17, 0x02211010},
10447 {0x18, 0x01a19040},
10448 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +020010449 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010450 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010451 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +020010452 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +080010453 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +020010454 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10455 {0x12, 0x99a30130},
10456 {0x14, 0x90170110},
10457 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010458 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010459 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10460 {0x12, 0x99a30140},
10461 {0x14, 0x90170110},
10462 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010463 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010464 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
10465 {0x12, 0x99a30150},
10466 {0x14, 0x90170110},
10467 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010468 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010469 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +020010470 {0x14, 0x90170110},
10471 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080010472 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020010473 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
10474 {0x12, 0x90a60130},
10475 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +080010476 {0x15, 0x0321101f}),
Kailang Yang5af290282020-01-17 14:04:01 +080010477 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10478 {0x14, 0x01014010},
10479 {0x17, 0x90170150},
Kailang Yangf2adbae2020-02-05 15:40:01 +080010480 {0x19, 0x02a11060},
Kailang Yang5af290282020-01-17 14:04:01 +080010481 {0x1b, 0x01813030},
10482 {0x21, 0x02211020}),
10483 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10484 {0x14, 0x01014010},
10485 {0x18, 0x01a19040},
10486 {0x1b, 0x01813030},
10487 {0x21, 0x02211020}),
10488 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
10489 {0x14, 0x01014020},
10490 {0x17, 0x90170110},
10491 {0x18, 0x01a19050},
10492 {0x1b, 0x01813040},
10493 {0x21, 0x02211030}),
Hui Wang532895c2014-05-29 15:59:19 +080010494 {}
10495};
10496
Takashi Iwai1d045db2011-07-07 18:23:21 +020010497/*
10498 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010499static int patch_alc662(struct hda_codec *codec)
10500{
10501 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +020010502 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010503
Takashi Iwai3de95172012-05-07 18:03:15 +020010504 err = alc_alloc_spec(codec, 0x0b);
10505 if (err < 0)
10506 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010507
Takashi Iwai3de95172012-05-07 18:03:15 +020010508 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010509
Takashi Iwai225068a2015-05-29 10:42:14 +020010510 spec->shutup = alc_eapd_shutup;
10511
Takashi Iwai53c334a2011-08-23 18:27:14 +020010512 /* handle multiple HPs as is */
10513 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
10514
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +020010515 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10516
Takashi Iwai7639a062015-03-03 10:07:24 +010010517 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +080010518 case 0x10ec0668:
10519 spec->init_hook = alc668_restore_default_value;
10520 break;
Kailang Yangf3f91852014-10-24 15:43:46 +080010521 }
Kailang Yang8663ff72012-06-29 09:35:52 +020010522
Takashi Iwaic9af7532019-05-10 11:01:43 +020010523 alc_pre_init(codec);
10524
Takashi Iwai1727a772013-01-10 09:52:52 +010010525 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010526 alc662_fixup_tbl, alc662_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +080010527 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +010010528 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +020010529
10530 alc_auto_parse_customize_define(codec);
10531
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010532 if (has_cdefine_beep(codec))
10533 spec->gen.beep_nid = 0x01;
10534
Takashi Iwai1bb7e432011-10-17 16:50:59 +020010535 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +010010536 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010537 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +080010538 err = alc_codec_rename(codec, "ALC272X");
10539 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010540 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +020010541 }
Kailang Yang274693f2009-12-03 10:07:50 +010010542
Takashi Iwaib9c51062011-08-24 18:08:07 +020010543 /* automatic parse from the BIOS config */
10544 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010545 if (err < 0)
10546 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010547
Takashi Iwai7504b6c2013-03-18 11:25:51 +010010548 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +010010549 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +010010550 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010551 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010552 break;
10553 case 0x10ec0272:
10554 case 0x10ec0663:
10555 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +080010556 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010557 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010558 break;
10559 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010560 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010010561 break;
10562 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010563 if (err < 0)
10564 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +010010565 }
Takashi Iwai2134ea42008-01-10 16:53:55 +010010566
Takashi Iwai1727a772013-01-10 09:52:52 +010010567 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010568
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010569 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010570
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010571 error:
10572 alc_free(codec);
10573 return err;
Kailang Yangb478b992011-05-18 11:51:15 +020010574}
10575
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010576/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010577 * ALC680 support
10578 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010579
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010580static int alc680_parse_auto_config(struct hda_codec *codec)
10581{
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010582 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010583}
10584
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010585/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010586 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010587static int patch_alc680(struct hda_codec *codec)
10588{
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010589 int err;
10590
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010591 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +020010592 err = alc_alloc_spec(codec, 0);
10593 if (err < 0)
10594 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020010595
Takashi Iwai1ebec5f2011-08-15 13:21:48 +020010596 /* automatic parse from the BIOS config */
10597 err = alc680_parse_auto_config(codec);
10598 if (err < 0) {
10599 alc_free(codec);
10600 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010601 }
10602
Kailang Yangd1eb57f2010-06-23 16:25:26 +020010603 return 0;
10604}
10605
10606/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070010607 * patch entries
10608 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010609static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +080010610 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010611 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Hui Wang2a36c162019-09-04 13:53:27 +080010612 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +080010613 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010614 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
10615 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010616 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010617 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +080010618 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Kailang Yang7fbdcd82020-04-23 14:18:31 +080010619 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010620 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
10621 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +080010622 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010623 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
10624 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
10625 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
10626 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
10627 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
10628 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
10629 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010630 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010631 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
10632 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
10633 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
10634 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
10635 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
10636 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010637 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010638 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
Kailang Yang630e3612020-05-27 14:10:26 +080010639 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010640 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080010641 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010642 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
10643 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
10644 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010645 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +080010646 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010647 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +080010648 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +080010649 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Kailang Yangf0778872019-10-24 15:13:32 +080010650 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010651 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
10652 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
10653 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
10654 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
10655 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
10656 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
10657 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
10658 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
10659 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
10660 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
10661 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
10662 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
10663 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
10664 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +080010665 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
10666 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
10667 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang83629532019-05-02 16:03:26 +080010668 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010669 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010670 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
10671 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
10672 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
10673 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
10674 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
10675 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
10676 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
10677 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
10678 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
10679 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
10680 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
Kailang Yange5782a52020-11-27 14:39:23 +080010681 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010682 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
10683 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang6d9ffcf2020-01-03 16:24:06 +080010684 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +080010685 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +080010686 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -070010687 {} /* terminator */
10688};
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010689MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010690
10691MODULE_LICENSE("GPL");
10692MODULE_DESCRIPTION("Realtek HD-audio codec");
10693
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010694static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +020010695 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +010010696};
10697
Takashi Iwaid8a766a2015-02-17 15:25:37 +010010698module_hda_codec_driver(realtek_driver);