blob: 668274e52674591b843df7f2256a962046ad6fde [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"
Lucas Tanured3dca022021-12-17 11:57:07 +000028#include "hda_component.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
Takashi Iwaicd63a5f2013-07-05 12:13:59 +020030/* keep halting ALC5505 DSP, for power saving */
31#define HALT_REALTEK_ALC5505
32
Takashi Iwai4a79ba32009-04-22 16:31:35 +020033/* extra amp-initialization sequence types */
34enum {
Takashi Iwai1c76aa52018-06-21 16:37:54 +020035 ALC_INIT_UNDEFINED,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020036 ALC_INIT_NONE,
37 ALC_INIT_DEFAULT,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020038};
39
David Henningsson73bdd592013-04-15 15:44:14 +020040enum {
41 ALC_HEADSET_MODE_UNKNOWN,
42 ALC_HEADSET_MODE_UNPLUGGED,
43 ALC_HEADSET_MODE_HEADSET,
44 ALC_HEADSET_MODE_MIC,
45 ALC_HEADSET_MODE_HEADPHONE,
46};
47
48enum {
49 ALC_HEADSET_TYPE_UNKNOWN,
50 ALC_HEADSET_TYPE_CTIA,
51 ALC_HEADSET_TYPE_OMTP,
52};
53
Hui Wangc7b60a82015-12-28 11:35:25 +080054enum {
55 ALC_KEY_MICMUTE_INDEX,
56};
57
Kailang Yangda00c242010-03-19 11:23:45 +010058struct alc_customize_define {
59 unsigned int sku_cfg;
60 unsigned char port_connectivity;
61 unsigned char check_sum;
62 unsigned char customization;
63 unsigned char external_amp;
64 unsigned int enable_pcbeep:1;
65 unsigned int platform_type:1;
66 unsigned int swap:1;
67 unsigned int override:1;
David Henningsson90622912010-10-14 14:50:18 +020068 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
Kailang Yangda00c242010-03-19 11:23:45 +010069};
70
Takashi Iwai766538a2020-06-18 13:08:41 +020071struct alc_coef_led {
72 unsigned int idx;
73 unsigned int mask;
74 unsigned int on;
75 unsigned int off;
76};
77
Linus Torvalds1da177e2005-04-16 15:20:36 -070078struct alc_spec {
Takashi Iwai08c189f2012-12-19 15:22:24 +010079 struct hda_gen_spec gen; /* must be at head */
Takashi Iwai23d30f22012-05-07 17:17:32 +020080
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 /* codec parameterization */
Kailang Yangda00c242010-03-19 11:23:45 +010082 struct alc_customize_define cdefine;
Takashi Iwai08c189f2012-12-19 15:22:24 +010083 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
84
Takashi Iwai5579cd62018-06-19 22:22:41 +020085 /* GPIO bits */
86 unsigned int gpio_mask;
87 unsigned int gpio_dir;
88 unsigned int gpio_data;
Takashi Iwai215c8502018-06-19 22:34:26 +020089 bool gpio_write_delay; /* add a delay before writing gpio_data */
Takashi Iwai5579cd62018-06-19 22:22:41 +020090
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +020091 /* mute LED for HP laptops, see vref_mute_led_set() */
Takashi Iwai08fb0d02013-01-10 17:33:58 +010092 int mute_led_polarity;
Kai-Heng Fengdbd13172020-04-30 16:32:51 +080093 int micmute_led_polarity;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010094 hda_nid_t mute_led_nid;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +080095 hda_nid_t cap_mute_led_nid;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010096
Takashi Iwai0f32fd192014-11-19 12:16:14 +010097 unsigned int gpio_mute_led_mask;
98 unsigned int gpio_mic_led_mask;
Takashi Iwai766538a2020-06-18 13:08:41 +020099 struct alc_coef_led mute_led_coef;
100 struct alc_coef_led mic_led_coef;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +0100101
David Henningsson73bdd592013-04-15 15:44:14 +0200102 hda_nid_t headset_mic_pin;
103 hda_nid_t headphone_mic_pin;
104 int current_headset_mode;
105 int current_headset_type;
106
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100107 /* hooks */
108 void (*init_hook)(struct hda_codec *codec);
Takashi Iwai83012a72012-08-24 18:38:08 +0200109#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500110 void (*power_hook)(struct hda_codec *codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100111#endif
Takashi Iwai1c7161532011-04-07 10:37:16 +0200112 void (*shutup)(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];
Lucas Tanured3dca022021-12-17 11:57:07 +0000130
131 /* component binding */
132 struct component_match *match;
133 struct hda_component comps[HDA_MAX_COMPONENTS];
Kailang Yangdf694da2005-12-05 19:42:22 +0100134};
135
Takashi Iwai23f0c042009-02-26 13:03:58 +0100136/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200137 * COEF access helper functions
138 */
139
140static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
141 unsigned int coef_idx)
142{
143 unsigned int val;
144
145 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
146 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
147 return val;
148}
149
150#define alc_read_coef_idx(codec, coef_idx) \
151 alc_read_coefex_idx(codec, 0x20, coef_idx)
152
153static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
154 unsigned int coef_idx, unsigned int coef_val)
155{
156 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
157 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
158}
159
160#define alc_write_coef_idx(codec, coef_idx, coef_val) \
161 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
162
Takashi Iwai98b24882014-08-18 13:47:50 +0200163static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
164 unsigned int coef_idx, unsigned int mask,
165 unsigned int bits_set)
166{
167 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
168
169 if (val != -1)
170 alc_write_coefex_idx(codec, nid, coef_idx,
171 (val & ~mask) | bits_set);
172}
173
174#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
175 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
176
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200177/* a special bypass for COEF 0; read the cached value at the second time */
178static unsigned int alc_get_coef0(struct hda_codec *codec)
179{
180 struct alc_spec *spec = codec->spec;
181
182 if (!spec->coef0)
183 spec->coef0 = alc_read_coef_idx(codec, 0);
184 return spec->coef0;
185}
186
Takashi Iwai54db6c32014-08-18 15:11:19 +0200187/* coef writes/updates batch */
188struct coef_fw {
189 unsigned char nid;
190 unsigned char idx;
191 unsigned short mask;
192 unsigned short val;
193};
194
195#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
196 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
197#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
198#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
199#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
200
201static void alc_process_coef_fw(struct hda_codec *codec,
202 const struct coef_fw *fw)
203{
204 for (; fw->nid; fw++) {
205 if (fw->mask == (unsigned short)-1)
206 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
207 else
208 alc_update_coefex_idx(codec, fw->nid, fw->idx,
209 fw->mask, fw->val);
210 }
211}
212
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200213/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200214 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100215 */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200216
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200217/* Enable GPIO mask and set output */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200218static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
219{
220 struct alc_spec *spec = codec->spec;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200221
Takashi Iwai5579cd62018-06-19 22:22:41 +0200222 spec->gpio_mask |= mask;
223 spec->gpio_dir |= mask;
224 spec->gpio_data |= mask;
225}
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200226
Takashi Iwai5579cd62018-06-19 22:22:41 +0200227static void alc_write_gpio_data(struct hda_codec *codec)
228{
229 struct alc_spec *spec = codec->spec;
230
231 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
232 spec->gpio_data);
233}
234
Takashi Iwaiaaf312d2018-06-19 22:28:22 +0200235static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
236 bool on)
237{
238 struct alc_spec *spec = codec->spec;
239 unsigned int oldval = spec->gpio_data;
240
241 if (on)
242 spec->gpio_data |= mask;
243 else
244 spec->gpio_data &= ~mask;
245 if (oldval != spec->gpio_data)
246 alc_write_gpio_data(codec);
247}
248
Takashi Iwai5579cd62018-06-19 22:22:41 +0200249static void alc_write_gpio(struct hda_codec *codec)
250{
251 struct alc_spec *spec = codec->spec;
252
253 if (!spec->gpio_mask)
254 return;
255
256 snd_hda_codec_write(codec, codec->core.afg, 0,
257 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
258 snd_hda_codec_write(codec, codec->core.afg, 0,
259 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
Takashi Iwai215c8502018-06-19 22:34:26 +0200260 if (spec->gpio_write_delay)
261 msleep(1);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200262 alc_write_gpio_data(codec);
263}
264
265static void alc_fixup_gpio(struct hda_codec *codec, int action,
266 unsigned int mask)
267{
268 if (action == HDA_FIXUP_ACT_PRE_PROBE)
269 alc_setup_gpio(codec, mask);
270}
271
272static void alc_fixup_gpio1(struct hda_codec *codec,
273 const struct hda_fixup *fix, int action)
274{
275 alc_fixup_gpio(codec, action, 0x01);
276}
277
278static void alc_fixup_gpio2(struct hda_codec *codec,
279 const struct hda_fixup *fix, int action)
280{
281 alc_fixup_gpio(codec, action, 0x02);
282}
283
284static void alc_fixup_gpio3(struct hda_codec *codec,
285 const struct hda_fixup *fix, int action)
286{
287 alc_fixup_gpio(codec, action, 0x03);
288}
Kailang Yangbdd148a2007-05-08 15:19:08 +0200289
Takashi Iwaiae065f12018-06-19 23:00:03 +0200290static void alc_fixup_gpio4(struct hda_codec *codec,
291 const struct hda_fixup *fix, int action)
292{
293 alc_fixup_gpio(codec, action, 0x04);
294}
295
Takashi Iwai8a503552020-06-18 13:08:32 +0200296static void alc_fixup_micmute_led(struct hda_codec *codec,
297 const struct hda_fixup *fix, int action)
298{
Jaroslav Kyselae65bf992021-03-17 18:29:43 +0100299 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai8a503552020-06-18 13:08:32 +0200300 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
301}
302
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200303/*
304 * Fix hardware PLL issue
305 * On some codecs, the analog PLL gating control must be off while
306 * the default value is 1.
307 */
308static void alc_fix_pll(struct hda_codec *codec)
309{
310 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200311
Takashi Iwai98b24882014-08-18 13:47:50 +0200312 if (spec->pll_nid)
313 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
314 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200315}
316
317static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
318 unsigned int coef_idx, unsigned int coef_bit)
319{
320 struct alc_spec *spec = codec->spec;
321 spec->pll_nid = nid;
322 spec->pll_coef_idx = coef_idx;
323 spec->pll_coef_bit = coef_bit;
324 alc_fix_pll(codec);
325}
326
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100327/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200328static void alc_update_knob_master(struct hda_codec *codec,
329 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100330{
331 unsigned int val;
332 struct snd_kcontrol *kctl;
333 struct snd_ctl_elem_value *uctl;
334
335 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
336 if (!kctl)
337 return;
338 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
339 if (!uctl)
340 return;
Takashi Iwai2ebab402016-02-09 10:23:52 +0100341 val = snd_hda_codec_read(codec, jack->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100342 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
343 val &= HDA_AMP_VOLMASK;
344 uctl->value.integer.value[0] = val;
345 uctl->value.integer.value[1] = val;
346 kctl->put(kctl, uctl);
347 kfree(uctl);
348}
349
David Henningsson29adc4b2012-09-25 11:31:00 +0200350static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100351{
David Henningsson29adc4b2012-09-25 11:31:00 +0200352 /* For some reason, the res given from ALC880 is broken.
353 Here we adjust it properly. */
354 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100355}
356
Kailang Yang394c97f2014-11-12 17:38:08 +0800357/* Change EAPD to verb control */
358static void alc_fill_eapd_coef(struct hda_codec *codec)
359{
360 int coef;
361
362 coef = alc_get_coef0(codec);
363
Takashi Iwai7639a062015-03-03 10:07:24 +0100364 switch (codec->core.vendor_id) {
Kailang Yang394c97f2014-11-12 17:38:08 +0800365 case 0x10ec0262:
366 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
367 break;
368 case 0x10ec0267:
369 case 0x10ec0268:
370 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
371 break;
372 case 0x10ec0269:
373 if ((coef & 0x00f0) == 0x0010)
374 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
375 if ((coef & 0x00f0) == 0x0020)
376 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
377 if ((coef & 0x00f0) == 0x0030)
378 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
379 break;
380 case 0x10ec0280:
381 case 0x10ec0284:
382 case 0x10ec0290:
383 case 0x10ec0292:
384 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
385 break;
Kailang Yang42314302016-02-03 15:03:50 +0800386 case 0x10ec0225:
Takashi Iwai44be77c2017-12-27 08:53:59 +0100387 case 0x10ec0295:
388 case 0x10ec0299:
389 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -0500390 fallthrough;
Takashi Iwai44be77c2017-12-27 08:53:59 +0100391 case 0x10ec0215:
Takashi Iwai1948fc02021-06-18 18:17:20 +0200392 case 0x10ec0230:
Kailang Yang394c97f2014-11-12 17:38:08 +0800393 case 0x10ec0233:
Kailang Yangea04a1d2018-04-25 15:31:52 +0800394 case 0x10ec0235:
Thomas Hebbc4473742020-03-30 12:09:38 -0400395 case 0x10ec0236:
Kailang Yang7fbdcd82020-04-23 14:18:31 +0800396 case 0x10ec0245:
Kailang Yang394c97f2014-11-12 17:38:08 +0800397 case 0x10ec0255:
Thomas Hebbc4473742020-03-30 12:09:38 -0400398 case 0x10ec0256:
Kailang Yangf429e7e2017-12-05 15:38:24 +0800399 case 0x10ec0257:
Kailang Yang394c97f2014-11-12 17:38:08 +0800400 case 0x10ec0282:
401 case 0x10ec0283:
402 case 0x10ec0286:
403 case 0x10ec0288:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800404 case 0x10ec0285:
Kailang Yang506b62c2014-12-18 17:07:44 +0800405 case 0x10ec0298:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800406 case 0x10ec0289:
Kailang Yang1078bef2018-11-08 16:36:15 +0800407 case 0x10ec0300:
Kailang Yang394c97f2014-11-12 17:38:08 +0800408 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
409 break;
Kailang Yang3aabf942017-11-08 15:28:33 +0800410 case 0x10ec0275:
411 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
412 break;
Hui Wang88227022021-05-07 10:44:52 +0800413 case 0x10ec0287:
414 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
415 alc_write_coef_idx(codec, 0x8, 0x4ab7);
416 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800417 case 0x10ec0293:
418 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
419 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800420 case 0x10ec0234:
421 case 0x10ec0274:
422 case 0x10ec0294:
Kailang Yang6fbae352016-05-30 16:44:20 +0800423 case 0x10ec0700:
424 case 0x10ec0701:
425 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +0800426 case 0x10ec0711:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800427 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
428 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800429 case 0x10ec0662:
430 if ((coef & 0x00f0) == 0x0030)
431 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
432 break;
433 case 0x10ec0272:
434 case 0x10ec0273:
435 case 0x10ec0663:
436 case 0x10ec0665:
437 case 0x10ec0670:
438 case 0x10ec0671:
439 case 0x10ec0672:
440 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
441 break;
Kailang Yang9194a1e2020-01-07 17:22:19 +0800442 case 0x10ec0222:
Kailang Yangf0778872019-10-24 15:13:32 +0800443 case 0x10ec0623:
444 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
445 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800446 case 0x10ec0668:
447 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
448 break;
449 case 0x10ec0867:
450 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
451 break;
452 case 0x10ec0888:
453 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
454 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
455 break;
456 case 0x10ec0892:
Kailang Yange5782a52020-11-27 14:39:23 +0800457 case 0x10ec0897:
Kailang Yang394c97f2014-11-12 17:38:08 +0800458 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
459 break;
460 case 0x10ec0899:
461 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +0800462 case 0x10ec0b00:
Kailang Yang65553b12017-07-11 15:15:47 +0800463 case 0x10ec1168:
Kailang Yanga535ad52017-01-16 16:59:26 +0800464 case 0x10ec1220:
Kailang Yang394c97f2014-11-12 17:38:08 +0800465 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
466 break;
467 }
468}
469
Kailang Yangf9423e72008-05-27 12:32:25 +0200470/* additional initialization for ALC888 variants */
471static void alc888_coef_init(struct hda_codec *codec)
472{
Kailang Yang1df88742014-10-29 16:10:13 +0800473 switch (alc_get_coef0(codec) & 0x00f0) {
474 /* alc888-VA */
475 case 0x00:
476 /* alc888-VB */
477 case 0x10:
478 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
479 break;
480 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200481}
482
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100483/* turn on/off EAPD control (only if available) */
484static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
485{
486 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
487 return;
488 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
489 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
490 on ? 2 : 0);
491}
492
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200493/* turn on/off EAPD controls of the codec */
494static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
495{
496 /* We currently only handle front, HP */
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100497 static const hda_nid_t pins[] = {
Hui Wangaf95b412015-03-26 17:14:55 +0800498 0x0f, 0x10, 0x14, 0x15, 0x17, 0
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200499 };
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100500 const hda_nid_t *p;
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200501 for (p = pins; *p; p++)
502 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200503}
504
Kailang Yangdad31972019-05-10 16:28:57 +0800505static int find_ext_mic_pin(struct hda_codec *codec);
506
507static void alc_headset_mic_no_shutup(struct hda_codec *codec)
508{
509 const struct hda_pincfg *pin;
510 int mic_pin = find_ext_mic_pin(codec);
511 int i;
512
513 /* don't shut up pins when unloading the driver; otherwise it breaks
514 * the default pin setup at the next load of the driver
515 */
516 if (codec->bus->shutdown)
517 return;
518
519 snd_array_for_each(&codec->init_pins, i, pin) {
520 /* use read here for syncing after issuing each verb */
521 if (pin->nid != mic_pin)
522 snd_hda_codec_read(codec, pin->nid, 0,
523 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
524 }
525
526 codec->pins_shutup = 1;
527}
528
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100529static void alc_shutup_pins(struct hda_codec *codec)
530{
531 struct alc_spec *spec = codec->spec;
532
Kailang Yangdad31972019-05-10 16:28:57 +0800533 switch (codec->core.vendor_id) {
Kailang Yang5aec9892021-10-05 14:35:14 +0800534 case 0x10ec0236:
535 case 0x10ec0256:
Kailang Yang66c5d712019-12-09 15:56:15 +0800536 case 0x10ec0283:
Kailang Yangdad31972019-05-10 16:28:57 +0800537 case 0x10ec0286:
538 case 0x10ec0288:
539 case 0x10ec0298:
540 alc_headset_mic_no_shutup(codec);
541 break;
542 default:
543 if (!spec->no_shutup_pins)
544 snd_hda_shutup_pins(codec);
545 break;
546 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100547}
548
Takashi Iwai1c7161532011-04-07 10:37:16 +0200549/* generic shutup callback;
Lars-Peter Clausen4ce8e6a2016-11-08 15:48:06 +0100550 * just turning off EAPD and a little pause for avoiding pop-noise
Takashi Iwai1c7161532011-04-07 10:37:16 +0200551 */
552static void alc_eapd_shutup(struct hda_codec *codec)
553{
Kailang Yang97a26572013-11-29 00:35:26 -0500554 struct alc_spec *spec = codec->spec;
555
Takashi Iwai1c7161532011-04-07 10:37:16 +0200556 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500557 if (!spec->no_depop_delay)
558 msleep(200);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100559 alc_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200560}
561
Takashi Iwai1d045db2011-07-07 18:23:21 +0200562/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200563static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200564{
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200565 alc_auto_setup_eapd(codec, true);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200566 alc_write_gpio(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200567 switch (type) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200568 case ALC_INIT_DEFAULT:
Takashi Iwai7639a062015-03-03 10:07:24 +0100569 switch (codec->core.vendor_id) {
Kailang Yangc9b58002007-10-16 14:30:01 +0200570 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200571 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200572 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200573 case 0x10ec0880:
574 case 0x10ec0882:
575 case 0x10ec0883:
576 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800577 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200578 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200579 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200580 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200581 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200582 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200583 break;
584 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200585}
Kailang Yangea1fb292008-08-26 12:58:38 +0200586
Takashi Iwai35a39f92019-02-01 11:19:50 +0100587/* get a primary headphone pin if available */
588static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
589{
590 if (spec->gen.autocfg.hp_pins[0])
591 return spec->gen.autocfg.hp_pins[0];
592 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
593 return spec->gen.autocfg.line_out_pins[0];
594 return 0;
595}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200596
597/*
598 * Realtek SSID verification
599 */
600
David Henningsson90622912010-10-14 14:50:18 +0200601/* Could be any non-zero and even value. When used as fixup, tells
602 * the driver to ignore any present sku defines.
603 */
604#define ALC_FIXUP_SKU_IGNORE (2)
605
Takashi Iwai23d30f22012-05-07 17:17:32 +0200606static void alc_fixup_sku_ignore(struct hda_codec *codec,
607 const struct hda_fixup *fix, int action)
608{
609 struct alc_spec *spec = codec->spec;
610 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
611 spec->cdefine.fixup = 1;
612 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
613 }
614}
615
Mengdong Linb5c66112013-11-29 00:35:35 -0500616static void alc_fixup_no_depop_delay(struct hda_codec *codec,
617 const struct hda_fixup *fix, int action)
618{
619 struct alc_spec *spec = codec->spec;
620
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500621 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500622 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500623 codec->depop_delay = 0;
624 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500625}
626
Kailang Yangda00c242010-03-19 11:23:45 +0100627static int alc_auto_parse_customize_define(struct hda_codec *codec)
628{
629 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100630 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100631 struct alc_spec *spec = codec->spec;
632
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200633 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
634
David Henningsson90622912010-10-14 14:50:18 +0200635 if (spec->cdefine.fixup) {
636 ass = spec->cdefine.sku_cfg;
637 if (ass == ALC_FIXUP_SKU_IGNORE)
638 return -1;
639 goto do_sku;
640 }
641
Takashi Iwai5100cd02014-02-15 10:03:19 +0100642 if (!codec->bus->pci)
643 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100644 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200645 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100646 goto do_sku;
647
648 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100649 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100650 nid = 0x17;
651 ass = snd_hda_codec_get_pincfg(codec, nid);
652
653 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100654 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100655 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100656 return -1;
657 }
658
659 /* check sum */
660 tmp = 0;
661 for (i = 1; i < 16; i++) {
662 if ((ass >> i) & 1)
663 tmp++;
664 }
665 if (((ass >> 16) & 0xf) != tmp)
666 return -1;
667
668 spec->cdefine.port_connectivity = ass >> 30;
669 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
670 spec->cdefine.check_sum = (ass >> 16) & 0xf;
671 spec->cdefine.customization = ass >> 8;
672do_sku:
673 spec->cdefine.sku_cfg = ass;
674 spec->cdefine.external_amp = (ass & 0x38) >> 3;
675 spec->cdefine.platform_type = (ass & 0x4) >> 2;
676 spec->cdefine.swap = (ass & 0x2) >> 1;
677 spec->cdefine.override = ass & 0x1;
678
Takashi Iwai4e76a882014-02-25 12:21:03 +0100679 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100680 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100681 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100682 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100683 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
684 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
685 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
686 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
687 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
688 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
689 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100690
691 return 0;
692}
693
Takashi Iwai08c189f2012-12-19 15:22:24 +0100694/* return the position of NID in the list, or -1 if not found */
695static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
696{
697 int i;
698 for (i = 0; i < nums; i++)
699 if (list[i] == nid)
700 return i;
701 return -1;
702}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200703/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200704static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
705{
Takashi Iwai21268962011-07-07 15:01:13 +0200706 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200707}
708
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200709/* check subsystem ID and set up device-specific initialization;
710 * return 1 if initialized, 0 if invalid SSID
711 */
712/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
713 * 31 ~ 16 : Manufacture ID
714 * 15 ~ 8 : SKU ID
715 * 7 ~ 0 : Assembly ID
716 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
717 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100718static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200719{
720 unsigned int ass, tmp, i;
721 unsigned nid;
722 struct alc_spec *spec = codec->spec;
723
David Henningsson90622912010-10-14 14:50:18 +0200724 if (spec->cdefine.fixup) {
725 ass = spec->cdefine.sku_cfg;
726 if (ass == ALC_FIXUP_SKU_IGNORE)
727 return 0;
728 goto do_sku;
729 }
730
Takashi Iwai7639a062015-03-03 10:07:24 +0100731 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100732 if (codec->bus->pci &&
733 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200734 goto do_sku;
735
736 /* invalid SSID, check the special NID pin defcfg instead */
737 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400738 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200739 * 29~21 : reserve
740 * 20 : PCBEEP input
741 * 19~16 : Check sum (15:1)
742 * 15~1 : Custom
743 * 0 : override
744 */
745 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100746 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200747 nid = 0x17;
748 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100749 codec_dbg(codec,
750 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200751 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100752 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200753 return 0;
754 if ((ass >> 30) != 1) /* no physical connection */
755 return 0;
756
757 /* check sum */
758 tmp = 0;
759 for (i = 1; i < 16; i++) {
760 if ((ass >> i) & 1)
761 tmp++;
762 }
763 if (((ass >> 16) & 0xf) != tmp)
764 return 0;
765do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100766 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100767 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200768 /*
769 * 0 : override
770 * 1 : Swap Jack
771 * 2 : 0 --> Desktop, 1 --> Laptop
772 * 3~5 : External Amplifier control
773 * 7~6 : Reserved
774 */
775 tmp = (ass & 0x38) >> 3; /* external Amp control */
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200776 if (spec->init_amp == ALC_INIT_UNDEFINED) {
777 switch (tmp) {
778 case 1:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200779 alc_setup_gpio(codec, 0x01);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200780 break;
781 case 3:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200782 alc_setup_gpio(codec, 0x02);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200783 break;
784 case 7:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200785 alc_setup_gpio(codec, 0x03);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200786 break;
787 case 5:
788 default:
789 spec->init_amp = ALC_INIT_DEFAULT;
790 break;
791 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200792 }
793
794 /* is laptop or Desktop and enable the function "Mute internal speaker
795 * when the external headphone out jack is plugged"
796 */
797 if (!(ass & 0x8000))
798 return 1;
799 /*
800 * 10~8 : Jack location
801 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
802 * 14~13: Resvered
803 * 15 : 1 --> enable the function "Mute internal speaker
804 * when the external headphone out jack is plugged"
805 */
Takashi Iwai35a39f92019-02-01 11:19:50 +0100806 if (!alc_get_hp_pin(spec)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200807 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200808 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100809 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100810 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
811 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200812 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100813 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200814 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200815 return 1;
816}
Kailang Yangea1fb292008-08-26 12:58:38 +0200817
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200818/* Check the validity of ALC subsystem-id
819 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
820static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200821{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100822 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200823 struct alc_spec *spec = codec->spec;
Takashi Iwai67791202020-04-18 21:06:39 +0200824 if (spec->init_amp == ALC_INIT_UNDEFINED) {
825 codec_dbg(codec,
826 "realtek: Enable default setup for auto mode as fallback\n");
827 spec->init_amp = ALC_INIT_DEFAULT;
828 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200829 }
Takashi Iwai21268962011-07-07 15:01:13 +0200830}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200831
Takashi Iwai41e41f12005-06-08 14:48:49 +0200832/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200833 */
834
David Henningsson9d36a7d2014-10-07 10:18:42 +0200835static void alc_fixup_inv_dmic(struct hda_codec *codec,
836 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200837{
838 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100839
David Henningsson9d36a7d2014-10-07 10:18:42 +0200840 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200841}
842
Takashi Iwai603c4012008-07-30 15:01:44 +0200843
Takashi Iwai2eab6942012-12-18 15:30:41 +0100844static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700845{
Takashi Iwaia5cb4632018-06-20 12:50:11 +0200846 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700847
Takashi Iwai08c189f2012-12-19 15:22:24 +0100848 err = snd_hda_gen_build_controls(codec);
849 if (err < 0)
850 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700851
Takashi Iwai1727a772013-01-10 09:52:52 +0100852 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100853 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700854}
855
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200856
Linus Torvalds1da177e2005-04-16 15:20:36 -0700857/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100858 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200859 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200860
Takashi Iwaic9af7532019-05-10 11:01:43 +0200861static void alc_pre_init(struct hda_codec *codec)
862{
863 alc_fill_eapd_coef(codec);
864}
865
Kailang Yangaeac1a02019-05-16 16:10:44 +0800866#define is_s3_resume(codec) \
867 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
Takashi Iwaic9af7532019-05-10 11:01:43 +0200868#define is_s4_resume(codec) \
869 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
870
Linus Torvalds1da177e2005-04-16 15:20:36 -0700871static int alc_init(struct hda_codec *codec)
872{
873 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200874
Takashi Iwaic9af7532019-05-10 11:01:43 +0200875 /* hibernation resume needs the full chip initialization */
876 if (is_s4_resume(codec))
877 alc_pre_init(codec);
878
Takashi Iwai546bb672012-03-07 08:37:19 +0100879 if (spec->init_hook)
880 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100881
Takashi Iwai89781d02019-08-30 12:03:38 +0200882 spec->gen.skip_verbs = 1; /* applied in below */
Kailang Yang607ca3b2019-04-26 16:35:41 +0800883 snd_hda_gen_init(codec);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200884 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200885 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai89781d02019-08-30 12:03:38 +0200886 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200887
Takashi Iwai1727a772013-01-10 09:52:52 +0100888 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200889
Linus Torvalds1da177e2005-04-16 15:20:36 -0700890 return 0;
891}
892
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100893static inline void alc_shutup(struct hda_codec *codec)
894{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200895 struct alc_spec *spec = codec->spec;
896
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200897 if (!snd_hda_get_bool_hint(codec, "shutup"))
898 return; /* disabled explicitly by hints */
899
Takashi Iwai1c7161532011-04-07 10:37:16 +0200900 if (spec && spec->shutup)
901 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200902 else
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100903 alc_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100904}
905
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100906#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700907
Takashi Iwai83012a72012-08-24 18:38:08 +0200908#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500909static void alc_power_eapd(struct hda_codec *codec)
910{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200911 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500912}
913
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200914static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100915{
916 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100917 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100918 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500919 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100920 return 0;
921}
922#endif
923
Takashi Iwai2a439522011-07-26 09:52:50 +0200924#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100925static int alc_resume(struct hda_codec *codec)
926{
Kailang Yang97a26572013-11-29 00:35:26 -0500927 struct alc_spec *spec = codec->spec;
928
929 if (!spec->no_depop_delay)
930 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100931 codec->patch_ops.init(codec);
Takashi Iwai1a462be2020-01-09 10:01:04 +0100932 snd_hda_regmap_sync(codec);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200933 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100934 return 0;
935}
Takashi Iwaie044c392008-10-27 16:56:24 +0100936#endif
937
Linus Torvalds1da177e2005-04-16 15:20:36 -0700938/*
939 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200940static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700941 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100942 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700943 .init = alc_init,
944 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200945 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200946#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100947 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100948 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100949 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200950#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700951};
952
David Henningsson29adc4b2012-09-25 11:31:00 +0200953
Takashi Iwaided255b2015-10-01 17:59:43 +0200954#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100955
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200956/*
Kailang Yang4b016932013-11-28 11:55:09 +0100957 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200958 */
959struct alc_codec_rename_table {
960 unsigned int vendor_id;
961 unsigned short coef_mask;
962 unsigned short coef_bits;
963 const char *name;
964};
965
Kailang Yang4b016932013-11-28 11:55:09 +0100966struct alc_codec_rename_pci_table {
967 unsigned int codec_vendor_id;
968 unsigned short pci_subvendor;
969 unsigned short pci_subdevice;
970 const char *name;
971};
972
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100973static const struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800974 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200975 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
976 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
977 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
978 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
979 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
980 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
981 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200982 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800983 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200984 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
985 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
986 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
987 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
988 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
989 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
990 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
991 { } /* terminator */
992};
993
Takashi Iwai6b0f95c2020-01-05 15:47:18 +0100994static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
Kailang Yang4b016932013-11-28 11:55:09 +0100995 { 0x10ec0280, 0x1028, 0, "ALC3220" },
996 { 0x10ec0282, 0x1028, 0, "ALC3221" },
997 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +0800998 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +0100999 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +08001000 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +01001001 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1002 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001003 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1004 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +08001005 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +08001006 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +08001007 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +08001008 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +08001009 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +08001010 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001011 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1012 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1013 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1014 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1015 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1016 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1017 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1018 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1019 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1020 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1021 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +01001022 { } /* terminator */
1023};
1024
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001025static int alc_codec_rename_from_preset(struct hda_codec *codec)
1026{
1027 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +01001028 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001029
1030 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001031 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001032 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02001033 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001034 return alc_codec_rename(codec, p->name);
1035 }
Kailang Yang4b016932013-11-28 11:55:09 +01001036
Takashi Iwai5100cd02014-02-15 10:03:19 +01001037 if (!codec->bus->pci)
1038 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +01001039 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001040 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +01001041 continue;
1042 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1043 continue;
1044 if (!q->pci_subdevice ||
1045 q->pci_subdevice == codec->bus->pci->subsystem_device)
1046 return alc_codec_rename(codec, q->name);
1047 }
1048
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001049 return 0;
1050}
1051
Takashi Iwaie4770622011-07-08 11:11:35 +02001052
1053/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001054 * Digital-beep handlers
1055 */
1056#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001057
1058/* additional beep mixers; private_value will be overwritten */
1059static const struct snd_kcontrol_new alc_beep_mixer[] = {
1060 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1061 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1062};
1063
1064/* set up and create beep controls */
1065static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1066 int idx, int dir)
1067{
1068 struct snd_kcontrol_new *knew;
1069 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1070 int i;
1071
1072 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1073 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1074 &alc_beep_mixer[i]);
1075 if (!knew)
1076 return -ENOMEM;
1077 knew->private_value = beep_amp;
1078 }
1079 return 0;
1080}
Takashi Iwai1d045db2011-07-07 18:23:21 +02001081
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001082static const struct snd_pci_quirk beep_allow_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +02001083 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -07001084 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001085 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +01001086 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001087 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1088 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1089 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +01001090 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001091 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001092 /* denylist -- no beep available */
Takashi Iwai051c78a2019-08-22 09:58:07 +02001093 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1094 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001095 {}
1096};
1097
1098static inline int has_cdefine_beep(struct hda_codec *codec)
1099{
1100 struct alc_spec *spec = codec->spec;
1101 const struct snd_pci_quirk *q;
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001102 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001103 if (q)
1104 return q->value;
1105 return spec->cdefine.enable_pcbeep;
1106}
1107#else
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001108#define set_beep_amp(spec, nid, idx, dir) 0
Takashi Iwai1d045db2011-07-07 18:23:21 +02001109#define has_cdefine_beep(codec) 0
1110#endif
1111
1112/* parse the BIOS configuration and set up the alc_spec */
1113/* return 1 if successful, 0 if the proper config is not found,
1114 * or a negative error code
1115 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001116static int alc_parse_auto_config(struct hda_codec *codec,
1117 const hda_nid_t *ignore_nids,
1118 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001119{
1120 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001121 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001122 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001123
Takashi Iwai53c334a2011-08-23 18:27:14 +02001124 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1125 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001126 if (err < 0)
1127 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001128
1129 if (ssid_nids)
1130 alc_ssid_check(codec, ssid_nids);
1131
Takashi Iwai08c189f2012-12-19 15:22:24 +01001132 err = snd_hda_gen_parse_auto_config(codec, cfg);
1133 if (err < 0)
1134 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001135
Takashi Iwai1d045db2011-07-07 18:23:21 +02001136 return 1;
1137}
1138
Takashi Iwai3de95172012-05-07 18:03:15 +02001139/* common preparation job for alc_spec */
1140static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1141{
1142 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1143 int err;
1144
1145 if (!spec)
1146 return -ENOMEM;
1147 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001148 snd_hda_gen_spec_init(&spec->gen);
1149 spec->gen.mixer_nid = mixer_nid;
1150 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001151 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001152 /* FIXME: do we need this for all Realtek codec models? */
1153 codec->spdif_status_reset = 1;
Kai Vehmanena6e7d0a2020-10-12 13:27:04 +03001154 codec->forced_resume = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001155 codec->patch_ops = alc_patch_ops;
Takashi Iwai3de95172012-05-07 18:03:15 +02001156
1157 err = alc_codec_rename_from_preset(codec);
1158 if (err < 0) {
1159 kfree(spec);
1160 return err;
1161 }
1162 return 0;
1163}
1164
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001165static int alc880_parse_auto_config(struct hda_codec *codec)
1166{
1167 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001168 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001169 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1170}
1171
Takashi Iwai1d045db2011-07-07 18:23:21 +02001172/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001173 * ALC880 fix-ups
1174 */
1175enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001176 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001177 ALC880_FIXUP_GPIO2,
1178 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001179 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001180 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001181 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001182 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001183 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001184 ALC880_FIXUP_VOL_KNOB,
1185 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001186 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001187 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001188 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001189 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001190 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001191 ALC880_FIXUP_3ST_BASE,
1192 ALC880_FIXUP_3ST,
1193 ALC880_FIXUP_3ST_DIG,
1194 ALC880_FIXUP_5ST_BASE,
1195 ALC880_FIXUP_5ST,
1196 ALC880_FIXUP_5ST_DIG,
1197 ALC880_FIXUP_6ST_BASE,
1198 ALC880_FIXUP_6ST,
1199 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001200 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001201};
1202
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001203/* enable the volume-knob widget support on NID 0x21 */
1204static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001205 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001206{
Takashi Iwai1727a772013-01-10 09:52:52 +01001207 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001208 snd_hda_jack_detect_enable_callback(codec, 0x21,
1209 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001210}
1211
Takashi Iwai1727a772013-01-10 09:52:52 +01001212static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001213 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001214 .type = HDA_FIXUP_FUNC,
1215 .v.func = alc_fixup_gpio1,
Takashi Iwai411225a2012-02-20 17:48:19 +01001216 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001217 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001218 .type = HDA_FIXUP_FUNC,
1219 .v.func = alc_fixup_gpio2,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001220 },
1221 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001222 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001223 .v.verbs = (const struct hda_verb[]) {
1224 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1225 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1226 { }
1227 },
1228 .chained = true,
1229 .chain_id = ALC880_FIXUP_GPIO2,
1230 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001231 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001232 .type = HDA_FIXUP_PINS,
1233 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001234 /* disable bogus unused pins */
1235 { 0x16, 0x411111f0 },
1236 { 0x18, 0x411111f0 },
1237 { 0x1a, 0x411111f0 },
1238 { }
1239 }
1240 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001241 [ALC880_FIXUP_LG_LW25] = {
1242 .type = HDA_FIXUP_PINS,
1243 .v.pins = (const struct hda_pintbl[]) {
1244 { 0x1a, 0x0181344f }, /* line-in */
1245 { 0x1b, 0x0321403f }, /* headphone */
1246 { }
1247 }
1248 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001249 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001250 .type = HDA_FIXUP_PINS,
1251 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001252 /* disable bogus unused pins */
1253 { 0x17, 0x411111f0 },
1254 { }
1255 },
1256 .chained = true,
1257 .chain_id = ALC880_FIXUP_GPIO2,
1258 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001259 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001260 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001261 .v.verbs = (const struct hda_verb[]) {
1262 /* change to EAPD mode */
1263 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1264 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1265 {}
1266 },
1267 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001268 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001269 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001270 .v.verbs = (const struct hda_verb[]) {
1271 /* change to EAPD mode */
1272 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1273 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1274 {}
1275 },
1276 .chained = true,
1277 .chain_id = ALC880_FIXUP_GPIO2,
1278 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001279 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001280 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001281 .v.func = alc880_fixup_vol_knob,
1282 },
1283 [ALC880_FIXUP_FUJITSU] = {
1284 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001285 .type = HDA_FIXUP_PINS,
1286 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001287 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001288 { 0x15, 0x99030120 }, /* speaker */
1289 { 0x16, 0x99030130 }, /* bass speaker */
1290 { 0x17, 0x411111f0 }, /* N/A */
1291 { 0x18, 0x411111f0 }, /* N/A */
1292 { 0x19, 0x01a19950 }, /* mic-in */
1293 { 0x1a, 0x411111f0 }, /* N/A */
1294 { 0x1b, 0x411111f0 }, /* N/A */
1295 { 0x1c, 0x411111f0 }, /* N/A */
1296 { 0x1d, 0x411111f0 }, /* N/A */
1297 { 0x1e, 0x01454140 }, /* SPDIF out */
1298 { }
1299 },
1300 .chained = true,
1301 .chain_id = ALC880_FIXUP_VOL_KNOB,
1302 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001303 [ALC880_FIXUP_F1734] = {
1304 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001305 .type = HDA_FIXUP_PINS,
1306 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001307 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001308 { 0x15, 0x99030120 }, /* speaker */
1309 { 0x16, 0x411111f0 }, /* N/A */
1310 { 0x17, 0x411111f0 }, /* N/A */
1311 { 0x18, 0x411111f0 }, /* N/A */
1312 { 0x19, 0x01a19950 }, /* mic-in */
1313 { 0x1a, 0x411111f0 }, /* N/A */
1314 { 0x1b, 0x411111f0 }, /* N/A */
1315 { 0x1c, 0x411111f0 }, /* N/A */
1316 { 0x1d, 0x411111f0 }, /* N/A */
1317 { 0x1e, 0x411111f0 }, /* N/A */
1318 { }
1319 },
1320 .chained = true,
1321 .chain_id = ALC880_FIXUP_VOL_KNOB,
1322 },
Takashi Iwai817de922012-02-20 17:20:48 +01001323 [ALC880_FIXUP_UNIWILL] = {
1324 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001325 .type = HDA_FIXUP_PINS,
1326 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001327 { 0x14, 0x0121411f }, /* HP */
1328 { 0x15, 0x99030120 }, /* speaker */
1329 { 0x16, 0x99030130 }, /* bass speaker */
1330 { }
1331 },
1332 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001333 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001334 .type = HDA_FIXUP_PINS,
1335 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001336 /* disable bogus unused pins */
1337 { 0x17, 0x411111f0 },
1338 { 0x19, 0x411111f0 },
1339 { 0x1b, 0x411111f0 },
1340 { 0x1f, 0x411111f0 },
1341 { }
1342 }
1343 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001344 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001345 .type = HDA_FIXUP_PINS,
1346 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001347 /* set up the whole pins as BIOS is utterly broken */
1348 { 0x14, 0x99030120 }, /* speaker */
1349 { 0x15, 0x0121411f }, /* HP */
1350 { 0x16, 0x411111f0 }, /* N/A */
1351 { 0x17, 0x411111f0 }, /* N/A */
1352 { 0x18, 0x01a19950 }, /* mic-in */
1353 { 0x19, 0x411111f0 }, /* N/A */
1354 { 0x1a, 0x01813031 }, /* line-in */
1355 { 0x1b, 0x411111f0 }, /* N/A */
1356 { 0x1c, 0x411111f0 }, /* N/A */
1357 { 0x1d, 0x411111f0 }, /* N/A */
1358 { 0x1e, 0x0144111e }, /* SPDIF */
1359 { }
1360 }
1361 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001362 [ALC880_FIXUP_ASUS_W5A] = {
1363 .type = HDA_FIXUP_PINS,
1364 .v.pins = (const struct hda_pintbl[]) {
1365 /* set up the whole pins as BIOS is utterly broken */
1366 { 0x14, 0x0121411f }, /* HP */
1367 { 0x15, 0x411111f0 }, /* N/A */
1368 { 0x16, 0x411111f0 }, /* N/A */
1369 { 0x17, 0x411111f0 }, /* N/A */
1370 { 0x18, 0x90a60160 }, /* mic */
1371 { 0x19, 0x411111f0 }, /* N/A */
1372 { 0x1a, 0x411111f0 }, /* N/A */
1373 { 0x1b, 0x411111f0 }, /* N/A */
1374 { 0x1c, 0x411111f0 }, /* N/A */
1375 { 0x1d, 0x411111f0 }, /* N/A */
1376 { 0x1e, 0xb743111e }, /* SPDIF out */
1377 { }
1378 },
1379 .chained = true,
1380 .chain_id = ALC880_FIXUP_GPIO1,
1381 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001382 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001383 .type = HDA_FIXUP_PINS,
1384 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001385 { 0x14, 0x01014010 }, /* line-out */
1386 { 0x15, 0x411111f0 }, /* N/A */
1387 { 0x16, 0x411111f0 }, /* N/A */
1388 { 0x17, 0x411111f0 }, /* N/A */
1389 { 0x18, 0x01a19c30 }, /* mic-in */
1390 { 0x19, 0x0121411f }, /* HP */
1391 { 0x1a, 0x01813031 }, /* line-in */
1392 { 0x1b, 0x02a19c40 }, /* front-mic */
1393 { 0x1c, 0x411111f0 }, /* N/A */
1394 { 0x1d, 0x411111f0 }, /* N/A */
1395 /* 0x1e is filled in below */
1396 { 0x1f, 0x411111f0 }, /* N/A */
1397 { }
1398 }
1399 },
1400 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001401 .type = HDA_FIXUP_PINS,
1402 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001403 { 0x1e, 0x411111f0 }, /* N/A */
1404 { }
1405 },
1406 .chained = true,
1407 .chain_id = ALC880_FIXUP_3ST_BASE,
1408 },
1409 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001410 .type = HDA_FIXUP_PINS,
1411 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001412 { 0x1e, 0x0144111e }, /* SPDIF */
1413 { }
1414 },
1415 .chained = true,
1416 .chain_id = ALC880_FIXUP_3ST_BASE,
1417 },
1418 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001419 .type = HDA_FIXUP_PINS,
1420 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001421 { 0x14, 0x01014010 }, /* front */
1422 { 0x15, 0x411111f0 }, /* N/A */
1423 { 0x16, 0x01011411 }, /* CLFE */
1424 { 0x17, 0x01016412 }, /* surr */
1425 { 0x18, 0x01a19c30 }, /* mic-in */
1426 { 0x19, 0x0121411f }, /* HP */
1427 { 0x1a, 0x01813031 }, /* line-in */
1428 { 0x1b, 0x02a19c40 }, /* front-mic */
1429 { 0x1c, 0x411111f0 }, /* N/A */
1430 { 0x1d, 0x411111f0 }, /* N/A */
1431 /* 0x1e is filled in below */
1432 { 0x1f, 0x411111f0 }, /* N/A */
1433 { }
1434 }
1435 },
1436 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001437 .type = HDA_FIXUP_PINS,
1438 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001439 { 0x1e, 0x411111f0 }, /* N/A */
1440 { }
1441 },
1442 .chained = true,
1443 .chain_id = ALC880_FIXUP_5ST_BASE,
1444 },
1445 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001446 .type = HDA_FIXUP_PINS,
1447 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001448 { 0x1e, 0x0144111e }, /* SPDIF */
1449 { }
1450 },
1451 .chained = true,
1452 .chain_id = ALC880_FIXUP_5ST_BASE,
1453 },
1454 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001455 .type = HDA_FIXUP_PINS,
1456 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001457 { 0x14, 0x01014010 }, /* front */
1458 { 0x15, 0x01016412 }, /* surr */
1459 { 0x16, 0x01011411 }, /* CLFE */
1460 { 0x17, 0x01012414 }, /* side */
1461 { 0x18, 0x01a19c30 }, /* mic-in */
1462 { 0x19, 0x02a19c40 }, /* front-mic */
1463 { 0x1a, 0x01813031 }, /* line-in */
1464 { 0x1b, 0x0121411f }, /* HP */
1465 { 0x1c, 0x411111f0 }, /* N/A */
1466 { 0x1d, 0x411111f0 }, /* N/A */
1467 /* 0x1e is filled in below */
1468 { 0x1f, 0x411111f0 }, /* N/A */
1469 { }
1470 }
1471 },
1472 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001473 .type = HDA_FIXUP_PINS,
1474 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001475 { 0x1e, 0x411111f0 }, /* N/A */
1476 { }
1477 },
1478 .chained = true,
1479 .chain_id = ALC880_FIXUP_6ST_BASE,
1480 },
1481 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001482 .type = HDA_FIXUP_PINS,
1483 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001484 { 0x1e, 0x0144111e }, /* SPDIF */
1485 { }
1486 },
1487 .chained = true,
1488 .chain_id = ALC880_FIXUP_6ST_BASE,
1489 },
Takashi Iwai53971452013-01-23 18:21:37 +01001490 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1491 .type = HDA_FIXUP_PINS,
1492 .v.pins = (const struct hda_pintbl[]) {
1493 { 0x1b, 0x0121401f }, /* HP with jack detect */
1494 { }
1495 },
1496 .chained_before = true,
1497 .chain_id = ALC880_FIXUP_6ST_BASE,
1498 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001499};
1500
1501static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001502 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001503 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001504 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001505 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001506 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001507 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001508 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001509 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001510 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001511 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001512 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001513 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001514 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001515 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001516 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001517 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001518 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001519 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001520 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1521 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1522 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001523 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001524 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001525
1526 /* Below is the copied entries from alc880_quirks.c.
1527 * It's not quite sure whether BIOS sets the correct pin-config table
1528 * on these machines, thus they are kept to be compatible with
1529 * the old static quirks. Once when it's confirmed to work without
1530 * these overrides, it'd be better to remove.
1531 */
1532 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1533 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1534 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1535 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1536 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1537 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1538 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1539 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1540 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1541 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1542 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1543 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1544 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1545 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1546 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1547 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1548 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1549 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1550 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1551 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1552 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1553 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1554 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1555 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1556 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1557 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1558 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1559 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1560 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1561 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1562 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1563 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1564 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1565 /* default Intel */
1566 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1567 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1568 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1569 {}
1570};
1571
Takashi Iwai1727a772013-01-10 09:52:52 +01001572static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001573 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1574 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1575 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1576 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1577 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1578 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001579 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001580 {}
1581};
1582
1583
1584/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001585 * OK, here we have finally the patch for ALC880
1586 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001587static int patch_alc880(struct hda_codec *codec)
1588{
1589 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001590 int err;
1591
Takashi Iwai3de95172012-05-07 18:03:15 +02001592 err = alc_alloc_spec(codec, 0x0b);
1593 if (err < 0)
1594 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001595
Takashi Iwai3de95172012-05-07 18:03:15 +02001596 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001597 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001598 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001599
Takashi Iwai225068a2015-05-29 10:42:14 +02001600 codec->patch_ops.unsol_event = alc880_unsol_event;
1601
Takashi Iwaic9af7532019-05-10 11:01:43 +02001602 alc_pre_init(codec);
1603
Takashi Iwai1727a772013-01-10 09:52:52 +01001604 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001605 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001606 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001607
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001608 /* automatic parse from the BIOS config */
1609 err = alc880_parse_auto_config(codec);
1610 if (err < 0)
1611 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001612
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001613 if (!spec->gen.no_analog) {
1614 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1615 if (err < 0)
1616 goto error;
1617 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001618
Takashi Iwai1727a772013-01-10 09:52:52 +01001619 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001620
Takashi Iwai1d045db2011-07-07 18:23:21 +02001621 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001622
1623 error:
1624 alc_free(codec);
1625 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001626}
1627
1628
1629/*
1630 * ALC260 support
1631 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001632static int alc260_parse_auto_config(struct hda_codec *codec)
1633{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001634 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001635 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1636 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001637}
1638
Takashi Iwai1d045db2011-07-07 18:23:21 +02001639/*
1640 * Pin config fixes
1641 */
1642enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001643 ALC260_FIXUP_HP_DC5750,
1644 ALC260_FIXUP_HP_PIN_0F,
1645 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001646 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001647 ALC260_FIXUP_GPIO1_TOGGLE,
1648 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001649 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001650 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001651 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001652 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001653 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001654};
1655
Takashi Iwai20f7d922012-02-16 12:35:16 +01001656static void alc260_gpio1_automute(struct hda_codec *codec)
1657{
1658 struct alc_spec *spec = codec->spec;
Takashi Iwaiaaf312d2018-06-19 22:28:22 +02001659
1660 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001661}
1662
1663static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001664 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001665{
1666 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001667 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001668 /* although the machine has only one output pin, we need to
1669 * toggle GPIO1 according to the jack state
1670 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001671 spec->gen.automute_hook = alc260_gpio1_automute;
1672 spec->gen.detect_hp = 1;
1673 spec->gen.automute_speaker = 1;
1674 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001675 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001676 snd_hda_gen_hp_automute);
Takashi Iwai5579cd62018-06-19 22:22:41 +02001677 alc_setup_gpio(codec, 0x01);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001678 }
1679}
1680
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001681static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001682 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001683{
1684 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001685 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001686 { 0x0f, 0x02214000 }, /* HP/speaker */
1687 { 0x12, 0x90a60160 }, /* int mic */
1688 { 0x13, 0x02a19000 }, /* ext mic */
1689 { 0x18, 0x01446000 }, /* SPDIF out */
1690 /* disable bogus I/O pins */
1691 { 0x10, 0x411111f0 },
1692 { 0x11, 0x411111f0 },
1693 { 0x14, 0x411111f0 },
1694 { 0x15, 0x411111f0 },
1695 { 0x16, 0x411111f0 },
1696 { 0x17, 0x411111f0 },
1697 { 0x19, 0x411111f0 },
1698 { }
1699 };
1700
1701 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001702 case HDA_FIXUP_ACT_PRE_PROBE:
1703 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001704 spec->init_amp = ALC_INIT_NONE;
1705 break;
1706 }
1707}
1708
Takashi Iwai39aedee2013-01-10 17:10:40 +01001709static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1710 const struct hda_fixup *fix, int action)
1711{
1712 struct alc_spec *spec = codec->spec;
Takashi Iwai1c76aa52018-06-21 16:37:54 +02001713 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001714 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001715}
1716
1717static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1718 const struct hda_fixup *fix, int action)
1719{
1720 struct alc_spec *spec = codec->spec;
1721 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001722 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001723 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001724 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001725}
1726
Takashi Iwai1727a772013-01-10 09:52:52 +01001727static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001728 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001729 .type = HDA_FIXUP_PINS,
1730 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001731 { 0x11, 0x90130110 }, /* speaker */
1732 { }
1733 }
1734 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001735 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001736 .type = HDA_FIXUP_PINS,
1737 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001738 { 0x0f, 0x01214000 }, /* HP */
1739 { }
1740 }
1741 },
1742 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001743 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001744 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001745 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1746 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001747 { }
1748 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001749 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001750 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001751 .type = HDA_FIXUP_FUNC,
1752 .v.func = alc_fixup_gpio1,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001753 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001754 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001755 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001756 .v.func = alc260_fixup_gpio1_toggle,
1757 .chained = true,
1758 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1759 },
1760 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001761 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001762 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001763 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1764 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001765 { }
1766 },
1767 .chained = true,
1768 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1769 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001770 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001771 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001772 .v.func = alc260_fixup_gpio1_toggle,
1773 .chained = true,
1774 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001775 },
1776 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001777 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001778 .v.func = alc260_fixup_kn1,
1779 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001780 [ALC260_FIXUP_FSC_S7020] = {
1781 .type = HDA_FIXUP_FUNC,
1782 .v.func = alc260_fixup_fsc_s7020,
1783 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001784 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1785 .type = HDA_FIXUP_FUNC,
1786 .v.func = alc260_fixup_fsc_s7020_jwse,
1787 .chained = true,
1788 .chain_id = ALC260_FIXUP_FSC_S7020,
1789 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001790 [ALC260_FIXUP_VAIO_PINS] = {
1791 .type = HDA_FIXUP_PINS,
1792 .v.pins = (const struct hda_pintbl[]) {
1793 /* Pin configs are missing completely on some VAIOs */
1794 { 0x0f, 0x01211020 },
1795 { 0x10, 0x0001003f },
1796 { 0x11, 0x411111f0 },
1797 { 0x12, 0x01a15930 },
1798 { 0x13, 0x411111f0 },
1799 { 0x14, 0x411111f0 },
1800 { 0x15, 0x411111f0 },
1801 { 0x16, 0x411111f0 },
1802 { 0x17, 0x411111f0 },
1803 { 0x18, 0x411111f0 },
1804 { 0x19, 0x411111f0 },
1805 { }
1806 }
1807 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001808};
1809
1810static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001811 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001812 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001813 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001814 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001815 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001816 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001817 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001818 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001819 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001820 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001821 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001822 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001823 {}
1824};
1825
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001826static const struct hda_model_fixup alc260_fixup_models[] = {
1827 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1828 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1829 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1830 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1831 {}
1832};
1833
Takashi Iwai1d045db2011-07-07 18:23:21 +02001834/*
1835 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001836static int patch_alc260(struct hda_codec *codec)
1837{
1838 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001839 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001840
Takashi Iwai3de95172012-05-07 18:03:15 +02001841 err = alc_alloc_spec(codec, 0x07);
1842 if (err < 0)
1843 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001844
Takashi Iwai3de95172012-05-07 18:03:15 +02001845 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001846 /* as quite a few machines require HP amp for speaker outputs,
1847 * it's easier to enable it unconditionally; even if it's unneeded,
1848 * it's almost harmless.
1849 */
1850 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001851 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001852
Takashi Iwai225068a2015-05-29 10:42:14 +02001853 spec->shutup = alc_eapd_shutup;
1854
Takashi Iwaic9af7532019-05-10 11:01:43 +02001855 alc_pre_init(codec);
1856
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001857 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1858 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001859 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001860
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001861 /* automatic parse from the BIOS config */
1862 err = alc260_parse_auto_config(codec);
1863 if (err < 0)
1864 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001865
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001866 if (!spec->gen.no_analog) {
1867 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1868 if (err < 0)
1869 goto error;
1870 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001871
Takashi Iwai1727a772013-01-10 09:52:52 +01001872 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001873
Takashi Iwai1d045db2011-07-07 18:23:21 +02001874 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001875
1876 error:
1877 alc_free(codec);
1878 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001879}
1880
1881
1882/*
1883 * ALC882/883/885/888/889 support
1884 *
1885 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1886 * configuration. Each pin widget can choose any input DACs and a mixer.
1887 * Each ADC is connected from a mixer of all inputs. This makes possible
1888 * 6-channel independent captures.
1889 *
1890 * In addition, an independent DAC for the multi-playback (not used in this
1891 * driver yet).
1892 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001893
1894/*
1895 * Pin config fixes
1896 */
1897enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001898 ALC882_FIXUP_ABIT_AW9D_MAX,
1899 ALC882_FIXUP_LENOVO_Y530,
1900 ALC882_FIXUP_PB_M5210,
1901 ALC882_FIXUP_ACER_ASPIRE_7736,
1902 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001903 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001904 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001905 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001906 ALC888_FIXUP_EEE1601,
PeiSen Hou4841b8e2021-02-02 10:30:22 +01001907 ALC886_FIXUP_EAPD,
Takashi Iwai177943a32011-11-09 12:55:18 +01001908 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001909 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001910 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001911 ALC882_FIXUP_GPIO1,
1912 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001913 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001914 ALC889_FIXUP_COEF,
1915 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001916 ALC882_FIXUP_ACER_ASPIRE_4930G,
1917 ALC882_FIXUP_ACER_ASPIRE_8930G,
1918 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001919 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001920 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001921 ALC889_FIXUP_MBP_VREF,
1922 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001923 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001924 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001925 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001926 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001927 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001928 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001929 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001930 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001931 ALC1220_FIXUP_GB_DUAL_CODECS,
Christian Lachnerc1933002022-01-03 15:05:17 +01001932 ALC1220_FIXUP_GB_X570,
Peisen0202f5c2017-10-26 10:35:36 +08001933 ALC1220_FIXUP_CLEVO_P950,
Richard Sailer80690a22019-04-02 15:52:04 +02001934 ALC1220_FIXUP_CLEVO_PB51ED,
1935 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
Jian-Hong Panca184352020-10-07 13:22:25 +08001936 ALC887_FIXUP_ASUS_AUDIO,
1937 ALC887_FIXUP_ASUS_HMIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001938};
1939
Takashi Iwai68ef0562011-11-09 18:24:44 +01001940static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001941 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001942{
Takashi Iwai1727a772013-01-10 09:52:52 +01001943 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001944 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001945 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001946}
1947
Takashi Iwai56710872011-11-14 17:42:11 +01001948/* set up GPIO at initialization */
1949static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001950 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001951{
Takashi Iwai215c8502018-06-19 22:34:26 +02001952 struct alc_spec *spec = codec->spec;
1953
1954 spec->gpio_write_delay = true;
1955 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001956}
1957
Takashi Iwai02a237b2012-02-13 15:25:07 +01001958/* Fix the connection of some pins for ALC889:
1959 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1960 * work correctly (bko#42740)
1961 */
1962static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001963 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001964{
Takashi Iwai1727a772013-01-10 09:52:52 +01001965 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001966 /* fake the connections during parsing the tree */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001967 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
1968 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
1969 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
1970 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
1971 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
1972 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001973 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001974 /* restore the connections */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001975 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1976 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
1977 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
1978 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
1979 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001980 }
1981}
1982
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001983/* Set VREF on HP pin */
1984static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001985 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001986{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01001987 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001988 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001989 int i;
1990
Takashi Iwai1727a772013-01-10 09:52:52 +01001991 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001992 return;
1993 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1994 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1995 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1996 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001997 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001998 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001999 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01002000 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002001 break;
2002 }
2003}
2004
Takashi Iwai0756f092013-12-04 13:59:45 +01002005static void alc889_fixup_mac_pins(struct hda_codec *codec,
2006 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002007{
2008 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002009 int i;
2010
Takashi Iwai0756f092013-12-04 13:59:45 +01002011 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002012 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01002013 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002014 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02002015 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002016 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01002017 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002018}
2019
Takashi Iwai0756f092013-12-04 13:59:45 +01002020/* Set VREF on speaker pins on imac91 */
2021static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2022 const struct hda_fixup *fix, int action)
2023{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002024 static const hda_nid_t nids[] = { 0x18, 0x1a };
Takashi Iwai0756f092013-12-04 13:59:45 +01002025
2026 if (action == HDA_FIXUP_ACT_INIT)
2027 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2028}
2029
Adrien Vergée7729a42014-01-24 14:56:14 -05002030/* Set VREF on speaker pins on mba11 */
2031static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2032 const struct hda_fixup *fix, int action)
2033{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002034 static const hda_nid_t nids[] = { 0x18 };
Adrien Vergée7729a42014-01-24 14:56:14 -05002035
2036 if (action == HDA_FIXUP_ACT_INIT)
2037 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2038}
2039
Takashi Iwai0756f092013-12-04 13:59:45 +01002040/* Set VREF on speaker pins on mba21 */
2041static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2042 const struct hda_fixup *fix, int action)
2043{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002044 static const hda_nid_t nids[] = { 0x18, 0x19 };
Takashi Iwai0756f092013-12-04 13:59:45 +01002045
2046 if (action == HDA_FIXUP_ACT_INIT)
2047 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2048}
2049
Takashi Iwaie427c232012-07-29 10:04:08 +02002050/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09002051 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2052 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02002053 */
2054static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01002055 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02002056{
2057 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002058 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01002059 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002060 spec->gen.no_multi_io = 1;
2061 }
Takashi Iwaie427c232012-07-29 10:04:08 +02002062}
2063
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002064static void alc_fixup_bass_chmap(struct hda_codec *codec,
2065 const struct hda_fixup *fix, int action);
2066
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002067/* For dual-codec configuration, we need to disable some features to avoid
2068 * conflicts of kctls and PCM streams
2069 */
2070static void alc_fixup_dual_codecs(struct hda_codec *codec,
2071 const struct hda_fixup *fix, int action)
2072{
2073 struct alc_spec *spec = codec->spec;
2074
2075 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2076 return;
2077 /* disable vmaster */
2078 spec->gen.suppress_vmaster = 1;
2079 /* auto-mute and auto-mic switch don't work with multiple codecs */
2080 spec->gen.suppress_auto_mute = 1;
2081 spec->gen.suppress_auto_mic = 1;
2082 /* disable aamix as well */
2083 spec->gen.mixer_nid = 0;
2084 /* add location prefix to avoid conflicts */
2085 codec->force_pin_prefix = 1;
2086}
2087
2088static void rename_ctl(struct hda_codec *codec, const char *oldname,
2089 const char *newname)
2090{
2091 struct snd_kcontrol *kctl;
2092
2093 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2094 if (kctl)
2095 strcpy(kctl->id.name, newname);
2096}
2097
2098static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2099 const struct hda_fixup *fix,
2100 int action)
2101{
2102 alc_fixup_dual_codecs(codec, fix, action);
2103 switch (action) {
2104 case HDA_FIXUP_ACT_PRE_PROBE:
2105 /* override card longname to provide a unique UCM profile */
2106 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2107 break;
2108 case HDA_FIXUP_ACT_BUILD:
2109 /* rename Capture controls depending on the codec */
2110 rename_ctl(codec, "Capture Volume",
2111 codec->addr == 0 ?
2112 "Rear-Panel Capture Volume" :
2113 "Front-Panel Capture Volume");
2114 rename_ctl(codec, "Capture Switch",
2115 codec->addr == 0 ?
2116 "Rear-Panel Capture Switch" :
2117 "Front-Panel Capture Switch");
2118 break;
2119 }
2120}
2121
Christian Lachnerc1933002022-01-03 15:05:17 +01002122static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2123 const struct hda_fixup *fix,
2124 int action)
2125{
2126 static const hda_nid_t conn1[] = { 0x0c };
2127 static const struct coef_fw gb_x570_coefs[] = {
2128 WRITE_COEF(0x1a, 0x01c1),
2129 WRITE_COEF(0x1b, 0x0202),
2130 WRITE_COEF(0x43, 0x3005),
2131 {}
2132 };
2133
2134 switch (action) {
2135 case HDA_FIXUP_ACT_PRE_PROBE:
2136 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2137 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2138 break;
2139 case HDA_FIXUP_ACT_INIT:
2140 alc_process_coef_fw(codec, gb_x570_coefs);
2141 break;
2142 }
2143}
2144
Peisen0202f5c2017-10-26 10:35:36 +08002145static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2146 const struct hda_fixup *fix,
2147 int action)
2148{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002149 static const hda_nid_t conn1[] = { 0x0c };
Peisen0202f5c2017-10-26 10:35:36 +08002150
2151 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2152 return;
2153
2154 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2155 /* We therefore want to make sure 0x14 (front headphone) and
2156 * 0x1b (speakers) use the stereo DAC 0x02
2157 */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002158 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2159 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
Peisen0202f5c2017-10-26 10:35:36 +08002160}
2161
Jeremy Soller7f665b12019-02-13 10:56:19 -07002162static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2163 const struct hda_fixup *fix, int action);
2164
Richard Sailer80690a22019-04-02 15:52:04 +02002165static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002166 const struct hda_fixup *fix,
2167 int action)
2168{
2169 alc1220_fixup_clevo_p950(codec, fix, action);
2170 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2171}
2172
Jian-Hong Panca184352020-10-07 13:22:25 +08002173static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2174 struct hda_jack_callback *jack)
2175{
2176 struct alc_spec *spec = codec->spec;
2177 unsigned int vref;
2178
2179 snd_hda_gen_hp_automute(codec, jack);
2180
2181 if (spec->gen.hp_jack_present)
2182 vref = AC_PINCTL_VREF_80;
2183 else
2184 vref = AC_PINCTL_VREF_HIZ;
2185 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2186}
2187
2188static void alc887_fixup_asus_jack(struct hda_codec *codec,
2189 const struct hda_fixup *fix, int action)
2190{
2191 struct alc_spec *spec = codec->spec;
2192 if (action != HDA_FIXUP_ACT_PROBE)
2193 return;
2194 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2195 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2196}
2197
Takashi Iwai1727a772013-01-10 09:52:52 +01002198static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002199 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002200 .type = HDA_FIXUP_PINS,
2201 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002202 { 0x15, 0x01080104 }, /* side */
2203 { 0x16, 0x01011012 }, /* rear */
2204 { 0x17, 0x01016011 }, /* clfe */
2205 { }
2206 }
2207 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002208 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002209 .type = HDA_FIXUP_PINS,
2210 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002211 { 0x15, 0x99130112 }, /* rear int speakers */
2212 { 0x16, 0x99130111 }, /* subwoofer */
2213 { }
2214 }
2215 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002216 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002217 .type = HDA_FIXUP_PINCTLS,
2218 .v.pins = (const struct hda_pintbl[]) {
2219 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002220 {}
2221 }
2222 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002223 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002224 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002225 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002226 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002227 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002228 .type = HDA_FIXUP_PINS,
2229 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002230 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2231 { }
2232 }
2233 },
Marton Balint8f239212012-03-05 21:33:23 +01002234 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002235 .type = HDA_FIXUP_PINS,
2236 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002237 { 0x1c, 0x993301f0 }, /* CD */
2238 { }
2239 }
2240 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002241 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2242 .type = HDA_FIXUP_PINS,
2243 .v.pins = (const struct hda_pintbl[]) {
2244 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2245 { }
2246 },
2247 .chained = true,
2248 .chain_id = ALC889_FIXUP_CD,
2249 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002250 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002251 .type = HDA_FIXUP_PINS,
2252 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002253 { 0x17, 0x90170111 }, /* hidden surround speaker */
2254 { }
2255 }
2256 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002257 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002258 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002259 .v.verbs = (const struct hda_verb[]) {
2260 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2261 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2262 { }
2263 }
Takashi Iwai177943a32011-11-09 12:55:18 +01002264 },
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002265 [ALC886_FIXUP_EAPD] = {
2266 .type = HDA_FIXUP_VERBS,
2267 .v.verbs = (const struct hda_verb[]) {
2268 /* change to EAPD mode */
2269 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2270 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2271 { }
2272 }
2273 },
Takashi Iwai177943a32011-11-09 12:55:18 +01002274 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002275 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a32011-11-09 12:55:18 +01002276 .v.verbs = (const struct hda_verb[]) {
2277 /* change to EAPD mode */
2278 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2279 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2280 { }
2281 }
2282 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002283 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002284 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002285 .v.verbs = (const struct hda_verb[]) {
2286 /* change to EAPD mode */
2287 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2288 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2289 { }
2290 }
2291 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002292 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002293 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002294 .v.verbs = (const struct hda_verb[]) {
2295 /* eanable EAPD on Acer laptops */
2296 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2297 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2298 { }
2299 }
2300 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002301 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002302 .type = HDA_FIXUP_FUNC,
2303 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002304 },
2305 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002306 .type = HDA_FIXUP_FUNC,
2307 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002308 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002309 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002310 .type = HDA_FIXUP_FUNC,
2311 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002312 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002313 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002314 .type = HDA_FIXUP_FUNC,
2315 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002316 .chained = true,
2317 .chain_id = ALC882_FIXUP_EAPD,
2318 },
2319 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002320 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002321 .v.func = alc889_fixup_coef,
2322 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002323 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002324 .type = HDA_FIXUP_PINS,
2325 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002326 { 0x16, 0x99130111 }, /* CLFE speaker */
2327 { 0x17, 0x99130112 }, /* surround speaker */
2328 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002329 },
2330 .chained = true,
2331 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002332 },
2333 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002334 .type = HDA_FIXUP_PINS,
2335 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002336 { 0x16, 0x99130111 }, /* CLFE speaker */
2337 { 0x1b, 0x99130112 }, /* surround speaker */
2338 { }
2339 },
2340 .chained = true,
2341 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2342 },
2343 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2344 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002345 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002346 .v.verbs = (const struct hda_verb[]) {
2347 /* Enable all DACs */
2348 /* DAC DISABLE/MUTE 1? */
2349 /* setting bits 1-5 disables DAC nids 0x02-0x06
2350 * apparently. Init=0x38 */
2351 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2352 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2353 /* DAC DISABLE/MUTE 2? */
2354 /* some bit here disables the other DACs.
2355 * Init=0x4900 */
2356 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2357 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2358 /* DMIC fix
2359 * This laptop has a stereo digital microphone.
2360 * The mics are only 1cm apart which makes the stereo
2361 * useless. However, either the mic or the ALC889
2362 * makes the signal become a difference/sum signal
2363 * instead of standard stereo, which is annoying.
2364 * So instead we flip this bit which makes the
2365 * codec replicate the sum signal to both channels,
2366 * turning it into a normal mono mic.
2367 */
2368 /* DMIC_CONTROL? Init value = 0x0001 */
2369 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2370 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2371 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2372 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2373 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002374 },
2375 .chained = true,
2376 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002377 },
Takashi Iwai56710872011-11-14 17:42:11 +01002378 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002379 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002380 .v.func = alc885_fixup_macpro_gpio,
2381 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002382 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002383 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002384 .v.func = alc889_fixup_dac_route,
2385 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002386 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002387 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002388 .v.func = alc889_fixup_mbp_vref,
2389 .chained = true,
2390 .chain_id = ALC882_FIXUP_GPIO1,
2391 },
2392 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002393 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002394 .v.func = alc889_fixup_imac91_vref,
2395 .chained = true,
2396 .chain_id = ALC882_FIXUP_GPIO1,
2397 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002398 [ALC889_FIXUP_MBA11_VREF] = {
2399 .type = HDA_FIXUP_FUNC,
2400 .v.func = alc889_fixup_mba11_vref,
2401 .chained = true,
2402 .chain_id = ALC889_FIXUP_MBP_VREF,
2403 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002404 [ALC889_FIXUP_MBA21_VREF] = {
2405 .type = HDA_FIXUP_FUNC,
2406 .v.func = alc889_fixup_mba21_vref,
2407 .chained = true,
2408 .chain_id = ALC889_FIXUP_MBP_VREF,
2409 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002410 [ALC889_FIXUP_MP11_VREF] = {
2411 .type = HDA_FIXUP_FUNC,
2412 .v.func = alc889_fixup_mba11_vref,
2413 .chained = true,
2414 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2415 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002416 [ALC889_FIXUP_MP41_VREF] = {
2417 .type = HDA_FIXUP_FUNC,
2418 .v.func = alc889_fixup_mbp_vref,
2419 .chained = true,
2420 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2421 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002422 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002423 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002424 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002425 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002426 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002427 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002428 .v.func = alc882_fixup_no_primary_hp,
2429 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002430 [ALC887_FIXUP_ASUS_BASS] = {
2431 .type = HDA_FIXUP_PINS,
2432 .v.pins = (const struct hda_pintbl[]) {
2433 {0x16, 0x99130130}, /* bass speaker */
2434 {}
2435 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002436 .chained = true,
2437 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2438 },
2439 [ALC887_FIXUP_BASS_CHMAP] = {
2440 .type = HDA_FIXUP_FUNC,
2441 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002442 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002443 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2444 .type = HDA_FIXUP_FUNC,
2445 .v.func = alc1220_fixup_gb_dual_codecs,
2446 },
Christian Lachnerc1933002022-01-03 15:05:17 +01002447 [ALC1220_FIXUP_GB_X570] = {
2448 .type = HDA_FIXUP_FUNC,
2449 .v.func = alc1220_fixup_gb_x570,
2450 },
Peisen0202f5c2017-10-26 10:35:36 +08002451 [ALC1220_FIXUP_CLEVO_P950] = {
2452 .type = HDA_FIXUP_FUNC,
2453 .v.func = alc1220_fixup_clevo_p950,
2454 },
Richard Sailer80690a22019-04-02 15:52:04 +02002455 [ALC1220_FIXUP_CLEVO_PB51ED] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002456 .type = HDA_FIXUP_FUNC,
Richard Sailer80690a22019-04-02 15:52:04 +02002457 .v.func = alc1220_fixup_clevo_pb51ed,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002458 },
Richard Sailer80690a22019-04-02 15:52:04 +02002459 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002460 .type = HDA_FIXUP_PINS,
2461 .v.pins = (const struct hda_pintbl[]) {
2462 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2463 {}
2464 },
2465 .chained = true,
Richard Sailer80690a22019-04-02 15:52:04 +02002466 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002467 },
Jian-Hong Panca184352020-10-07 13:22:25 +08002468 [ALC887_FIXUP_ASUS_AUDIO] = {
2469 .type = HDA_FIXUP_PINS,
2470 .v.pins = (const struct hda_pintbl[]) {
2471 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2472 { 0x19, 0x22219420 },
2473 {}
2474 },
2475 },
2476 [ALC887_FIXUP_ASUS_HMIC] = {
2477 .type = HDA_FIXUP_FUNC,
2478 .v.func = alc887_fixup_asus_jack,
2479 .chained = true,
2480 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2481 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002482};
2483
2484static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002485 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2486 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002487 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002488 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2489 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2490 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2491 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002492 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2493 ALC882_FIXUP_ACER_ASPIRE_4930G),
2494 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2495 ALC882_FIXUP_ACER_ASPIRE_4930G),
2496 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2497 ALC882_FIXUP_ACER_ASPIRE_8930G),
2498 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2499 ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaib2650472021-04-28 13:26:52 +02002500 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2501 ALC882_FIXUP_ACER_ASPIRE_4930G),
2502 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002503 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2504 ALC882_FIXUP_ACER_ASPIRE_4930G),
2505 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2506 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002507 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2508 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002509 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002510 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002511 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a32011-11-09 12:55:18 +01002512 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002513 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002514 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Jian-Hong Panca184352020-10-07 13:22:25 +08002515 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002516 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002517 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002518 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaib7529c12021-04-28 13:26:53 +02002519 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2520 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002521 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002522 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002523 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002524
2525 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002526 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2527 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2528 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002529 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002530 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2531 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002532 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2533 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002534 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002535 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002536 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002537 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2538 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002539 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002540 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2541 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2542 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002543 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002544 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002545 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2546 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002547 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002548
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002549 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002550 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002551 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002552 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Christian Lachnerc1933002022-01-03 15:05:17 +01002553 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
Christian Lachnerd9e8fe02020-05-18 07:38:44 +02002554 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia0b03952020-06-16 15:21:50 +02002555 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia655e2b2020-02-17 16:19:47 +01002556 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai09926202020-12-20 09:09:43 +01002557 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai1d3aa4a2020-04-08 15:56:45 +02002558 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7dafba32020-02-12 09:10:47 +01002559 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaicc5049a2020-02-18 09:09:15 +01002560 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002561 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai26af1772021-03-03 15:23:46 +01002562 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwai63691582017-05-22 16:32:46 +02002563 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002564 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002565 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
PeiSen Hou259eb822020-05-19 08:50:12 +02002566 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002567 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2568 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2569 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002570 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Steven Clarksonaef454b2021-10-14 06:35:54 -07002571 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002572 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2573 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002574 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Tim Crawforddbfe83502021-11-01 10:21:34 -06002575 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Hou259eb822020-05-19 08:50:12 +02002576 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Werner Sembach1f8d3982021-10-01 15:31:10 +02002577 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Werner Sembachcc030692021-10-01 15:31:11 +02002578 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
Takashi Iwai13e1a4c2021-04-28 13:26:54 +02002579 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2580 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2581 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2582 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2583 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2584 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2585 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2586 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2587 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2588 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2589 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2590 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002591 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2592 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002593 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002594 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002595 {}
2596};
2597
Takashi Iwai1727a772013-01-10 09:52:52 +01002598static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002599 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2600 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2601 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2602 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2603 {.id = ALC889_FIXUP_CD, .name = "cd"},
2604 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2605 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2606 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2607 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2608 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2609 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2610 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2611 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2612 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2613 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002614 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2615 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2616 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002617 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2618 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2619 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2620 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2621 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2622 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2623 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2624 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002625 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002626 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002627 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002628 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002629 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002630 {}
2631};
2632
Hui Wang119b75c2021-05-22 11:47:41 +08002633static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2634 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2635 {0x14, 0x01014010},
2636 {0x15, 0x01011012},
2637 {0x16, 0x01016011},
2638 {0x18, 0x01a19040},
2639 {0x19, 0x02a19050},
2640 {0x1a, 0x0181304f},
2641 {0x1b, 0x0221401f},
2642 {0x1e, 0x01456130}),
2643 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2644 {0x14, 0x01015010},
2645 {0x15, 0x01011012},
2646 {0x16, 0x01011011},
2647 {0x18, 0x01a11040},
2648 {0x19, 0x02a19050},
2649 {0x1a, 0x0181104f},
2650 {0x1b, 0x0221401f},
2651 {0x1e, 0x01451130}),
2652 {}
2653};
2654
Takashi Iwai1d045db2011-07-07 18:23:21 +02002655/*
2656 * BIOS auto configuration
2657 */
2658/* almost identical with ALC880 parser... */
2659static int alc882_parse_auto_config(struct hda_codec *codec)
2660{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002661 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002662 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2663 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002664}
2665
Takashi Iwai1d045db2011-07-07 18:23:21 +02002666/*
2667 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002668static int patch_alc882(struct hda_codec *codec)
2669{
2670 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002671 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002672
Takashi Iwai3de95172012-05-07 18:03:15 +02002673 err = alc_alloc_spec(codec, 0x0b);
2674 if (err < 0)
2675 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002676
Takashi Iwai3de95172012-05-07 18:03:15 +02002677 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002678
Takashi Iwai7639a062015-03-03 10:07:24 +01002679 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002680 case 0x10ec0882:
2681 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002682 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +08002683 case 0x10ec0b00:
Kailang Yanga535ad52017-01-16 16:59:26 +08002684 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002685 break;
2686 default:
2687 /* ALC883 and variants */
2688 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2689 break;
2690 }
2691
Takashi Iwaic9af7532019-05-10 11:01:43 +02002692 alc_pre_init(codec);
2693
Takashi Iwai1727a772013-01-10 09:52:52 +01002694 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002695 alc882_fixups);
Hui Wang119b75c2021-05-22 11:47:41 +08002696 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +01002697 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002698
2699 alc_auto_parse_customize_define(codec);
2700
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002701 if (has_cdefine_beep(codec))
2702 spec->gen.beep_nid = 0x01;
2703
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002704 /* automatic parse from the BIOS config */
2705 err = alc882_parse_auto_config(codec);
2706 if (err < 0)
2707 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002708
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002709 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2710 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2711 if (err < 0)
2712 goto error;
2713 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002714
Takashi Iwai1727a772013-01-10 09:52:52 +01002715 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002716
Takashi Iwai1d045db2011-07-07 18:23:21 +02002717 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002718
2719 error:
2720 alc_free(codec);
2721 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002722}
2723
2724
2725/*
2726 * ALC262 support
2727 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002728static int alc262_parse_auto_config(struct hda_codec *codec)
2729{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002730 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002731 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2732 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002733}
2734
2735/*
2736 * Pin config fixes
2737 */
2738enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002739 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002740 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002741 ALC262_FIXUP_HP_Z200,
2742 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002743 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002744 ALC262_FIXUP_BENQ,
2745 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002746 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002747 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002748};
2749
Takashi Iwai1727a772013-01-10 09:52:52 +01002750static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002751 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002752 .type = HDA_FIXUP_PINS,
2753 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002754 { 0x14, 0x99130110 }, /* speaker */
2755 { 0x15, 0x0221142f }, /* front HP */
2756 { 0x1b, 0x0121141f }, /* rear HP */
2757 { }
2758 }
2759 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002760 [ALC262_FIXUP_FSC_S7110] = {
2761 .type = HDA_FIXUP_PINS,
2762 .v.pins = (const struct hda_pintbl[]) {
2763 { 0x15, 0x90170110 }, /* speaker */
2764 { }
2765 },
2766 .chained = true,
2767 .chain_id = ALC262_FIXUP_BENQ,
2768 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002769 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002770 .type = HDA_FIXUP_PINS,
2771 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002772 { 0x16, 0x99130120 }, /* internal speaker */
2773 { }
2774 }
2775 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002776 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002777 .type = HDA_FIXUP_PINS,
2778 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002779 { 0x14, 0x1993e1f0 }, /* int AUX */
2780 { }
2781 }
2782 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002783 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002784 .type = HDA_FIXUP_PINCTLS,
2785 .v.pins = (const struct hda_pintbl[]) {
2786 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002787 {}
2788 },
2789 .chained = true,
2790 .chain_id = ALC262_FIXUP_BENQ,
2791 },
2792 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002793 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002794 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002795 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2796 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2797 {}
2798 }
2799 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002800 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002801 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002802 .v.verbs = (const struct hda_verb[]) {
2803 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2804 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2805 {}
2806 }
2807 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002808 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002809 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002810 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002811 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002812 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2813 .type = HDA_FIXUP_FUNC,
2814 .v.func = alc_fixup_no_depop_delay,
2815 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002816};
2817
2818static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002819 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002820 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002821 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002822 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002823 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002824 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002825 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002826 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2827 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002828 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002829 {}
2830};
2831
Takashi Iwai1727a772013-01-10 09:52:52 +01002832static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002833 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002834 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2835 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2836 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2837 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2838 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2839 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2840 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2841 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002842 {}
2843};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002844
Takashi Iwai1d045db2011-07-07 18:23:21 +02002845/*
2846 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002847static int patch_alc262(struct hda_codec *codec)
2848{
2849 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002850 int err;
2851
Takashi Iwai3de95172012-05-07 18:03:15 +02002852 err = alc_alloc_spec(codec, 0x0b);
2853 if (err < 0)
2854 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002855
Takashi Iwai3de95172012-05-07 18:03:15 +02002856 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002857 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002858
Takashi Iwai225068a2015-05-29 10:42:14 +02002859 spec->shutup = alc_eapd_shutup;
2860
Takashi Iwai1d045db2011-07-07 18:23:21 +02002861#if 0
2862 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2863 * under-run
2864 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002865 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002866#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002867 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2868
Takashi Iwaic9af7532019-05-10 11:01:43 +02002869 alc_pre_init(codec);
2870
Takashi Iwai1727a772013-01-10 09:52:52 +01002871 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002872 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002873 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002874
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002875 alc_auto_parse_customize_define(codec);
2876
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002877 if (has_cdefine_beep(codec))
2878 spec->gen.beep_nid = 0x01;
2879
Takashi Iwai42399f72011-11-07 17:18:44 +01002880 /* automatic parse from the BIOS config */
2881 err = alc262_parse_auto_config(codec);
2882 if (err < 0)
2883 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002884
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002885 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2886 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2887 if (err < 0)
2888 goto error;
2889 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002890
Takashi Iwai1727a772013-01-10 09:52:52 +01002891 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002892
Takashi Iwai1d045db2011-07-07 18:23:21 +02002893 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002894
2895 error:
2896 alc_free(codec);
2897 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002898}
2899
2900/*
2901 * ALC268
2902 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002903/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002904static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2905 struct snd_ctl_elem_value *ucontrol)
2906{
2907 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2908 unsigned long pval;
2909 int err;
2910
2911 mutex_lock(&codec->control_mutex);
2912 pval = kcontrol->private_value;
2913 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2914 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2915 if (err >= 0) {
2916 kcontrol->private_value = (pval & ~0xff) | 0x10;
2917 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2918 }
2919 kcontrol->private_value = pval;
2920 mutex_unlock(&codec->control_mutex);
2921 return err;
2922}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002923
2924static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2925 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002926 {
2927 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2928 .name = "Beep Playback Switch",
2929 .subdevice = HDA_SUBDEV_AMP_FLAG,
2930 .info = snd_hda_mixer_amp_switch_info,
2931 .get = snd_hda_mixer_amp_switch_get,
2932 .put = alc268_beep_switch_put,
2933 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2934 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002935};
2936
2937/* set PCBEEP vol = 0, mute connections */
2938static const struct hda_verb alc268_beep_init_verbs[] = {
2939 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2940 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2941 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2942 { }
2943};
2944
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002945enum {
2946 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002947 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002948 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002949};
2950
Takashi Iwai1727a772013-01-10 09:52:52 +01002951static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002952 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002953 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002954 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002955 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002956 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002957 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002958 .v.verbs = (const struct hda_verb[]) {
2959 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2960 {}
2961 }
2962 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002963 [ALC268_FIXUP_SPDIF] = {
2964 .type = HDA_FIXUP_PINS,
2965 .v.pins = (const struct hda_pintbl[]) {
2966 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2967 {}
2968 }
2969 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002970};
2971
Takashi Iwai1727a772013-01-10 09:52:52 +01002972static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002973 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002974 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02002975 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002976 {}
2977};
2978
2979static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002980 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002981 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002982 /* below is codec SSID since multiple Toshiba laptops have the
2983 * same PCI SSID 1179:ff00
2984 */
2985 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002986 {}
2987};
2988
Takashi Iwai1d045db2011-07-07 18:23:21 +02002989/*
2990 * BIOS auto configuration
2991 */
2992static int alc268_parse_auto_config(struct hda_codec *codec)
2993{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002994 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002995 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002996}
2997
Takashi Iwai1d045db2011-07-07 18:23:21 +02002998/*
2999 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003000static int patch_alc268(struct hda_codec *codec)
3001{
3002 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02003003 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003004
Takashi Iwai1d045db2011-07-07 18:23:21 +02003005 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02003006 err = alc_alloc_spec(codec, 0);
3007 if (err < 0)
3008 return err;
3009
3010 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02003011 if (has_cdefine_beep(codec))
3012 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003013
Takashi Iwai225068a2015-05-29 10:42:14 +02003014 spec->shutup = alc_eapd_shutup;
3015
Takashi Iwaic9af7532019-05-10 11:01:43 +02003016 alc_pre_init(codec);
3017
Takashi Iwai1727a772013-01-10 09:52:52 +01003018 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3019 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02003020
Takashi Iwai6ebb8052011-08-16 15:15:40 +02003021 /* automatic parse from the BIOS config */
3022 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02003023 if (err < 0)
3024 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003025
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003026 if (err > 0 && !spec->gen.no_analog &&
3027 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02003028 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3029 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3030 &alc268_beep_mixer[i])) {
3031 err = -ENOMEM;
3032 goto error;
3033 }
3034 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003035 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003036 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3037 /* override the amp caps for beep generator */
3038 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3039 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3040 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3041 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3042 (0 << AC_AMPCAP_MUTE_SHIFT));
3043 }
3044
Takashi Iwai1727a772013-01-10 09:52:52 +01003045 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02003046
Takashi Iwai1d045db2011-07-07 18:23:21 +02003047 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02003048
3049 error:
3050 alc_free(codec);
3051 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003052}
3053
3054/*
3055 * ALC269
3056 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003057
Takashi Iwai1d045db2011-07-07 18:23:21 +02003058static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003059 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003060};
3061
3062static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003063 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003064};
3065
Takashi Iwai1d045db2011-07-07 18:23:21 +02003066/* different alc269-variants */
3067enum {
3068 ALC269_TYPE_ALC269VA,
3069 ALC269_TYPE_ALC269VB,
3070 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02003071 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01003072 ALC269_TYPE_ALC280,
3073 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02003074 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01003075 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08003076 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02003077 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08003078 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003079 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08003080 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08003081 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08003082 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08003083 ALC269_TYPE_ALC225,
Kailang Yang99cee0342021-07-01 09:09:37 +08003084 ALC269_TYPE_ALC287,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003085 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08003086 ALC269_TYPE_ALC300,
Kailang Yangf0778872019-10-24 15:13:32 +08003087 ALC269_TYPE_ALC623,
Kailang Yang6fbae352016-05-30 16:44:20 +08003088 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02003089};
3090
3091/*
3092 * BIOS auto configuration
3093 */
3094static int alc269_parse_auto_config(struct hda_codec *codec)
3095{
Takashi Iwai1d045db2011-07-07 18:23:21 +02003096 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003097 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3098 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3099 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02003100 const hda_nid_t *ssids;
3101
3102 switch (spec->codec_variant) {
3103 case ALC269_TYPE_ALC269VA:
3104 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01003105 case ALC269_TYPE_ALC280:
3106 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08003107 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003108 ssids = alc269va_ssids;
3109 break;
3110 case ALC269_TYPE_ALC269VB:
3111 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01003112 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02003113 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02003114 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08003115 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003116 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08003117 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08003118 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08003119 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08003120 case ALC269_TYPE_ALC225:
Kailang Yang99cee0342021-07-01 09:09:37 +08003121 case ALC269_TYPE_ALC287:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003122 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08003123 case ALC269_TYPE_ALC300:
Kailang Yangf0778872019-10-24 15:13:32 +08003124 case ALC269_TYPE_ALC623:
Kailang Yang6fbae352016-05-30 16:44:20 +08003125 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003126 ssids = alc269_ssids;
3127 break;
3128 default:
3129 ssids = alc269_ssids;
3130 break;
3131 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02003132
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003133 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003134}
3135
Hui Wang476c02e2020-03-29 16:20:18 +08003136static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3137 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3138 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3139 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3140 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3141 {}
3142};
3143
3144static void alc_headset_btn_callback(struct hda_codec *codec,
3145 struct hda_jack_callback *jack)
3146{
3147 int report = 0;
3148
3149 if (jack->unsol_res & (7 << 13))
3150 report |= SND_JACK_BTN_0;
3151
3152 if (jack->unsol_res & (1 << 16 | 3 << 8))
3153 report |= SND_JACK_BTN_1;
3154
3155 /* Volume up key */
3156 if (jack->unsol_res & (7 << 23))
3157 report |= SND_JACK_BTN_2;
3158
3159 /* Volume down key */
3160 if (jack->unsol_res & (7 << 10))
3161 report |= SND_JACK_BTN_3;
3162
Hui Wang04f77912021-03-05 17:26:08 +08003163 snd_hda_jack_set_button_state(codec, jack->nid, report);
Hui Wang476c02e2020-03-29 16:20:18 +08003164}
3165
3166static void alc_disable_headset_jack_key(struct hda_codec *codec)
3167{
3168 struct alc_spec *spec = codec->spec;
3169
3170 if (!spec->has_hs_key)
3171 return;
3172
3173 switch (codec->core.vendor_id) {
3174 case 0x10ec0215:
3175 case 0x10ec0225:
3176 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003177 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003178 case 0x10ec0295:
3179 case 0x10ec0289:
3180 case 0x10ec0299:
3181 alc_write_coef_idx(codec, 0x48, 0x0);
3182 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3183 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3184 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02003185 case 0x10ec0230:
Hui Wang476c02e2020-03-29 16:20:18 +08003186 case 0x10ec0236:
3187 case 0x10ec0256:
3188 alc_write_coef_idx(codec, 0x48, 0x0);
3189 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3190 break;
3191 }
3192}
3193
3194static void alc_enable_headset_jack_key(struct hda_codec *codec)
3195{
3196 struct alc_spec *spec = codec->spec;
3197
3198 if (!spec->has_hs_key)
3199 return;
3200
3201 switch (codec->core.vendor_id) {
3202 case 0x10ec0215:
3203 case 0x10ec0225:
3204 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003205 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003206 case 0x10ec0295:
3207 case 0x10ec0289:
3208 case 0x10ec0299:
3209 alc_write_coef_idx(codec, 0x48, 0xd011);
3210 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3211 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3212 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02003213 case 0x10ec0230:
Hui Wang476c02e2020-03-29 16:20:18 +08003214 case 0x10ec0236:
3215 case 0x10ec0256:
3216 alc_write_coef_idx(codec, 0x48, 0xd011);
3217 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3218 break;
3219 }
3220}
3221
3222static void alc_fixup_headset_jack(struct hda_codec *codec,
3223 const struct hda_fixup *fix, int action)
3224{
3225 struct alc_spec *spec = codec->spec;
Hui Wang04f77912021-03-05 17:26:08 +08003226 hda_nid_t hp_pin;
Hui Wang476c02e2020-03-29 16:20:18 +08003227
3228 switch (action) {
3229 case HDA_FIXUP_ACT_PRE_PROBE:
3230 spec->has_hs_key = 1;
3231 snd_hda_jack_detect_enable_callback(codec, 0x55,
3232 alc_headset_btn_callback);
Hui Wang476c02e2020-03-29 16:20:18 +08003233 break;
Hui Wang04f77912021-03-05 17:26:08 +08003234 case HDA_FIXUP_ACT_BUILD:
3235 hp_pin = alc_get_hp_pin(spec);
3236 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3237 alc_headset_btn_keymap,
3238 hp_pin))
3239 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3240 false, SND_JACK_HEADSET,
3241 alc_headset_btn_keymap);
3242
Hui Wang476c02e2020-03-29 16:20:18 +08003243 alc_enable_headset_jack_key(codec);
3244 break;
3245 }
3246}
3247
Kailang Yang1387e2d2012-11-08 10:23:18 +01003248static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003249{
Takashi Iwai98b24882014-08-18 13:47:50 +02003250 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003251}
3252
3253static void alc269_shutup(struct hda_codec *codec)
3254{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003255 struct alc_spec *spec = codec->spec;
3256
Kailang Yang1387e2d2012-11-08 10:23:18 +01003257 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3258 alc269vb_toggle_power_output(codec, 0);
3259 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3260 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003261 msleep(150);
3262 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003263 alc_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003264}
3265
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003266static const struct coef_fw alc282_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003267 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08003268 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003269 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3270 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3271 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3272 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3273 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3274 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3275 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3276 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3277 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3278 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3279 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3280 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3281 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3282 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3283 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3284 WRITE_COEF(0x63, 0x2902), /* PLL */
3285 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3286 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3287 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3288 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3289 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3290 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3291 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3292 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3293 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3294 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3295 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3296 {}
3297};
3298
Kailang Yangcb149cb2014-03-18 16:45:32 +08003299static void alc282_restore_default_value(struct hda_codec *codec)
3300{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003301 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08003302}
3303
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003304static void alc282_init(struct hda_codec *codec)
3305{
3306 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003307 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003308 bool hp_pin_sense;
3309 int coef78;
3310
Kailang Yangcb149cb2014-03-18 16:45:32 +08003311 alc282_restore_default_value(codec);
3312
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003313 if (!hp_pin)
3314 return;
3315 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3316 coef78 = alc_read_coef_idx(codec, 0x78);
3317
3318 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3319 /* Headphone capless set to high power mode */
3320 alc_write_coef_idx(codec, 0x78, 0x9004);
3321
3322 if (hp_pin_sense)
3323 msleep(2);
3324
3325 snd_hda_codec_write(codec, hp_pin, 0,
3326 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3327
3328 if (hp_pin_sense)
3329 msleep(85);
3330
3331 snd_hda_codec_write(codec, hp_pin, 0,
3332 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3333
3334 if (hp_pin_sense)
3335 msleep(100);
3336
3337 /* Headphone capless set to normal mode */
3338 alc_write_coef_idx(codec, 0x78, coef78);
3339}
3340
3341static void alc282_shutup(struct hda_codec *codec)
3342{
3343 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003344 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003345 bool hp_pin_sense;
3346 int coef78;
3347
3348 if (!hp_pin) {
3349 alc269_shutup(codec);
3350 return;
3351 }
3352
3353 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3354 coef78 = alc_read_coef_idx(codec, 0x78);
3355 alc_write_coef_idx(codec, 0x78, 0x9004);
3356
3357 if (hp_pin_sense)
3358 msleep(2);
3359
3360 snd_hda_codec_write(codec, hp_pin, 0,
3361 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3362
3363 if (hp_pin_sense)
3364 msleep(85);
3365
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003366 if (!spec->no_shutup_pins)
3367 snd_hda_codec_write(codec, hp_pin, 0,
3368 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003369
3370 if (hp_pin_sense)
3371 msleep(100);
3372
3373 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003374 alc_shutup_pins(codec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003375 alc_write_coef_idx(codec, 0x78, coef78);
3376}
3377
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003378static const struct coef_fw alc283_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003379 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003380 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003381 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3382 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3383 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3384 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3385 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3386 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3387 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3388 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3389 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3390 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3391 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3392 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3393 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3394 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3395 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3396 WRITE_COEF(0x2e, 0x2902), /* PLL */
3397 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3398 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3399 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3400 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3401 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3402 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3403 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3404 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3405 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3406 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3407 WRITE_COEF(0x49, 0x0), /* test mode */
3408 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3409 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3410 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003411 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003412 {}
3413};
3414
Kailang Yang6bd55b02014-03-17 13:51:27 +08003415static void alc283_restore_default_value(struct hda_codec *codec)
3416{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003417 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003418}
3419
Kailang Yang2af02be2013-08-22 10:03:50 +02003420static void alc283_init(struct hda_codec *codec)
3421{
3422 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003423 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003424 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003425
Kailang Yang6bd55b02014-03-17 13:51:27 +08003426 alc283_restore_default_value(codec);
3427
Kailang Yang2af02be2013-08-22 10:03:50 +02003428 if (!hp_pin)
3429 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003430
3431 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003432 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3433
3434 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3435 /* Headphone capless set to high power mode */
3436 alc_write_coef_idx(codec, 0x43, 0x9004);
3437
3438 snd_hda_codec_write(codec, hp_pin, 0,
3439 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3440
3441 if (hp_pin_sense)
3442 msleep(85);
3443
3444 snd_hda_codec_write(codec, hp_pin, 0,
3445 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3446
3447 if (hp_pin_sense)
3448 msleep(85);
3449 /* Index 0x46 Combo jack auto switch control 2 */
3450 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003451 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003452 /* Headphone capless set to normal mode */
3453 alc_write_coef_idx(codec, 0x43, 0x9614);
3454}
3455
3456static void alc283_shutup(struct hda_codec *codec)
3457{
3458 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003459 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003460 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003461
3462 if (!hp_pin) {
3463 alc269_shutup(codec);
3464 return;
3465 }
3466
3467 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3468
3469 alc_write_coef_idx(codec, 0x43, 0x9004);
3470
Harsha Priyab450b172014-10-09 11:04:56 +00003471 /*depop hp during suspend*/
3472 alc_write_coef_idx(codec, 0x06, 0x2100);
3473
Kailang Yang2af02be2013-08-22 10:03:50 +02003474 snd_hda_codec_write(codec, hp_pin, 0,
3475 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3476
3477 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003478 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003479
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003480 if (!spec->no_shutup_pins)
3481 snd_hda_codec_write(codec, hp_pin, 0,
3482 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003483
Takashi Iwai98b24882014-08-18 13:47:50 +02003484 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003485
3486 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003487 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003488 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003489 alc_shutup_pins(codec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003490 alc_write_coef_idx(codec, 0x43, 0x9614);
3491}
3492
Kailang Yang4a219ef2017-06-16 16:54:35 +08003493static void alc256_init(struct hda_codec *codec)
3494{
3495 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003496 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003497 bool hp_pin_sense;
3498
3499 if (!hp_pin)
Kailang Yang6447c962019-05-08 16:27:03 +08003500 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003501
3502 msleep(30);
3503
3504 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3505
3506 if (hp_pin_sense)
3507 msleep(2);
3508
3509 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yang6447c962019-05-08 16:27:03 +08003510 if (spec->ultra_low_power) {
3511 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3512 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3513 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3514 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3515 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3516 msleep(30);
3517 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003518
3519 snd_hda_codec_write(codec, hp_pin, 0,
3520 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3521
Kailang Yang6447c962019-05-08 16:27:03 +08003522 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003523 msleep(85);
3524
3525 snd_hda_codec_write(codec, hp_pin, 0,
3526 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3527
Kailang Yang6447c962019-05-08 16:27:03 +08003528 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003529 msleep(100);
3530
3531 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3532 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003533 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3534 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Thomas Hebbc4473742020-03-30 12:09:38 -04003535 /*
3536 * Expose headphone mic (or possibly Line In on some machines) instead
3537 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3538 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3539 * this register.
3540 */
3541 alc_write_coef_idx(codec, 0x36, 0x5757);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003542}
3543
3544static void alc256_shutup(struct hda_codec *codec)
3545{
3546 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003547 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003548 bool hp_pin_sense;
3549
Kailang Yang6447c962019-05-08 16:27:03 +08003550 if (!hp_pin)
3551 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003552
3553 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3554
3555 if (hp_pin_sense)
3556 msleep(2);
3557
3558 snd_hda_codec_write(codec, hp_pin, 0,
3559 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3560
Kailang Yang6447c962019-05-08 16:27:03 +08003561 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003562 msleep(85);
3563
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003564 /* 3k pull low control for Headset jack. */
3565 /* NOTE: call this before clearing the pin, otherwise codec stalls */
Hui Wang3f742492020-09-14 14:51:18 +08003566 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3567 * when booting with headset plugged. So skip setting it for the codec alc257
3568 */
Kailang Yang5aec9892021-10-05 14:35:14 +08003569 if (spec->codec_variant != ALC269_TYPE_ALC257 &&
3570 spec->codec_variant != ALC269_TYPE_ALC256)
Hui Wang3f742492020-09-14 14:51:18 +08003571 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003572
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003573 if (!spec->no_shutup_pins)
3574 snd_hda_codec_write(codec, hp_pin, 0,
3575 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003576
Kailang Yang6447c962019-05-08 16:27:03 +08003577 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003578 msleep(100);
3579
3580 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003581 alc_shutup_pins(codec);
Kailang Yang6447c962019-05-08 16:27:03 +08003582 if (spec->ultra_low_power) {
3583 msleep(50);
3584 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3585 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3586 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3587 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3588 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3589 msleep(30);
3590 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003591}
3592
Kailang Yang3c24e482021-07-01 09:33:33 +08003593static void alc285_hp_init(struct hda_codec *codec)
3594{
3595 struct alc_spec *spec = codec->spec;
3596 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3597 int i, val;
3598 int coef38, coef0d, coef36;
3599
3600 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3601 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3602 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3603 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3604 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3605 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3606
3607 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3608
3609 if (hp_pin)
3610 snd_hda_codec_write(codec, hp_pin, 0,
3611 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3612
3613 msleep(130);
3614 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3615 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3616
3617 if (hp_pin)
3618 snd_hda_codec_write(codec, hp_pin, 0,
3619 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3620 msleep(10);
3621 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3622 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3623 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3624 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3625
3626 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3627 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3628 for (i = 0; i < 20 && val & 0x8000; i++) {
3629 msleep(50);
3630 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3631 } /* Wait for depop procedure finish */
3632
3633 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3634 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3635 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3636 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3637
3638 msleep(50);
3639 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3640}
3641
Kailang Yangda911b12018-01-05 16:50:08 +08003642static void alc225_init(struct hda_codec *codec)
3643{
3644 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003645 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003646 bool hp1_pin_sense, hp2_pin_sense;
3647
Kailang Yang3c24e482021-07-01 09:33:33 +08003648 if (spec->codec_variant != ALC269_TYPE_ALC287)
3649 /* required only at boot or S3 and S4 resume time */
3650 if (!spec->done_hp_init ||
3651 is_s3_resume(codec) ||
3652 is_s4_resume(codec)) {
3653 alc285_hp_init(codec);
3654 spec->done_hp_init = true;
3655 }
3656
Kailang Yangda911b12018-01-05 16:50:08 +08003657 if (!hp_pin)
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003658 hp_pin = 0x21;
Kailang Yangda911b12018-01-05 16:50:08 +08003659 msleep(30);
3660
3661 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3662 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3663
3664 if (hp1_pin_sense || hp2_pin_sense)
3665 msleep(2);
3666
3667 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003668 if (spec->ultra_low_power) {
3669 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3670 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3671 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3672 msleep(30);
3673 }
Kailang Yangda911b12018-01-05 16:50:08 +08003674
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003675 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003676 snd_hda_codec_write(codec, hp_pin, 0,
3677 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3678 if (hp2_pin_sense)
3679 snd_hda_codec_write(codec, 0x16, 0,
3680 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3681
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003682 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003683 msleep(85);
3684
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003685 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003686 snd_hda_codec_write(codec, hp_pin, 0,
3687 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3688 if (hp2_pin_sense)
3689 snd_hda_codec_write(codec, 0x16, 0,
3690 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3691
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003692 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003693 msleep(100);
3694
3695 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3696 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3697}
3698
3699static void alc225_shutup(struct hda_codec *codec)
3700{
3701 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003702 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003703 bool hp1_pin_sense, hp2_pin_sense;
3704
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003705 if (!hp_pin)
3706 hp_pin = 0x21;
Hui Wang476c02e2020-03-29 16:20:18 +08003707
3708 alc_disable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003709 /* 3k pull low control for Headset jack. */
3710 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3711
3712 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3713 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3714
3715 if (hp1_pin_sense || hp2_pin_sense)
3716 msleep(2);
3717
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003718 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003719 snd_hda_codec_write(codec, hp_pin, 0,
3720 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3721 if (hp2_pin_sense)
3722 snd_hda_codec_write(codec, 0x16, 0,
3723 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3724
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003725 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003726 msleep(85);
3727
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003728 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003729 snd_hda_codec_write(codec, hp_pin, 0,
3730 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3731 if (hp2_pin_sense)
3732 snd_hda_codec_write(codec, 0x16, 0,
3733 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3734
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003735 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003736 msleep(100);
3737
3738 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003739 alc_shutup_pins(codec);
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003740 if (spec->ultra_low_power) {
3741 msleep(50);
3742 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3743 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3744 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3745 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3746 msleep(30);
3747 }
Hui Wang476c02e2020-03-29 16:20:18 +08003748
3749 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3750 alc_enable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003751}
3752
Kailang Yangc2d6af52017-06-21 14:50:54 +08003753static void alc_default_init(struct hda_codec *codec)
3754{
3755 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003756 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003757 bool hp_pin_sense;
3758
3759 if (!hp_pin)
3760 return;
3761
3762 msleep(30);
3763
3764 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3765
3766 if (hp_pin_sense)
3767 msleep(2);
3768
3769 snd_hda_codec_write(codec, hp_pin, 0,
3770 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3771
3772 if (hp_pin_sense)
3773 msleep(85);
3774
3775 snd_hda_codec_write(codec, hp_pin, 0,
3776 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3777
3778 if (hp_pin_sense)
3779 msleep(100);
3780}
3781
3782static void alc_default_shutup(struct hda_codec *codec)
3783{
3784 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003785 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003786 bool hp_pin_sense;
3787
3788 if (!hp_pin) {
3789 alc269_shutup(codec);
3790 return;
3791 }
3792
3793 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3794
3795 if (hp_pin_sense)
3796 msleep(2);
3797
3798 snd_hda_codec_write(codec, hp_pin, 0,
3799 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3800
3801 if (hp_pin_sense)
3802 msleep(85);
3803
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003804 if (!spec->no_shutup_pins)
3805 snd_hda_codec_write(codec, hp_pin, 0,
3806 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003807
3808 if (hp_pin_sense)
3809 msleep(100);
3810
3811 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003812 alc_shutup_pins(codec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003813}
3814
Kailang Yang693abe12019-01-29 15:38:21 +08003815static void alc294_hp_init(struct hda_codec *codec)
3816{
3817 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003818 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang693abe12019-01-29 15:38:21 +08003819 int i, val;
3820
3821 if (!hp_pin)
3822 return;
3823
3824 snd_hda_codec_write(codec, hp_pin, 0,
3825 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3826
3827 msleep(100);
3828
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003829 if (!spec->no_shutup_pins)
3830 snd_hda_codec_write(codec, hp_pin, 0,
3831 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang693abe12019-01-29 15:38:21 +08003832
3833 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3834 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3835
3836 /* Wait for depop procedure finish */
3837 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3838 for (i = 0; i < 20 && val & 0x0080; i++) {
3839 msleep(50);
3840 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3841 }
3842 /* Set HP depop to auto mode */
3843 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3844 msleep(50);
3845}
3846
3847static void alc294_init(struct hda_codec *codec)
3848{
3849 struct alc_spec *spec = codec->spec;
3850
Takashi Iwaif6ef4e02019-01-29 14:14:51 +01003851 /* required only at boot or S4 resume time */
3852 if (!spec->done_hp_init ||
3853 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
Kailang Yang693abe12019-01-29 15:38:21 +08003854 alc294_hp_init(codec);
3855 spec->done_hp_init = true;
3856 }
3857 alc_default_init(codec);
3858}
3859
Kailang Yangad60d502013-06-28 12:03:01 +02003860static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3861 unsigned int val)
3862{
3863 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3864 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3865 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3866}
3867
3868static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3869{
3870 unsigned int val;
3871
3872 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3873 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3874 & 0xffff;
3875 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3876 << 16;
3877 return val;
3878}
3879
3880static void alc5505_dsp_halt(struct hda_codec *codec)
3881{
3882 unsigned int val;
3883
3884 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3885 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3886 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3887 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3888 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3889 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3890 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3891 val = alc5505_coef_get(codec, 0x6220);
3892 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3893}
3894
3895static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3896{
3897 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3898 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3899 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3900 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3901 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3902 alc5505_coef_set(codec, 0x880c, 0x00000004);
3903}
3904
3905static void alc5505_dsp_init(struct hda_codec *codec)
3906{
3907 unsigned int val;
3908
3909 alc5505_dsp_halt(codec);
3910 alc5505_dsp_back_from_halt(codec);
3911 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3912 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3913 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3914 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3915 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3916 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3917 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3918 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3919 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3920 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3921 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3922 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3923 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3924
3925 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3926 if (val <= 3)
3927 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3928 else
3929 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3930
3931 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3932 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3933 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3934 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3935 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3936 alc5505_coef_set(codec, 0x880c, 0x00000003);
3937 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003938
3939#ifdef HALT_REALTEK_ALC5505
3940 alc5505_dsp_halt(codec);
3941#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003942}
3943
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003944#ifdef HALT_REALTEK_ALC5505
Pierre-Louis Bossart8a718212020-01-11 15:47:35 -06003945#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3946#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003947#else
3948#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3949#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3950#endif
3951
Takashi Iwai2a439522011-07-26 09:52:50 +02003952#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003953static int alc269_suspend(struct hda_codec *codec)
3954{
3955 struct alc_spec *spec = codec->spec;
3956
3957 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003958 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003959 return alc_suspend(codec);
3960}
3961
Takashi Iwai1d045db2011-07-07 18:23:21 +02003962static int alc269_resume(struct hda_codec *codec)
3963{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003964 struct alc_spec *spec = codec->spec;
3965
Kailang Yang1387e2d2012-11-08 10:23:18 +01003966 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3967 alc269vb_toggle_power_output(codec, 0);
3968 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003969 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003970 msleep(150);
3971 }
3972
3973 codec->patch_ops.init(codec);
3974
Kailang Yang1387e2d2012-11-08 10:23:18 +01003975 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3976 alc269vb_toggle_power_output(codec, 1);
3977 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003978 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003979 msleep(200);
3980 }
3981
Takashi Iwai1a462be2020-01-09 10:01:04 +01003982 snd_hda_regmap_sync(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003983 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003984
3985 /* on some machine, the BIOS will clear the codec gpio data when enter
3986 * suspend, and won't restore the data after resume, so we restore it
3987 * in the driver.
3988 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003989 if (spec->gpio_data)
3990 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003991
Kailang Yangad60d502013-06-28 12:03:01 +02003992 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003993 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003994
Takashi Iwai1d045db2011-07-07 18:23:21 +02003995 return 0;
3996}
Takashi Iwai2a439522011-07-26 09:52:50 +02003997#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003998
David Henningsson108cc102012-07-20 10:37:25 +02003999static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004000 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02004001{
4002 struct alc_spec *spec = codec->spec;
4003
Takashi Iwai1727a772013-01-10 09:52:52 +01004004 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02004005 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4006}
4007
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01004008static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4009 const struct hda_fixup *fix,
4010 int action)
4011{
4012 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4013 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4014
4015 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4016 snd_hda_codec_set_pincfg(codec, 0x19,
4017 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4018 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4019}
4020
Takashi Iwai1d045db2011-07-07 18:23:21 +02004021static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004022 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02004023{
Takashi Iwai98b24882014-08-18 13:47:50 +02004024 if (action == HDA_FIXUP_ACT_INIT)
4025 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004026}
4027
David Henningsson7c478f02013-10-11 10:18:46 +02004028static void alc269_fixup_headset_mic(struct hda_codec *codec,
4029 const struct hda_fixup *fix, int action)
4030{
4031 struct alc_spec *spec = codec->spec;
4032
4033 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4034 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4035}
4036
Takashi Iwai1d045db2011-07-07 18:23:21 +02004037static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004038 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02004039{
4040 static const struct hda_verb verbs[] = {
4041 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4042 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4043 {}
4044 };
4045 unsigned int cfg;
4046
Takashi Iwai7639a062015-03-03 10:07:24 +01004047 if (strcmp(codec->core.chip_name, "ALC271X") &&
4048 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02004049 return;
4050 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4051 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4052 snd_hda_sequence_write(codec, verbs);
4053}
4054
Takashi Iwaic8426b22021-04-07 11:57:30 +02004055/* Fix the speaker amp after resume, etc */
4056static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4057 const struct hda_fixup *fix,
4058 int action)
4059{
4060 if (action == HDA_FIXUP_ACT_INIT)
4061 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4062}
4063
Takashi Iwai017f2a12011-07-09 14:42:25 +02004064static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004065 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02004066{
4067 struct alc_spec *spec = codec->spec;
4068
Takashi Iwai1727a772013-01-10 09:52:52 +01004069 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02004070 return;
4071
4072 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4073 * fix the sample rate of analog I/O to 44.1kHz
4074 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01004075 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4076 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02004077}
4078
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004079static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004080 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004081{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004082 /* The digital-mic unit sends PDM (differential signal) instead of
4083 * the standard PCM, thus you can't record a valid mono stream as is.
4084 * Below is a workaround specific to ALC269 to control the dmic
4085 * signal source as mono.
4086 */
Takashi Iwai98b24882014-08-18 13:47:50 +02004087 if (action == HDA_FIXUP_ACT_INIT)
4088 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004089}
4090
Takashi Iwai24519912011-08-16 15:08:49 +02004091static void alc269_quanta_automute(struct hda_codec *codec)
4092{
Takashi Iwai08c189f2012-12-19 15:22:24 +01004093 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02004094
Takashi Iwai1687ccc2014-08-18 13:49:35 +02004095 alc_write_coef_idx(codec, 0x0c, 0x680);
4096 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02004097}
4098
4099static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004100 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02004101{
4102 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01004103 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02004104 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01004105 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02004106}
4107
David Henningssond240d1d2013-04-15 12:50:02 +02004108static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02004109 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02004110{
4111 struct alc_spec *spec = codec->spec;
4112 int vref;
4113 msleep(200);
4114 snd_hda_gen_hp_automute(codec, jack);
4115
4116 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4117 msleep(100);
4118 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4119 vref);
4120 msleep(500);
4121 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4122 vref);
4123}
4124
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02004125/*
4126 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4127 */
4128struct hda_alc298_mbxinit {
4129 unsigned char value_0x23;
4130 unsigned char value_0x25;
4131};
4132
4133static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4134 const struct hda_alc298_mbxinit *initval,
4135 bool first)
4136{
4137 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4138 alc_write_coef_idx(codec, 0x26, 0xb000);
4139
4140 if (first)
4141 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4142
4143 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4144 alc_write_coef_idx(codec, 0x26, 0xf000);
4145 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4146
4147 if (initval->value_0x23 != 0x1e)
4148 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4149
4150 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4151 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4152}
4153
4154static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4155 const struct hda_fixup *fix,
4156 int action)
4157{
4158 /* Initialization magic */
4159 static const struct hda_alc298_mbxinit dac_init[] = {
4160 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4161 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4162 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4163 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4164 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4165 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4166 {0x2f, 0x00},
4167 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4168 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4169 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4170 {}
4171 };
4172 const struct hda_alc298_mbxinit *seq;
4173
4174 if (action != HDA_FIXUP_ACT_INIT)
4175 return;
4176
4177 /* Start */
4178 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4179 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4180 alc_write_coef_idx(codec, 0x26, 0xf000);
4181 alc_write_coef_idx(codec, 0x22, 0x31);
4182 alc_write_coef_idx(codec, 0x23, 0x0b);
4183 alc_write_coef_idx(codec, 0x25, 0x00);
4184 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4185 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4186
4187 for (seq = dac_init; seq->value_0x23; seq++)
4188 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4189}
4190
David Henningssond240d1d2013-04-15 12:50:02 +02004191static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4192 const struct hda_fixup *fix, int action)
4193{
4194 struct alc_spec *spec = codec->spec;
4195 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4196 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4197 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4198 }
4199}
4200
Takashi Iwai766538a2020-06-18 13:08:41 +02004201static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4202 bool polarity, bool on)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004203{
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004204 unsigned int pinval;
4205
Takashi Iwai766538a2020-06-18 13:08:41 +02004206 if (!pin)
4207 return;
4208 if (polarity)
4209 on = !on;
4210 pinval = snd_hda_codec_get_pin_target(codec, pin);
Takashi Iwai415d5552014-04-03 11:51:21 +02004211 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwai766538a2020-06-18 13:08:41 +02004212 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4213 /* temporarily power up/down for setting VREF */
4214 snd_hda_power_up_pm(codec);
4215 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4216 snd_hda_power_down_pm(codec);
4217}
Takashi Iwai1d045db2011-07-07 18:23:21 +02004218
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004219/* update mute-LED according to the speaker mute state via mic VREF pin */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004220static int vref_mute_led_set(struct led_classdev *led_cdev,
4221 enum led_brightness brightness)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004222{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004223 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004224 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004225
Takashi Iwai766538a2020-06-18 13:08:41 +02004226 alc_update_vref_led(codec, spec->mute_led_nid,
4227 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004228 return 0;
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004229}
4230
David Henningssond5b6b652013-11-06 10:50:44 +01004231/* Make sure the led works even in runtime suspend */
4232static unsigned int led_power_filter(struct hda_codec *codec,
4233 hda_nid_t nid,
4234 unsigned int power_state)
4235{
4236 struct alc_spec *spec = codec->spec;
4237
Hui Wang50dd9052014-07-08 17:56:15 +08004238 if (power_state != AC_PWRST_D3 || nid == 0 ||
4239 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01004240 return power_state;
4241
4242 /* Set pin ctl again, it might have just been set to 0 */
4243 snd_hda_set_pin_ctl(codec, nid,
4244 snd_hda_codec_get_pin_target(codec, nid));
4245
Takashi Iwaicffd3962015-04-09 10:30:25 +02004246 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01004247}
4248
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004249static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4250 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004251{
4252 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004253 const struct dmi_device *dev = NULL;
4254
4255 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4256 return;
4257
4258 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4259 int pol, pin;
4260 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4261 continue;
4262 if (pin < 0x0a || pin >= 0x10)
4263 break;
4264 spec->mute_led_polarity = pol;
4265 spec->mute_led_nid = pin - 0x0a + 0x18;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004266 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004267 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01004268 codec_dbg(codec,
4269 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004270 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004271 break;
4272 }
4273}
4274
Takashi Iwai85c467d2018-05-29 11:38:38 +02004275static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4276 const struct hda_fixup *fix,
4277 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01004278{
4279 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004280
David Henningssond06ac142013-02-18 11:41:55 +01004281 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4282 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004283 spec->mute_led_nid = pin;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004284 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004285 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01004286 }
4287}
4288
Takashi Iwai85c467d2018-05-29 11:38:38 +02004289static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4290 const struct hda_fixup *fix, int action)
4291{
4292 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4293}
4294
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004295static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4296 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004297{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004298 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004299}
4300
Tom Briden7f783bd2017-03-25 10:12:01 +00004301static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4302 const struct hda_fixup *fix, int action)
4303{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004304 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00004305}
4306
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004307/* update LED status via GPIO */
4308static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004309 int polarity, bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004310{
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004311 if (polarity)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004312 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02004313 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004314}
4315
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004316/* turn on/off mute LED via GPIO per vmaster hook */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004317static int gpio_mute_led_set(struct led_classdev *led_cdev,
4318 enum led_brightness brightness)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004319{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004320 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004321 struct alc_spec *spec = codec->spec;
4322
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004323 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004324 spec->mute_led_polarity, !brightness);
4325 return 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004326}
4327
4328/* turn on/off mic-mute LED via GPIO per capture hook */
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004329static int micmute_led_set(struct led_classdev *led_cdev,
4330 enum led_brightness brightness)
4331{
4332 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4333 struct alc_spec *spec = codec->spec;
4334
4335 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
Hui Wang40469062020-08-11 20:24:30 +08004336 spec->micmute_led_polarity, !brightness);
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004337 return 0;
4338}
4339
Takashi Iwai01e4a272018-06-19 22:47:30 +02004340/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4341static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4342 int action,
4343 unsigned int mute_mask,
4344 unsigned int micmute_mask)
4345{
4346 struct alc_spec *spec = codec->spec;
4347
4348 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4349
4350 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4351 return;
4352 if (mute_mask) {
4353 spec->gpio_mute_led_mask = mute_mask;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004354 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004355 }
4356 if (micmute_mask) {
4357 spec->gpio_mic_led_mask = micmute_mask;
Takashi Iwai7cdf8c42020-06-18 13:08:31 +02004358 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004359 }
4360}
4361
Jeremy Szue7d66cf2021-03-16 15:46:24 +08004362static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4363 const struct hda_fixup *fix, int action)
4364{
4365 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4366}
4367
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004368static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4369 const struct hda_fixup *fix, int action)
4370{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004371 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004372}
4373
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004374static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4375 const struct hda_fixup *fix, int action)
4376{
Kai-Heng Feng3e0650a2020-04-30 16:32:52 +08004377 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004378}
4379
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004380static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4381 const struct hda_fixup *fix, int action)
4382{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004383 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004384}
4385
Kailang Yanga0ccbc52020-11-06 15:20:38 +08004386static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4387 const struct hda_fixup *fix, int action)
4388{
4389 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4390}
4391
Johnathon Clark5fc462c2021-10-20 14:12:51 +01004392static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4393 const struct hda_fixup *fix, int action)
4394{
4395 struct alc_spec *spec = codec->spec;
4396
4397 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4398 spec->micmute_led_polarity = 1;
4399 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4400}
4401
Takashi Iwai8a503552020-06-18 13:08:32 +02004402/* turn on/off mic-mute LED per capture hook via VREF change */
4403static int vref_micmute_led_set(struct led_classdev *led_cdev,
4404 enum led_brightness brightness)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004405{
Takashi Iwai8a503552020-06-18 13:08:32 +02004406 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004407 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004408
Takashi Iwai766538a2020-06-18 13:08:41 +02004409 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4410 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004411 return 0;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004412}
4413
4414static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4415 const struct hda_fixup *fix, int action)
4416{
4417 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004418
Takashi Iwai01e4a272018-06-19 22:47:30 +02004419 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004420 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02004421 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4422 * enable headphone amp
4423 */
4424 spec->gpio_mask |= 0x10;
4425 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004426 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004427 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Hui Wang50dd9052014-07-08 17:56:15 +08004428 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004429 }
4430}
4431
David Henningsson7a5255f2014-10-30 08:26:01 +01004432static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4433 const struct hda_fixup *fix, int action)
4434{
David Henningsson7a5255f2014-10-30 08:26:01 +01004435 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01004436
Takashi Iwai01e4a272018-06-19 22:47:30 +02004437 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01004438 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01004439 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004440 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
David Henningsson7a5255f2014-10-30 08:26:01 +01004441 codec->power_filter = led_power_filter;
4442 }
4443}
4444
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01004445/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4446 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4447 */
4448static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4449 const struct hda_fixup *fix, int action)
4450{
4451 struct alc_spec *spec = codec->spec;
4452
4453 switch (action) {
4454 case HDA_FIXUP_ACT_PRE_PROBE:
4455 spec->gpio_mask |= 0x01;
4456 spec->gpio_dir |= 0x01;
4457 break;
4458 case HDA_FIXUP_ACT_INIT:
4459 /* need to toggle GPIO to enable the amp */
4460 alc_update_gpio_data(codec, 0x01, true);
4461 msleep(100);
4462 alc_update_gpio_data(codec, 0x01, false);
4463 break;
4464 }
4465}
4466
Takashi Iwai622464c2021-05-04 11:18:02 +02004467/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4468static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4469 struct hda_codec *codec,
4470 struct snd_pcm_substream *substream,
4471 int action)
4472{
4473 switch (action) {
4474 case HDA_GEN_PCM_ACT_PREPARE:
4475 alc_update_gpio_data(codec, 0x04, true);
4476 break;
4477 case HDA_GEN_PCM_ACT_CLEANUP:
4478 alc_update_gpio_data(codec, 0x04, false);
4479 break;
4480 }
4481}
4482
4483static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4484 const struct hda_fixup *fix,
4485 int action)
4486{
4487 struct alc_spec *spec = codec->spec;
4488
4489 if (action == HDA_FIXUP_ACT_PROBE) {
4490 spec->gpio_mask |= 0x04;
4491 spec->gpio_dir |= 0x04;
4492 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4493 }
4494}
4495
Takashi Iwai766538a2020-06-18 13:08:41 +02004496static void alc_update_coef_led(struct hda_codec *codec,
4497 struct alc_coef_led *led,
4498 bool polarity, bool on)
Kailang Yang431e76c2020-04-07 14:40:20 +08004499{
Takashi Iwai766538a2020-06-18 13:08:41 +02004500 if (polarity)
4501 on = !on;
4502 /* temporarily power up/down for setting COEF bit */
4503 alc_update_coef_idx(codec, led->idx, led->mask,
4504 on ? led->on : led->off);
4505}
4506
Kailang Yang431e76c2020-04-07 14:40:20 +08004507/* update mute-LED according to the speaker mute state via COEF bit */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004508static int coef_mute_led_set(struct led_classdev *led_cdev,
4509 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004510{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004511 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004512 struct alc_spec *spec = codec->spec;
4513
Takashi Iwai766538a2020-06-18 13:08:41 +02004514 alc_update_coef_led(codec, &spec->mute_led_coef,
4515 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004516 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004517}
4518
4519static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4520 const struct hda_fixup *fix,
4521 int action)
4522{
4523 struct alc_spec *spec = codec->spec;
4524
4525 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4526 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004527 spec->mute_led_coef.idx = 0x0b;
4528 spec->mute_led_coef.mask = 1 << 3;
4529 spec->mute_led_coef.on = 1 << 3;
4530 spec->mute_led_coef.off = 0;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004531 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004532 }
4533}
4534
Kailang Yang24164f42020-04-07 14:52:42 +08004535static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4536 const struct hda_fixup *fix,
4537 int action)
4538{
4539 struct alc_spec *spec = codec->spec;
4540
4541 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4542 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004543 spec->mute_led_coef.idx = 0x34;
4544 spec->mute_led_coef.mask = 1 << 5;
4545 spec->mute_led_coef.on = 0;
4546 spec->mute_led_coef.off = 1 << 5;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004547 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004548 }
4549}
4550
Kailang Yang431e76c2020-04-07 14:40:20 +08004551/* turn on/off mic-mute LED per capture hook by coef bit */
Takashi Iwai8a503552020-06-18 13:08:32 +02004552static int coef_micmute_led_set(struct led_classdev *led_cdev,
4553 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004554{
Takashi Iwai8a503552020-06-18 13:08:32 +02004555 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004556 struct alc_spec *spec = codec->spec;
4557
Takashi Iwai766538a2020-06-18 13:08:41 +02004558 alc_update_coef_led(codec, &spec->mic_led_coef,
4559 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004560 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004561}
4562
4563static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4564 const struct hda_fixup *fix, int action)
4565{
4566 struct alc_spec *spec = codec->spec;
4567
4568 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004569 spec->mic_led_coef.idx = 0x19;
4570 spec->mic_led_coef.mask = 1 << 13;
4571 spec->mic_led_coef.on = 1 << 13;
4572 spec->mic_led_coef.off = 0;
Takashi Iwai8a503552020-06-18 13:08:32 +02004573 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004574 }
4575}
4576
Kailang Yang24164f42020-04-07 14:52:42 +08004577static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4578 const struct hda_fixup *fix, int action)
4579{
4580 struct alc_spec *spec = codec->spec;
4581
4582 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004583 spec->mic_led_coef.idx = 0x35;
4584 spec->mic_led_coef.mask = 3 << 2;
4585 spec->mic_led_coef.on = 2 << 2;
4586 spec->mic_led_coef.off = 1 << 2;
Takashi Iwai8a503552020-06-18 13:08:32 +02004587 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004588 }
4589}
4590
Kailang Yang431e76c2020-04-07 14:40:20 +08004591static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4592 const struct hda_fixup *fix, int action)
4593{
4594 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4595 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4596}
4597
Kailang Yang24164f42020-04-07 14:52:42 +08004598static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4599 const struct hda_fixup *fix, int action)
4600{
4601 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4602 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4603}
4604
Jonas Witschel75b62ab2021-04-16 12:58:54 +02004605static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4606 const struct hda_fixup *fix, int action)
4607{
4608 struct alc_spec *spec = codec->spec;
4609
4610 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4611 spec->cap_mute_led_nid = 0x1a;
4612 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4613 codec->power_filter = led_power_filter;
4614 }
4615}
4616
4617static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4618 const struct hda_fixup *fix, int action)
4619{
4620 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4621 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4622}
4623
Takashi Iwai6a30aba2018-04-27 17:17:35 +02004624#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01004625static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4626 struct hda_jack_callback *event)
4627{
4628 struct alc_spec *spec = codec->spec;
4629
4630 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4631 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08004632 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01004633 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08004634 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01004635 input_sync(spec->kb_dev);
4636}
David Henningsson33f4acd2015-01-07 15:50:13 +01004637
Kailang3694cb22015-12-28 11:35:24 +08004638static int alc_register_micmute_input_device(struct hda_codec *codec)
4639{
4640 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08004641 int i;
Kailang3694cb22015-12-28 11:35:24 +08004642
4643 spec->kb_dev = input_allocate_device();
4644 if (!spec->kb_dev) {
4645 codec_err(codec, "Out of memory (input_allocate_device)\n");
4646 return -ENOMEM;
4647 }
Hui Wangc7b60a82015-12-28 11:35:25 +08004648
4649 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4650
Kailang3694cb22015-12-28 11:35:24 +08004651 spec->kb_dev->name = "Microphone Mute Button";
4652 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08004653 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4654 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4655 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4656 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4657 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08004658
4659 if (input_register_device(spec->kb_dev)) {
4660 codec_err(codec, "input_register_device failed\n");
4661 input_free_device(spec->kb_dev);
4662 spec->kb_dev = NULL;
4663 return -ENOMEM;
4664 }
4665
4666 return 0;
4667}
4668
Takashi Iwai01e4a272018-06-19 22:47:30 +02004669/* GPIO1 = set according to SKU external amp
4670 * GPIO2 = mic mute hotkey
4671 * GPIO3 = mute LED
4672 * GPIO4 = mic mute LED
4673 */
David Henningsson33f4acd2015-01-07 15:50:13 +01004674static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4675 const struct hda_fixup *fix, int action)
4676{
David Henningsson33f4acd2015-01-07 15:50:13 +01004677 struct alc_spec *spec = codec->spec;
4678
Takashi Iwai01e4a272018-06-19 22:47:30 +02004679 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01004680 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004681 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004682 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01004683 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01004684
Takashi Iwai01e4a272018-06-19 22:47:30 +02004685 spec->gpio_mask |= 0x06;
4686 spec->gpio_dir |= 0x02;
4687 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01004688 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01004689 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01004690 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01004691 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01004692 return;
4693 }
4694
4695 if (!spec->kb_dev)
4696 return;
4697
4698 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01004699 case HDA_FIXUP_ACT_FREE:
4700 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01004701 spec->kb_dev = NULL;
4702 }
David Henningsson33f4acd2015-01-07 15:50:13 +01004703}
4704
Takashi Iwai01e4a272018-06-19 22:47:30 +02004705/* Line2 = mic mute hotkey
4706 * GPIO2 = mic mute LED
4707 */
Kailang3694cb22015-12-28 11:35:24 +08004708static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4709 const struct hda_fixup *fix, int action)
4710{
Kailang3694cb22015-12-28 11:35:24 +08004711 struct alc_spec *spec = codec->spec;
4712
Takashi Iwai01e4a272018-06-19 22:47:30 +02004713 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08004714 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004715 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004716 if (alc_register_micmute_input_device(codec) != 0)
4717 return;
4718
Kailang3694cb22015-12-28 11:35:24 +08004719 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4720 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08004721 return;
4722 }
4723
4724 if (!spec->kb_dev)
4725 return;
4726
4727 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08004728 case HDA_FIXUP_ACT_FREE:
4729 input_unregister_device(spec->kb_dev);
4730 spec->kb_dev = NULL;
4731 }
4732}
Takashi Iwaic4696522018-01-15 10:44:35 +01004733#else /* INPUT */
4734#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4735#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4736#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004737
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004738static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4739 const struct hda_fixup *fix, int action)
4740{
4741 struct alc_spec *spec = codec->spec;
4742
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004743 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004744 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004745 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004746 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004747 }
4748}
4749
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004750static const struct coef_fw alc225_pre_hsmode[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004751 UPDATE_COEF(0x4a, 1<<8, 0),
4752 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4753 UPDATE_COEF(0x63, 3<<14, 3<<14),
4754 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4755 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4756 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4757 UPDATE_COEF(0x4a, 3<<10, 0),
4758 {}
4759};
4760
David Henningsson73bdd592013-04-15 15:44:14 +02004761static void alc_headset_mode_unplugged(struct hda_codec *codec)
4762{
Kailang Yang92666d42020-11-19 17:04:21 +08004763 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004764 static const struct coef_fw coef0255[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004765 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02004766 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4767 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4768 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4769 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4770 {}
4771 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004772 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004773 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
Kailang Yang717f43d2019-05-31 17:16:53 +08004774 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4775 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4776 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4777 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
Kailang Yange69e7e02016-05-30 15:58:28 +08004778 {}
4779 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004780 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004781 WRITE_COEF(0x1b, 0x0c0b),
4782 WRITE_COEF(0x45, 0xc429),
4783 UPDATE_COEF(0x35, 0x4000, 0),
4784 WRITE_COEF(0x06, 0x2104),
4785 WRITE_COEF(0x1a, 0x0001),
4786 WRITE_COEF(0x26, 0x0004),
4787 WRITE_COEF(0x32, 0x42a3),
4788 {}
4789 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004790 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004791 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4792 UPDATE_COEF(0x50, 0x2000, 0x2000),
4793 UPDATE_COEF(0x56, 0x0006, 0x0006),
4794 UPDATE_COEF(0x66, 0x0008, 0),
4795 UPDATE_COEF(0x67, 0x2000, 0),
4796 {}
4797 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004798 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004799 UPDATE_COEF(0x19, 0x1300, 0x0300),
4800 {}
4801 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004802 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004803 WRITE_COEF(0x76, 0x000e),
4804 WRITE_COEF(0x6c, 0x2400),
4805 WRITE_COEF(0x18, 0x7308),
4806 WRITE_COEF(0x6b, 0xc429),
4807 {}
4808 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004809 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004810 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4811 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4812 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4813 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4814 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4815 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4816 {}
4817 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004818 static const struct coef_fw coef0668[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004819 WRITE_COEF(0x15, 0x0d40),
4820 WRITE_COEF(0xb7, 0x802b),
4821 {}
4822 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004823 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004824 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004825 {}
4826 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004827 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004828 UPDATE_COEF(0x4a, 0x0100, 0),
4829 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4830 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4831 UPDATE_COEF(0x4a, 0x0010, 0),
4832 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4833 WRITE_COEF(0x45, 0x5289),
4834 UPDATE_COEF(0x4a, 0x0c00, 0),
4835 {}
4836 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004837
Kailang Yang92666d42020-11-19 17:04:21 +08004838 if (spec->no_internal_mic_pin) {
4839 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4840 return;
4841 }
4842
Takashi Iwai7639a062015-03-03 10:07:24 +01004843 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004844 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004845 alc_process_coef_fw(codec, coef0255);
4846 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02004847 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08004848 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004849 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004850 alc_process_coef_fw(codec, coef0256);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004851 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004852 case 0x10ec0234:
4853 case 0x10ec0274:
4854 case 0x10ec0294:
4855 alc_process_coef_fw(codec, coef0274);
4856 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004857 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004858 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004859 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004860 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004861 case 0x10ec0286:
4862 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004863 alc_process_coef_fw(codec, coef0288);
4864 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004865 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004866 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004867 alc_process_coef_fw(codec, coef0288);
4868 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004869 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004870 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004871 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004872 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004873 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004874 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004875 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004876 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004877 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004878 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004879 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004880 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004881 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004882 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004883 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004884 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004885 alc_process_coef_fw(codec, coef0225);
4886 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004887 case 0x10ec0867:
4888 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4889 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004890 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004891 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004892}
4893
4894
4895static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4896 hda_nid_t mic_pin)
4897{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004898 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004899 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4900 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4901 {}
4902 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004903 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004904 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4905 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4906 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4907 {}
4908 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004909 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004910 UPDATE_COEF(0x35, 0, 1<<14),
4911 WRITE_COEF(0x06, 0x2100),
4912 WRITE_COEF(0x1a, 0x0021),
4913 WRITE_COEF(0x26, 0x008c),
4914 {}
4915 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004916 static const struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004917 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004918 UPDATE_COEF(0x50, 0x2000, 0),
4919 UPDATE_COEF(0x56, 0x0006, 0),
4920 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4921 UPDATE_COEF(0x66, 0x0008, 0x0008),
4922 UPDATE_COEF(0x67, 0x2000, 0x2000),
4923 {}
4924 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004925 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004926 WRITE_COEF(0x19, 0xa208),
4927 WRITE_COEF(0x2e, 0xacf0),
4928 {}
4929 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004930 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004931 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4932 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4933 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4934 {}
4935 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004936 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004937 WRITE_COEF(0xb7, 0x802b),
4938 WRITE_COEF(0xb5, 0x1040),
4939 UPDATE_COEF(0xc3, 0, 1<<12),
4940 {}
4941 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004942 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004943 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4944 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4945 UPDATE_COEF(0x63, 3<<14, 0),
4946 {}
4947 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004948 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004949 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4950 UPDATE_COEF(0x4a, 0x0010, 0),
4951 UPDATE_COEF(0x6b, 0xf000, 0),
4952 {}
4953 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004954
Takashi Iwai7639a062015-03-03 10:07:24 +01004955 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004956 case 0x10ec0255:
4957 alc_write_coef_idx(codec, 0x45, 0xc489);
4958 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004959 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004960 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4961 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02004962 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08004963 case 0x10ec0236:
4964 case 0x10ec0256:
4965 alc_write_coef_idx(codec, 0x45, 0xc489);
4966 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4967 alc_process_coef_fw(codec, coef0256);
4968 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4969 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004970 case 0x10ec0234:
4971 case 0x10ec0274:
4972 case 0x10ec0294:
4973 alc_write_coef_idx(codec, 0x45, 0x4689);
4974 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4975 alc_process_coef_fw(codec, coef0274);
4976 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4977 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004978 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004979 case 0x10ec0283:
4980 alc_write_coef_idx(codec, 0x45, 0xc429);
4981 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004982 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004983 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4984 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004985 case 0x10ec0286:
4986 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004987 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004988 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4989 alc_process_coef_fw(codec, coef0288);
4990 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4991 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004992 case 0x10ec0292:
4993 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004994 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004995 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004996 case 0x10ec0293:
4997 /* Set to TRS mode */
4998 alc_write_coef_idx(codec, 0x45, 0xc429);
4999 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02005000 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005001 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5002 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005003 case 0x10ec0867:
5004 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -05005005 fallthrough;
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08005006 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02005007 case 0x10ec0662:
5008 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5009 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5010 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005011 case 0x10ec0668:
5012 alc_write_coef_idx(codec, 0x11, 0x0001);
5013 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02005014 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005015 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5016 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005017 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005018 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005019 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005020 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005021 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005022 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005023 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005024 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5025 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5026 alc_process_coef_fw(codec, coef0225);
5027 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5028 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005029 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005030 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005031}
5032
5033static void alc_headset_mode_default(struct hda_codec *codec)
5034{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005035 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08005036 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5037 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5038 UPDATE_COEF(0x49, 3<<8, 0<<8),
5039 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5040 UPDATE_COEF(0x63, 3<<14, 0),
5041 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01005042 {}
5043 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005044 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005045 WRITE_COEF(0x45, 0xc089),
5046 WRITE_COEF(0x45, 0xc489),
5047 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5048 WRITE_COEF(0x49, 0x0049),
5049 {}
5050 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005051 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08005052 WRITE_COEF(0x45, 0xc489),
5053 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5054 WRITE_COEF(0x49, 0x0049),
5055 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5056 WRITE_COEF(0x06, 0x6100),
5057 {}
5058 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005059 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005060 WRITE_COEF(0x06, 0x2100),
5061 WRITE_COEF(0x32, 0x4ea3),
5062 {}
5063 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005064 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005065 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5066 UPDATE_COEF(0x50, 0x2000, 0x2000),
5067 UPDATE_COEF(0x56, 0x0006, 0x0006),
5068 UPDATE_COEF(0x66, 0x0008, 0),
5069 UPDATE_COEF(0x67, 0x2000, 0),
5070 {}
5071 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005072 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005073 WRITE_COEF(0x76, 0x000e),
5074 WRITE_COEF(0x6c, 0x2400),
5075 WRITE_COEF(0x6b, 0xc429),
5076 WRITE_COEF(0x18, 0x7308),
5077 {}
5078 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005079 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005080 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5081 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5082 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5083 {}
5084 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005085 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005086 WRITE_COEF(0x11, 0x0041),
5087 WRITE_COEF(0x15, 0x0d40),
5088 WRITE_COEF(0xb7, 0x802b),
5089 {}
5090 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005091 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005092 WRITE_COEF(0x45, 0x4289),
5093 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5094 UPDATE_COEF(0x6b, 0x0f00, 0),
5095 UPDATE_COEF(0x49, 0x0300, 0x0300),
5096 {}
5097 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005098
Takashi Iwai7639a062015-03-03 10:07:24 +01005099 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08005100 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01005101 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005102 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005103 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005104 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005105 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005106 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01005107 alc_process_coef_fw(codec, coef0225);
5108 break;
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005109 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005110 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005111 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005112 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08005113 case 0x10ec0236:
5114 case 0x10ec0256:
5115 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5116 alc_write_coef_idx(codec, 0x45, 0xc089);
5117 msleep(50);
5118 alc_process_coef_fw(codec, coef0256);
5119 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005120 case 0x10ec0234:
5121 case 0x10ec0274:
5122 case 0x10ec0294:
5123 alc_process_coef_fw(codec, coef0274);
5124 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005125 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005126 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005127 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005128 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005129 case 0x10ec0286:
5130 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005131 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08005132 alc_process_coef_fw(codec, coef0288);
5133 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005134 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005135 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005136 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005137 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005138 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005139 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005140 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005141 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005142 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005143 case 0x10ec0867:
5144 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5145 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005146 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005147 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005148}
5149
5150/* Iphone type */
5151static void alc_headset_mode_ctia(struct hda_codec *codec)
5152{
Kailang Yang89542932017-07-17 15:03:43 +08005153 int val;
5154
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005155 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005156 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5157 WRITE_COEF(0x1b, 0x0c2b),
5158 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5159 {}
5160 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005161 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005162 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005163 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005164 {}
5165 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005166 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005167 WRITE_COEF(0x45, 0xd429),
5168 WRITE_COEF(0x1b, 0x0c2b),
5169 WRITE_COEF(0x32, 0x4ea3),
5170 {}
5171 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005172 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005173 UPDATE_COEF(0x50, 0x2000, 0x2000),
5174 UPDATE_COEF(0x56, 0x0006, 0x0006),
5175 UPDATE_COEF(0x66, 0x0008, 0),
5176 UPDATE_COEF(0x67, 0x2000, 0),
5177 {}
5178 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005179 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005180 WRITE_COEF(0x6b, 0xd429),
5181 WRITE_COEF(0x76, 0x0008),
5182 WRITE_COEF(0x18, 0x7388),
5183 {}
5184 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005185 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005186 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5187 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5188 {}
5189 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005190 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005191 WRITE_COEF(0x11, 0x0001),
5192 WRITE_COEF(0x15, 0x0d60),
5193 WRITE_COEF(0xc3, 0x0000),
5194 {}
5195 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005196 static const struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005197 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005198 UPDATE_COEF(0x63, 3<<14, 2<<14),
5199 {}
5200 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005201 static const struct coef_fw coef0225_2[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08005202 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5203 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005204 {}
5205 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005206
Takashi Iwai7639a062015-03-03 10:07:24 +01005207 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005208 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005209 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005210 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005211 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005212 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005213 case 0x10ec0256:
5214 alc_process_coef_fw(codec, coef0256);
5215 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005216 case 0x10ec0234:
5217 case 0x10ec0274:
5218 case 0x10ec0294:
5219 alc_write_coef_idx(codec, 0x45, 0xd689);
5220 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005221 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005222 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005223 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005224 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005225 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005226 val = alc_read_coef_idx(codec, 0x50);
5227 if (val & (1 << 12)) {
5228 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5229 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5230 msleep(300);
5231 } else {
5232 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5233 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5234 msleep(300);
5235 }
5236 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005237 case 0x10ec0286:
5238 case 0x10ec0288:
5239 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5240 msleep(300);
5241 alc_process_coef_fw(codec, coef0288);
5242 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005243 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005244 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005245 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005246 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005247 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005248 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005249 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005250 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005251 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005252 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005253 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005254 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005255 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005256 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005257 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005258 val = alc_read_coef_idx(codec, 0x45);
5259 if (val & (1 << 9))
5260 alc_process_coef_fw(codec, coef0225_2);
5261 else
5262 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005263 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005264 case 0x10ec0867:
5265 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5266 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005267 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005268 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005269}
5270
5271/* Nokia type */
5272static void alc_headset_mode_omtp(struct hda_codec *codec)
5273{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005274 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005275 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5276 WRITE_COEF(0x1b, 0x0c2b),
5277 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5278 {}
5279 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005280 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005281 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005282 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005283 {}
5284 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005285 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005286 WRITE_COEF(0x45, 0xe429),
5287 WRITE_COEF(0x1b, 0x0c2b),
5288 WRITE_COEF(0x32, 0x4ea3),
5289 {}
5290 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005291 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005292 UPDATE_COEF(0x50, 0x2000, 0x2000),
5293 UPDATE_COEF(0x56, 0x0006, 0x0006),
5294 UPDATE_COEF(0x66, 0x0008, 0),
5295 UPDATE_COEF(0x67, 0x2000, 0),
5296 {}
5297 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005298 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005299 WRITE_COEF(0x6b, 0xe429),
5300 WRITE_COEF(0x76, 0x0008),
5301 WRITE_COEF(0x18, 0x7388),
5302 {}
5303 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005304 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005305 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5306 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5307 {}
5308 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005309 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005310 WRITE_COEF(0x11, 0x0001),
5311 WRITE_COEF(0x15, 0x0d50),
5312 WRITE_COEF(0xc3, 0x0000),
5313 {}
5314 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005315 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005316 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005317 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005318 {}
5319 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005320
Takashi Iwai7639a062015-03-03 10:07:24 +01005321 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005322 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005323 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005324 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005325 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005326 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005327 case 0x10ec0256:
5328 alc_process_coef_fw(codec, coef0256);
5329 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005330 case 0x10ec0234:
5331 case 0x10ec0274:
5332 case 0x10ec0294:
5333 alc_write_coef_idx(codec, 0x45, 0xe689);
5334 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005335 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005336 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005337 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005338 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005339 case 0x10ec0298:
5340 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08005341 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5342 msleep(300);
5343 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005344 case 0x10ec0286:
5345 case 0x10ec0288:
5346 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5347 msleep(300);
5348 alc_process_coef_fw(codec, coef0288);
5349 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005350 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005351 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005352 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005353 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005354 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005355 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005356 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005357 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005358 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005359 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005360 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005361 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005362 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005363 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005364 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005365 alc_process_coef_fw(codec, coef0225);
5366 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005367 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005368 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005369}
5370
5371static void alc_determine_headset_type(struct hda_codec *codec)
5372{
5373 int val;
5374 bool is_ctia = false;
5375 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005376 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005377 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5378 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5379 conteol) */
5380 {}
5381 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005382 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005383 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5384 {}
5385 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005386 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08005387 UPDATE_COEF(0x50, 0x2000, 0x2000),
5388 UPDATE_COEF(0x56, 0x0006, 0x0006),
5389 UPDATE_COEF(0x66, 0x0008, 0),
5390 UPDATE_COEF(0x67, 0x2000, 0),
5391 UPDATE_COEF(0x19, 0x1300, 0x1300),
5392 {}
5393 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005394 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005395 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5396 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5397 {}
5398 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005399 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005400 WRITE_COEF(0x11, 0x0001),
5401 WRITE_COEF(0xb7, 0x802b),
5402 WRITE_COEF(0x15, 0x0d60),
5403 WRITE_COEF(0xc3, 0x0c00),
5404 {}
5405 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005406 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005407 UPDATE_COEF(0x4a, 0x0010, 0),
5408 UPDATE_COEF(0x4a, 0x8000, 0),
5409 WRITE_COEF(0x45, 0xd289),
5410 UPDATE_COEF(0x49, 0x0300, 0x0300),
5411 {}
5412 };
David Henningsson73bdd592013-04-15 15:44:14 +02005413
Kailang Yang92666d42020-11-19 17:04:21 +08005414 if (spec->no_internal_mic_pin) {
5415 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5416 return;
5417 }
5418
Takashi Iwai7639a062015-03-03 10:07:24 +01005419 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005420 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005421 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005422 msleep(300);
5423 val = alc_read_coef_idx(codec, 0x46);
5424 is_ctia = (val & 0x0070) == 0x0070;
5425 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005426 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08005427 case 0x10ec0236:
5428 case 0x10ec0256:
5429 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5430 alc_write_coef_idx(codec, 0x06, 0x6104);
5431 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5432
5433 snd_hda_codec_write(codec, 0x21, 0,
5434 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5435 msleep(80);
5436 snd_hda_codec_write(codec, 0x21, 0,
5437 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5438
5439 alc_process_coef_fw(codec, coef0255);
5440 msleep(300);
5441 val = alc_read_coef_idx(codec, 0x46);
5442 is_ctia = (val & 0x0070) == 0x0070;
5443
5444 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5445 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5446
5447 snd_hda_codec_write(codec, 0x21, 0,
5448 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5449 msleep(80);
5450 snd_hda_codec_write(codec, 0x21, 0,
5451 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5452 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005453 case 0x10ec0234:
5454 case 0x10ec0274:
5455 case 0x10ec0294:
5456 alc_process_coef_fw(codec, coef0274);
Hui Wangfebf22562021-03-20 17:15:41 +08005457 msleep(850);
Kailang Yang71683c32017-06-20 16:33:50 +08005458 val = alc_read_coef_idx(codec, 0x46);
5459 is_ctia = (val & 0x00f0) == 0x00f0;
5460 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005461 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005462 case 0x10ec0283:
5463 alc_write_coef_idx(codec, 0x45, 0xd029);
5464 msleep(300);
5465 val = alc_read_coef_idx(codec, 0x46);
5466 is_ctia = (val & 0x0070) == 0x0070;
5467 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005468 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005469 snd_hda_codec_write(codec, 0x21, 0,
5470 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5471 msleep(100);
5472 snd_hda_codec_write(codec, 0x21, 0,
5473 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5474 msleep(200);
5475
5476 val = alc_read_coef_idx(codec, 0x50);
5477 if (val & (1 << 12)) {
5478 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5479 alc_process_coef_fw(codec, coef0288);
5480 msleep(350);
5481 val = alc_read_coef_idx(codec, 0x50);
5482 is_ctia = (val & 0x0070) == 0x0070;
5483 } else {
5484 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5485 alc_process_coef_fw(codec, coef0288);
5486 msleep(350);
5487 val = alc_read_coef_idx(codec, 0x50);
5488 is_ctia = (val & 0x0070) == 0x0070;
5489 }
5490 alc_process_coef_fw(codec, coef0298);
5491 snd_hda_codec_write(codec, 0x21, 0,
5492 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5493 msleep(75);
5494 snd_hda_codec_write(codec, 0x21, 0,
5495 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5496 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005497 case 0x10ec0286:
5498 case 0x10ec0288:
5499 alc_process_coef_fw(codec, coef0288);
5500 msleep(350);
5501 val = alc_read_coef_idx(codec, 0x50);
5502 is_ctia = (val & 0x0070) == 0x0070;
5503 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005504 case 0x10ec0292:
5505 alc_write_coef_idx(codec, 0x6b, 0xd429);
5506 msleep(300);
5507 val = alc_read_coef_idx(codec, 0x6c);
5508 is_ctia = (val & 0x001c) == 0x001c;
5509 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005510 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005511 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005512 msleep(300);
5513 val = alc_read_coef_idx(codec, 0x46);
5514 is_ctia = (val & 0x0070) == 0x0070;
5515 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005516 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005517 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005518 msleep(300);
5519 val = alc_read_coef_idx(codec, 0xbe);
5520 is_ctia = (val & 0x1c02) == 0x1c02;
5521 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005522 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005523 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005524 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005525 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005526 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005527 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08005528 snd_hda_codec_write(codec, 0x21, 0,
5529 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5530 msleep(80);
5531 snd_hda_codec_write(codec, 0x21, 0,
5532 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5533
Kailang Yang5a367672017-07-21 15:23:53 +08005534 alc_process_coef_fw(codec, alc225_pre_hsmode);
5535 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5536 val = alc_read_coef_idx(codec, 0x45);
5537 if (val & (1 << 9)) {
5538 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5539 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5540 msleep(800);
5541 val = alc_read_coef_idx(codec, 0x46);
5542 is_ctia = (val & 0x00f0) == 0x00f0;
5543 } else {
5544 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5545 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5546 msleep(800);
5547 val = alc_read_coef_idx(codec, 0x46);
5548 is_ctia = (val & 0x00f0) == 0x00f0;
5549 }
5550 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5551 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5552 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08005553
5554 snd_hda_codec_write(codec, 0x21, 0,
5555 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5556 msleep(80);
5557 snd_hda_codec_write(codec, 0x21, 0,
5558 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005559 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005560 case 0x10ec0867:
5561 is_ctia = true;
5562 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005563 }
5564
Takashi Iwai4e76a882014-02-25 12:21:03 +01005565 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02005566 is_ctia ? "yes" : "no");
5567 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5568}
5569
5570static void alc_update_headset_mode(struct hda_codec *codec)
5571{
5572 struct alc_spec *spec = codec->spec;
5573
5574 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
Takashi Iwai35a39f92019-02-01 11:19:50 +01005575 hda_nid_t hp_pin = alc_get_hp_pin(spec);
David Henningsson73bdd592013-04-15 15:44:14 +02005576
5577 int new_headset_mode;
5578
5579 if (!snd_hda_jack_detect(codec, hp_pin))
5580 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5581 else if (mux_pin == spec->headset_mic_pin)
5582 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5583 else if (mux_pin == spec->headphone_mic_pin)
5584 new_headset_mode = ALC_HEADSET_MODE_MIC;
5585 else
5586 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5587
David Henningsson5959a6b2013-11-12 11:10:57 +01005588 if (new_headset_mode == spec->current_headset_mode) {
5589 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005590 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01005591 }
David Henningsson73bdd592013-04-15 15:44:14 +02005592
5593 switch (new_headset_mode) {
5594 case ALC_HEADSET_MODE_UNPLUGGED:
5595 alc_headset_mode_unplugged(codec);
Kailang Yangaeac1a02019-05-16 16:10:44 +08005596 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5597 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02005598 spec->gen.hp_jack_present = false;
5599 break;
5600 case ALC_HEADSET_MODE_HEADSET:
5601 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5602 alc_determine_headset_type(codec);
5603 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5604 alc_headset_mode_ctia(codec);
5605 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5606 alc_headset_mode_omtp(codec);
5607 spec->gen.hp_jack_present = true;
5608 break;
5609 case ALC_HEADSET_MODE_MIC:
5610 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5611 spec->gen.hp_jack_present = false;
5612 break;
5613 case ALC_HEADSET_MODE_HEADPHONE:
5614 alc_headset_mode_default(codec);
5615 spec->gen.hp_jack_present = true;
5616 break;
5617 }
5618 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5619 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5620 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005621 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02005622 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5623 PIN_VREFHIZ);
5624 }
5625 spec->current_headset_mode = new_headset_mode;
5626
5627 snd_hda_gen_update_outputs(codec);
5628}
5629
5630static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01005631 struct snd_kcontrol *kcontrol,
5632 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02005633{
5634 alc_update_headset_mode(codec);
5635}
5636
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005637static void alc_update_headset_jack_cb(struct hda_codec *codec,
5638 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02005639{
David Henningsson73bdd592013-04-15 15:44:14 +02005640 snd_hda_gen_hp_automute(codec, jack);
Hui Wange54f30b2021-03-20 17:15:42 +08005641 alc_update_headset_mode(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005642}
5643
5644static void alc_probe_headset_mode(struct hda_codec *codec)
5645{
5646 int i;
5647 struct alc_spec *spec = codec->spec;
5648 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5649
5650 /* Find mic pins */
5651 for (i = 0; i < cfg->num_inputs; i++) {
5652 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5653 spec->headset_mic_pin = cfg->inputs[i].pin;
5654 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5655 spec->headphone_mic_pin = cfg->inputs[i].pin;
5656 }
5657
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02005658 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02005659 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5660 spec->gen.automute_hook = alc_update_headset_mode;
5661 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5662}
5663
5664static void alc_fixup_headset_mode(struct hda_codec *codec,
5665 const struct hda_fixup *fix, int action)
5666{
5667 struct alc_spec *spec = codec->spec;
5668
5669 switch (action) {
5670 case HDA_FIXUP_ACT_PRE_PROBE:
5671 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5672 break;
5673 case HDA_FIXUP_ACT_PROBE:
5674 alc_probe_headset_mode(codec);
5675 break;
5676 case HDA_FIXUP_ACT_INIT:
Kailang Yangaeac1a02019-05-16 16:10:44 +08005677 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5678 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5679 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5680 }
David Henningsson73bdd592013-04-15 15:44:14 +02005681 alc_update_headset_mode(codec);
5682 break;
5683 }
5684}
5685
5686static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5687 const struct hda_fixup *fix, int action)
5688{
5689 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5690 struct alc_spec *spec = codec->spec;
5691 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5692 }
5693 else
5694 alc_fixup_headset_mode(codec, fix, action);
5695}
5696
Kailang Yang31278992014-03-03 15:27:22 +08005697static void alc255_set_default_jack_type(struct hda_codec *codec)
5698{
5699 /* Set to iphone type */
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005700 static const struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005701 WRITE_COEF(0x1b, 0x880b),
5702 WRITE_COEF(0x45, 0xd089),
5703 WRITE_COEF(0x1b, 0x080b),
5704 WRITE_COEF(0x46, 0x0004),
5705 WRITE_COEF(0x1b, 0x0c0b),
5706 {}
5707 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005708 static const struct coef_fw alc256fw[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005709 WRITE_COEF(0x1b, 0x884b),
5710 WRITE_COEF(0x45, 0xd089),
5711 WRITE_COEF(0x1b, 0x084b),
5712 WRITE_COEF(0x46, 0x0004),
5713 WRITE_COEF(0x1b, 0x0c4b),
5714 {}
5715 };
5716 switch (codec->core.vendor_id) {
5717 case 0x10ec0255:
5718 alc_process_coef_fw(codec, alc255fw);
5719 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005720 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005721 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005722 case 0x10ec0256:
5723 alc_process_coef_fw(codec, alc256fw);
5724 break;
5725 }
Kailang Yang31278992014-03-03 15:27:22 +08005726 msleep(30);
5727}
5728
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005729static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5730 const struct hda_fixup *fix, int action)
5731{
5732 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08005733 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005734 }
5735 alc_fixup_headset_mode(codec, fix, action);
5736}
5737
Kailang Yang31278992014-03-03 15:27:22 +08005738static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5739 const struct hda_fixup *fix, int action)
5740{
5741 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5742 struct alc_spec *spec = codec->spec;
5743 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5744 alc255_set_default_jack_type(codec);
5745 }
5746 else
5747 alc_fixup_headset_mode(codec, fix, action);
5748}
5749
Kailang Yange1e62b92015-04-08 16:01:22 +08005750static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5751 struct hda_jack_callback *jack)
5752{
5753 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08005754
5755 alc_update_headset_jack_cb(codec, jack);
5756 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02005757 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08005758}
5759
5760static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5761 const struct hda_fixup *fix, int action)
5762{
5763 alc_fixup_headset_mode(codec, fix, action);
5764 if (action == HDA_FIXUP_ACT_PROBE) {
5765 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02005766 /* toggled via hp_automute_hook */
5767 spec->gpio_mask |= 0x40;
5768 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08005769 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5770 }
5771}
5772
Hui Wang493a52a2014-01-14 14:07:36 +08005773static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5774 const struct hda_fixup *fix, int action)
5775{
5776 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5777 struct alc_spec *spec = codec->spec;
5778 spec->gen.auto_mute_via_amp = 1;
5779 }
5780}
5781
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005782static void alc_fixup_no_shutup(struct hda_codec *codec,
5783 const struct hda_fixup *fix, int action)
5784{
Takashi Iwaiefe55732018-06-15 11:55:02 +02005785 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005786 struct alc_spec *spec = codec->spec;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01005787 spec->no_shutup_pins = 1;
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005788 }
5789}
5790
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005791static void alc_fixup_disable_aamix(struct hda_codec *codec,
5792 const struct hda_fixup *fix, int action)
5793{
5794 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5795 struct alc_spec *spec = codec->spec;
5796 /* Disable AA-loopback as it causes white noise */
5797 spec->gen.mixer_nid = 0;
5798 }
5799}
5800
Takashi Iwai7f57d802015-09-24 17:36:51 +02005801/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5802static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5803 const struct hda_fixup *fix, int action)
5804{
5805 static const struct hda_pintbl pincfgs[] = {
5806 { 0x16, 0x21211010 }, /* dock headphone */
5807 { 0x19, 0x21a11010 }, /* dock mic */
5808 { }
5809 };
5810 struct alc_spec *spec = codec->spec;
5811
5812 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5813 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5814 codec->power_save_node = 0; /* avoid click noises */
5815 snd_hda_apply_pincfgs(codec, pincfgs);
5816 }
5817}
5818
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005819static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5820 const struct hda_fixup *fix, int action)
5821{
5822 static const struct hda_pintbl pincfgs[] = {
5823 { 0x17, 0x21211010 }, /* dock headphone */
5824 { 0x19, 0x21a11010 }, /* dock mic */
5825 { }
5826 };
5827 struct alc_spec *spec = codec->spec;
5828
5829 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5830 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005831 snd_hda_apply_pincfgs(codec, pincfgs);
5832 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005833 /* Enable DOCK device */
5834 snd_hda_codec_write(codec, 0x17, 0,
5835 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5836 /* Enable DOCK device */
5837 snd_hda_codec_write(codec, 0x19, 0,
5838 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005839 }
5840}
5841
Takashi Iwai399c01a2020-05-26 08:24:06 +02005842static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5843 const struct hda_fixup *fix, int action)
5844{
5845 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5846 * the speaker output becomes too low by some reason on Thinkpads with
5847 * ALC298 codec
5848 */
5849 static const hda_nid_t preferred_pairs[] = {
5850 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5851 0
5852 };
5853 struct alc_spec *spec = codec->spec;
5854
5855 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5856 spec->gen.preferred_dacs = preferred_pairs;
5857}
5858
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02005859static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5860 const struct hda_fixup *fix, int action)
5861{
5862 static const hda_nid_t preferred_pairs[] = {
5863 0x17, 0x02, 0x21, 0x03, 0
5864 };
5865 struct alc_spec *spec = codec->spec;
5866
5867 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5868 spec->gen.preferred_dacs = preferred_pairs;
5869}
5870
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005871static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005872{
5873 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01005874 int hp_pin = alc_get_hp_pin(spec);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005875
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005876 /* Prevent pop noises when headphones are plugged in */
5877 snd_hda_codec_write(codec, hp_pin, 0,
5878 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5879 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005880}
5881
5882static void alc_fixup_dell_xps13(struct hda_codec *codec,
5883 const struct hda_fixup *fix, int action)
5884{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005885 struct alc_spec *spec = codec->spec;
5886 struct hda_input_mux *imux = &spec->gen.input_mux;
5887 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005888
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005889 switch (action) {
5890 case HDA_FIXUP_ACT_PRE_PROBE:
5891 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5892 * it causes a click noise at start up
5893 */
5894 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005895 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005896 break;
5897 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005898 /* Make the internal mic the default input source. */
5899 for (i = 0; i < imux->num_items; i++) {
5900 if (spec->gen.imux_pins[i] == 0x12) {
5901 spec->gen.cur_mux[0] = i;
5902 break;
5903 }
5904 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005905 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005906 }
5907}
5908
David Henningsson1f8b46c2015-05-12 14:38:15 +02005909static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5910 const struct hda_fixup *fix, int action)
5911{
5912 struct alc_spec *spec = codec->spec;
5913
5914 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5915 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5916 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005917
5918 /* Disable boost for mic-in permanently. (This code is only called
5919 from quirks that guarantee that the headphone is at NID 0x1b.) */
5920 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5921 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005922 } else
5923 alc_fixup_headset_mode(codec, fix, action);
5924}
5925
David Henningsson73bdd592013-04-15 15:44:14 +02005926static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5927 const struct hda_fixup *fix, int action)
5928{
5929 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005930 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005931 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005932 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5933 }
5934 alc_fixup_headset_mode(codec, fix, action);
5935}
5936
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005937/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5938static int find_ext_mic_pin(struct hda_codec *codec)
5939{
5940 struct alc_spec *spec = codec->spec;
5941 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5942 hda_nid_t nid;
5943 unsigned int defcfg;
5944 int i;
5945
5946 for (i = 0; i < cfg->num_inputs; i++) {
5947 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5948 continue;
5949 nid = cfg->inputs[i].pin;
5950 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5951 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5952 continue;
5953 return nid;
5954 }
5955
5956 return 0;
5957}
5958
Dylan Reid08a978d2012-11-18 22:56:40 -08005959static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005960 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005961 int action)
5962{
5963 struct alc_spec *spec = codec->spec;
5964
Takashi Iwai0db75792013-01-23 13:57:20 +01005965 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005966 int mic_pin = find_ext_mic_pin(codec);
Takashi Iwai35a39f92019-02-01 11:19:50 +01005967 int hp_pin = alc_get_hp_pin(spec);
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005968
5969 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005970 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005971 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005972 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005973}
David Henningsson693b6132012-06-22 19:12:10 +02005974
David Henningsson3e0d6112013-04-22 14:30:14 +02005975static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5976 const struct hda_fixup *fix,
5977 int action)
5978{
5979 struct alc_spec *spec = codec->spec;
5980 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5981 int i;
5982
5983 /* The mic boosts on level 2 and 3 are too noisy
5984 on the internal mic input.
5985 Therefore limit the boost to 0 or 1. */
5986
5987 if (action != HDA_FIXUP_ACT_PROBE)
5988 return;
5989
5990 for (i = 0; i < cfg->num_inputs; i++) {
5991 hda_nid_t nid = cfg->inputs[i].pin;
5992 unsigned int defcfg;
5993 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5994 continue;
5995 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5996 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5997 continue;
5998
5999 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6000 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6001 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6002 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6003 (0 << AC_AMPCAP_MUTE_SHIFT));
6004 }
6005}
6006
Kailang Yangcd217a62013-08-22 10:15:24 +02006007static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02006008 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02006009{
6010 struct alc_spec *spec = codec->spec;
6011 int vref;
6012
6013 msleep(200);
6014 snd_hda_gen_hp_automute(codec, jack);
6015
6016 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6017
6018 msleep(600);
6019 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6020 vref);
6021}
6022
Kailang Yangcd217a62013-08-22 10:15:24 +02006023static void alc283_fixup_chromebook(struct hda_codec *codec,
6024 const struct hda_fixup *fix, int action)
6025{
6026 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02006027
6028 switch (action) {
6029 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08006030 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01006031 /* Disable AA-loopback as it causes white noise */
6032 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08006033 break;
6034 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08006035 /* MIC2-VREF control */
6036 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02006037 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08006038 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02006039 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08006040 break;
6041 }
6042}
6043
6044static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6045 const struct hda_fixup *fix, int action)
6046{
6047 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08006048
6049 switch (action) {
6050 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02006051 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6052 break;
6053 case HDA_FIXUP_ACT_INIT:
6054 /* MIC2-VREF control */
6055 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02006056 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02006057 break;
6058 }
6059}
6060
Takashi Iwai7bba2152013-09-06 15:45:38 +02006061/* mute tablet speaker pin (0x14) via dock plugging in addition */
6062static void asus_tx300_automute(struct hda_codec *codec)
6063{
6064 struct alc_spec *spec = codec->spec;
6065 snd_hda_gen_update_outputs(codec);
6066 if (snd_hda_jack_detect(codec, 0x1b))
6067 spec->gen.mute_bits |= (1ULL << 0x14);
6068}
6069
6070static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6071 const struct hda_fixup *fix, int action)
6072{
6073 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02006074 static const struct hda_pintbl dock_pins[] = {
6075 { 0x1b, 0x21114000 }, /* dock speaker pin */
6076 {}
6077 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02006078
6079 switch (action) {
6080 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02006081 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02006082 /* TX300 needs to set up GPIO2 for the speaker amp */
6083 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02006084 snd_hda_apply_pincfgs(codec, dock_pins);
6085 spec->gen.auto_mute_via_amp = 1;
6086 spec->gen.automute_hook = asus_tx300_automute;
6087 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006088 snd_hda_gen_hp_automute);
6089 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02006090 case HDA_FIXUP_ACT_PROBE:
6091 spec->init_amp = ALC_INIT_DEFAULT;
6092 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02006093 case HDA_FIXUP_ACT_BUILD:
6094 /* this is a bit tricky; give more sane names for the main
6095 * (tablet) speaker and the dock speaker, respectively
6096 */
Takashi Iwai56798e62017-04-11 08:10:52 +02006097 rename_ctl(codec, "Speaker Playback Switch",
6098 "Dock Speaker Playback Switch");
6099 rename_ctl(codec, "Bass Speaker Playback Switch",
6100 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02006101 break;
6102 }
6103}
6104
David Henningsson338cae52013-10-07 10:39:59 +02006105static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6106 const struct hda_fixup *fix, int action)
6107{
David Henningsson0f4881d2013-12-20 16:08:13 +01006108 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6109 /* DAC node 0x03 is giving mono output. We therefore want to
6110 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6111 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006112 static const hda_nid_t conn1[] = { 0x0c };
6113 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6114 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
David Henningsson0f4881d2013-12-20 16:08:13 +01006115 }
David Henningsson338cae52013-10-07 10:39:59 +02006116}
6117
Hui Wangdd9aa332016-08-01 10:20:32 +08006118static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6119 const struct hda_fixup *fix, int action)
6120{
6121 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6122 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6123 we can't adjust the speaker's volume since this node does not has
6124 Amp-out capability. we change the speaker's route to:
6125 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6126 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6127 speaker's volume now. */
6128
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006129 static const hda_nid_t conn1[] = { 0x0c };
6130 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
Hui Wangdd9aa332016-08-01 10:20:32 +08006131 }
6132}
6133
Takashi Iwaie312a862018-03-06 12:14:17 +01006134/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6135static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6136 const struct hda_fixup *fix, int action)
6137{
6138 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006139 static const hda_nid_t conn[] = { 0x02, 0x03 };
6140 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Takashi Iwaie312a862018-03-06 12:14:17 +01006141 }
6142}
6143
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006144/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6145static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6146 const struct hda_fixup *fix, int action)
6147{
6148 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006149 static const hda_nid_t conn[] = { 0x02 };
6150 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006151 }
6152}
6153
Keith Packard98973f22015-07-15 12:14:39 -07006154/* Hook to update amp GPIO4 for automute */
6155static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6156 struct hda_jack_callback *jack)
6157{
6158 struct alc_spec *spec = codec->spec;
6159
6160 snd_hda_gen_hp_automute(codec, jack);
6161 /* mute_led_polarity is set to 0, so we pass inverted value here */
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08006162 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6163 !spec->gen.hp_jack_present);
Keith Packard98973f22015-07-15 12:14:39 -07006164}
6165
6166/* Manage GPIOs for HP EliteBook Folio 9480m.
6167 *
6168 * GPIO4 is the headphone amplifier power control
6169 * GPIO3 is the audio output mute indicator LED
6170 */
6171
6172static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6173 const struct hda_fixup *fix,
6174 int action)
6175{
6176 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07006177
Takashi Iwai01e4a272018-06-19 22:47:30 +02006178 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07006179 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02006180 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6181 spec->gpio_mask |= 0x10;
6182 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07006183 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07006184 }
6185}
6186
Takashi Iwaiae065f12018-06-19 23:00:03 +02006187static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6188 const struct hda_fixup *fix,
6189 int action)
6190{
6191 struct alc_spec *spec = codec->spec;
6192
6193 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6194 spec->gpio_mask |= 0x04;
6195 spec->gpio_dir |= 0x04;
6196 /* set data bit low */
6197 }
6198}
6199
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006200/* Quirk for Thinkpad X1 7th and 8th Gen
6201 * The following fixed routing needed
6202 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6203 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6204 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6205 */
6206static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6207 const struct hda_fixup *fix, int action)
6208{
6209 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6210 static const hda_nid_t preferred_pairs[] = {
6211 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6212 };
6213 struct alc_spec *spec = codec->spec;
6214
6215 switch (action) {
6216 case HDA_FIXUP_ACT_PRE_PROBE:
6217 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6218 spec->gen.preferred_dacs = preferred_pairs;
6219 break;
6220 case HDA_FIXUP_ACT_BUILD:
6221 /* The generic parser creates somewhat unintuitive volume ctls
6222 * with the fixed routing above, and the shared DAC2 may be
6223 * confusing for PA.
6224 * Rename those to unique names so that PA doesn't touch them
6225 * and use only Master volume.
6226 */
6227 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6228 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6229 break;
6230 }
6231}
6232
Kailang Yangca169cc2017-04-25 16:17:40 +08006233static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6234 const struct hda_fixup *fix,
6235 int action)
6236{
6237 alc_fixup_dual_codecs(codec, fix, action);
6238 switch (action) {
6239 case HDA_FIXUP_ACT_PRE_PROBE:
6240 /* override card longname to provide a unique UCM profile */
6241 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6242 break;
6243 case HDA_FIXUP_ACT_BUILD:
6244 /* rename Capture controls depending on the codec */
6245 rename_ctl(codec, "Capture Volume",
6246 codec->addr == 0 ?
6247 "Rear-Panel Capture Volume" :
6248 "Front-Panel Capture Volume");
6249 rename_ctl(codec, "Capture Switch",
6250 codec->addr == 0 ?
6251 "Rear-Panel Capture Switch" :
6252 "Front-Panel Capture Switch");
6253 break;
6254 }
6255}
6256
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006257static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6258 const struct hda_fixup *fix, int action)
6259{
6260 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6261 return;
6262
6263 codec->power_save_node = 1;
6264}
6265
Kailang Yang92266652017-12-14 15:28:58 +08006266/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6267static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6268 const struct hda_fixup *fix, int action)
6269{
6270 struct alc_spec *spec = codec->spec;
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006271 static const hda_nid_t preferred_pairs[] = {
Kailang Yang92266652017-12-14 15:28:58 +08006272 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6273 0
6274 };
6275
6276 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6277 return;
6278
6279 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang0700d3d2019-04-26 16:13:54 +08006280 spec->gen.auto_mute_via_amp = 1;
6281 codec->power_save_node = 0;
Kailang Yang92266652017-12-14 15:28:58 +08006282}
6283
Takashi Iwaic84bfed2020-11-27 15:11:04 +01006284/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6285static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6286 const struct hda_fixup *fix, int action)
6287{
6288 static const hda_nid_t preferred_pairs[] = {
6289 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6290 };
6291 struct alc_spec *spec = codec->spec;
6292
6293 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6294 spec->gen.preferred_dacs = preferred_pairs;
6295 spec->gen.obey_preferred_dacs = 1;
6296 }
6297}
6298
Hui Wangc4cfcf62018-11-26 14:17:16 +08006299/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6300static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6301 const struct hda_fixup *fix, int action)
6302{
6303 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6304 return;
6305
6306 snd_hda_override_wcaps(codec, 0x03, 0);
6307}
6308
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006309static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6310{
6311 switch (codec->core.vendor_id) {
6312 case 0x10ec0274:
6313 case 0x10ec0294:
6314 case 0x10ec0225:
6315 case 0x10ec0295:
6316 case 0x10ec0299:
6317 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6318 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6319 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02006320 case 0x10ec0230:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006321 case 0x10ec0235:
6322 case 0x10ec0236:
6323 case 0x10ec0255:
6324 case 0x10ec0256:
6325 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6326 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6327 break;
6328 }
6329}
6330
Kailang Yang8983eb62019-04-03 15:31:49 +08006331static void alc295_fixup_chromebook(struct hda_codec *codec,
6332 const struct hda_fixup *fix, int action)
6333{
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006334 struct alc_spec *spec = codec->spec;
6335
Kailang Yang8983eb62019-04-03 15:31:49 +08006336 switch (action) {
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006337 case HDA_FIXUP_ACT_PRE_PROBE:
6338 spec->ultra_low_power = true;
6339 break;
Kailang Yang8983eb62019-04-03 15:31:49 +08006340 case HDA_FIXUP_ACT_INIT:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006341 alc_combo_jack_hp_jd_restart(codec);
Kailang Yang8983eb62019-04-03 15:31:49 +08006342 break;
6343 }
6344}
6345
Kailang Yangd1dd4212019-01-09 17:05:24 +08006346static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6347 const struct hda_fixup *fix, int action)
6348{
6349 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6350 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6351}
6352
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006353
6354static void alc294_gx502_toggle_output(struct hda_codec *codec,
6355 struct hda_jack_callback *cb)
6356{
6357 /* The Windows driver sets the codec up in a very different way where
6358 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6359 */
6360 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6361 alc_write_coef_idx(codec, 0x10, 0x8a20);
6362 else
6363 alc_write_coef_idx(codec, 0x10, 0x0a20);
6364}
6365
6366static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6367 const struct hda_fixup *fix, int action)
6368{
6369 /* Pin 0x21: headphones/headset mic */
6370 if (!is_jack_detectable(codec, 0x21))
6371 return;
6372
6373 switch (action) {
6374 case HDA_FIXUP_ACT_PRE_PROBE:
6375 snd_hda_jack_detect_enable_callback(codec, 0x21,
6376 alc294_gx502_toggle_output);
6377 break;
6378 case HDA_FIXUP_ACT_INIT:
6379 /* Make sure to start in a correct state, i.e. if
6380 * headphones have been plugged in before powering up the system
6381 */
6382 alc294_gx502_toggle_output(codec, NULL);
6383 break;
6384 }
6385}
6386
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05006387static void alc294_gu502_toggle_output(struct hda_codec *codec,
6388 struct hda_jack_callback *cb)
6389{
6390 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6391 * responsible from changes between speakers and headphones
6392 */
6393 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6394 alc_write_coef_idx(codec, 0x10, 0x8420);
6395 else
6396 alc_write_coef_idx(codec, 0x10, 0x0a20);
6397}
6398
6399static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6400 const struct hda_fixup *fix, int action)
6401{
6402 if (!is_jack_detectable(codec, 0x21))
6403 return;
6404
6405 switch (action) {
6406 case HDA_FIXUP_ACT_PRE_PROBE:
6407 snd_hda_jack_detect_enable_callback(codec, 0x21,
6408 alc294_gu502_toggle_output);
6409 break;
6410 case HDA_FIXUP_ACT_INIT:
6411 alc294_gu502_toggle_output(codec, NULL);
6412 break;
6413 }
6414}
6415
Kailang Yang56496252020-07-29 15:09:27 +08006416static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6417 const struct hda_fixup *fix, int action)
6418{
6419 if (action != HDA_FIXUP_ACT_INIT)
6420 return;
6421
6422 msleep(100);
6423 alc_write_coef_idx(codec, 0x65, 0x0);
6424}
6425
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006426static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6427 const struct hda_fixup *fix, int action)
6428{
6429 switch (action) {
6430 case HDA_FIXUP_ACT_INIT:
6431 alc_combo_jack_hp_jd_restart(codec);
6432 break;
6433 }
6434}
6435
Kailang Yang92666d42020-11-19 17:04:21 +08006436static void alc_fixup_no_int_mic(struct hda_codec *codec,
6437 const struct hda_fixup *fix, int action)
6438{
6439 struct alc_spec *spec = codec->spec;
6440
6441 switch (action) {
6442 case HDA_FIXUP_ACT_PRE_PROBE:
6443 /* Mic RING SLEEVE swap for combo jack */
6444 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6445 spec->no_internal_mic_pin = true;
6446 break;
6447 case HDA_FIXUP_ACT_INIT:
6448 alc_combo_jack_hp_jd_restart(codec);
6449 break;
6450 }
6451}
6452
Davide Baldod94befb2021-10-15 09:21:22 +02006453/* GPIO1 = amplifier on/off
6454 * GPIO3 = mic mute LED
6455 */
6456static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6457 const struct hda_fixup *fix, int action)
6458{
6459 static const hda_nid_t conn[] = { 0x02 };
6460
6461 struct alc_spec *spec = codec->spec;
6462 static const struct hda_pintbl pincfgs[] = {
6463 { 0x14, 0x90170110 }, /* front/high speakers */
6464 { 0x17, 0x90170130 }, /* back/bass speakers */
6465 { }
6466 };
6467
6468 //enable micmute led
6469 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6470
6471 switch (action) {
6472 case HDA_FIXUP_ACT_PRE_PROBE:
6473 spec->micmute_led_polarity = 1;
6474 /* needed for amp of back speakers */
6475 spec->gpio_mask |= 0x01;
6476 spec->gpio_dir |= 0x01;
6477 snd_hda_apply_pincfgs(codec, pincfgs);
6478 /* share DAC to have unified volume control */
6479 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6480 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6481 break;
6482 case HDA_FIXUP_ACT_INIT:
6483 /* need to toggle GPIO to enable the amp of back speakers */
6484 alc_update_gpio_data(codec, 0x01, true);
6485 msleep(100);
6486 alc_update_gpio_data(codec, 0x01, false);
6487 break;
6488 }
6489}
6490
Elia Devito434591b2021-06-19 22:41:04 +02006491static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6492 const struct hda_fixup *fix, int action)
6493{
6494 static const hda_nid_t conn[] = { 0x02 };
6495 static const struct hda_pintbl pincfgs[] = {
6496 { 0x14, 0x90170110 }, /* rear speaker */
6497 { }
6498 };
6499
6500 switch (action) {
6501 case HDA_FIXUP_ACT_PRE_PROBE:
6502 snd_hda_apply_pincfgs(codec, pincfgs);
6503 /* force front speaker to DAC1 */
6504 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6505 break;
6506 }
6507}
6508
Takashi Iwaib317b032014-01-08 11:44:21 +01006509/* for hda_fixup_thinkpad_acpi() */
6510#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01006511
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006512static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6513 const struct hda_fixup *fix, int action)
6514{
6515 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6516 hda_fixup_thinkpad_acpi(codec, fix, action);
6517}
6518
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07006519/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6520static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6521 const struct hda_fixup *fix,
6522 int action)
6523{
6524 struct alc_spec *spec = codec->spec;
6525
6526 switch (action) {
6527 case HDA_FIXUP_ACT_PRE_PROBE:
6528 spec->gen.suppress_auto_mute = 1;
6529 break;
6530 }
6531}
6532
Lucas Tanured3dca022021-12-17 11:57:07 +00006533static int comp_match_dev_name(struct device *dev, void *data)
6534{
6535 return strcmp(dev_name(dev), data) == 0;
6536}
6537
6538static int find_comp_by_dev_name(struct alc_spec *spec, const char *name)
6539{
6540 int i;
6541
6542 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6543 if (strcmp(spec->comps[i].name, name) == 0)
6544 return i;
6545 }
6546
6547 return -ENODEV;
6548}
6549
6550static int comp_bind(struct device *dev)
6551{
6552 struct hda_codec *cdc = dev_to_hda_codec(dev);
6553 struct alc_spec *spec = cdc->spec;
6554
6555 return component_bind_all(dev, spec->comps);
6556}
6557
6558static void comp_unbind(struct device *dev)
6559{
6560 struct hda_codec *cdc = dev_to_hda_codec(dev);
6561 struct alc_spec *spec = cdc->spec;
6562
6563 component_unbind_all(dev, spec->comps);
6564}
6565
6566static const struct component_master_ops comp_master_ops = {
6567 .bind = comp_bind,
6568 .unbind = comp_unbind,
6569};
6570
6571static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6572 struct snd_pcm_substream *sub, int action)
6573{
6574 struct alc_spec *spec = cdc->spec;
6575 int i;
6576
6577 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6578 if (spec->comps[i].dev)
6579 spec->comps[i].playback_hook(spec->comps[i].dev, action);
6580 }
6581}
6582
Stefan Bindingae7abe32021-12-17 11:57:08 +00006583static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6584 const char *hid, int count)
6585{
6586 struct device *dev = hda_codec_dev(cdc);
6587 struct alc_spec *spec = cdc->spec;
6588 char *name;
6589 int ret, i;
6590
6591 switch (action) {
6592 case HDA_FIXUP_ACT_PRE_PROBE:
6593 for (i = 0; i < count; i++) {
6594 name = devm_kasprintf(dev, GFP_KERNEL,
6595 "%s-%s:00-cs35l41-hda.%d", bus, hid, i);
6596 if (!name)
6597 return;
6598 component_match_add(dev, &spec->match, comp_match_dev_name, name);
6599 }
6600 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6601 if (ret)
6602 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6603 else
6604 spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6605 break;
6606 }
6607}
6608
6609static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6610{
6611 cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6612}
6613
Lucas Tanured3dca022021-12-17 11:57:07 +00006614static void alc287_legion_16achg6_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6615 struct snd_pcm_substream *sub, int action)
6616{
6617 struct alc_spec *spec = cdc->spec;
6618 unsigned int rx_slot;
6619 int i;
6620
6621 switch (action) {
6622 case HDA_GEN_PCM_ACT_PREPARE:
6623 rx_slot = 0;
6624 i = find_comp_by_dev_name(spec, "i2c-CLSA0100:00-cs35l41-hda.0");
6625 if (i >= 0)
6626 spec->comps[i].set_channel_map(spec->comps[i].dev, 0, NULL, 1, &rx_slot);
6627
6628 rx_slot = 1;
6629 i = find_comp_by_dev_name(spec, "i2c-CLSA0100:00-cs35l41-hda.1");
6630 if (i >= 0)
6631 spec->comps[i].set_channel_map(spec->comps[i].dev, 0, NULL, 1, &rx_slot);
6632 break;
6633 }
6634
6635 comp_generic_playback_hook(hinfo, cdc, sub, action);
6636}
6637
6638static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6639 int action)
6640{
6641 struct device *dev = hda_codec_dev(cdc);
6642 struct alc_spec *spec = cdc->spec;
6643 int ret;
6644
6645 switch (action) {
6646 case HDA_FIXUP_ACT_PRE_PROBE:
6647 component_match_add(dev, &spec->match, comp_match_dev_name,
6648 "i2c-CLSA0100:00-cs35l41-hda.0");
6649 component_match_add(dev, &spec->match, comp_match_dev_name,
6650 "i2c-CLSA0100:00-cs35l41-hda.1");
6651 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6652 if (ret)
6653 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6654 else
6655 spec->gen.pcm_playback_hook = alc287_legion_16achg6_playback_hook;
6656 break;
6657 }
6658}
6659
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006660/* for alc295_fixup_hp_top_speakers */
6661#include "hp_x360_helper.c"
6662
Takashi Iwai26928ca2021-04-16 10:12:11 +02006663/* for alc285_fixup_ideapad_s740_coef() */
6664#include "ideapad_s740_helper.c"
6665
Werner Sembach619764c2021-12-02 17:50:10 +01006666static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6667 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6668 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6669 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6670 {}
6671};
6672
6673static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6674 const struct hda_fixup *fix,
6675 int action)
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02006676{
6677 /*
Werner Sembach619764c2021-12-02 17:50:10 +01006678 * A certain other OS sets these coeffs to different values. On at least
6679 * one TongFang barebone these settings might survive even a cold
6680 * reboot. So to restore a clean slate the values are explicitly reset
6681 * to default here. Without this, the external microphone is always in a
6682 * plugged-in state, while the internal microphone is always in an
6683 * unplugged state, breaking the ability to use the internal microphone.
6684 */
6685 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02006686}
6687
Werner Sembach174a7fb2021-11-12 12:07:04 +01006688static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6689 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6690 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6691 WRITE_COEF(0x49, 0x0149),
6692 {}
6693};
6694
6695static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6696 const struct hda_fixup *fix,
6697 int action)
6698{
6699 /*
6700 * The audio jack input and output is not detected on the ASRock NUC Box
6701 * 1100 series when cold booting without this fix. Warm rebooting from a
6702 * certain other OS makes the audio functional, as COEF settings are
6703 * preserved in this case. This fix sets these altered COEF values as
6704 * the default.
6705 */
6706 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6707}
6708
Werner Sembachedca7cc2021-12-15 20:16:46 +01006709static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6710 const struct hda_fixup *fix,
6711 int action)
6712{
6713 /*
6714 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6715 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6716 * needs an additional quirk for sound working after suspend and resume.
6717 */
6718 if (codec->core.vendor_id == 0x10ec0256) {
6719 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6720 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6721 } else {
6722 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6723 }
6724}
6725
Takashi Iwai1d045db2011-07-07 18:23:21 +02006726enum {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006727 ALC269_FIXUP_GPIO2,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006728 ALC269_FIXUP_SONY_VAIO,
6729 ALC275_FIXUP_SONY_VAIO_GPIO2,
6730 ALC269_FIXUP_DELL_M101Z,
6731 ALC269_FIXUP_SKU_IGNORE,
6732 ALC269_FIXUP_ASUS_G73JW,
6733 ALC269_FIXUP_LENOVO_EAPD,
6734 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006735 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006736 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006737 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006738 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02006739 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02006740 ALC269_FIXUP_QUANTA_MUTE,
6741 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02006742 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006743 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006744 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006745 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02006746 ALC269_FIXUP_AMIC,
6747 ALC269_FIXUP_DMIC,
6748 ALC269VB_FIXUP_AMIC,
6749 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006750 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01006751 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006752 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00006753 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006754 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006755 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6756 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02006757 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02006758 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwaib590b382020-05-14 18:05:33 +02006759 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006760 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02006761 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02006762 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02006763 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6764 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02006765 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08006766 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02006767 ALC269_FIXUP_HEADSET_MODE,
6768 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02006769 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02006770 ALC269_FIXUP_ASUS_X101_FUNC,
6771 ALC269_FIXUP_ASUS_X101_VERB,
6772 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08006773 ALC271_FIXUP_AMIC_MIC2,
6774 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006775 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07006776 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02006777 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01006778 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01006779 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01006780 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02006781 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02006782 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08006783 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006784 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02006785 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02006786 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01006787 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6788 ALC290_FIXUP_SUBWOOFER,
6789 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006790 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01006791 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06006792 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06006793 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006794 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08006795 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006796 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08006797 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08006798 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006799 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01006800 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02006801 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006802 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02006803 ALC282_FIXUP_ASPIRE_V5_PINS,
Takashi Iwaic8426b22021-04-07 11:57:30 +02006804 ALC269VB_FIXUP_ASPIRE_E1_COEF,
David Henningsson7a5255f2014-10-30 08:26:01 +01006805 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006806 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01006807 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01006808 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006809 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07006810 ALC280_FIXUP_HP_9480M,
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01006811 ALC245_FIXUP_HP_X360_AMP,
Davide Baldod94befb2021-10-15 09:21:22 +02006812 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
Kailang Yange1e62b92015-04-08 16:01:22 +08006813 ALC288_FIXUP_DELL_HEADSET_MODE,
6814 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08006815 ALC288_FIXUP_DELL_XPS_13,
6816 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai5fab5822020-01-05 09:11:19 +01006817 ALC292_FIXUP_DELL_E7X_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006818 ALC292_FIXUP_DELL_E7X,
6819 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01006820 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
James McDonnell54324222019-09-16 14:53:38 +00006821 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
Kailang Yang977e6272015-05-18 15:31:20 +08006822 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08006823 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08006824 ALC275_FIXUP_DELL_XPS,
Hui Wang23adc192015-12-08 12:27:18 +08006825 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08006826 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006827 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006828 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01006829 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01006830 ALC295_FIXUP_DISABLE_DAC3,
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006831 ALC285_FIXUP_SPEAKER2_TO_DAC1,
Takashi Iwaif8839822016-02-25 14:31:59 +01006832 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08006833 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02006834 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08006835 ALC298_FIXUP_SPK_VOLUME,
Kailang Yangf86de9b2020-10-23 14:46:47 +08006836 ALC298_FIXUP_LENOVO_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006837 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006838 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006839 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06006840 ALC256_FIXUP_ASUS_HEADSET_MODE,
6841 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006842 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06006843 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6844 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08006845 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08006846 ALC233_FIXUP_ACER_HEADSET_MIC,
Hui Wangf33f79f2017-07-07 12:08:29 +08006847 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08006848 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006849 ALC225_FIXUP_S3_POP_NOISE,
PeiSen Houb84e8432017-09-01 15:11:56 +08006850 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08006851 ALC274_FIXUP_DELL_BIND_DACS,
6852 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Takashi Iwai399c01a2020-05-26 08:24:06 +02006853 ALC298_FIXUP_TPT470_DOCK_FIX,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006854 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08006855 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006856 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006857 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006858 ALC298_FIXUP_HUAWEI_MBX_STEREO,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006859 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08006860 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08006861 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006862 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08006863 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08006864 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006865 ALC294_FIXUP_ASUS_HEADSET_MIC,
6866 ALC294_FIXUP_ASUS_SPK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07006867 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Hui Wangc8c6ee62019-02-14 11:41:33 +08006868 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08006869 ALC255_FIXUP_ACER_HEADSET_MIC,
Kailang Yang10f5b1b2019-02-21 16:10:22 +08006870 ALC295_FIXUP_CHROME_BOOK,
Kailang Yang8983eb62019-04-03 15:31:49 +08006871 ALC225_FIXUP_HEADSET_JACK,
Kailang Yang136824e2019-03-14 16:22:45 +08006872 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6873 ALC225_FIXUP_WYSE_AUTO_MUTE,
6874 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08006875 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
Daniel Drake8c8967a2019-10-17 16:15:01 +08006876 ALC256_FIXUP_ASUS_HEADSET_MIC,
Jian-Hong Pane1037352019-03-22 11:37:18 +08006877 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01006878 ALC299_FIXUP_PREDATOR_SPK,
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02006879 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
Kailang Yange79c2262019-12-19 14:12:15 +08006880 ALC289_FIXUP_DELL_SPK2,
6881 ALC289_FIXUP_DUAL_SPK,
Chris Chiu48e01502019-12-30 11:11:18 +08006882 ALC294_FIXUP_SPK2_TO_DAC1,
6883 ALC294_FIXUP_ASUS_DUAL_SPK,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006884 ALC285_FIXUP_THINKPAD_X1_GEN7,
Kailang Yang76f7dec2020-02-10 16:30:26 +08006885 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08006886 ALC294_FIXUP_ASUS_HPE,
Takashi Iwai1b94e592020-05-12 09:32:03 +02006887 ALC294_FIXUP_ASUS_COEF_1B,
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006888 ALC294_FIXUP_ASUS_GX502_HP,
6889 ALC294_FIXUP_ASUS_GX502_PINS,
6890 ALC294_FIXUP_ASUS_GX502_VERBS,
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05006891 ALC294_FIXUP_ASUS_GU502_HP,
6892 ALC294_FIXUP_ASUS_GU502_PINS,
6893 ALC294_FIXUP_ASUS_GU502_VERBS,
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08006894 ALC285_FIXUP_HP_GPIO_LED,
Kailang Yang431e76c2020-04-07 14:40:20 +08006895 ALC285_FIXUP_HP_MUTE_LED,
Jeremy Szue7d66cf2021-03-16 15:46:24 +08006896 ALC236_FIXUP_HP_GPIO_LED,
Kailang Yang24164f42020-04-07 14:52:42 +08006897 ALC236_FIXUP_HP_MUTE_LED,
Jonas Witschel75b62ab2021-04-16 12:58:54 +02006898 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
Mike Pozulp14425f12020-05-09 20:28:37 -07006899 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
Chris Chiu9e433422020-05-12 14:15:24 +08006900 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08006901 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08006902 ALC269VC_FIXUP_ACER_HEADSET_MIC,
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08006903 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
Armas Spann293a92c2020-07-24 16:08:37 +02006904 ALC289_FIXUP_ASUS_GA401,
Armas Spann4b43d052020-07-24 16:06:16 +02006905 ALC289_FIXUP_ASUS_GA502,
Jian-Hong Panf50a1212020-07-13 14:04:22 +08006906 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
Kailang Yang56496252020-07-29 15:09:27 +08006907 ALC285_FIXUP_HP_GPIO_AMP_INIT,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08006908 ALC269_FIXUP_CZC_B20,
6909 ALC269_FIXUP_CZC_TMI,
6910 ALC269_FIXUP_CZC_L101,
6911 ALC269_FIXUP_LEMOTE_A1802,
6912 ALC269_FIXUP_LEMOTE_A190X,
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08006913 ALC256_FIXUP_INTEL_NUC8_RUGGED,
Phil Calvind1ee66c2021-04-15 18:01:29 -04006914 ALC233_FIXUP_INTEL_NUC8_DMIC,
6915 ALC233_FIXUP_INTEL_NUC8_BOOST,
Werner Sembach73e71612021-03-02 19:04:14 +01006916 ALC256_FIXUP_INTEL_NUC10,
Hui Wangfc19d552020-09-09 10:00:41 +08006917 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
Hui Wang13468bf2020-09-28 16:01:17 +08006918 ALC274_FIXUP_HP_MIC,
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006919 ALC274_FIXUP_HP_HEADSET_MIC,
Takashi Iwai622464c2021-05-04 11:18:02 +02006920 ALC274_FIXUP_HP_ENVY_GPIO,
Kailang Yangef9ce662020-11-03 15:40:35 +08006921 ALC256_FIXUP_ASUS_HPE,
Kailang Yang446b8182020-11-02 15:00:12 +08006922 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Kailang Yanga0ccbc52020-11-06 15:20:38 +08006923 ALC287_FIXUP_HP_GPIO_LED,
Kailang Yang9e885772020-11-03 15:30:51 +08006924 ALC256_FIXUP_HP_HEADSET_MIC,
Johnathon Clark5fc462c2021-10-20 14:12:51 +01006925 ALC245_FIXUP_HP_GPIO_LED,
Kailang Yang92666d42020-11-19 17:04:21 +08006926 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
Chris Chiu34cdf402020-12-16 20:52:00 +08006927 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
Chris Chiu495dc762021-01-14 16:27:28 +08006928 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
Chris Chiud0e18562021-02-26 09:04:40 +08006929 ALC256_FIXUP_ACER_HEADSET_MIC,
Takashi Iwai26928ca2021-04-16 10:12:11 +02006930 ALC285_FIXUP_IDEAPAD_S740_COEF,
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08006931 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02006932 ALC295_FIXUP_ASUS_DACS,
Takashi Iwai5d84b532021-05-04 14:18:32 +02006933 ALC295_FIXUP_HP_OMEN,
Elia Devitof2be77f2021-05-11 14:46:49 +02006934 ALC285_FIXUP_HP_SPECTRE_X360,
Hui Wang9ebaef02021-05-22 12:26:45 +08006935 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03006936 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
Hui Wang57c9e212021-06-08 10:46:00 +08006937 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
Kai-Heng Feng8903376d2021-08-18 22:41:18 +08006938 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07006939 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6940 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6941 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02006942 ALC287_FIXUP_13S_GEN2_SPEAKERS,
Werner Sembach619764c2021-12-02 17:50:10 +01006943 ALC256_FIXUP_SET_COEF_DEFAULTS,
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06006944 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Werner Sembach174a7fb2021-11-12 12:07:04 +01006945 ALC233_FIXUP_NO_AUDIO_JACK,
Werner Sembachedca7cc2021-12-15 20:16:46 +01006946 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
Baole Fang8f4c9042022-01-05 22:08:54 +08006947 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
6948 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
Lucas Tanured3dca022021-12-17 11:57:07 +00006949 ALC287_FIXUP_LEGION_16ACHG6,
Stefan Bindingae7abe32021-12-17 11:57:08 +00006950 ALC287_FIXUP_CS35L41_I2C_2,
Alexander Sergeyev91502a92022-01-14 19:50:50 +03006951 ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006952};
6953
Takashi Iwai1727a772013-01-10 09:52:52 +01006954static const struct hda_fixup alc269_fixups[] = {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006955 [ALC269_FIXUP_GPIO2] = {
6956 .type = HDA_FIXUP_FUNC,
6957 .v.func = alc_fixup_gpio2,
6958 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006959 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01006960 .type = HDA_FIXUP_PINCTLS,
6961 .v.pins = (const struct hda_pintbl[]) {
6962 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02006963 {}
6964 }
6965 },
6966 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02006967 .type = HDA_FIXUP_FUNC,
6968 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006969 .chained = true,
6970 .chain_id = ALC269_FIXUP_SONY_VAIO
6971 },
6972 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006973 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006974 .v.verbs = (const struct hda_verb[]) {
6975 /* Enables internal speaker */
6976 {0x20, AC_VERB_SET_COEF_INDEX, 13},
6977 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
6978 {}
6979 }
6980 },
6981 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006982 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02006983 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006984 },
6985 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006986 .type = HDA_FIXUP_PINS,
6987 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02006988 { 0x17, 0x99130111 }, /* subwoofer */
6989 { }
6990 }
6991 },
6992 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006993 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006994 .v.verbs = (const struct hda_verb[]) {
6995 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
6996 {}
6997 }
6998 },
6999 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007000 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007001 .v.func = alc269_fixup_hweq,
7002 .chained = true,
7003 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7004 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02007005 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7006 .type = HDA_FIXUP_FUNC,
7007 .v.func = alc_fixup_disable_aamix,
7008 .chained = true,
7009 .chain_id = ALC269_FIXUP_SONY_VAIO
7010 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02007011 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007012 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007013 .v.func = alc271_fixup_dmic,
7014 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02007015 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007016 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02007017 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02007018 .chained = true,
7019 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02007020 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02007021 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007022 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02007023 .v.func = alc269_fixup_stereo_dmic,
7024 },
David Henningsson7c478f02013-10-11 10:18:46 +02007025 [ALC269_FIXUP_HEADSET_MIC] = {
7026 .type = HDA_FIXUP_FUNC,
7027 .v.func = alc269_fixup_headset_mic,
7028 },
Takashi Iwai24519912011-08-16 15:08:49 +02007029 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007030 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02007031 .v.func = alc269_fixup_quanta_mute,
7032 },
7033 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007034 .type = HDA_FIXUP_PINS,
7035 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02007036 { 0x1a, 0x2101103f }, /* dock line-out */
7037 { 0x1b, 0x23a11040 }, /* dock mic-in */
7038 { }
7039 },
7040 .chained = true,
7041 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7042 },
David Henningsson2041d562014-06-13 11:15:44 +02007043 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7044 .type = HDA_FIXUP_PINS,
7045 .v.pins = (const struct hda_pintbl[]) {
7046 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7047 { }
7048 },
7049 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02007050 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7051 .type = HDA_FIXUP_PINS,
7052 .v.pins = (const struct hda_pintbl[]) {
7053 { 0x21, 0x0221102f }, /* HP out */
7054 { }
7055 },
7056 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02007057 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7058 .type = HDA_FIXUP_FUNC,
7059 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7060 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01007061 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7062 .type = HDA_FIXUP_FUNC,
7063 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7064 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02007065 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007066 .type = HDA_FIXUP_PINS,
7067 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02007068 { 0x14, 0x99130110 }, /* speaker */
7069 { 0x15, 0x0121401f }, /* HP out */
7070 { 0x18, 0x01a19c20 }, /* mic */
7071 { 0x19, 0x99a3092f }, /* int-mic */
7072 { }
7073 },
7074 },
7075 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007076 .type = HDA_FIXUP_PINS,
7077 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02007078 { 0x12, 0x99a3092f }, /* int-mic */
7079 { 0x14, 0x99130110 }, /* speaker */
7080 { 0x15, 0x0121401f }, /* HP out */
7081 { 0x18, 0x01a19c20 }, /* mic */
7082 { }
7083 },
7084 },
7085 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007086 .type = HDA_FIXUP_PINS,
7087 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02007088 { 0x14, 0x99130110 }, /* speaker */
7089 { 0x18, 0x01a19c20 }, /* mic */
7090 { 0x19, 0x99a3092f }, /* int-mic */
7091 { 0x21, 0x0121401f }, /* HP out */
7092 { }
7093 },
7094 },
David Henningsson2267ea92012-01-03 08:45:56 +01007095 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007096 .type = HDA_FIXUP_PINS,
7097 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02007098 { 0x12, 0x99a3092f }, /* int-mic */
7099 { 0x14, 0x99130110 }, /* speaker */
7100 { 0x18, 0x01a19c20 }, /* mic */
7101 { 0x21, 0x0121401f }, /* HP out */
7102 { }
7103 },
7104 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01007105 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007106 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01007107 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01007108 },
David Henningssond06ac142013-02-18 11:41:55 +01007109 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7110 .type = HDA_FIXUP_FUNC,
7111 .v.func = alc269_fixup_hp_mute_led_mic1,
7112 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01007113 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007114 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01007115 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01007116 },
Tom Briden7f783bd2017-03-25 10:12:01 +00007117 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7118 .type = HDA_FIXUP_FUNC,
7119 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05007120 .chained = true,
7121 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00007122 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01007123 [ALC269_FIXUP_HP_GPIO_LED] = {
7124 .type = HDA_FIXUP_FUNC,
7125 .v.func = alc269_fixup_hp_gpio_led,
7126 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007127 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7128 .type = HDA_FIXUP_FUNC,
7129 .v.func = alc269_fixup_hp_gpio_mic1_led,
7130 },
7131 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7132 .type = HDA_FIXUP_FUNC,
7133 .v.func = alc269_fixup_hp_line1_mic1_led,
7134 },
David Henningsson693b6132012-06-22 19:12:10 +02007135 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007136 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02007137 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02007138 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01007139 [ALC269_FIXUP_NO_SHUTUP] = {
7140 .type = HDA_FIXUP_FUNC,
7141 .v.func = alc_fixup_no_shutup,
7142 },
David Henningsson108cc102012-07-20 10:37:25 +02007143 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007144 .type = HDA_FIXUP_PINS,
7145 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02007146 { 0x19, 0x23a11040 }, /* dock mic */
7147 { 0x1b, 0x2121103f }, /* dock headphone */
7148 { }
7149 },
7150 .chained = true,
7151 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7152 },
Takashi Iwaib590b382020-05-14 18:05:33 +02007153 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7154 .type = HDA_FIXUP_FUNC,
7155 .v.func = alc269_fixup_limit_int_mic_boost,
7156 .chained = true,
7157 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7158 },
David Henningsson108cc102012-07-20 10:37:25 +02007159 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007160 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02007161 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01007162 .chained = true,
7163 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02007164 },
David Henningsson73bdd592013-04-15 15:44:14 +02007165 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7166 .type = HDA_FIXUP_PINS,
7167 .v.pins = (const struct hda_pintbl[]) {
7168 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7169 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7170 { }
7171 },
7172 .chained = true,
7173 .chain_id = ALC269_FIXUP_HEADSET_MODE
7174 },
7175 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7176 .type = HDA_FIXUP_PINS,
7177 .v.pins = (const struct hda_pintbl[]) {
7178 { 0x16, 0x21014020 }, /* dock line out */
7179 { 0x19, 0x21a19030 }, /* dock mic */
7180 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7181 { }
7182 },
7183 .chained = true,
7184 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7185 },
David Henningsson338cae52013-10-07 10:39:59 +02007186 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7187 .type = HDA_FIXUP_PINS,
7188 .v.pins = (const struct hda_pintbl[]) {
7189 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7190 { }
7191 },
7192 .chained = true,
7193 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7194 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08007195 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7196 .type = HDA_FIXUP_PINS,
7197 .v.pins = (const struct hda_pintbl[]) {
7198 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7199 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7200 { }
7201 },
7202 .chained = true,
7203 .chain_id = ALC269_FIXUP_HEADSET_MODE
7204 },
David Henningsson73bdd592013-04-15 15:44:14 +02007205 [ALC269_FIXUP_HEADSET_MODE] = {
7206 .type = HDA_FIXUP_FUNC,
7207 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08007208 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007209 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02007210 },
7211 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7212 .type = HDA_FIXUP_FUNC,
7213 .v.func = alc_fixup_headset_mode_no_hp_mic,
7214 },
Takashi Iwai78197172015-06-27 10:21:13 +02007215 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7216 .type = HDA_FIXUP_PINS,
7217 .v.pins = (const struct hda_pintbl[]) {
7218 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7219 { }
7220 },
7221 .chained = true,
7222 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7223 },
David Henningsson88cfcf82013-10-11 10:18:45 +02007224 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7225 .type = HDA_FIXUP_PINS,
7226 .v.pins = (const struct hda_pintbl[]) {
7227 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7228 { }
7229 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02007230 .chained = true,
7231 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02007232 },
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04007233 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05007234 .type = HDA_FIXUP_PINS,
7235 .v.pins = (const struct hda_pintbl[]) {
7236 {0x12, 0x90a60130},
7237 {0x13, 0x40000000},
7238 {0x14, 0x90170110},
7239 {0x18, 0x411111f0},
7240 {0x19, 0x04a11040},
7241 {0x1a, 0x411111f0},
7242 {0x1b, 0x90170112},
7243 {0x1d, 0x40759a05},
7244 {0x1e, 0x411111f0},
7245 {0x21, 0x04211020},
7246 { }
7247 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05007248 .chained = true,
7249 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05007250 },
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02007251 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7252 .type = HDA_FIXUP_FUNC,
7253 .v.func = alc298_fixup_huawei_mbx_stereo,
7254 .chained = true,
7255 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7256 },
David Henningssond240d1d2013-04-15 12:50:02 +02007257 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7258 .type = HDA_FIXUP_FUNC,
7259 .v.func = alc269_fixup_x101_headset_mic,
7260 },
7261 [ALC269_FIXUP_ASUS_X101_VERB] = {
7262 .type = HDA_FIXUP_VERBS,
7263 .v.verbs = (const struct hda_verb[]) {
7264 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7265 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7266 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7267 { }
7268 },
7269 .chained = true,
7270 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7271 },
7272 [ALC269_FIXUP_ASUS_X101] = {
7273 .type = HDA_FIXUP_PINS,
7274 .v.pins = (const struct hda_pintbl[]) {
7275 { 0x18, 0x04a1182c }, /* Headset mic */
7276 { }
7277 },
7278 .chained = true,
7279 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7280 },
Dylan Reid08a978d2012-11-18 22:56:40 -08007281 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007282 .type = HDA_FIXUP_PINS,
7283 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08007284 { 0x14, 0x99130110 }, /* speaker */
7285 { 0x19, 0x01a19c20 }, /* mic */
7286 { 0x1b, 0x99a7012f }, /* int-mic */
7287 { 0x21, 0x0121401f }, /* HP out */
7288 { }
7289 },
7290 },
7291 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007292 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08007293 .v.func = alc271_hp_gate_mic_jack,
7294 .chained = true,
7295 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7296 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01007297 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7298 .type = HDA_FIXUP_FUNC,
7299 .v.func = alc269_fixup_limit_int_mic_boost,
7300 .chained = true,
7301 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7302 },
Dylan Reid42397002013-04-05 14:58:22 -07007303 [ALC269_FIXUP_ACER_AC700] = {
7304 .type = HDA_FIXUP_PINS,
7305 .v.pins = (const struct hda_pintbl[]) {
7306 { 0x12, 0x99a3092f }, /* int-mic */
7307 { 0x14, 0x99130110 }, /* speaker */
7308 { 0x18, 0x03a11c20 }, /* mic */
7309 { 0x1e, 0x0346101e }, /* SPDIF1 */
7310 { 0x21, 0x0321101f }, /* HP out */
7311 { }
7312 },
7313 .chained = true,
7314 .chain_id = ALC271_FIXUP_DMIC,
7315 },
David Henningsson3e0d6112013-04-22 14:30:14 +02007316 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7317 .type = HDA_FIXUP_FUNC,
7318 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01007319 .chained = true,
7320 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02007321 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01007322 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7323 .type = HDA_FIXUP_FUNC,
7324 .v.func = alc269_fixup_limit_int_mic_boost,
7325 .chained = true,
7326 .chain_id = ALC269VB_FIXUP_DMIC,
7327 },
Takashi Iwai23870832013-11-29 14:13:12 +01007328 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7329 .type = HDA_FIXUP_VERBS,
7330 .v.verbs = (const struct hda_verb[]) {
7331 /* class-D output amp +5dB */
7332 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7333 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7334 {}
7335 },
7336 .chained = true,
7337 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7338 },
David Henningsson8e35cd42013-11-06 11:20:01 +01007339 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7340 .type = HDA_FIXUP_FUNC,
7341 .v.func = alc269_fixup_limit_int_mic_boost,
7342 .chained = true,
7343 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7344 },
Anisse Astier02b504d2013-06-03 11:53:10 +02007345 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7346 .type = HDA_FIXUP_PINS,
7347 .v.pins = (const struct hda_pintbl[]) {
7348 { 0x12, 0x99a3092f }, /* int-mic */
7349 { 0x18, 0x03a11d20 }, /* mic */
7350 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7351 { }
7352 },
7353 },
Kailang Yangcd217a62013-08-22 10:15:24 +02007354 [ALC283_FIXUP_CHROME_BOOK] = {
7355 .type = HDA_FIXUP_FUNC,
7356 .v.func = alc283_fixup_chromebook,
7357 },
Kailang Yang0202e992013-12-02 15:20:15 +08007358 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7359 .type = HDA_FIXUP_FUNC,
7360 .v.func = alc283_fixup_sense_combo_jack,
7361 .chained = true,
7362 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7363 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02007364 [ALC282_FIXUP_ASUS_TX300] = {
7365 .type = HDA_FIXUP_FUNC,
7366 .v.func = alc282_fixup_asus_tx300,
7367 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02007368 [ALC283_FIXUP_INT_MIC] = {
7369 .type = HDA_FIXUP_VERBS,
7370 .v.verbs = (const struct hda_verb[]) {
7371 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7372 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7373 { }
7374 },
7375 .chained = true,
7376 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7377 },
David Henningsson0f4881d2013-12-20 16:08:13 +01007378 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7379 .type = HDA_FIXUP_PINS,
7380 .v.pins = (const struct hda_pintbl[]) {
7381 { 0x17, 0x90170112 }, /* subwoofer */
7382 { }
7383 },
7384 .chained = true,
7385 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7386 },
7387 [ALC290_FIXUP_SUBWOOFER] = {
7388 .type = HDA_FIXUP_PINS,
7389 .v.pins = (const struct hda_pintbl[]) {
7390 { 0x17, 0x90170112 }, /* subwoofer */
7391 { }
7392 },
7393 .chained = true,
7394 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7395 },
David Henningsson338cae52013-10-07 10:39:59 +02007396 [ALC290_FIXUP_MONO_SPEAKERS] = {
7397 .type = HDA_FIXUP_FUNC,
7398 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01007399 },
7400 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7401 .type = HDA_FIXUP_FUNC,
7402 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02007403 .chained = true,
7404 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7405 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01007406 [ALC269_FIXUP_THINKPAD_ACPI] = {
7407 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02007408 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02007409 .chained = true,
7410 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01007411 },
David Henningsson56f27012016-01-11 09:33:14 +01007412 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7413 .type = HDA_FIXUP_FUNC,
7414 .v.func = alc_fixup_inv_dmic,
7415 .chained = true,
7416 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7417 },
Chris Chiu5824ce82017-02-28 14:17:11 -06007418 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
Hui Wang17d30462019-06-14 16:44:12 +08007419 .type = HDA_FIXUP_PINS,
7420 .v.pins = (const struct hda_pintbl[]) {
7421 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7422 { }
Chris Chiu5824ce82017-02-28 14:17:11 -06007423 },
7424 .chained = true,
Hui Wang17d30462019-06-14 16:44:12 +08007425 .chain_id = ALC255_FIXUP_HEADSET_MODE
Chris Chiu5824ce82017-02-28 14:17:11 -06007426 },
Chris Chiu615966a2017-02-28 14:17:12 -06007427 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7428 .type = HDA_FIXUP_PINS,
7429 .v.pins = (const struct hda_pintbl[]) {
7430 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7431 { }
7432 },
7433 .chained = true,
7434 .chain_id = ALC255_FIXUP_HEADSET_MODE
7435 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007436 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7437 .type = HDA_FIXUP_PINS,
7438 .v.pins = (const struct hda_pintbl[]) {
7439 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7440 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7441 { }
7442 },
7443 .chained = true,
7444 .chain_id = ALC255_FIXUP_HEADSET_MODE
7445 },
Kailang Yang31278992014-03-03 15:27:22 +08007446 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7447 .type = HDA_FIXUP_PINS,
7448 .v.pins = (const struct hda_pintbl[]) {
7449 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7450 { }
7451 },
7452 .chained = true,
7453 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7454 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007455 [ALC255_FIXUP_HEADSET_MODE] = {
7456 .type = HDA_FIXUP_FUNC,
7457 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08007458 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007459 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007460 },
Kailang Yang31278992014-03-03 15:27:22 +08007461 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7462 .type = HDA_FIXUP_FUNC,
7463 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7464 },
Kailang Yanga22aa262014-04-23 17:34:28 +08007465 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7466 .type = HDA_FIXUP_PINS,
7467 .v.pins = (const struct hda_pintbl[]) {
7468 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7469 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7470 { }
7471 },
7472 .chained = true,
7473 .chain_id = ALC269_FIXUP_HEADSET_MODE
7474 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02007475 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02007476 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02007477 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02007478 .chained = true,
7479 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7480 },
Takashi Iwai9a811232015-12-09 15:17:43 +01007481 [ALC292_FIXUP_TPT440] = {
7482 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01007483 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01007484 .chained = true,
7485 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7486 },
Anisse Astierabaa22742016-08-24 09:14:13 +02007487 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01007488 .type = HDA_FIXUP_PINS,
7489 .v.pins = (const struct hda_pintbl[]) {
7490 { 0x19, 0x04a110f0 },
7491 { },
7492 },
7493 },
Takashi Iwaib3802782018-11-26 17:47:46 +01007494 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08007495 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007496 .v.func = alc_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08007497 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007498 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7499 .type = HDA_FIXUP_PINS,
7500 .v.pins = (const struct hda_pintbl[]) {
7501 { 0x12, 0x90a60130 },
7502 { 0x14, 0x90170110 },
7503 { 0x17, 0x40000008 },
7504 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02007505 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007506 { 0x1a, 0x411111f0 },
7507 { 0x1b, 0x411111f0 },
7508 { 0x1d, 0x40f89b2d },
7509 { 0x1e, 0x411111f0 },
7510 { 0x21, 0x0321101f },
7511 { },
7512 },
7513 },
Takashi Iwaic8426b22021-04-07 11:57:30 +02007514 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7515 .type = HDA_FIXUP_FUNC,
7516 .v.func = alc269vb_fixup_aspire_e1_coef,
7517 },
David Henningsson7a5255f2014-10-30 08:26:01 +01007518 [ALC280_FIXUP_HP_GPIO4] = {
7519 .type = HDA_FIXUP_FUNC,
7520 .v.func = alc280_fixup_hp_gpio4,
7521 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08007522 [ALC286_FIXUP_HP_GPIO_LED] = {
7523 .type = HDA_FIXUP_FUNC,
7524 .v.func = alc286_fixup_hp_gpio_led,
7525 },
David Henningsson33f4acd2015-01-07 15:50:13 +01007526 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7527 .type = HDA_FIXUP_FUNC,
7528 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7529 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01007530 [ALC280_FIXUP_HP_DOCK_PINS] = {
7531 .type = HDA_FIXUP_PINS,
7532 .v.pins = (const struct hda_pintbl[]) {
7533 { 0x1b, 0x21011020 }, /* line-out */
7534 { 0x1a, 0x01a1903c }, /* headset mic */
7535 { 0x18, 0x2181103f }, /* line-in */
7536 { },
7537 },
7538 .chained = true,
7539 .chain_id = ALC280_FIXUP_HP_GPIO4
7540 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01007541 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7542 .type = HDA_FIXUP_PINS,
7543 .v.pins = (const struct hda_pintbl[]) {
7544 { 0x1b, 0x21011020 }, /* line-out */
7545 { 0x18, 0x2181103f }, /* line-in */
7546 { },
7547 },
7548 .chained = true,
7549 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7550 },
Keith Packard98973f22015-07-15 12:14:39 -07007551 [ALC280_FIXUP_HP_9480M] = {
7552 .type = HDA_FIXUP_FUNC,
7553 .v.func = alc280_fixup_hp_9480m,
7554 },
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01007555 [ALC245_FIXUP_HP_X360_AMP] = {
7556 .type = HDA_FIXUP_FUNC,
7557 .v.func = alc245_fixup_hp_x360_amp,
Johnathon Clark5fc462c2021-10-20 14:12:51 +01007558 .chained = true,
7559 .chain_id = ALC245_FIXUP_HP_GPIO_LED
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01007560 },
Kailang Yange1e62b92015-04-08 16:01:22 +08007561 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7562 .type = HDA_FIXUP_FUNC,
7563 .v.func = alc_fixup_headset_mode_dell_alc288,
7564 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007565 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08007566 },
7567 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7568 .type = HDA_FIXUP_PINS,
7569 .v.pins = (const struct hda_pintbl[]) {
7570 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7571 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7572 { }
7573 },
7574 .chained = true,
7575 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7576 },
Hui Wang831bfdf92015-06-26 12:35:17 +08007577 [ALC288_FIXUP_DISABLE_AAMIX] = {
7578 .type = HDA_FIXUP_FUNC,
7579 .v.func = alc_fixup_disable_aamix,
7580 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02007581 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08007582 },
7583 [ALC288_FIXUP_DELL_XPS_13] = {
7584 .type = HDA_FIXUP_FUNC,
7585 .v.func = alc_fixup_dell_xps13,
7586 .chained = true,
7587 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7588 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007589 [ALC292_FIXUP_DISABLE_AAMIX] = {
7590 .type = HDA_FIXUP_FUNC,
7591 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08007592 .chained = true,
7593 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007594 },
David Henningssonc04017e2015-12-15 14:44:03 +01007595 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7596 .type = HDA_FIXUP_FUNC,
7597 .v.func = alc_fixup_disable_aamix,
7598 .chained = true,
7599 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7600 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007601 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007602 .type = HDA_FIXUP_FUNC,
7603 .v.func = alc_fixup_dell_xps13,
7604 .chained = true,
7605 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7606 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007607 [ALC292_FIXUP_DELL_E7X] = {
7608 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007609 .v.func = alc_fixup_micmute_led,
Takashi Iwai5fab5822020-01-05 09:11:19 +01007610 /* micmute fixup must be applied at last */
7611 .chained_before = true,
7612 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7613 },
James McDonnell54324222019-09-16 14:53:38 +00007614 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7615 .type = HDA_FIXUP_PINS,
7616 .v.pins = (const struct hda_pintbl[]) {
7617 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7618 { }
7619 },
7620 .chained_before = true,
7621 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7622 },
Kailang Yang977e6272015-05-18 15:31:20 +08007623 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7624 .type = HDA_FIXUP_PINS,
7625 .v.pins = (const struct hda_pintbl[]) {
7626 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7627 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7628 { }
7629 },
7630 .chained = true,
7631 .chain_id = ALC269_FIXUP_HEADSET_MODE
7632 },
Hui Wang2f726ae2017-03-31 10:31:40 +08007633 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7634 .type = HDA_FIXUP_PINS,
7635 .v.pins = (const struct hda_pintbl[]) {
7636 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7637 { }
7638 },
7639 .chained = true,
7640 .chain_id = ALC269_FIXUP_HEADSET_MODE
7641 },
Kailang Yang6ed11312015-10-26 15:37:39 +08007642 [ALC275_FIXUP_DELL_XPS] = {
7643 .type = HDA_FIXUP_VERBS,
7644 .v.verbs = (const struct hda_verb[]) {
7645 /* Enables internal speaker */
7646 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7647 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7648 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7649 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7650 {}
7651 }
7652 },
Hui Wang23adc192015-12-08 12:27:18 +08007653 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7654 .type = HDA_FIXUP_FUNC,
7655 .v.func = alc_fixup_disable_aamix,
7656 .chained = true,
7657 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7658 },
Kailang3694cb22015-12-28 11:35:24 +08007659 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7660 .type = HDA_FIXUP_FUNC,
7661 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7662 },
Phil Calvind1ee66c2021-04-15 18:01:29 -04007663 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7664 .type = HDA_FIXUP_FUNC,
7665 .v.func = alc_fixup_inv_dmic,
7666 .chained = true,
7667 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7668 },
7669 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7670 .type = HDA_FIXUP_FUNC,
7671 .v.func = alc269_fixup_limit_int_mic_boost
7672 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007673 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7674 .type = HDA_FIXUP_FUNC,
7675 .v.func = alc_fixup_disable_aamix,
7676 .chained = true,
7677 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7678 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08007679 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7680 .type = HDA_FIXUP_FUNC,
7681 .v.func = alc_fixup_disable_mic_vref,
7682 .chained = true,
7683 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7684 },
David Henningsson2ae95572016-02-25 09:37:05 +01007685 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7686 .type = HDA_FIXUP_VERBS,
7687 .v.verbs = (const struct hda_verb[]) {
7688 /* Disable pass-through path for FRONT 14h */
7689 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7690 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7691 {}
7692 },
7693 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08007694 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01007695 },
Takashi Iwaif8839822016-02-25 14:31:59 +01007696 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7697 .type = HDA_FIXUP_FUNC,
7698 .v.func = alc_fixup_disable_aamix,
7699 .chained = true,
7700 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7701 },
Hui Wange549d192016-04-01 11:00:15 +08007702 [ALC221_FIXUP_HP_FRONT_MIC] = {
7703 .type = HDA_FIXUP_PINS,
7704 .v.pins = (const struct hda_pintbl[]) {
7705 { 0x19, 0x02a19020 }, /* Front Mic */
7706 { }
7707 },
7708 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02007709 [ALC292_FIXUP_TPT460] = {
7710 .type = HDA_FIXUP_FUNC,
7711 .v.func = alc_fixup_tpt440_dock,
7712 .chained = true,
7713 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7714 },
Hui Wangdd9aa332016-08-01 10:20:32 +08007715 [ALC298_FIXUP_SPK_VOLUME] = {
7716 .type = HDA_FIXUP_FUNC,
7717 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08007718 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08007719 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08007720 },
Kailang Yangf86de9b2020-10-23 14:46:47 +08007721 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7722 .type = HDA_FIXUP_FUNC,
7723 .v.func = alc298_fixup_speaker_volume,
7724 },
Takashi Iwaie312a862018-03-06 12:14:17 +01007725 [ALC295_FIXUP_DISABLE_DAC3] = {
7726 .type = HDA_FIXUP_FUNC,
7727 .v.func = alc295_fixup_disable_dac3,
7728 },
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007729 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7730 .type = HDA_FIXUP_FUNC,
7731 .v.func = alc285_fixup_speaker2_to_dac1,
Hui Wangc37c0ab2020-02-19 13:23:06 +08007732 .chained = true,
7733 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007734 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007735 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7736 .type = HDA_FIXUP_PINS,
7737 .v.pins = (const struct hda_pintbl[]) {
7738 { 0x1b, 0x90170151 },
7739 { }
7740 },
7741 .chained = true,
7742 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7743 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01007744 [ALC269_FIXUP_ATIV_BOOK_8] = {
7745 .type = HDA_FIXUP_FUNC,
7746 .v.func = alc_fixup_auto_mute_via_amp,
7747 .chained = true,
7748 .chain_id = ALC269_FIXUP_NO_SHUTUP
7749 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08007750 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7751 .type = HDA_FIXUP_PINS,
7752 .v.pins = (const struct hda_pintbl[]) {
7753 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7754 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7755 { }
7756 },
7757 .chained = true,
7758 .chain_id = ALC269_FIXUP_HEADSET_MODE
7759 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06007760 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7761 .type = HDA_FIXUP_FUNC,
7762 .v.func = alc_fixup_headset_mode,
7763 },
7764 [ALC256_FIXUP_ASUS_MIC] = {
7765 .type = HDA_FIXUP_PINS,
7766 .v.pins = (const struct hda_pintbl[]) {
7767 { 0x13, 0x90a60160 }, /* use as internal mic */
7768 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7769 { }
7770 },
7771 .chained = true,
7772 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7773 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06007774 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02007775 .type = HDA_FIXUP_FUNC,
7776 /* Set up GPIO2 for the speaker amp */
7777 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06007778 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06007779 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7780 .type = HDA_FIXUP_PINS,
7781 .v.pins = (const struct hda_pintbl[]) {
7782 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7783 { }
7784 },
7785 .chained = true,
7786 .chain_id = ALC269_FIXUP_HEADSET_MIC
7787 },
7788 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7789 .type = HDA_FIXUP_VERBS,
7790 .v.verbs = (const struct hda_verb[]) {
7791 /* Enables internal speaker */
7792 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7793 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7794 {}
7795 },
7796 .chained = true,
7797 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7798 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007799 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7800 .type = HDA_FIXUP_FUNC,
7801 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08007802 .chained = true,
7803 .chain_id = ALC269_FIXUP_GPIO2
Kailang Yangca169cc2017-04-25 16:17:40 +08007804 },
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007805 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7806 .type = HDA_FIXUP_VERBS,
7807 .v.verbs = (const struct hda_verb[]) {
7808 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7809 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7810 { }
7811 },
7812 .chained = true,
7813 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7814 },
Hui Wangf33f79f2017-07-07 12:08:29 +08007815 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7816 .type = HDA_FIXUP_PINS,
7817 .v.pins = (const struct hda_pintbl[]) {
7818 /* Change the mic location from front to right, otherwise there are
7819 two front mics with the same name, pulseaudio can't handle them.
7820 This is just a temporary workaround, after applying this fixup,
7821 there will be one "Front Mic" and one "Mic" in this machine.
7822 */
7823 { 0x1a, 0x04a19040 },
7824 { }
7825 },
7826 },
Kailang Yang5f364132017-07-25 16:28:16 +08007827 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7828 .type = HDA_FIXUP_PINS,
7829 .v.pins = (const struct hda_pintbl[]) {
7830 { 0x16, 0x0101102f }, /* Rear Headset HP */
7831 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7832 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7833 { 0x1b, 0x02011020 },
7834 { }
7835 },
7836 .chained = true,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08007837 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7838 },
7839 [ALC225_FIXUP_S3_POP_NOISE] = {
7840 .type = HDA_FIXUP_FUNC,
7841 .v.func = alc225_fixup_s3_pop_noise,
7842 .chained = true,
Kailang Yang5f364132017-07-25 16:28:16 +08007843 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7844 },
PeiSen Houb84e8432017-09-01 15:11:56 +08007845 [ALC700_FIXUP_INTEL_REFERENCE] = {
7846 .type = HDA_FIXUP_VERBS,
7847 .v.verbs = (const struct hda_verb[]) {
7848 /* Enables internal speaker */
7849 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7850 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7851 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7852 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7853 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7854 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7855 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7856 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7857 {}
7858 }
7859 },
Kailang Yang92266652017-12-14 15:28:58 +08007860 [ALC274_FIXUP_DELL_BIND_DACS] = {
7861 .type = HDA_FIXUP_FUNC,
7862 .v.func = alc274_fixup_bind_dacs,
7863 .chained = true,
7864 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7865 },
7866 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7867 .type = HDA_FIXUP_PINS,
7868 .v.pins = (const struct hda_pintbl[]) {
7869 { 0x1b, 0x0401102f },
7870 { }
7871 },
7872 .chained = true,
7873 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7874 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007875 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007876 .type = HDA_FIXUP_FUNC,
7877 .v.func = alc_fixup_tpt470_dock,
7878 .chained = true,
7879 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7880 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007881 [ALC298_FIXUP_TPT470_DOCK] = {
7882 .type = HDA_FIXUP_FUNC,
7883 .v.func = alc_fixup_tpt470_dacs,
7884 .chained = true,
7885 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7886 },
Kailang Yangae104a22018-02-05 16:07:20 +08007887 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7888 .type = HDA_FIXUP_PINS,
7889 .v.pins = (const struct hda_pintbl[]) {
7890 { 0x14, 0x0201101f },
7891 { }
7892 },
7893 .chained = true,
7894 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7895 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007896 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7897 .type = HDA_FIXUP_PINS,
7898 .v.pins = (const struct hda_pintbl[]) {
7899 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7900 { }
7901 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08007902 .chained = true,
7903 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007904 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007905 [ALC295_FIXUP_HP_X360] = {
7906 .type = HDA_FIXUP_FUNC,
7907 .v.func = alc295_fixup_hp_top_speakers,
7908 .chained = true,
7909 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08007910 },
7911 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7912 .type = HDA_FIXUP_PINS,
7913 .v.pins = (const struct hda_pintbl[]) {
7914 { 0x19, 0x0181313f},
7915 { }
7916 },
7917 .chained = true,
7918 .chain_id = ALC269_FIXUP_HEADSET_MIC
7919 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08007920 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7921 .type = HDA_FIXUP_FUNC,
7922 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08007923 .chained = true,
7924 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08007925 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05007926 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7927 .type = HDA_FIXUP_FUNC,
7928 .v.func = alc_fixup_auto_mute_via_amp,
7929 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08007930 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7931 .type = HDA_FIXUP_PINS,
7932 .v.pins = (const struct hda_pintbl[]) {
7933 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7934 { }
7935 },
7936 .chained = true,
7937 .chain_id = ALC269_FIXUP_HEADSET_MIC
7938 },
Chris Chiud8ae4582018-12-07 17:17:11 +08007939 [ALC294_FIXUP_ASUS_MIC] = {
7940 .type = HDA_FIXUP_PINS,
7941 .v.pins = (const struct hda_pintbl[]) {
7942 { 0x13, 0x90a60160 }, /* use as internal mic */
7943 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7944 { }
7945 },
7946 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007947 .chain_id = ALC269_FIXUP_HEADSET_MIC
Chris Chiud8ae4582018-12-07 17:17:11 +08007948 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007949 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7950 .type = HDA_FIXUP_PINS,
7951 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08007952 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007953 { }
7954 },
7955 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007956 .chain_id = ALC269_FIXUP_HEADSET_MIC
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007957 },
7958 [ALC294_FIXUP_ASUS_SPK] = {
7959 .type = HDA_FIXUP_VERBS,
7960 .v.verbs = (const struct hda_verb[]) {
7961 /* Set EAPD high */
7962 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
7963 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
Kailang Yang473fbe132020-07-16 14:42:33 +08007964 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
7965 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007966 { }
7967 },
7968 .chained = true,
7969 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
7970 },
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007971 [ALC295_FIXUP_CHROME_BOOK] = {
Kailang Yange8547472018-11-28 15:32:45 +08007972 .type = HDA_FIXUP_FUNC,
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01007973 .v.func = alc295_fixup_chromebook,
Kailang Yang8983eb62019-04-03 15:31:49 +08007974 .chained = true,
7975 .chain_id = ALC225_FIXUP_HEADSET_JACK
7976 },
7977 [ALC225_FIXUP_HEADSET_JACK] = {
7978 .type = HDA_FIXUP_FUNC,
7979 .v.func = alc_fixup_headset_jack,
Kailang Yange8547472018-11-28 15:32:45 +08007980 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07007981 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
7982 .type = HDA_FIXUP_PINS,
7983 .v.pins = (const struct hda_pintbl[]) {
7984 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7985 { }
7986 },
7987 .chained = true,
7988 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7989 },
Hui Wangc8c6ee62019-02-14 11:41:33 +08007990 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
7991 .type = HDA_FIXUP_VERBS,
7992 .v.verbs = (const struct hda_verb[]) {
7993 /* Disable PCBEEP-IN passthrough */
7994 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7995 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7996 { }
7997 },
7998 .chained = true,
7999 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8000 },
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08008001 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
8002 .type = HDA_FIXUP_PINS,
8003 .v.pins = (const struct hda_pintbl[]) {
8004 { 0x19, 0x03a11130 },
8005 { 0x1a, 0x90a60140 }, /* use as internal mic */
8006 { }
8007 },
8008 .chained = true,
8009 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8010 },
Kailang Yang136824e2019-03-14 16:22:45 +08008011 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8012 .type = HDA_FIXUP_PINS,
8013 .v.pins = (const struct hda_pintbl[]) {
8014 { 0x16, 0x01011020 }, /* Rear Line out */
8015 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8016 { }
8017 },
8018 .chained = true,
8019 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8020 },
8021 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8022 .type = HDA_FIXUP_FUNC,
8023 .v.func = alc_fixup_auto_mute_via_amp,
8024 .chained = true,
8025 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8026 },
8027 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8028 .type = HDA_FIXUP_FUNC,
8029 .v.func = alc_fixup_disable_mic_vref,
8030 .chained = true,
8031 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8032 },
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08008033 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8034 .type = HDA_FIXUP_VERBS,
8035 .v.verbs = (const struct hda_verb[]) {
8036 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8037 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8038 { }
8039 },
8040 .chained = true,
8041 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8042 },
Daniel Drake8c8967a2019-10-17 16:15:01 +08008043 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8044 .type = HDA_FIXUP_PINS,
8045 .v.pins = (const struct hda_pintbl[]) {
8046 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8047 { }
8048 },
8049 .chained = true,
8050 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8051 },
Jian-Hong Pane1037352019-03-22 11:37:18 +08008052 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8053 .type = HDA_FIXUP_PINS,
8054 .v.pins = (const struct hda_pintbl[]) {
8055 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8056 { }
8057 },
8058 .chained = true,
8059 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8060 },
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008061 [ALC299_FIXUP_PREDATOR_SPK] = {
8062 .type = HDA_FIXUP_PINS,
8063 .v.pins = (const struct hda_pintbl[]) {
8064 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8065 { }
8066 }
8067 },
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02008068 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8069 .type = HDA_FIXUP_PINS,
8070 .v.pins = (const struct hda_pintbl[]) {
8071 { 0x19, 0x04a11040 },
8072 { 0x21, 0x04211020 },
8073 { }
8074 },
8075 .chained = true,
8076 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8077 },
Kailang Yange79c2262019-12-19 14:12:15 +08008078 [ALC289_FIXUP_DELL_SPK2] = {
8079 .type = HDA_FIXUP_PINS,
8080 .v.pins = (const struct hda_pintbl[]) {
8081 { 0x17, 0x90170130 }, /* bass spk */
8082 { }
8083 },
8084 .chained = true,
8085 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8086 },
8087 [ALC289_FIXUP_DUAL_SPK] = {
8088 .type = HDA_FIXUP_FUNC,
8089 .v.func = alc285_fixup_speaker2_to_dac1,
8090 .chained = true,
8091 .chain_id = ALC289_FIXUP_DELL_SPK2
8092 },
Chris Chiu48e01502019-12-30 11:11:18 +08008093 [ALC294_FIXUP_SPK2_TO_DAC1] = {
8094 .type = HDA_FIXUP_FUNC,
8095 .v.func = alc285_fixup_speaker2_to_dac1,
8096 .chained = true,
8097 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8098 },
8099 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
Jian-Hong Pan436e2552019-11-25 17:34:06 +08008100 .type = HDA_FIXUP_FUNC,
8101 /* The GPIO must be pulled to initialize the AMP */
8102 .v.func = alc_fixup_gpio4,
8103 .chained = true,
Chris Chiu48e01502019-12-30 11:11:18 +08008104 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
Jian-Hong Pan436e2552019-11-25 17:34:06 +08008105 },
Takashi Iwai6a6660d2020-09-03 10:33:00 +02008106 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8107 .type = HDA_FIXUP_FUNC,
8108 .v.func = alc285_fixup_thinkpad_x1_gen7,
8109 .chained = true,
8110 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8111 },
Kailang Yang76f7dec2020-02-10 16:30:26 +08008112 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8113 .type = HDA_FIXUP_FUNC,
8114 .v.func = alc_fixup_headset_jack,
8115 .chained = true,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02008116 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
Kailang Yang76f7dec2020-02-10 16:30:26 +08008117 },
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08008118 [ALC294_FIXUP_ASUS_HPE] = {
8119 .type = HDA_FIXUP_VERBS,
8120 .v.verbs = (const struct hda_verb[]) {
8121 /* Set EAPD high */
8122 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8123 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8124 { }
8125 },
8126 .chained = true,
8127 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8128 },
Luke D Jonesc3cdf182020-09-07 20:19:59 +12008129 [ALC294_FIXUP_ASUS_GX502_PINS] = {
8130 .type = HDA_FIXUP_PINS,
8131 .v.pins = (const struct hda_pintbl[]) {
8132 { 0x19, 0x03a11050 }, /* front HP mic */
8133 { 0x1a, 0x01a11830 }, /* rear external mic */
8134 { 0x21, 0x03211020 }, /* front HP out */
8135 { }
8136 },
8137 .chained = true,
8138 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8139 },
8140 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8141 .type = HDA_FIXUP_VERBS,
8142 .v.verbs = (const struct hda_verb[]) {
8143 /* set 0x15 to HP-OUT ctrl */
8144 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8145 /* unmute the 0x15 amp */
8146 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8147 { }
8148 },
8149 .chained = true,
8150 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8151 },
8152 [ALC294_FIXUP_ASUS_GX502_HP] = {
8153 .type = HDA_FIXUP_FUNC,
8154 .v.func = alc294_fixup_gx502_hp,
8155 },
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05008156 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8157 .type = HDA_FIXUP_PINS,
8158 .v.pins = (const struct hda_pintbl[]) {
8159 { 0x19, 0x01a11050 }, /* rear HP mic */
8160 { 0x1a, 0x01a11830 }, /* rear external mic */
8161 { 0x21, 0x012110f0 }, /* rear HP out */
8162 { }
8163 },
8164 .chained = true,
8165 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8166 },
8167 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8168 .type = HDA_FIXUP_VERBS,
8169 .v.verbs = (const struct hda_verb[]) {
8170 /* set 0x15 to HP-OUT ctrl */
8171 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8172 /* unmute the 0x15 amp */
8173 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8174 /* set 0x1b to HP-OUT */
8175 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8176 { }
8177 },
8178 .chained = true,
8179 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8180 },
8181 [ALC294_FIXUP_ASUS_GU502_HP] = {
8182 .type = HDA_FIXUP_FUNC,
8183 .v.func = alc294_fixup_gu502_hp,
8184 },
Takashi Iwai1b94e592020-05-12 09:32:03 +02008185 [ALC294_FIXUP_ASUS_COEF_1B] = {
8186 .type = HDA_FIXUP_VERBS,
8187 .v.verbs = (const struct hda_verb[]) {
8188 /* Set bit 10 to correct noisy output after reboot from
8189 * Windows 10 (due to pop noise reduction?)
8190 */
8191 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8192 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8193 { }
8194 },
Takashi Iwaif8fbcdf2021-06-20 08:59:52 +02008195 .chained = true,
8196 .chain_id = ALC289_FIXUP_ASUS_GA401,
Takashi Iwai1b94e592020-05-12 09:32:03 +02008197 },
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08008198 [ALC285_FIXUP_HP_GPIO_LED] = {
8199 .type = HDA_FIXUP_FUNC,
8200 .v.func = alc285_fixup_hp_gpio_led,
8201 },
Kailang Yang431e76c2020-04-07 14:40:20 +08008202 [ALC285_FIXUP_HP_MUTE_LED] = {
8203 .type = HDA_FIXUP_FUNC,
8204 .v.func = alc285_fixup_hp_mute_led,
8205 },
Jeremy Szue7d66cf2021-03-16 15:46:24 +08008206 [ALC236_FIXUP_HP_GPIO_LED] = {
8207 .type = HDA_FIXUP_FUNC,
8208 .v.func = alc236_fixup_hp_gpio_led,
8209 },
Kailang Yang24164f42020-04-07 14:52:42 +08008210 [ALC236_FIXUP_HP_MUTE_LED] = {
8211 .type = HDA_FIXUP_FUNC,
8212 .v.func = alc236_fixup_hp_mute_led,
8213 },
Jonas Witschel75b62ab2021-04-16 12:58:54 +02008214 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8215 .type = HDA_FIXUP_FUNC,
8216 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8217 },
Mike Pozulp14425f12020-05-09 20:28:37 -07008218 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8219 .type = HDA_FIXUP_VERBS,
8220 .v.verbs = (const struct hda_verb[]) {
8221 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8222 { }
8223 },
8224 },
Chris Chiu9e433422020-05-12 14:15:24 +08008225 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8226 .type = HDA_FIXUP_PINS,
8227 .v.pins = (const struct hda_pintbl[]) {
8228 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8229 { }
8230 },
8231 .chained = true,
8232 .chain_id = ALC269_FIXUP_HEADSET_MODE
8233 },
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08008234 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8235 .type = HDA_FIXUP_PINS,
8236 .v.pins = (const struct hda_pintbl[]) {
8237 { 0x14, 0x90100120 }, /* use as internal speaker */
8238 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8239 { 0x1a, 0x01011020 }, /* use as line out */
8240 { },
8241 },
8242 .chained = true,
8243 .chain_id = ALC269_FIXUP_HEADSET_MIC
8244 },
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08008245 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8246 .type = HDA_FIXUP_PINS,
8247 .v.pins = (const struct hda_pintbl[]) {
8248 { 0x18, 0x02a11030 }, /* use as headset mic */
8249 { }
8250 },
8251 .chained = true,
8252 .chain_id = ALC269_FIXUP_HEADSET_MIC
8253 },
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08008254 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8255 .type = HDA_FIXUP_PINS,
8256 .v.pins = (const struct hda_pintbl[]) {
8257 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8258 { }
8259 },
8260 .chained = true,
8261 .chain_id = ALC269_FIXUP_HEADSET_MIC
8262 },
Armas Spann293a92c2020-07-24 16:08:37 +02008263 [ALC289_FIXUP_ASUS_GA401] = {
Takashi Iwaic84bfed2020-11-27 15:11:04 +01008264 .type = HDA_FIXUP_FUNC,
8265 .v.func = alc289_fixup_asus_ga401,
8266 .chained = true,
8267 .chain_id = ALC289_FIXUP_ASUS_GA502,
Armas Spannff536642020-07-11 13:05:57 +02008268 },
Armas Spann4b43d052020-07-24 16:06:16 +02008269 [ALC289_FIXUP_ASUS_GA502] = {
8270 .type = HDA_FIXUP_PINS,
8271 .v.pins = (const struct hda_pintbl[]) {
8272 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8273 { }
8274 },
8275 },
Jian-Hong Panf50a1212020-07-13 14:04:22 +08008276 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8277 .type = HDA_FIXUP_PINS,
8278 .v.pins = (const struct hda_pintbl[]) {
8279 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8280 { }
8281 },
8282 .chained = true,
8283 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8284 },
Kailang Yang56496252020-07-29 15:09:27 +08008285 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8286 .type = HDA_FIXUP_FUNC,
8287 .v.func = alc285_fixup_hp_gpio_amp_init,
8288 .chained = true,
8289 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8290 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008291 [ALC269_FIXUP_CZC_B20] = {
8292 .type = HDA_FIXUP_PINS,
8293 .v.pins = (const struct hda_pintbl[]) {
8294 { 0x12, 0x411111f0 },
8295 { 0x14, 0x90170110 }, /* speaker */
8296 { 0x15, 0x032f1020 }, /* HP out */
8297 { 0x17, 0x411111f0 },
8298 { 0x18, 0x03ab1040 }, /* mic */
8299 { 0x19, 0xb7a7013f },
8300 { 0x1a, 0x0181305f },
8301 { 0x1b, 0x411111f0 },
8302 { 0x1d, 0x411111f0 },
8303 { 0x1e, 0x411111f0 },
8304 { }
8305 },
8306 .chain_id = ALC269_FIXUP_DMIC,
8307 },
8308 [ALC269_FIXUP_CZC_TMI] = {
8309 .type = HDA_FIXUP_PINS,
8310 .v.pins = (const struct hda_pintbl[]) {
8311 { 0x12, 0x4000c000 },
8312 { 0x14, 0x90170110 }, /* speaker */
8313 { 0x15, 0x0421401f }, /* HP out */
8314 { 0x17, 0x411111f0 },
8315 { 0x18, 0x04a19020 }, /* mic */
8316 { 0x19, 0x411111f0 },
8317 { 0x1a, 0x411111f0 },
8318 { 0x1b, 0x411111f0 },
8319 { 0x1d, 0x40448505 },
8320 { 0x1e, 0x411111f0 },
8321 { 0x20, 0x8000ffff },
8322 { }
8323 },
8324 .chain_id = ALC269_FIXUP_DMIC,
8325 },
8326 [ALC269_FIXUP_CZC_L101] = {
8327 .type = HDA_FIXUP_PINS,
8328 .v.pins = (const struct hda_pintbl[]) {
8329 { 0x12, 0x40000000 },
8330 { 0x14, 0x01014010 }, /* speaker */
8331 { 0x15, 0x411111f0 }, /* HP out */
8332 { 0x16, 0x411111f0 },
8333 { 0x18, 0x01a19020 }, /* mic */
8334 { 0x19, 0x02a19021 },
8335 { 0x1a, 0x0181302f },
8336 { 0x1b, 0x0221401f },
8337 { 0x1c, 0x411111f0 },
8338 { 0x1d, 0x4044c601 },
8339 { 0x1e, 0x411111f0 },
8340 { }
8341 },
8342 .chain_id = ALC269_FIXUP_DMIC,
8343 },
8344 [ALC269_FIXUP_LEMOTE_A1802] = {
8345 .type = HDA_FIXUP_PINS,
8346 .v.pins = (const struct hda_pintbl[]) {
8347 { 0x12, 0x40000000 },
8348 { 0x14, 0x90170110 }, /* speaker */
8349 { 0x17, 0x411111f0 },
8350 { 0x18, 0x03a19040 }, /* mic1 */
8351 { 0x19, 0x90a70130 }, /* mic2 */
8352 { 0x1a, 0x411111f0 },
8353 { 0x1b, 0x411111f0 },
8354 { 0x1d, 0x40489d2d },
8355 { 0x1e, 0x411111f0 },
8356 { 0x20, 0x0003ffff },
8357 { 0x21, 0x03214020 },
8358 { }
8359 },
8360 .chain_id = ALC269_FIXUP_DMIC,
8361 },
8362 [ALC269_FIXUP_LEMOTE_A190X] = {
8363 .type = HDA_FIXUP_PINS,
8364 .v.pins = (const struct hda_pintbl[]) {
8365 { 0x14, 0x99130110 }, /* speaker */
8366 { 0x15, 0x0121401f }, /* HP out */
8367 { 0x18, 0x01a19c20 }, /* rear mic */
8368 { 0x19, 0x99a3092f }, /* front mic */
8369 { 0x1b, 0x0201401f }, /* front lineout */
8370 { }
8371 },
8372 .chain_id = ALC269_FIXUP_DMIC,
8373 },
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08008374 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8375 .type = HDA_FIXUP_PINS,
8376 .v.pins = (const struct hda_pintbl[]) {
8377 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8378 { }
8379 },
8380 .chained = true,
8381 .chain_id = ALC269_FIXUP_HEADSET_MODE
8382 },
Werner Sembach73e71612021-03-02 19:04:14 +01008383 [ALC256_FIXUP_INTEL_NUC10] = {
8384 .type = HDA_FIXUP_PINS,
8385 .v.pins = (const struct hda_pintbl[]) {
8386 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8387 { }
8388 },
8389 .chained = true,
8390 .chain_id = ALC269_FIXUP_HEADSET_MODE
8391 },
Hui Wangfc19d552020-09-09 10:00:41 +08008392 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8393 .type = HDA_FIXUP_VERBS,
8394 .v.verbs = (const struct hda_verb[]) {
8395 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8396 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8397 { }
8398 },
8399 .chained = true,
Takashi Iwaic84bfed2020-11-27 15:11:04 +01008400 .chain_id = ALC289_FIXUP_ASUS_GA502
Hui Wangfc19d552020-09-09 10:00:41 +08008401 },
Hui Wang13468bf2020-09-28 16:01:17 +08008402 [ALC274_FIXUP_HP_MIC] = {
8403 .type = HDA_FIXUP_VERBS,
8404 .v.verbs = (const struct hda_verb[]) {
8405 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8406 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8407 { }
8408 },
8409 },
Kailang Yang8a8de09c2020-10-27 16:46:38 +08008410 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8411 .type = HDA_FIXUP_FUNC,
8412 .v.func = alc274_fixup_hp_headset_mic,
8413 .chained = true,
8414 .chain_id = ALC274_FIXUP_HP_MIC
8415 },
Takashi Iwai622464c2021-05-04 11:18:02 +02008416 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8417 .type = HDA_FIXUP_FUNC,
8418 .v.func = alc274_fixup_hp_envy_gpio,
8419 },
Kailang Yangef9ce662020-11-03 15:40:35 +08008420 [ALC256_FIXUP_ASUS_HPE] = {
8421 .type = HDA_FIXUP_VERBS,
8422 .v.verbs = (const struct hda_verb[]) {
8423 /* Set EAPD high */
8424 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8425 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8426 { }
8427 },
8428 .chained = true,
8429 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8430 },
Kailang Yang446b8182020-11-02 15:00:12 +08008431 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8432 .type = HDA_FIXUP_FUNC,
8433 .v.func = alc_fixup_headset_jack,
8434 .chained = true,
8435 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8436 },
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008437 [ALC287_FIXUP_HP_GPIO_LED] = {
8438 .type = HDA_FIXUP_FUNC,
8439 .v.func = alc287_fixup_hp_gpio_led,
8440 },
Kailang Yang9e885772020-11-03 15:30:51 +08008441 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8442 .type = HDA_FIXUP_FUNC,
8443 .v.func = alc274_fixup_hp_headset_mic,
8444 },
Kailang Yang92666d42020-11-19 17:04:21 +08008445 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8446 .type = HDA_FIXUP_FUNC,
8447 .v.func = alc_fixup_no_int_mic,
8448 .chained = true,
8449 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8450 },
Chris Chiu34cdf402020-12-16 20:52:00 +08008451 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8452 .type = HDA_FIXUP_PINS,
8453 .v.pins = (const struct hda_pintbl[]) {
8454 { 0x1b, 0x411111f0 },
8455 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8456 { },
8457 },
8458 .chained = true,
8459 .chain_id = ALC269_FIXUP_HEADSET_MODE
8460 },
Chris Chiu495dc762021-01-14 16:27:28 +08008461 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8462 .type = HDA_FIXUP_FUNC,
8463 .v.func = alc269_fixup_limit_int_mic_boost,
8464 .chained = true,
8465 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8466 },
Chris Chiud0e18562021-02-26 09:04:40 +08008467 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8468 .type = HDA_FIXUP_PINS,
8469 .v.pins = (const struct hda_pintbl[]) {
8470 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8471 { 0x1a, 0x90a1092f }, /* use as internal mic */
8472 { }
8473 },
8474 .chained = true,
8475 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8476 },
Takashi Iwai26928ca2021-04-16 10:12:11 +02008477 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8478 .type = HDA_FIXUP_FUNC,
8479 .v.func = alc285_fixup_ideapad_s740_coef,
8480 .chained = true,
8481 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8482 },
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008483 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8484 .type = HDA_FIXUP_FUNC,
8485 .v.func = alc269_fixup_limit_int_mic_boost,
8486 .chained = true,
8487 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8488 },
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008489 [ALC295_FIXUP_ASUS_DACS] = {
8490 .type = HDA_FIXUP_FUNC,
8491 .v.func = alc295_fixup_asus_dacs,
8492 },
Takashi Iwai5d84b532021-05-04 14:18:32 +02008493 [ALC295_FIXUP_HP_OMEN] = {
8494 .type = HDA_FIXUP_PINS,
8495 .v.pins = (const struct hda_pintbl[]) {
8496 { 0x12, 0xb7a60130 },
8497 { 0x13, 0x40000000 },
8498 { 0x14, 0x411111f0 },
8499 { 0x16, 0x411111f0 },
8500 { 0x17, 0x90170110 },
8501 { 0x18, 0x411111f0 },
8502 { 0x19, 0x02a11030 },
8503 { 0x1a, 0x411111f0 },
8504 { 0x1b, 0x04a19030 },
8505 { 0x1d, 0x40600001 },
8506 { 0x1e, 0x411111f0 },
8507 { 0x21, 0x03211020 },
8508 {}
8509 },
8510 .chained = true,
8511 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8512 },
Elia Devitof2be77f2021-05-11 14:46:49 +02008513 [ALC285_FIXUP_HP_SPECTRE_X360] = {
Elia Devito434591b2021-06-19 22:41:04 +02008514 .type = HDA_FIXUP_FUNC,
8515 .v.func = alc285_fixup_hp_spectre_x360,
Elia Devitof2be77f2021-05-11 14:46:49 +02008516 },
Davide Baldod94befb2021-10-15 09:21:22 +02008517 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8518 .type = HDA_FIXUP_FUNC,
8519 .v.func = alc285_fixup_hp_spectre_x360_eb1
8520 },
Hui Wang9ebaef02021-05-22 12:26:45 +08008521 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8522 .type = HDA_FIXUP_FUNC,
8523 .v.func = alc285_fixup_ideapad_s740_coef,
8524 .chained = true,
8525 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8526 },
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03008527 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8528 .type = HDA_FIXUP_FUNC,
8529 .v.func = alc_fixup_no_shutup,
8530 .chained = true,
8531 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8532 },
Hui Wang57c9e212021-06-08 10:46:00 +08008533 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8534 .type = HDA_FIXUP_PINS,
8535 .v.pins = (const struct hda_pintbl[]) {
8536 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8537 { }
8538 },
8539 .chained = true,
8540 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8541 },
Kai-Heng Feng8903376d2021-08-18 22:41:18 +08008542 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8543 .type = HDA_FIXUP_FUNC,
8544 .v.func = alc269_fixup_limit_int_mic_boost,
8545 .chained = true,
8546 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8547 },
Baole Fang8f4c9042022-01-05 22:08:54 +08008548 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8549 .type = HDA_FIXUP_FUNC,
8550 .v.func = alc285_fixup_ideapad_s740_coef,
8551 .chained = true,
8552 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8553 },
8554 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8555 .type = HDA_FIXUP_FUNC,
8556 .v.func = alc287_fixup_legion_15imhg05_speakers,
8557 .chained = true,
8558 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8559 },
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07008560 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8561 .type = HDA_FIXUP_VERBS,
8562 //.v.verbs = legion_15imhg05_coefs,
8563 .v.verbs = (const struct hda_verb[]) {
8564 // set left speaker Legion 7i.
8565 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8566 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8567
8568 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8569 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8570 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8571 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8572 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8573
8574 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8575 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8576 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8577 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8578 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8579
8580 // set right speaker Legion 7i.
8581 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8582 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8583
8584 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8585 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8586 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8587 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8588 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8589
8590 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8591 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8592 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8593 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8594 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8595 {}
8596 },
8597 .chained = true,
8598 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8599 },
8600 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8601 .type = HDA_FIXUP_FUNC,
8602 .v.func = alc287_fixup_legion_15imhg05_speakers,
8603 .chained = true,
8604 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8605 },
8606 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8607 .type = HDA_FIXUP_VERBS,
8608 .v.verbs = (const struct hda_verb[]) {
8609 // set left speaker Yoga 7i.
8610 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8611 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8612
8613 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8614 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8615 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8616 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8617 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8618
8619 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8620 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8621 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8622 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8623 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8624
8625 // set right speaker Yoga 7i.
8626 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8627 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8628
8629 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8630 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8631 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8632 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8633 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8634
8635 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8636 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8637 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8638 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8639 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8640 {}
8641 },
8642 .chained = true,
8643 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8644 },
8645 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8646 .type = HDA_FIXUP_VERBS,
8647 .v.verbs = (const struct hda_verb[]) {
8648 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8649 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
Cameron Berkenpas023a0622021-10-10 15:54:11 -07008650 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07008651 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8652 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8653 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8654 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8655 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8656 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8657 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8658 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8659 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8660 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8661 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8662 {}
8663 },
8664 .chained = true,
8665 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8666 },
Werner Sembach619764c2021-12-02 17:50:10 +01008667 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02008668 .type = HDA_FIXUP_FUNC,
Werner Sembach619764c2021-12-02 17:50:10 +01008669 .v.func = alc256_fixup_set_coef_defaults,
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02008670 },
Johnathon Clark5fc462c2021-10-20 14:12:51 +01008671 [ALC245_FIXUP_HP_GPIO_LED] = {
8672 .type = HDA_FIXUP_FUNC,
8673 .v.func = alc245_fixup_hp_gpio_led,
8674 },
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06008675 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8676 .type = HDA_FIXUP_PINS,
8677 .v.pins = (const struct hda_pintbl[]) {
8678 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8679 { }
8680 },
8681 .chained = true,
8682 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8683 },
Werner Sembach174a7fb2021-11-12 12:07:04 +01008684 [ALC233_FIXUP_NO_AUDIO_JACK] = {
8685 .type = HDA_FIXUP_FUNC,
8686 .v.func = alc233_fixup_no_audio_jack,
8687 },
Werner Sembachedca7cc2021-12-15 20:16:46 +01008688 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
8689 .type = HDA_FIXUP_FUNC,
8690 .v.func = alc256_fixup_mic_no_presence_and_resume,
8691 .chained = true,
8692 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8693 },
Lucas Tanured3dca022021-12-17 11:57:07 +00008694 [ALC287_FIXUP_LEGION_16ACHG6] = {
8695 .type = HDA_FIXUP_FUNC,
8696 .v.func = alc287_fixup_legion_16achg6_speakers,
8697 },
Stefan Bindingae7abe32021-12-17 11:57:08 +00008698 [ALC287_FIXUP_CS35L41_I2C_2] = {
8699 .type = HDA_FIXUP_FUNC,
8700 .v.func = cs35l41_fixup_i2c_two,
8701 },
Alexander Sergeyev91502a92022-01-14 19:50:50 +03008702 [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
8703 .type = HDA_FIXUP_VERBS,
8704 .v.verbs = (const struct hda_verb[]) {
8705 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
8706 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
8707 { }
8708 },
8709 .chained = true,
8710 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8711 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02008712};
8713
8714static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01008715 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02008716 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8717 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008718 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02008719 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008720 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8721 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05008722 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01008723 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02008724 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Takashi Iwai433f8942021-04-28 13:26:56 +02008725 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
Takashi Iwaic8426b22021-04-07 11:57:30 +02008726 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
Chris Chiu13be30f2020-12-22 23:04:59 +08008727 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
Chris Chiu705b65f2018-12-05 14:48:54 +08008728 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08008729 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01008730 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiu495dc762021-01-14 16:27:28 +08008731 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
Chris Chiuc7531e32019-03-21 17:17:31 +08008732 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8733 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiu13be30f2020-12-22 23:04:59 +08008734 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8735 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008736 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08008737 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08008738 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiud0e18562021-02-26 09:04:40 +08008739 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08008740 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8741 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8742 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Chris Chiud0e18562021-02-26 09:04:40 +08008743 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
Nikos Liolios35171fb2021-07-27 06:05:10 +03008744 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
Jian-Hong Pan2733cce2019-03-21 16:39:04 +08008745 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08008746 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08008747 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
Jaroslav Kysela2a5bb692021-11-04 16:57:26 +01008748 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Alexander Monakov0d4867a2021-07-21 20:01:41 +03008749 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Jian-Hong Panf50a1212020-07-13 14:04:22 +08008750 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
Hui Wang57c9e212021-06-08 10:46:00 +08008751 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008752 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08008753 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01008754 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01008755 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02008756 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8757 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008758 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02008759 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8760 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8761 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01008762 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8763 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01008764 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02008765 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008766 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08008767 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8768 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08008769 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02008770 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02008771 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08008772 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08008773 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8774 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01008775 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8776 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8777 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8778 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8779 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08008780 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08008781 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01008782 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08008783 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08008784 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwai493de342017-02-28 17:27:57 +01008785 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008786 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Kailang Yang5f364132017-07-25 16:28:16 +08008787 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08008788 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8789 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08008790 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8791 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08008792 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yang136824e2019-03-14 16:22:45 +08008793 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
Kailang Yangda484d02019-03-14 15:50:59 +08008794 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08008795 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yange79c2262019-12-19 14:12:15 +08008796 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008797 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Kailang Yang78def222020-02-20 15:21:54 +08008798 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8799 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
Kailang Yang92666d42020-11-19 17:04:21 +08008800 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8801 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
Kailang Yangc1e89522020-12-23 15:34:57 +08008802 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
Kristin Pagetda946922021-08-14 15:46:05 -07008803 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
John Liueb676622021-09-30 13:53:16 +02008804 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
Chris Chiu2b987fe2021-10-01 14:28:56 +08008805 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8806 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
Kailang Yanga22aa262014-04-23 17:34:28 +08008807 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8808 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01008809 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008810 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01008811 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
Hui Wang7976eb42015-02-13 11:14:41 +08008812 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008813 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008814 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008815 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8816 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8817 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8818 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008819 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8820 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8821 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8822 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008823 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008824 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8825 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8826 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8827 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8828 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008829 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008830 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008831 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08008832 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008833 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8834 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8835 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008836 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8837 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8838 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8839 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8840 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008841 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008842 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008843 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008844 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008845 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08008846 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008847 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008848 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008849 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008850 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8851 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8852 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8853 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8854 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008855 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008856 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8857 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008858 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8859 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8860 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8861 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang8a02b162014-06-13 17:16:31 +08008862 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8863 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8864 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8865 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008866 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8867 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Kailang Yang1c9d9df2021-04-20 14:17:34 +08008868 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8869 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
Takashi Iwai563785e2018-11-12 09:43:12 +01008870 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08008871 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01008872 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Takashi Iwaiaeedad22020-11-28 10:00:15 +01008873 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008874 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8875 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05008876 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Carlos M901be142021-05-31 22:20:26 +02008877 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai190d0382019-08-13 17:39:56 +02008878 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai5d84b532021-05-04 14:18:32 +02008879 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
Sam Bazleyd33cd422019-09-01 03:31:30 +01008880 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Elia Devitof2be77f2021-05-11 14:46:49 +02008881 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
Bradley Scottd296a742021-12-13 10:49:39 -05008882 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Takashi Iwai0ac05b22021-06-23 14:20:22 +02008883 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008884 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Takashi Iwai622464c2021-05-04 11:18:02 +02008885 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
Jeremy Szu15d295b2021-06-05 16:25:36 +08008886 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szu61d3e872021-06-05 16:25:37 +08008887 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Kai-Heng Fenga5980982020-12-30 20:56:35 +08008888 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengc0584932021-11-10 22:40:32 +08008889 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008890 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
Jonas Witschel75b62ab2021-04-16 12:58:54 +02008891 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Takashi Iwai05ec7162021-11-18 08:16:36 +01008892 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Kailang Yang56496252020-07-29 15:09:27 +08008893 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Qiu Wenbo08befca2020-10-02 20:44:54 +08008894 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang431e76c2020-04-07 14:40:20 +08008895 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang24164f42020-04-07 14:52:42 +08008896 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Jeremy Szu91bc1562021-01-06 21:05:46 +08008897 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8898 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8899 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8900 ALC285_FIXUP_HP_GPIO_AMP_INIT),
Takashi Iwai375f8422021-10-28 09:09:11 +02008901 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
Manuel Jiménez48422952020-12-29 15:38:56 +01008902 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
Jeremy Szue7d66cf2021-03-16 15:46:24 +08008903 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Andy Chi2b70b262021-07-01 17:14:13 +08008904 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Andy Chifb3acdb2021-07-01 17:14:15 +08008905 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Jeremy Szu417eadf2021-03-30 19:44:27 +08008906 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008907 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8908 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
Johnathon Clark93ab3ea2021-08-23 17:21:10 +01008909 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01008910 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
Jeremy Szud07149a2021-08-10 18:08:45 +08008911 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Jeremy Szudfc2e8a2021-06-25 21:34:13 +08008912 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Davide Baldod94befb2021-10-15 09:21:22 +02008913 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8914 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
Jeremy Szu53b861b2021-03-16 17:42:35 +08008915 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuc3d2c882021-06-18 01:14:20 +08008916 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szudfb06402021-06-05 16:25:38 +08008917 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuca688332021-03-16 14:54:50 +08008918 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Feng8903376d2021-08-18 22:41:18 +08008919 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8920 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
Jeremy Szu50dbfae2021-05-20 01:03:56 +08008921 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szue650c1a2021-05-20 01:03:55 +08008922 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szubbe183e2021-05-20 01:03:54 +08008923 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szu600dd2a2021-06-08 19:47:48 +08008924 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
Alexander Sergeyev91502a92022-01-14 19:50:50 +03008925 SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
Jeremy Szu0e68c4b2021-05-20 01:03:53 +08008926 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008927 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
Frank Schäfer42334fb2021-07-03 15:54:16 +02008928 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
Kai-Heng Feng08977fe2021-12-24 11:50:13 +08008929 SND_PCI_QUIRK(0x103c, 0x89c3, "HP", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuf7ac5702021-12-15 00:41:54 +08008930 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008931 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02008932 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02008933 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01008934 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008935 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008936 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02008937 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008938 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008939 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Chris Chiu5cfca592020-12-07 15:27:55 +08008940 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008941 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8942 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008943 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008944 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008945 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01008946 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01008947 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02008948 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008949 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
Chris Chiu48e01502019-12-30 11:11:18 +08008950 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
Luke D Jones739d0952021-08-07 14:58:05 +12008951 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008952 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
Daniel Drake8c8967a2019-10-17 16:15:01 +08008953 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
Adam Barber4963d662020-04-10 17:00:32 +08008954 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
Kailang Yang158ae2f2020-07-16 15:21:59 +08008955 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
Takashi Iwai4fad4fb2021-11-07 09:33:39 +01008956 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
Jian-Hong Pan5de3b942021-01-22 13:47:06 +08008957 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08008958 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan7900e812020-05-12 14:15:28 +08008959 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai017f2a12011-07-09 14:42:25 +02008960 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06008961 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai1b94e592020-05-12 09:32:03 +02008962 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
David Henningsson693b6132012-06-22 19:12:10 +02008963 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06008964 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008965 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008966 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Kailang Yangef9ce662020-11-03 15:40:35 +08008967 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
Armas Spann4b43d052020-07-24 16:06:16 +02008968 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05008969 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
Luke D Jones76fae612021-04-19 15:04:11 +12008970 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
Armas Spann293a92c2020-07-24 16:08:37 +02008971 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
Chris Chiueeed4cd2017-02-28 14:17:15 -06008972 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02008973 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
8974 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
8975 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
8976 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02008977 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwai1d045db2011-07-07 18:23:21 +02008978 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
8979 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
8980 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02008981 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwaicab561f2021-04-28 13:26:59 +02008982 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
8983 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai24519912011-08-16 15:08:49 +02008984 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02008985 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02008986 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01008987 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
Takashi Iwaic656f742021-04-28 13:27:01 +02008988 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
David Henningsson2041d562014-06-13 11:15:44 +02008989 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08008990 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
Takashi Iwaic656f742021-04-28 13:27:01 +02008991 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
PeiSen Hou6fa38ef2020-07-27 13:56:47 +02008992 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
PeiSen Houce2e79b2020-12-31 11:57:28 +01008993 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
8994 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09008995 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02008996 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Mike Pozulp14425f12020-05-09 20:28:37 -07008997 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
8998 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Mike Pozulpf70fff82020-08-13 21:53:44 -07008999 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Adrien Crivelli8bcea6c2020-08-26 17:40:14 +09009000 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01009001 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Joonho Wohn568e4e82020-07-18 17:23:15 +09009002 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Takashi Iwaic656f742021-04-28 13:27:01 +02009003 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Anisse Astierabaa22742016-08-24 09:14:13 +02009004 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
9005 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01009006 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
Chris Chiu6ca653e2020-12-22 23:04:58 +08009007 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009008 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02009009 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009010 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9011 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9012 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9013 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9014 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9015 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9016 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9017 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9018 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9019 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06009020 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9021 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009022 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9023 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9024 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9025 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9026 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06009027 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9028 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009029 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02009030 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009031 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02009032 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9033 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009034 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9035 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9036 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9037 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9038 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02009039 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9040 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9041 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9042 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009043 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9044 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9045 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9046 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9047 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02009048 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9049 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9050 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9051 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9052 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009053 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9054 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembachedca7cc2021-12-15 20:16:46 +01009055 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009056 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9057 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9058 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9059 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02009060 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009061 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9062 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02009063 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9064 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02009065 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9066 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9067 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9068 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9069 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9070 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Kailang Yangca169cc2017-04-25 16:17:40 +08009071 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03009072 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009073 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
9074 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
9075 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
9076 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
9077 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwaif552ff52021-04-28 13:27:00 +02009078 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwaib590b382020-05-14 18:05:33 +02009079 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
Felix Kaechelec8415a42012-08-06 23:02:01 +02009080 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02009081 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02009082 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02009083 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01009084 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02009085 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02009086 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05009087 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02009088 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01009089 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02009090 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01009091 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07009092 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02009093 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08009094 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9095 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02009096 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02009097 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08009098 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
9099 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9100 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01009101 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08009102 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9103 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9104 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01009105 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Benjamin Poirier9774dc22020-07-03 17:00:04 +09009106 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Hans de Goedeca707b32020-04-02 19:43:11 +02009107 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Kailang Yang446b8182020-11-02 15:00:12 +08009108 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9109 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
Stefan Bindingae7abe32021-12-17 11:57:08 +00009110 SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9111 SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9112 SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
Kailang3694cb22015-12-28 11:35:24 +08009113 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08009114 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08009115 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Dennis Wassenbergbef33e12019-06-28 10:54:53 +02009116 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08009117 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08009118 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08009119 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang2a36c162019-09-04 13:53:27 +08009120 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Aaron Ma8a6c55d2019-10-24 19:44:39 +08009121 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9122 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Hui Wange4efa822021-07-19 11:02:31 +08009123 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07009124 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
Takashi Iwai2aac5502022-01-05 17:03:21 +01009125 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
9126 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
9127 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
9128 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
Bart Kroonb81e9e52021-12-13 19:20:43 +01009129 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
Takashi Iwai2aac5502022-01-05 17:03:21 +01009130 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
Lucas Tanured3dca022021-12-17 11:57:07 +00009131 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
Takashi Iwai2aac5502022-01-05 17:03:21 +01009132 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07009133 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9134 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
David Henningsson56f27012016-01-11 09:33:14 +01009135 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01009136 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Michał Wadowski56df90b2019-05-14 16:58:00 +02009137 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaif552ff52021-04-28 13:27:00 +02009138 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
David Henningssona4a9e082013-08-16 14:09:01 +02009139 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02009140 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02009141 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02009142 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02009143 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01009144 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02009145 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02009146 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08009147 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02009148 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02009149 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02009150 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08009151 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9152 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9153 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02009154 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08009155 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9156 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009157 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Werner Sembach174a7fb2021-11-12 12:07:04 +01009158 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04009159 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009160 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
9161 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
9162 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
Anisse Astier02b504d2013-06-03 11:53:10 +02009163 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaic656f742021-04-28 13:27:01 +02009164 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
9165 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
Werner Sembach619764c2021-12-02 17:50:10 +01009166 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
Hui Wangfc19d552020-09-09 10:00:41 +08009167 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Xiaoliang Yub95bc122021-03-16 00:49:00 +08009168 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang695d1ec2019-11-21 10:54:27 +08009169 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
Xiaoliang Yue1c86212021-03-13 07:54:53 +08009170 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Phil Calvind1ee66c2021-04-15 18:01:29 -04009171 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08009172 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
Werner Sembach73e71612021-03-02 19:04:14 +01009173 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
Takashi Iwaia4297b52011-08-23 18:40:12 +02009174
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01009175#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02009176 /* Below is a quirk table taken from the old code.
9177 * Basically the device should work as is without the fixup table.
9178 * If BIOS doesn't give a proper info, enable the corresponding
9179 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02009180 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02009181 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
9182 ALC269_FIXUP_AMIC),
9183 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02009184 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
9185 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
9186 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
9187 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
9188 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
9189 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
9190 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
9191 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
9192 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
9193 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
9194 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
9195 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
9196 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
9197 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
9198 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
9199 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
9200 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
9201 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
9202 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
9203 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
9204 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
9205 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
9206 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
9207 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
9208 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
9209 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
9210 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
9211 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
9212 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
9213 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
9214 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
9215 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
9216 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
9217 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
9218 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
9219 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
9220 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
9221 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
9222#endif
9223 {}
9224};
9225
David Henningsson214eef72014-07-22 14:09:35 +02009226static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9227 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9228 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9229 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9230 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04009231 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
David Henningsson214eef72014-07-22 14:09:35 +02009232 {}
9233};
9234
Takashi Iwai1727a772013-01-10 09:52:52 +01009235static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02009236 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9237 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02009238 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9239 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9240 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02009241 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02009242 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9243 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02009244 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwaib590b382020-05-14 18:05:33 +02009245 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01009246 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01009247 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02009248 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9249 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009250 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9251 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08009252 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08009253 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02009254 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01009255 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02009256 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwai399c01a2020-05-26 08:24:06 +02009257 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009258 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02009259 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02009260 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009261 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9262 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9263 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9264 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9265 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9266 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9267 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9268 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9269 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9270 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9271 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9272 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9273 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9274 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9275 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9276 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9277 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9278 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9279 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9280 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9281 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9282 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9283 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9284 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9285 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9286 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9287 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9288 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9289 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9290 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9291 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9292 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9293 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9294 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9295 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9296 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9297 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9298 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9299 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9300 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01009301 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009302 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
Takashi Iwaic8426b22021-04-07 11:57:30 +02009303 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009304 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9305 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9306 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9307 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9308 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9309 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9310 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9311 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9312 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9313 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9314 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9315 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9316 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9317 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009318 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9319 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9320 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08009321 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009322 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01009323 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009324 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9325 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9326 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9327 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9328 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9329 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9330 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9331 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9332 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9333 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9334 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9335 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9336 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9337 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9338 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9339 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9340 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yang8983eb62019-04-03 15:31:49 +08009341 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9342 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01009343 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02009344 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02009345 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
Mike Pozulp23dc9582020-08-16 21:32:17 -07009346 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
Hui Wangfc19d552020-09-09 10:00:41 +08009347 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
Hui Wang13468bf2020-09-28 16:01:17 +08009348 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01009349 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
Takashi Iwai5d84b532021-05-04 14:18:32 +02009350 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
Elia Devitof2be77f2021-05-11 14:46:49 +02009351 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
Davide Baldod94befb2021-10-15 09:21:22 +02009352 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
Hui Wang9ebaef02021-05-22 12:26:45 +08009353 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03009354 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
Hui Wang57c9e212021-06-08 10:46:00 +08009355 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
Bradley Scottaa723942021-12-13 11:22:47 -05009356 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02009357 {}
9358};
Kailang Yangcfc5a842016-02-03 15:20:39 +08009359#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08009360 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02009361
Hui Wange8191a82015-04-24 13:39:59 +08009362#define ALC256_STANDARD_PINS \
9363 {0x12, 0x90a60140}, \
9364 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08009365 {0x21, 0x02211020}
9366
David Henningssonfea185e2014-09-03 10:23:04 +02009367#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08009368 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08009369
David Henningssonfea185e2014-09-03 10:23:04 +02009370#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08009371 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02009372
9373#define ALC292_STANDARD_PINS \
9374 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08009375 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08009376
Hui Wang3f6409702016-09-11 11:26:16 +08009377#define ALC295_STANDARD_PINS \
9378 {0x12, 0xb7a60130}, \
9379 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08009380 {0x21, 0x04211020}
9381
Woodrow Shen703867e2015-08-05 12:34:12 +08009382#define ALC298_STANDARD_PINS \
9383 {0x12, 0x90a60130}, \
9384 {0x21, 0x03211020}
9385
Hui Wange1918932014-05-26 16:22:44 +08009386static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08009387 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9388 {0x14, 0x01014020},
9389 {0x17, 0x90170110},
9390 {0x18, 0x02a11030},
9391 {0x19, 0x0181303F},
9392 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06009393 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9394 {0x12, 0x90a601c0},
9395 {0x14, 0x90171120},
9396 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06009397 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9398 {0x14, 0x90170110},
9399 {0x1b, 0x90a70130},
9400 {0x21, 0x03211020}),
9401 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9402 {0x1a, 0x90a70130},
9403 {0x1b, 0x90170110},
9404 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01009405 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08009406 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08009407 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08009408 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01009409 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08009410 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08009411 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08009412 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08009413 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9414 ALC225_STANDARD_PINS,
9415 {0x12, 0xb7a60150},
9416 {0x14, 0x901701a0}),
9417 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9418 ALC225_STANDARD_PINS,
9419 {0x12, 0xb7a60150},
9420 {0x14, 0x901701b0}),
9421 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9422 ALC225_STANDARD_PINS,
9423 {0x12, 0xb7a60130},
9424 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05009425 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9426 {0x1b, 0x01111010},
9427 {0x1e, 0x01451130},
9428 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08009429 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9430 {0x12, 0x90a60140},
9431 {0x14, 0x90170110},
9432 {0x19, 0x02a11030},
9433 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08009434 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9435 {0x14, 0x90170110},
9436 {0x19, 0x02a11030},
9437 {0x1a, 0x02a11040},
9438 {0x1b, 0x01014020},
9439 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08009440 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9441 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08009442 {0x19, 0x02a11030},
9443 {0x1a, 0x02a11040},
9444 {0x1b, 0x01011020},
9445 {0x21, 0x0221101f}),
9446 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9447 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08009448 {0x19, 0x02a11020},
9449 {0x1a, 0x02a11030},
9450 {0x21, 0x0221101f}),
Kailang Yang92666d42020-11-19 17:04:21 +08009451 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9452 {0x21, 0x02211010}),
Kailang Yang9e885772020-11-03 15:30:51 +08009453 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9454 {0x14, 0x90170110},
9455 {0x19, 0x02a11020},
9456 {0x21, 0x02211030}),
Hui Wangc77900e2014-09-03 11:31:07 +08009457 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08009458 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08009459 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02009460 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08009461 {0x14, 0x90170130},
9462 {0x21, 0x02211040}),
9463 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02009464 {0x12, 0x90a60140},
9465 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02009466 {0x21, 0x02211020}),
9467 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9468 {0x12, 0x90a60160},
9469 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009470 {0x21, 0x02211030}),
9471 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08009472 {0x14, 0x90170110},
9473 {0x1b, 0x02011020},
9474 {0x21, 0x0221101f}),
9475 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08009476 {0x14, 0x90170110},
9477 {0x1b, 0x01011020},
9478 {0x21, 0x0221101f}),
9479 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02009480 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02009481 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02009482 {0x21, 0x0221103f}),
9483 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08009484 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08009485 {0x1b, 0x01011020},
9486 {0x21, 0x0221103f}),
9487 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9488 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08009489 {0x1b, 0x02011020},
9490 {0x21, 0x0221103f}),
9491 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08009492 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009493 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009494 {0x21, 0x0221105f}),
9495 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08009496 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009497 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009498 {0x21, 0x0221101f}),
9499 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02009500 {0x12, 0x90a60160},
9501 {0x14, 0x90170120},
9502 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02009503 {0x21, 0x0321102f}),
9504 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9505 {0x12, 0x90a60160},
9506 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02009507 {0x21, 0x02211040}),
9508 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9509 {0x12, 0x90a60160},
9510 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02009511 {0x21, 0x02211050}),
9512 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9513 {0x12, 0x90a60170},
9514 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009515 {0x21, 0x02211030}),
9516 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9517 {0x12, 0x90a60170},
9518 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02009519 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08009520 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08009521 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08009522 {0x14, 0x90171130},
9523 {0x21, 0x02211040}),
9524 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9525 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08009526 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08009527 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02009528 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02009529 {0x12, 0x90a60180},
9530 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02009531 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08009532 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9533 {0x12, 0x90a60180},
9534 {0x14, 0x90170120},
9535 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08009536 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9537 {0x1b, 0x01011020},
9538 {0x21, 0x02211010}),
Chris Chiuc1732ed2017-02-28 14:17:13 -06009539 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9540 {0x14, 0x90170110},
9541 {0x1b, 0x90a70130},
9542 {0x21, 0x04211020}),
9543 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9544 {0x14, 0x90170110},
9545 {0x1b, 0x90a70130},
9546 {0x21, 0x03211020}),
Jian-Hong Pane1037352019-03-22 11:37:18 +08009547 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiua806ef12019-03-22 11:37:20 +08009548 {0x12, 0x90a60130},
9549 {0x14, 0x90170110},
9550 {0x21, 0x03211020}),
9551 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan6ac371a2019-03-22 11:37:22 +08009552 {0x12, 0x90a60130},
9553 {0x14, 0x90170110},
9554 {0x21, 0x04211020}),
9555 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pane1037352019-03-22 11:37:18 +08009556 {0x1a, 0x90a70130},
9557 {0x1b, 0x90170110},
9558 {0x21, 0x03211020}),
Kailang Yang9e885772020-11-03 15:30:51 +08009559 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9560 {0x14, 0x90170110},
9561 {0x19, 0x02a11020},
9562 {0x21, 0x0221101f}),
Kailang Yang8a8de09c2020-10-27 16:46:38 +08009563 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9564 {0x17, 0x90170110},
9565 {0x19, 0x03a11030},
9566 {0x21, 0x03211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01009567 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9568 {0x12, 0x90a60130},
David Henningssoncf51eb92014-10-30 08:26:02 +01009569 {0x14, 0x90170110},
9570 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009571 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08009572 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9573 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08009574 {0x14, 0x90170110},
9575 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08009576 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08009577 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08009578 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02009579 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009580 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02009581 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02009582 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02009583 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08009584 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009585 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009586 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009587 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08009588 {0x21, 0x03211040}),
9589 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009590 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009591 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009592 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08009593 {0x21, 0x03211020}),
9594 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009595 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009596 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009597 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08009598 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08009599 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02009600 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08009601 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08009602 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08009603 {0x21, 0x04211020}),
Chris Chiu34cdf402020-12-16 20:52:00 +08009604 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9605 ALC282_STANDARD_PINS,
9606 {0x12, 0x90a609c0},
9607 {0x18, 0x03a11830},
9608 {0x19, 0x04a19831},
9609 {0x1a, 0x0481303f},
9610 {0x1b, 0x04211020},
9611 {0x21, 0x0321101f}),
9612 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9613 ALC282_STANDARD_PINS,
9614 {0x12, 0x90a60940},
9615 {0x18, 0x03a11830},
9616 {0x19, 0x04a19831},
9617 {0x1a, 0x0481303f},
9618 {0x1b, 0x04211020},
9619 {0x21, 0x0321101f}),
David Henningsson76c21322014-06-24 14:46:54 +02009620 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009621 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02009622 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02009623 {0x21, 0x0321101f}),
9624 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9625 {0x12, 0x90a60160},
9626 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009627 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08009628 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009629 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08009630 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08009631 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08009632 {0x21, 0x0321101f}),
Hui Wangc8c6ee62019-02-14 11:41:33 +08009633 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Sami Loone266fd992021-05-01 12:07:53 +02009634 {0x12, 0x90a60130},
9635 {0x14, 0x90170110},
9636 {0x19, 0x04a11040},
9637 {0x21, 0x04211020}),
9638 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9639 {0x14, 0x90170110},
9640 {0x19, 0x04a11040},
9641 {0x1d, 0x40600001},
9642 {0x21, 0x04211020}),
9643 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Hui Wangc4cfcf62018-11-26 14:17:16 +08009644 {0x14, 0x90170110},
9645 {0x19, 0x04a11040},
9646 {0x21, 0x04211020}),
Hui Wangc72b9bf2020-12-05 13:11:30 +08009647 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9648 {0x14, 0x90170110},
9649 {0x17, 0x90170111},
9650 {0x19, 0x03a11030},
9651 {0x21, 0x03211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08009652 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9653 {0x12, 0x90a60130},
9654 {0x17, 0x90170110},
9655 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02009656 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08009657 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08009658 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08009659 {0x21, 0x0321101f}),
Hui Wange4442bc2014-09-03 11:31:09 +08009660 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009661 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009662 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08009663 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08009664 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009665 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009666 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009667 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08009668 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08009669 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009670 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009671 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009672 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009673 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009674 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009675 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009676 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009677 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08009678 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009679 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009680 {0x14, 0x90170110},
9681 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009682 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08009683 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009684 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009685 {0x14, 0x90170110},
9686 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009687 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009688 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009689 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009690 {0x14, 0x90170110},
9691 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009692 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08009693 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009694 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08009695 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08009696 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08009697 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08009698 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009699 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08009700 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08009701 {0x16, 0x01014020},
9702 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08009703 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02009704 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009705 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08009706 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02009707 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009708 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02009709 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02009710 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08009711 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02009712 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009713 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08009714 {0x13, 0x90a60140}),
Jian-Hong Paneeacd802020-11-24 17:20:25 +08009715 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9716 {0x17, 0x90170110},
9717 {0x21, 0x04211020}),
Chris Chiud8ae4582018-12-07 17:17:11 +08009718 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9719 {0x14, 0x90170110},
9720 {0x1b, 0x90a70130},
9721 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08009722 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9723 {0x12, 0x90a60130},
9724 {0x17, 0x90170110},
Jian-Hong Pan8bb37a22019-02-21 17:00:18 +08009725 {0x21, 0x03211020}),
9726 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9727 {0x12, 0x90a60130},
9728 {0x17, 0x90170110},
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08009729 {0x21, 0x04211020}),
Takashi Iwai3887c262019-04-30 15:10:01 +02009730 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9731 {0x12, 0x90a60130},
9732 {0x17, 0x90170110},
9733 {0x21, 0x03211020}),
Chris Chiu9e433422020-05-12 14:15:24 +08009734 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Panad97d662020-05-12 14:15:26 +08009735 {0x12, 0x90a60120},
9736 {0x17, 0x90170110},
9737 {0x21, 0x04211030}),
9738 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiu9e433422020-05-12 14:15:24 +08009739 {0x12, 0x90a60130},
9740 {0x17, 0x90170110},
9741 {0x21, 0x03211020}),
9742 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9743 {0x12, 0x90a60130},
9744 {0x17, 0x90170110},
9745 {0x21, 0x03211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08009746 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Kailang Yang0a29c572019-04-24 16:34:25 +08009747 {0x14, 0x90170110},
9748 {0x21, 0x04211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08009749 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9750 {0x14, 0x90170110},
9751 {0x21, 0x04211030}),
Hui Wang3f6409702016-09-11 11:26:16 +08009752 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08009753 ALC295_STANDARD_PINS,
9754 {0x17, 0x21014020},
9755 {0x18, 0x21a19030}),
9756 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9757 ALC295_STANDARD_PINS,
9758 {0x17, 0x21014040},
9759 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08009760 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9761 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08009762 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08009763 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02009764 {0x17, 0x90170110}),
9765 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9766 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08009767 {0x17, 0x90170140}),
9768 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9769 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02009770 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08009771 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9772 {0x12, 0xb7a60140},
9773 {0x13, 0xb7a60150},
9774 {0x17, 0x90170110},
9775 {0x1a, 0x03011020},
9776 {0x21, 0x03211030}),
James McDonnell54324222019-09-16 14:53:38 +00009777 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9778 {0x12, 0xb7a60140},
9779 {0x17, 0x90170110},
9780 {0x1a, 0x03a11030},
9781 {0x21, 0x03211020}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08009782 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9783 ALC225_STANDARD_PINS,
9784 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08009785 {0x17, 0x90170110}),
Hui Wang573fcbf2020-06-08 19:55:41 +08009786 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9787 {0x14, 0x01014010},
9788 {0x17, 0x90170120},
9789 {0x18, 0x02a11030},
9790 {0x19, 0x02a1103f},
9791 {0x21, 0x0221101f}),
Hui Wange1918932014-05-26 16:22:44 +08009792 {}
9793};
Takashi Iwai1d045db2011-07-07 18:23:21 +02009794
Hui Wang7c0a6932019-08-16 14:27:40 +08009795/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9796 * more machines, don't need to match all valid pins, just need to match
9797 * all the pins defined in the tbl. Just because of this reason, it is possible
9798 * that a single machine matches multiple tbls, so there is one limitation:
9799 * at most one tbl is allowed to define for the same vendor and same codec
9800 */
9801static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9802 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9803 {0x19, 0x40000000},
9804 {0x1b, 0x40000000}),
Hui Wangaed8c7f2019-11-21 10:26:43 +08009805 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9806 {0x19, 0x40000000},
9807 {0x1a, 0x40000000}),
Hui Wangd64ebdb2019-11-21 10:26:44 +08009808 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9809 {0x19, 0x40000000},
9810 {0x1a, 0x40000000}),
Hui Wang5815bdf2019-12-11 13:13:21 +08009811 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9812 {0x19, 0x40000000},
9813 {0x1a, 0x40000000}),
Hui Wang7c0a6932019-08-16 14:27:40 +08009814 {}
9815};
9816
Takashi Iwai546bb672012-03-07 08:37:19 +01009817static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02009818{
Kailang Yang526af6e2012-03-07 08:25:20 +01009819 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009820 int val;
9821
Kailang Yang526af6e2012-03-07 08:25:20 +01009822 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01009823 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01009824
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009825 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009826 alc_write_coef_idx(codec, 0xf, 0x960b);
9827 alc_write_coef_idx(codec, 0xe, 0x8817);
9828 }
9829
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009830 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009831 alc_write_coef_idx(codec, 0xf, 0x960b);
9832 alc_write_coef_idx(codec, 0xe, 0x8814);
9833 }
9834
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009835 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009836 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02009837 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009838 }
9839
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009840 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009841 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009842 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009843 /* Capless ramp up clock control */
9844 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9845 }
9846 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009847 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009848 /* Class D power on reset */
9849 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9850 }
9851 }
9852
Takashi Iwai98b24882014-08-18 13:47:50 +02009853 /* HP */
9854 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009855}
9856
9857/*
9858 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009859static int patch_alc269(struct hda_codec *codec)
9860{
9861 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02009862 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009863
Takashi Iwai3de95172012-05-07 18:03:15 +02009864 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009865 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02009866 return err;
9867
9868 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01009869 spec->gen.shared_mic_vref_pin = 0x18;
Kailang Yang317d9312019-05-23 14:43:04 +08009870 codec->power_save_node = 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009871
Takashi Iwai225068a2015-05-29 10:42:14 +02009872#ifdef CONFIG_PM
9873 codec->patch_ops.suspend = alc269_suspend;
9874 codec->patch_ops.resume = alc269_resume;
9875#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08009876 spec->shutup = alc_default_shutup;
9877 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02009878
Takashi Iwai7639a062015-03-03 10:07:24 +01009879 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01009880 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009881 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009882 switch (alc_get_coef0(codec) & 0x00f0) {
9883 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009884 if (codec->bus->pci &&
9885 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009886 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009887 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009888 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009889 break;
9890 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009891 if (codec->bus->pci &&
9892 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009893 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009894 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009895 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009896 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02009897 case 0x0030:
9898 spec->codec_variant = ALC269_TYPE_ALC269VD;
9899 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009900 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009901 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009902 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009903 if (err < 0)
9904 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08009905 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01009906 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009907 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01009908 break;
9909
9910 case 0x10ec0280:
9911 case 0x10ec0290:
9912 spec->codec_variant = ALC269_TYPE_ALC280;
9913 break;
9914 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01009915 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08009916 spec->shutup = alc282_shutup;
9917 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01009918 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02009919 case 0x10ec0233:
9920 case 0x10ec0283:
9921 spec->codec_variant = ALC269_TYPE_ALC283;
9922 spec->shutup = alc283_shutup;
9923 spec->init_hook = alc283_init;
9924 break;
Kailang Yang065380f2013-01-10 10:25:48 +01009925 case 0x10ec0284:
9926 case 0x10ec0292:
9927 spec->codec_variant = ALC269_TYPE_ALC284;
9928 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02009929 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08009930 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02009931 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02009932 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08009933 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02009934 spec->codec_variant = ALC269_TYPE_ALC286;
9935 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08009936 case 0x10ec0298:
9937 spec->codec_variant = ALC269_TYPE_ALC298;
9938 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08009939 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009940 case 0x10ec0255:
9941 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08009942 spec->shutup = alc256_shutup;
9943 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009944 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02009945 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08009946 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08009947 case 0x10ec0256:
9948 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08009949 spec->shutup = alc256_shutup;
9950 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02009951 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yang4344aec2014-12-17 17:39:05 +08009952 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009953 case 0x10ec0257:
9954 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08009955 spec->shutup = alc256_shutup;
9956 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009957 spec->gen.mixer_nid = 0;
9958 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009959 case 0x10ec0215:
Kailang Yang7fbdcd82020-04-23 14:18:31 +08009960 case 0x10ec0245:
Kailang Yang0a6f0602017-06-30 16:00:48 +08009961 case 0x10ec0285:
9962 case 0x10ec0289:
9963 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08009964 spec->shutup = alc225_shutup;
9965 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08009966 spec->gen.mixer_nid = 0;
9967 break;
Kailang Yang42314302016-02-03 15:03:50 +08009968 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08009969 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08009970 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08009971 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08009972 spec->shutup = alc225_shutup;
9973 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01009974 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08009975 break;
Kailang Yang99cee0342021-07-01 09:09:37 +08009976 case 0x10ec0287:
9977 spec->codec_variant = ALC269_TYPE_ALC287;
9978 spec->shutup = alc225_shutup;
9979 spec->init_hook = alc225_init;
9980 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
9981 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009982 case 0x10ec0234:
9983 case 0x10ec0274:
9984 case 0x10ec0294:
9985 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08009986 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08009987 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +08009988 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08009989 break;
Kailang Yang1078bef2018-11-08 16:36:15 +08009990 case 0x10ec0300:
9991 spec->codec_variant = ALC269_TYPE_ALC300;
9992 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009993 break;
Kailang Yangf0778872019-10-24 15:13:32 +08009994 case 0x10ec0623:
9995 spec->codec_variant = ALC269_TYPE_ALC623;
9996 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08009997 case 0x10ec0700:
9998 case 0x10ec0701:
9999 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +080010000 case 0x10ec0711:
Kailang Yang6fbae352016-05-30 16:44:20 +080010001 spec->codec_variant = ALC269_TYPE_ALC700;
10002 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +080010003 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +080010004 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +080010005 break;
10006
Takashi Iwai1d045db2011-07-07 18:23:21 +020010007 }
10008
Kailang Yangad60d502013-06-28 12:03:01 +020010009 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -050010010 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +020010011 spec->init_hook = alc5505_dsp_init;
10012 }
10013
Takashi Iwaic9af7532019-05-10 11:01:43 +020010014 alc_pre_init(codec);
10015
Takashi Iwaiefe55732018-06-15 11:55:02 +020010016 snd_hda_pick_fixup(codec, alc269_fixup_models,
10017 alc269_fixup_tbl, alc269_fixups);
Takashi Iwai13d9c6b2021-08-20 16:32:14 +020010018 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
10019 * the quirk breaks the latter (bko#214101).
10020 * Clear the wrong entry.
10021 */
10022 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
10023 codec->core.vendor_id == 0x10ec0294) {
10024 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
10025 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
10026 }
10027
Hui Wang0fc1e442019-08-16 14:27:39 +080010028 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
Hui Wang7c0a6932019-08-16 14:27:40 +080010029 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
Takashi Iwaiefe55732018-06-15 11:55:02 +020010030 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
10031 alc269_fixups);
10032 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10033
10034 alc_auto_parse_customize_define(codec);
10035
10036 if (has_cdefine_beep(codec))
10037 spec->gen.beep_nid = 0x01;
10038
Takashi Iwaia4297b52011-08-23 18:40:12 +020010039 /* automatic parse from the BIOS config */
10040 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010041 if (err < 0)
10042 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010043
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010044 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
10045 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
10046 if (err < 0)
10047 goto error;
10048 }
Takashi Iwai1d045db2011-07-07 18:23:21 +020010049
Takashi Iwai1727a772013-01-10 09:52:52 +010010050 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010051
Takashi Iwai1d045db2011-07-07 18:23:21 +020010052 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010053
10054 error:
10055 alc_free(codec);
10056 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010057}
10058
10059/*
10060 * ALC861
10061 */
10062
Takashi Iwai1d045db2011-07-07 18:23:21 +020010063static int alc861_parse_auto_config(struct hda_codec *codec)
10064{
Takashi Iwai1d045db2011-07-07 18:23:21 +020010065 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010066 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
10067 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +020010068}
10069
Takashi Iwai1d045db2011-07-07 18:23:21 +020010070/* Pin config fixes */
10071enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010072 ALC861_FIXUP_FSC_AMILO_PI1505,
10073 ALC861_FIXUP_AMP_VREF_0F,
10074 ALC861_FIXUP_NO_JACK_DETECT,
10075 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +010010076 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +020010077};
10078
Takashi Iwai31150f22012-01-30 10:54:08 +010010079/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
10080static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +010010081 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +010010082{
10083 struct alc_spec *spec = codec->spec;
10084 unsigned int val;
10085
Takashi Iwai1727a772013-01-10 09:52:52 +010010086 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +010010087 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +010010088 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +010010089 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
10090 val |= AC_PINCTL_IN_EN;
10091 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +020010092 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +010010093 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +010010094}
10095
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010096/* suppress the jack-detection */
10097static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +010010098 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010099{
Takashi Iwai1727a772013-01-10 09:52:52 +010010100 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010101 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +020010102}
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010103
Takashi Iwai1727a772013-01-10 09:52:52 +010010104static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010105 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010106 .type = HDA_FIXUP_PINS,
10107 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +020010108 { 0x0b, 0x0221101f }, /* HP */
10109 { 0x0f, 0x90170310 }, /* speaker */
10110 { }
10111 }
10112 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010113 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010114 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +010010115 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +010010116 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010117 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010118 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010119 .v.func = alc_fixup_no_jack_detect,
10120 },
10121 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010122 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010123 .v.func = alc861_fixup_asus_amp_vref_0f,
10124 .chained = true,
10125 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +010010126 },
10127 [ALC660_FIXUP_ASUS_W7J] = {
10128 .type = HDA_FIXUP_VERBS,
10129 .v.verbs = (const struct hda_verb[]) {
10130 /* ASUS W7J needs a magic pin setup on unused NID 0x10
10131 * for enabling outputs
10132 */
10133 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10134 { }
10135 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010136 }
Takashi Iwai1d045db2011-07-07 18:23:21 +020010137};
10138
10139static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +010010140 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +010010141 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010142 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
10143 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
10144 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
Takashi Iwaidefce242021-04-28 13:27:03 +020010145 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010146 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +020010147 {}
10148};
10149
10150/*
10151 */
Takashi Iwai1d045db2011-07-07 18:23:21 +020010152static int patch_alc861(struct hda_codec *codec)
10153{
10154 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010155 int err;
10156
Takashi Iwai3de95172012-05-07 18:03:15 +020010157 err = alc_alloc_spec(codec, 0x15);
10158 if (err < 0)
10159 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010160
Takashi Iwai3de95172012-05-07 18:03:15 +020010161 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +020010162 if (has_cdefine_beep(codec))
10163 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010164
Takashi Iwai225068a2015-05-29 10:42:14 +020010165#ifdef CONFIG_PM
10166 spec->power_hook = alc_power_eapd;
10167#endif
10168
Takashi Iwaic9af7532019-05-10 11:01:43 +020010169 alc_pre_init(codec);
10170
Takashi Iwai1727a772013-01-10 09:52:52 +010010171 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10172 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +020010173
Takashi Iwaicb4e4822011-08-23 17:34:25 +020010174 /* automatic parse from the BIOS config */
10175 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010176 if (err < 0)
10177 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010178
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010179 if (!spec->gen.no_analog) {
10180 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
10181 if (err < 0)
10182 goto error;
10183 }
Takashi Iwai1d045db2011-07-07 18:23:21 +020010184
Takashi Iwai1727a772013-01-10 09:52:52 +010010185 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010186
Takashi Iwai1d045db2011-07-07 18:23:21 +020010187 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010188
10189 error:
10190 alc_free(codec);
10191 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010192}
10193
10194/*
10195 * ALC861-VD support
10196 *
10197 * Based on ALC882
10198 *
10199 * In addition, an independent DAC
10200 */
Takashi Iwai1d045db2011-07-07 18:23:21 +020010201static int alc861vd_parse_auto_config(struct hda_codec *codec)
10202{
Takashi Iwai1d045db2011-07-07 18:23:21 +020010203 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010204 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10205 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +020010206}
10207
Takashi Iwai1d045db2011-07-07 18:23:21 +020010208enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010209 ALC660VD_FIX_ASUS_GPIO1,
10210 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +020010211};
10212
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010213/* exclude VREF80 */
10214static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +010010215 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010216{
Takashi Iwai1727a772013-01-10 09:52:52 +010010217 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +010010218 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10219 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010220 }
10221}
10222
Takashi Iwaidf73d832018-06-19 23:05:47 +020010223/* reset GPIO1 */
10224static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10225 const struct hda_fixup *fix, int action)
10226{
10227 struct alc_spec *spec = codec->spec;
10228
10229 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10230 spec->gpio_mask |= 0x02;
10231 alc_fixup_gpio(codec, action, 0x01);
10232}
10233
Takashi Iwai1727a772013-01-10 09:52:52 +010010234static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +020010235 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +020010236 .type = HDA_FIXUP_FUNC,
10237 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +020010238 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010239 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010240 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010241 .v.func = alc861vd_fixup_dallas,
10242 },
Takashi Iwai1d045db2011-07-07 18:23:21 +020010243};
10244
10245static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010246 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +020010247 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010248 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +020010249 {}
10250};
10251
Takashi Iwai1d045db2011-07-07 18:23:21 +020010252/*
10253 */
Takashi Iwai1d045db2011-07-07 18:23:21 +020010254static int patch_alc861vd(struct hda_codec *codec)
10255{
10256 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +020010257 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010258
Takashi Iwai3de95172012-05-07 18:03:15 +020010259 err = alc_alloc_spec(codec, 0x0b);
10260 if (err < 0)
10261 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010262
Takashi Iwai3de95172012-05-07 18:03:15 +020010263 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +020010264 if (has_cdefine_beep(codec))
10265 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010266
Takashi Iwai225068a2015-05-29 10:42:14 +020010267 spec->shutup = alc_eapd_shutup;
10268
Takashi Iwaic9af7532019-05-10 11:01:43 +020010269 alc_pre_init(codec);
10270
Takashi Iwai1727a772013-01-10 09:52:52 +010010271 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10272 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +020010273
Takashi Iwaicb4e4822011-08-23 17:34:25 +020010274 /* automatic parse from the BIOS config */
10275 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010276 if (err < 0)
10277 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010278
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010279 if (!spec->gen.no_analog) {
10280 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10281 if (err < 0)
10282 goto error;
10283 }
Takashi Iwai1d045db2011-07-07 18:23:21 +020010284
Takashi Iwai1727a772013-01-10 09:52:52 +010010285 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010286
Takashi Iwai1d045db2011-07-07 18:23:21 +020010287 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010288
10289 error:
10290 alc_free(codec);
10291 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010292}
10293
10294/*
10295 * ALC662 support
10296 *
10297 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10298 * configuration. Each pin widget can choose any input DACs and a mixer.
10299 * Each ADC is connected from a mixer of all inputs. This makes possible
10300 * 6-channel independent captures.
10301 *
10302 * In addition, an independent DAC for the multi-playback (not used in this
10303 * driver yet).
10304 */
Takashi Iwai1d045db2011-07-07 18:23:21 +020010305
10306/*
10307 * BIOS auto configuration
10308 */
10309
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010310static int alc662_parse_auto_config(struct hda_codec *codec)
10311{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +020010312 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010313 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10314 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10315 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +020010316
Takashi Iwai7639a062015-03-03 10:07:24 +010010317 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10318 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10319 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010320 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +010010321 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010322 ssids = alc662_ssids;
10323 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010324}
10325
Todd Broch6be79482010-12-07 16:51:05 -080010326static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +010010327 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +010010328{
Takashi Iwai9bb1f062013-01-10 17:14:29 +010010329 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +010010330 return;
Todd Broch6be79482010-12-07 16:51:05 -080010331 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10332 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10333 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10334 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10335 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +010010336 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -080010337}
10338
Takashi Iwai8e383952013-10-30 17:41:12 +010010339static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10340 { .channels = 2,
10341 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10342 { .channels = 4,
10343 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10344 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10345 { }
10346};
10347
10348/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010349static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +010010350 const struct hda_fixup *fix, int action)
10351{
10352 if (action == HDA_FIXUP_ACT_BUILD) {
10353 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +010010354 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +010010355 }
10356}
10357
Takashi Iwaibf686652014-01-13 16:18:25 +010010358/* avoid D3 for keeping GPIO up */
10359static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10360 hda_nid_t nid,
10361 unsigned int power_state)
10362{
10363 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +020010364 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +010010365 return AC_PWRST_D0;
10366 return power_state;
10367}
10368
Takashi Iwai3e887f32014-01-10 17:50:58 +010010369static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10370 const struct hda_fixup *fix, int action)
10371{
10372 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +010010373
Takashi Iwai01e4a272018-06-19 22:47:30 +020010374 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +010010375 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +010010376 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +010010377 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +010010378 }
10379}
10380
Kailang Yangc6790c82016-11-25 16:15:17 +080010381static void alc662_usi_automute_hook(struct hda_codec *codec,
10382 struct hda_jack_callback *jack)
10383{
10384 struct alc_spec *spec = codec->spec;
10385 int vref;
10386 msleep(200);
10387 snd_hda_gen_hp_automute(codec, jack);
10388
10389 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10390 msleep(100);
10391 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10392 vref);
10393}
10394
10395static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10396 const struct hda_fixup *fix, int action)
10397{
10398 struct alc_spec *spec = codec->spec;
10399 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10400 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10401 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10402 }
10403}
10404
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010405static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10406 struct hda_jack_callback *cb)
10407{
10408 /* surround speakers at 0x1b already get muted automatically when
10409 * headphones are plugged in, but we have to mute/unmute the remaining
10410 * channels manually:
10411 * 0x15 - front left/front right
10412 * 0x18 - front center/ LFE
10413 */
10414 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10415 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10416 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10417 } else {
10418 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10419 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10420 }
10421}
10422
10423static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10424 const struct hda_fixup *fix, int action)
10425{
10426 /* Pin 0x1b: shared headphones jack and surround speakers */
10427 if (!is_jack_detectable(codec, 0x1b))
10428 return;
10429
10430 switch (action) {
10431 case HDA_FIXUP_ACT_PRE_PROBE:
10432 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10433 alc662_aspire_ethos_mute_speakers);
Takashi Iwai336820c2019-11-28 21:26:30 +010010434 /* subwoofer needs an extra GPIO setting to become audible */
10435 alc_setup_gpio(codec, 0x02);
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010436 break;
10437 case HDA_FIXUP_ACT_INIT:
10438 /* Make sure to start in a correct state, i.e. if
10439 * headphones have been plugged in before powering up the system
10440 */
10441 alc662_aspire_ethos_mute_speakers(codec, NULL);
10442 break;
10443 }
10444}
10445
Kailang Yang5af290282020-01-17 14:04:01 +080010446static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10447 const struct hda_fixup *fix, int action)
10448{
10449 struct alc_spec *spec = codec->spec;
10450
10451 static const struct hda_pintbl pincfgs[] = {
10452 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10453 { 0x1b, 0x0181304f },
10454 { }
10455 };
10456
10457 switch (action) {
10458 case HDA_FIXUP_ACT_PRE_PROBE:
10459 spec->gen.mixer_nid = 0;
10460 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10461 snd_hda_apply_pincfgs(codec, pincfgs);
10462 break;
10463 case HDA_FIXUP_ACT_INIT:
10464 alc_write_coef_idx(codec, 0x19, 0xa054);
10465 break;
10466 }
10467}
10468
Kailang Yangd7f327912021-11-23 16:32:44 +080010469static void alc897_hp_automute_hook(struct hda_codec *codec,
10470 struct hda_jack_callback *jack)
10471{
10472 struct alc_spec *spec = codec->spec;
10473 int vref;
10474
10475 snd_hda_gen_hp_automute(codec, jack);
10476 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10477 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10478 vref);
10479}
10480
10481static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10482 const struct hda_fixup *fix, int action)
10483{
10484 struct alc_spec *spec = codec->spec;
10485 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10486 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10487 }
10488}
10489
Takashi Iwai6b0f95c2020-01-05 15:47:18 +010010490static const struct coef_fw alc668_coefs[] = {
Kailang Yangf3f91852014-10-24 15:43:46 +080010491 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10492 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10493 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10494 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10495 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10496 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10497 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10498 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10499 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10500 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10501 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10502 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10503 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10504 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10505 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10506 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10507 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10508 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10509 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10510 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10511 {}
10512};
10513
10514static void alc668_restore_default_value(struct hda_codec *codec)
10515{
10516 alc_process_coef_fw(codec, alc668_coefs);
10517}
10518
David Henningsson6cb3b702010-09-09 08:51:44 +020010519enum {
Daniel T Chen2df03512010-10-10 22:39:28 -040010520 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +010010521 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +020010522 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -080010523 ALC272_FIXUP_MARIO,
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010524 ALC662_FIXUP_CZC_ET26,
Anisse Astierd2ebd472011-01-20 12:36:21 +010010525 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +020010526 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010527 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +020010528 ALC662_FIXUP_ASUS_MODE1,
10529 ALC662_FIXUP_ASUS_MODE2,
10530 ALC662_FIXUP_ASUS_MODE3,
10531 ALC662_FIXUP_ASUS_MODE4,
10532 ALC662_FIXUP_ASUS_MODE5,
10533 ALC662_FIXUP_ASUS_MODE6,
10534 ALC662_FIXUP_ASUS_MODE7,
10535 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +010010536 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +020010537 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +020010538 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010539 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +020010540 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010541 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +020010542 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +010010543 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +010010544 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010545 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +010010546 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +080010547 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +020010548 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010549 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010550 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010551 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010552 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010553 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +020010554 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010555 ALC891_FIXUP_HEADSET_MODE,
10556 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010557 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010558 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +080010559 ALC662_FIXUP_USI_FUNC,
10560 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +080010561 ALC662_FIXUP_LENOVO_MULTI_CODECS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010562 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010563 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
Kailang Yang5af290282020-01-17 14:04:01 +080010564 ALC671_FIXUP_HP_HEADSET_MIC2,
Jian-Hong Pand858c702020-03-17 16:28:07 +080010565 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
Jian-Hong Pana1244582020-03-17 16:28:09 +080010566 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
Hui Wanga3fd1a92021-10-12 19:47:48 +080010567 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10568 ALC668_FIXUP_HEADSET_MIC,
10569 ALC668_FIXUP_MIC_DET_COEF,
Kailang Yangd7f327912021-11-23 16:32:44 +080010570 ALC897_FIXUP_LENOVO_HEADSET_MIC,
10571 ALC897_FIXUP_HEADSET_MIC_PIN,
David Henningsson6cb3b702010-09-09 08:51:44 +020010572};
10573
Takashi Iwai1727a772013-01-10 09:52:52 +010010574static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -040010575 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010576 .type = HDA_FIXUP_PINS,
10577 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -040010578 { 0x15, 0x99130112 }, /* subwoofer */
10579 { }
10580 }
10581 },
Takashi Iwai3e887f32014-01-10 17:50:58 +010010582 [ALC662_FIXUP_LED_GPIO1] = {
10583 .type = HDA_FIXUP_FUNC,
10584 .v.func = alc662_fixup_led_gpio1,
10585 },
David Henningsson6cb3b702010-09-09 08:51:44 +020010586 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010587 .type = HDA_FIXUP_PINS,
10588 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +020010589 { 0x17, 0x99130112 }, /* subwoofer */
10590 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +010010591 },
10592 .chained = true,
10593 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +020010594 },
Todd Broch6be79482010-12-07 16:51:05 -080010595 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010596 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +010010597 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +010010598 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010599 [ALC662_FIXUP_CZC_ET26] = {
10600 .type = HDA_FIXUP_PINS,
10601 .v.pins = (const struct hda_pintbl[]) {
10602 {0x12, 0x403cc000},
10603 {0x14, 0x90170110}, /* speaker */
10604 {0x15, 0x411111f0},
10605 {0x16, 0x411111f0},
10606 {0x18, 0x01a19030}, /* mic */
10607 {0x19, 0x90a7013f}, /* int-mic */
10608 {0x1a, 0x01014020},
10609 {0x1b, 0x0121401f},
10610 {0x1c, 0x411111f0},
10611 {0x1d, 0x411111f0},
10612 {0x1e, 0x40478e35},
10613 {}
10614 },
10615 .chained = true,
10616 .chain_id = ALC662_FIXUP_SKU_IGNORE
10617 },
Anisse Astierd2ebd472011-01-20 12:36:21 +010010618 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010619 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +010010620 .v.verbs = (const struct hda_verb[]) {
10621 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10622 {}
10623 }
10624 },
David Henningsson94024cd2011-04-29 14:10:55 +020010625 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010626 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +020010627 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +020010628 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010629 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010630 .type = HDA_FIXUP_PINS,
10631 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010632 { 0x14, 0x0221201f }, /* HP out */
10633 { }
10634 },
10635 .chained = true,
10636 .chain_id = ALC662_FIXUP_SKU_IGNORE
10637 },
Takashi Iwai53c334a2011-08-23 18:27:14 +020010638 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010639 .type = HDA_FIXUP_PINS,
10640 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010641 { 0x14, 0x99130110 }, /* speaker */
10642 { 0x18, 0x01a19c20 }, /* mic */
10643 { 0x19, 0x99a3092f }, /* int-mic */
10644 { 0x21, 0x0121401f }, /* HP out */
10645 { }
10646 },
10647 .chained = true,
10648 .chain_id = ALC662_FIXUP_SKU_IGNORE
10649 },
10650 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010651 .type = HDA_FIXUP_PINS,
10652 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +020010653 { 0x14, 0x99130110 }, /* speaker */
10654 { 0x18, 0x01a19820 }, /* mic */
10655 { 0x19, 0x99a3092f }, /* int-mic */
10656 { 0x1b, 0x0121401f }, /* HP out */
10657 { }
10658 },
Takashi Iwai53c334a2011-08-23 18:27:14 +020010659 .chained = true,
10660 .chain_id = ALC662_FIXUP_SKU_IGNORE
10661 },
10662 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010663 .type = HDA_FIXUP_PINS,
10664 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010665 { 0x14, 0x99130110 }, /* speaker */
10666 { 0x15, 0x0121441f }, /* HP */
10667 { 0x18, 0x01a19840 }, /* mic */
10668 { 0x19, 0x99a3094f }, /* int-mic */
10669 { 0x21, 0x01211420 }, /* HP2 */
10670 { }
10671 },
10672 .chained = true,
10673 .chain_id = ALC662_FIXUP_SKU_IGNORE
10674 },
10675 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010676 .type = HDA_FIXUP_PINS,
10677 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010678 { 0x14, 0x99130110 }, /* speaker */
10679 { 0x16, 0x99130111 }, /* speaker */
10680 { 0x18, 0x01a19840 }, /* mic */
10681 { 0x19, 0x99a3094f }, /* int-mic */
10682 { 0x21, 0x0121441f }, /* HP */
10683 { }
10684 },
10685 .chained = true,
10686 .chain_id = ALC662_FIXUP_SKU_IGNORE
10687 },
10688 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010689 .type = HDA_FIXUP_PINS,
10690 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010691 { 0x14, 0x99130110 }, /* speaker */
10692 { 0x15, 0x0121441f }, /* HP */
10693 { 0x16, 0x99130111 }, /* speaker */
10694 { 0x18, 0x01a19840 }, /* mic */
10695 { 0x19, 0x99a3094f }, /* int-mic */
10696 { }
10697 },
10698 .chained = true,
10699 .chain_id = ALC662_FIXUP_SKU_IGNORE
10700 },
10701 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010702 .type = HDA_FIXUP_PINS,
10703 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010704 { 0x14, 0x99130110 }, /* speaker */
10705 { 0x15, 0x01211420 }, /* HP2 */
10706 { 0x18, 0x01a19840 }, /* mic */
10707 { 0x19, 0x99a3094f }, /* int-mic */
10708 { 0x1b, 0x0121441f }, /* HP */
10709 { }
10710 },
10711 .chained = true,
10712 .chain_id = ALC662_FIXUP_SKU_IGNORE
10713 },
10714 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010715 .type = HDA_FIXUP_PINS,
10716 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010717 { 0x14, 0x99130110 }, /* speaker */
10718 { 0x17, 0x99130111 }, /* speaker */
10719 { 0x18, 0x01a19840 }, /* mic */
10720 { 0x19, 0x99a3094f }, /* int-mic */
10721 { 0x1b, 0x01214020 }, /* HP */
10722 { 0x21, 0x0121401f }, /* HP */
10723 { }
10724 },
10725 .chained = true,
10726 .chain_id = ALC662_FIXUP_SKU_IGNORE
10727 },
10728 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010729 .type = HDA_FIXUP_PINS,
10730 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010731 { 0x14, 0x99130110 }, /* speaker */
10732 { 0x12, 0x99a30970 }, /* int-mic */
10733 { 0x15, 0x01214020 }, /* HP */
10734 { 0x17, 0x99130111 }, /* speaker */
10735 { 0x18, 0x01a19840 }, /* mic */
10736 { 0x21, 0x0121401f }, /* HP */
10737 { }
10738 },
10739 .chained = true,
10740 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +020010741 },
Takashi Iwai1565cc32012-02-13 12:03:25 +010010742 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010743 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +010010744 .v.func = alc_fixup_no_jack_detect,
10745 },
David Henningssonedfe3bf2012-06-12 13:15:12 +020010746 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010747 .type = HDA_FIXUP_PINS,
10748 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +020010749 { 0x1b, 0x02214020 }, /* Front HP */
10750 { }
10751 }
10752 },
Takashi Iwai125821a2012-06-22 14:30:29 +020010753 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010754 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +020010755 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +020010756 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010757 [ALC668_FIXUP_DELL_XPS13] = {
10758 .type = HDA_FIXUP_FUNC,
10759 .v.func = alc_fixup_dell_xps13,
10760 .chained = true,
10761 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10762 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +020010763 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10764 .type = HDA_FIXUP_FUNC,
10765 .v.func = alc_fixup_disable_aamix,
10766 .chained = true,
10767 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10768 },
Hui Wang493a52a2014-01-14 14:07:36 +080010769 [ALC668_FIXUP_AUTO_MUTE] = {
10770 .type = HDA_FIXUP_FUNC,
10771 .v.func = alc_fixup_auto_mute_via_amp,
10772 .chained = true,
10773 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10774 },
David Henningsson1f8b46c2015-05-12 14:38:15 +020010775 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10776 .type = HDA_FIXUP_PINS,
10777 .v.pins = (const struct hda_pintbl[]) {
10778 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10779 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10780 { }
10781 },
10782 .chained = true,
10783 .chain_id = ALC662_FIXUP_HEADSET_MODE
10784 },
10785 [ALC662_FIXUP_HEADSET_MODE] = {
10786 .type = HDA_FIXUP_FUNC,
10787 .v.func = alc_fixup_headset_mode_alc662,
10788 },
David Henningsson73bdd592013-04-15 15:44:14 +020010789 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10790 .type = HDA_FIXUP_PINS,
10791 .v.pins = (const struct hda_pintbl[]) {
10792 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10793 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10794 { }
10795 },
10796 .chained = true,
10797 .chain_id = ALC668_FIXUP_HEADSET_MODE
10798 },
10799 [ALC668_FIXUP_HEADSET_MODE] = {
10800 .type = HDA_FIXUP_FUNC,
10801 .v.func = alc_fixup_headset_mode_alc668,
10802 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010803 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +010010804 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010805 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +010010806 .chained = true,
10807 .chain_id = ALC662_FIXUP_ASUS_MODE4
10808 },
David Henningsson61a75f12014-02-07 09:31:08 +010010809 [ALC662_FIXUP_BASS_16] = {
10810 .type = HDA_FIXUP_PINS,
10811 .v.pins = (const struct hda_pintbl[]) {
10812 {0x16, 0x80106111}, /* bass speaker */
10813 {}
10814 },
10815 .chained = true,
10816 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10817 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010818 [ALC662_FIXUP_BASS_1A] = {
10819 .type = HDA_FIXUP_PINS,
10820 .v.pins = (const struct hda_pintbl[]) {
10821 {0x1a, 0x80106111}, /* bass speaker */
10822 {}
10823 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010824 .chained = true,
10825 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010826 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010827 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010828 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010829 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010830 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010831 [ALC662_FIXUP_ASUS_Nx50] = {
10832 .type = HDA_FIXUP_FUNC,
10833 .v.func = alc_fixup_auto_mute_via_amp,
10834 .chained = true,
10835 .chain_id = ALC662_FIXUP_BASS_1A
10836 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010837 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10838 .type = HDA_FIXUP_FUNC,
10839 .v.func = alc_fixup_headset_mode_alc668,
10840 .chain_id = ALC662_FIXUP_BASS_CHMAP
10841 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010842 [ALC668_FIXUP_ASUS_Nx51] = {
10843 .type = HDA_FIXUP_PINS,
10844 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010845 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10846 { 0x1a, 0x90170151 }, /* bass speaker */
10847 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010848 {}
10849 },
10850 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010851 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010852 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010853 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +020010854 .type = HDA_FIXUP_VERBS,
10855 .v.verbs = (const struct hda_verb[]) {
10856 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10857 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10858 {}
10859 },
10860 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010861 [ALC668_FIXUP_ASUS_G751] = {
10862 .type = HDA_FIXUP_PINS,
10863 .v.pins = (const struct hda_pintbl[]) {
10864 { 0x16, 0x0421101f }, /* HP */
10865 {}
10866 },
10867 .chained = true,
10868 .chain_id = ALC668_FIXUP_MIC_COEF
10869 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010870 [ALC891_FIXUP_HEADSET_MODE] = {
10871 .type = HDA_FIXUP_FUNC,
10872 .v.func = alc_fixup_headset_mode,
10873 },
10874 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10875 .type = HDA_FIXUP_PINS,
10876 .v.pins = (const struct hda_pintbl[]) {
10877 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10878 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10879 { }
10880 },
10881 .chained = true,
10882 .chain_id = ALC891_FIXUP_HEADSET_MODE
10883 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010884 [ALC662_FIXUP_ACER_VERITON] = {
10885 .type = HDA_FIXUP_PINS,
10886 .v.pins = (const struct hda_pintbl[]) {
10887 { 0x15, 0x50170120 }, /* no internal speaker */
10888 { }
10889 }
10890 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010891 [ALC892_FIXUP_ASROCK_MOBO] = {
10892 .type = HDA_FIXUP_PINS,
10893 .v.pins = (const struct hda_pintbl[]) {
10894 { 0x15, 0x40f000f0 }, /* disabled */
10895 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010896 { }
10897 }
10898 },
Kailang Yangc6790c82016-11-25 16:15:17 +080010899 [ALC662_FIXUP_USI_FUNC] = {
10900 .type = HDA_FIXUP_FUNC,
10901 .v.func = alc662_fixup_usi_headset_mic,
10902 },
10903 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10904 .type = HDA_FIXUP_PINS,
10905 .v.pins = (const struct hda_pintbl[]) {
10906 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10907 { 0x18, 0x01a1903d },
10908 { }
10909 },
10910 .chained = true,
10911 .chain_id = ALC662_FIXUP_USI_FUNC
10912 },
Kailang Yangca169cc2017-04-25 16:17:40 +080010913 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10914 .type = HDA_FIXUP_FUNC,
10915 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10916 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010917 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10918 .type = HDA_FIXUP_FUNC,
10919 .v.func = alc662_fixup_aspire_ethos_hp,
10920 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010921 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10922 .type = HDA_FIXUP_PINS,
10923 .v.pins = (const struct hda_pintbl[]) {
10924 { 0x15, 0x92130110 }, /* front speakers */
10925 { 0x18, 0x99130111 }, /* center/subwoofer */
10926 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10927 { }
10928 },
10929 .chained = true,
Takashi Iwai336820c2019-11-28 21:26:30 +010010930 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010931 },
Kailang Yang5af290282020-01-17 14:04:01 +080010932 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10933 .type = HDA_FIXUP_FUNC,
10934 .v.func = alc671_fixup_hp_headset_mic2,
10935 },
Jian-Hong Pand858c702020-03-17 16:28:07 +080010936 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10937 .type = HDA_FIXUP_PINS,
10938 .v.pins = (const struct hda_pintbl[]) {
10939 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10940 { }
10941 },
10942 .chained = true,
10943 .chain_id = ALC662_FIXUP_USI_FUNC
10944 },
Jian-Hong Pana1244582020-03-17 16:28:09 +080010945 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10946 .type = HDA_FIXUP_PINS,
10947 .v.pins = (const struct hda_pintbl[]) {
10948 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10949 { 0x1b, 0x0221144f },
10950 { }
10951 },
10952 .chained = true,
10953 .chain_id = ALC662_FIXUP_USI_FUNC
10954 },
Hui Wanga3fd1a92021-10-12 19:47:48 +080010955 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
10956 .type = HDA_FIXUP_PINS,
10957 .v.pins = (const struct hda_pintbl[]) {
10958 { 0x1b, 0x04a1112c },
10959 { }
10960 },
10961 .chained = true,
10962 .chain_id = ALC668_FIXUP_HEADSET_MIC
10963 },
10964 [ALC668_FIXUP_HEADSET_MIC] = {
10965 .type = HDA_FIXUP_FUNC,
10966 .v.func = alc269_fixup_headset_mic,
10967 .chained = true,
10968 .chain_id = ALC668_FIXUP_MIC_DET_COEF
10969 },
10970 [ALC668_FIXUP_MIC_DET_COEF] = {
10971 .type = HDA_FIXUP_VERBS,
10972 .v.verbs = (const struct hda_verb[]) {
10973 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
10974 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
10975 {}
10976 },
10977 },
Kailang Yangd7f327912021-11-23 16:32:44 +080010978 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
10979 .type = HDA_FIXUP_FUNC,
10980 .v.func = alc897_fixup_lenovo_headset_mic,
10981 },
10982 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
10983 .type = HDA_FIXUP_PINS,
10984 .v.pins = (const struct hda_pintbl[]) {
10985 { 0x1a, 0x03a11050 },
10986 { }
10987 },
10988 .chained = true,
10989 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
10990 },
David Henningsson6cb3b702010-09-09 08:51:44 +020010991};
10992
Takashi Iwaia9111322011-05-02 11:30:18 +020010993static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010994 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +020010995 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +010010996 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +010010997 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +020010998 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +020010999 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +020011000 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -040011001 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
Takashi Iwai9edeb112021-04-28 13:27:02 +020011002 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
Jian-Hong Pana1244582020-03-17 16:28:09 +080011003 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
Jian-Hong Pand858c702020-03-17 16:28:07 +080011004 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
David Henningsson73bdd592013-04-15 15:44:14 +020011005 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11006 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +020011007 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020011008 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +020011009 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +010011010 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +010011011 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +080011012 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11013 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +080011014 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020011015 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Jeremy Szu148ebf542020-10-08 18:56:44 +080011016 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
Kaho Ng2da2dc92016-05-09 00:27:49 +080011017 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +020011018 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020011019 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +020011020 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
Takashi Iwai9edeb112021-04-28 13:27:02 +020011021 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
David Henningsson8e54b4a2014-02-07 09:31:07 +010011022 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +010011023 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070011024 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
11025 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Hui Wanga3fd1a92021-10-12 19:47:48 +080011026 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
Takashi Iwaic7efff92017-01-04 21:38:16 +010011027 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +010011028 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +010011029 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +010011030 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +020011031 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -050011032 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +080011033 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +080011034 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Kailang Yangd7f327912021-11-23 16:32:44 +080011035 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
11036 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
11037 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
11038 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
Valentine Sinitsynd4118582010-10-01 22:24:08 +060011039 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +020011040 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +020011041 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +020011042 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080011043 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Huacai Chenf1ec5be2020-08-02 17:26:40 +080011044 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
Anisse Astierd2ebd472011-01-20 12:36:21 +010011045 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +020011046
11047#if 0
11048 /* Below is a quirk table taken from the old code.
11049 * Basically the device should work as is without the fixup table.
11050 * If BIOS doesn't give a proper info, enable the corresponding
11051 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +020011052 */
Takashi Iwai53c334a2011-08-23 18:27:14 +020011053 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
11054 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
11055 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
11056 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
11057 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11058 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11059 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11060 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
11061 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
11062 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11063 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
11064 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
11065 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
11066 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
11067 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
11068 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11069 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
11070 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
11071 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11072 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11073 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11074 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11075 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
11076 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
11077 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
11078 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11079 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
11080 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11081 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11082 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
11083 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11084 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11085 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
11086 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
11087 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
11088 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
11089 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
11090 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
11091 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
11092 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11093 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
11094 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
11095 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11096 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
11097 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
11098 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
11099 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
11100 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
11101 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11102 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
11103#endif
David Henningsson6cb3b702010-09-09 08:51:44 +020011104 {}
11105};
11106
Takashi Iwai1727a772013-01-10 09:52:52 +010011107static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020011108 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
11109 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -080011110 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020011111 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +020011112 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
11113 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
11114 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
11115 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
11116 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
11117 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
11118 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
11119 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020011120 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +020011121 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020011122 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +020011123 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020011124 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
11125 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
11126 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
11127 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
11128 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
11129 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
11130 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
11131 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +020011132 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020011133 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
11134 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
11135 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
11136 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
11137 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +020011138 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020011139 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
Todd Broch6be79482010-12-07 16:51:05 -080011140 {}
11141};
David Henningsson6cb3b702010-09-09 08:51:44 +020011142
Hui Wang532895c2014-05-29 15:59:19 +080011143static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +080011144 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11145 {0x17, 0x02211010},
11146 {0x18, 0x01a19030},
11147 {0x1a, 0x01813040},
11148 {0x21, 0x01014020}),
Hui Wang4b4e0e32019-07-16 15:21:34 +080011149 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11150 {0x16, 0x01813030},
11151 {0x17, 0x02211010},
11152 {0x18, 0x01a19040},
11153 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +020011154 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +020011155 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +020011156 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +020011157 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +080011158 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +020011159 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11160 {0x12, 0x99a30130},
11161 {0x14, 0x90170110},
11162 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080011163 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020011164 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11165 {0x12, 0x99a30140},
11166 {0x14, 0x90170110},
11167 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080011168 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020011169 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11170 {0x12, 0x99a30150},
11171 {0x14, 0x90170110},
11172 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080011173 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020011174 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +020011175 {0x14, 0x90170110},
11176 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080011177 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020011178 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
11179 {0x12, 0x90a60130},
11180 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +080011181 {0x15, 0x0321101f}),
Kailang Yang5af290282020-01-17 14:04:01 +080011182 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11183 {0x14, 0x01014010},
11184 {0x17, 0x90170150},
Kailang Yangf2adbae2020-02-05 15:40:01 +080011185 {0x19, 0x02a11060},
Kailang Yang5af290282020-01-17 14:04:01 +080011186 {0x1b, 0x01813030},
11187 {0x21, 0x02211020}),
11188 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11189 {0x14, 0x01014010},
11190 {0x18, 0x01a19040},
11191 {0x1b, 0x01813030},
11192 {0x21, 0x02211020}),
11193 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11194 {0x14, 0x01014020},
11195 {0x17, 0x90170110},
11196 {0x18, 0x01a19050},
11197 {0x1b, 0x01813040},
11198 {0x21, 0x02211030}),
Hui Wang532895c2014-05-29 15:59:19 +080011199 {}
11200};
11201
Takashi Iwai1d045db2011-07-07 18:23:21 +020011202/*
11203 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011204static int patch_alc662(struct hda_codec *codec)
11205{
11206 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +020011207 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011208
Takashi Iwai3de95172012-05-07 18:03:15 +020011209 err = alc_alloc_spec(codec, 0x0b);
11210 if (err < 0)
11211 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011212
Takashi Iwai3de95172012-05-07 18:03:15 +020011213 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020011214
Takashi Iwai225068a2015-05-29 10:42:14 +020011215 spec->shutup = alc_eapd_shutup;
11216
Takashi Iwai53c334a2011-08-23 18:27:14 +020011217 /* handle multiple HPs as is */
11218 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
11219
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +020011220 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11221
Takashi Iwai7639a062015-03-03 10:07:24 +010011222 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +080011223 case 0x10ec0668:
11224 spec->init_hook = alc668_restore_default_value;
11225 break;
Kailang Yangf3f91852014-10-24 15:43:46 +080011226 }
Kailang Yang8663ff72012-06-29 09:35:52 +020011227
Takashi Iwaic9af7532019-05-10 11:01:43 +020011228 alc_pre_init(codec);
11229
Takashi Iwai1727a772013-01-10 09:52:52 +010011230 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +020011231 alc662_fixup_tbl, alc662_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +080011232 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +010011233 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +020011234
11235 alc_auto_parse_customize_define(codec);
11236
Takashi Iwai7504b6c2013-03-18 11:25:51 +010011237 if (has_cdefine_beep(codec))
11238 spec->gen.beep_nid = 0x01;
11239
Takashi Iwai1bb7e432011-10-17 16:50:59 +020011240 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +010011241 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020011242 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +080011243 err = alc_codec_rename(codec, "ALC272X");
11244 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020011245 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +020011246 }
Kailang Yang274693f2009-12-03 10:07:50 +010011247
Takashi Iwaib9c51062011-08-24 18:08:07 +020011248 /* automatic parse from the BIOS config */
11249 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020011250 if (err < 0)
11251 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011252
Takashi Iwai7504b6c2013-03-18 11:25:51 +010011253 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +010011254 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +010011255 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020011256 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010011257 break;
11258 case 0x10ec0272:
11259 case 0x10ec0663:
11260 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +080011261 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020011262 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010011263 break;
11264 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020011265 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010011266 break;
11267 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +020011268 if (err < 0)
11269 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +010011270 }
Takashi Iwai2134ea42008-01-10 16:53:55 +010011271
Takashi Iwai1727a772013-01-10 09:52:52 +010011272 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010011273
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011274 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011275
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020011276 error:
11277 alc_free(codec);
11278 return err;
Kailang Yangb478b992011-05-18 11:51:15 +020011279}
11280
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011281/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011282 * ALC680 support
11283 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011284
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011285static int alc680_parse_auto_config(struct hda_codec *codec)
11286{
Takashi Iwai3e6179b2011-07-08 16:55:13 +020011287 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011288}
11289
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011290/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011291 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011292static int patch_alc680(struct hda_codec *codec)
11293{
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011294 int err;
11295
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020011296 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +020011297 err = alc_alloc_spec(codec, 0);
11298 if (err < 0)
11299 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020011300
Takashi Iwai1ebec5f2011-08-15 13:21:48 +020011301 /* automatic parse from the BIOS config */
11302 err = alc680_parse_auto_config(codec);
11303 if (err < 0) {
11304 alc_free(codec);
11305 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011306 }
11307
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011308 return 0;
11309}
11310
11311/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070011312 * patch entries
11313 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011314static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +080011315 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011316 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Hui Wang2a36c162019-09-04 13:53:27 +080011317 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +080011318 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwai1948fc02021-06-18 18:17:20 +020011319 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011320 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11321 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080011322 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011323 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +080011324 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Kailang Yang7fbdcd82020-04-23 14:18:31 +080011325 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011326 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11327 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +080011328 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011329 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11330 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11331 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11332 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11333 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11334 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11335 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080011336 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011337 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11338 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11339 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11340 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11341 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11342 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080011343 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011344 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
Kailang Yang630e3612020-05-27 14:10:26 +080011345 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011346 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080011347 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011348 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11349 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11350 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080011351 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +080011352 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011353 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +080011354 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +080011355 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Kailang Yangf0778872019-10-24 15:13:32 +080011356 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011357 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11358 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11359 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11360 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11361 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11362 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11363 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11364 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11365 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11366 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11367 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11368 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11369 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11370 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +080011371 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11372 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11373 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang83629532019-05-02 16:03:26 +080011374 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +080011375 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011376 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11377 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11378 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11379 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11380 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11381 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11382 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11383 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11384 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11385 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11386 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
Kailang Yange5782a52020-11-27 14:39:23 +080011387 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011388 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11389 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang6d9ffcf2020-01-03 16:24:06 +080011390 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +080011391 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +080011392 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -070011393 {} /* terminator */
11394};
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011395MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +010011396
11397MODULE_LICENSE("GPL");
11398MODULE_DESCRIPTION("Realtek HD-audio codec");
11399
Takashi Iwaid8a766a2015-02-17 15:25:37 +010011400static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011401 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +010011402};
11403
Takashi Iwaid8a766a2015-02-17 15:25:37 +010011404module_hda_codec_driver(realtek_driver);