blob: 3ce318a3086dade8873a8654fa30beb4fcb54953 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Universal Interface for Intel High Definition Audio Codec
3 *
Takashi Iwai1d045db2011-07-07 18:23:21 +02004 * HD audio interface patch for Realtek ALC codecs
Linus Torvalds1da177e2005-04-16 15:20:36 -07005 *
Kailang Yangdf694da2005-12-05 19:42:22 +01006 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
7 * PeiSen Hou <pshou@realtek.com.tw>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 * Takashi Iwai <tiwai@suse.de>
Jonathan Woithe409a3e92012-03-27 13:01:01 +10309 * Jonathan Woithe <jwoithe@just42.net>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 *
11 * This driver is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This driver is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
Linus Torvalds1da177e2005-04-16 15:20:36 -070026#include <linux/init.h>
27#include <linux/delay.h>
28#include <linux/slab.h>
29#include <linux/pci.h>
Takashi Iwai08fb0d02013-01-10 17:33:58 +010030#include <linux/dmi.h>
Paul Gortmakerda155d52011-07-15 12:38:28 -040031#include <linux/module.h>
David Henningsson33f4acd2015-01-07 15:50:13 +010032#include <linux/input.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070033#include <sound/core.h>
Kailang Yang9ad0e492010-09-14 23:22:00 +020034#include <sound/jack.h>
Pierre-Louis Bossartbe57bff2018-08-22 15:24:57 -050035#include <sound/hda_codec.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070036#include "hda_local.h"
Takashi Iwai23d30f22012-05-07 17:17:32 +020037#include "hda_auto_parser.h"
Takashi Iwai1835a0f2011-10-27 22:12:46 +020038#include "hda_jack.h"
Takashi Iwai08c189f2012-12-19 15:22:24 +010039#include "hda_generic.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
Takashi Iwaicd63a5f2013-07-05 12:13:59 +020041/* keep halting ALC5505 DSP, for power saving */
42#define HALT_REALTEK_ALC5505
43
Takashi Iwai4a79ba32009-04-22 16:31:35 +020044/* extra amp-initialization sequence types */
45enum {
Takashi Iwai1c76aa52018-06-21 16:37:54 +020046 ALC_INIT_UNDEFINED,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020047 ALC_INIT_NONE,
48 ALC_INIT_DEFAULT,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020049};
50
David Henningsson73bdd592013-04-15 15:44:14 +020051enum {
52 ALC_HEADSET_MODE_UNKNOWN,
53 ALC_HEADSET_MODE_UNPLUGGED,
54 ALC_HEADSET_MODE_HEADSET,
55 ALC_HEADSET_MODE_MIC,
56 ALC_HEADSET_MODE_HEADPHONE,
57};
58
59enum {
60 ALC_HEADSET_TYPE_UNKNOWN,
61 ALC_HEADSET_TYPE_CTIA,
62 ALC_HEADSET_TYPE_OMTP,
63};
64
Hui Wangc7b60a82015-12-28 11:35:25 +080065enum {
66 ALC_KEY_MICMUTE_INDEX,
67};
68
Kailang Yangda00c242010-03-19 11:23:45 +010069struct alc_customize_define {
70 unsigned int sku_cfg;
71 unsigned char port_connectivity;
72 unsigned char check_sum;
73 unsigned char customization;
74 unsigned char external_amp;
75 unsigned int enable_pcbeep:1;
76 unsigned int platform_type:1;
77 unsigned int swap:1;
78 unsigned int override:1;
David Henningsson90622912010-10-14 14:50:18 +020079 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
Kailang Yangda00c242010-03-19 11:23:45 +010080};
81
Linus Torvalds1da177e2005-04-16 15:20:36 -070082struct alc_spec {
Takashi Iwai08c189f2012-12-19 15:22:24 +010083 struct hda_gen_spec gen; /* must be at head */
Takashi Iwai23d30f22012-05-07 17:17:32 +020084
Linus Torvalds1da177e2005-04-16 15:20:36 -070085 /* codec parameterization */
Kailang Yangda00c242010-03-19 11:23:45 +010086 struct alc_customize_define cdefine;
Takashi Iwai08c189f2012-12-19 15:22:24 +010087 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
88
Takashi Iwai5579cd62018-06-19 22:22:41 +020089 /* GPIO bits */
90 unsigned int gpio_mask;
91 unsigned int gpio_dir;
92 unsigned int gpio_data;
Takashi Iwai215c8502018-06-19 22:34:26 +020093 bool gpio_write_delay; /* add a delay before writing gpio_data */
Takashi Iwai5579cd62018-06-19 22:22:41 +020094
Takashi Iwai08fb0d02013-01-10 17:33:58 +010095 /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
96 int mute_led_polarity;
97 hda_nid_t mute_led_nid;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +080098 hda_nid_t cap_mute_led_nid;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010099
Takashi Iwai0f32fd192014-11-19 12:16:14 +0100100 unsigned int gpio_mute_led_mask;
101 unsigned int gpio_mic_led_mask;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +0100102
David Henningsson73bdd592013-04-15 15:44:14 +0200103 hda_nid_t headset_mic_pin;
104 hda_nid_t headphone_mic_pin;
105 int current_headset_mode;
106 int current_headset_type;
107
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100108 /* hooks */
109 void (*init_hook)(struct hda_codec *codec);
Takashi Iwai83012a72012-08-24 18:38:08 +0200110#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500111 void (*power_hook)(struct hda_codec *codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100112#endif
Takashi Iwai1c7161532011-04-07 10:37:16 +0200113 void (*shutup)(struct hda_codec *codec);
Takashi Iwai70a09762015-12-15 14:59:58 +0100114 void (*reboot_notify)(struct hda_codec *codec);
Takashi Iwaid922b512011-04-28 12:18:53 +0200115
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200116 int init_amp;
Takashi Iwaid433a672010-09-20 15:11:54 +0200117 int codec_variant; /* flag for other variants */
Kailang Yang97a26572013-11-29 00:35:26 -0500118 unsigned int has_alc5505_dsp:1;
119 unsigned int no_depop_delay:1;
Kailang Yang693abe12019-01-29 15:38:21 +0800120 unsigned int done_hp_init:1;
Takashi Iwaie64f14f2009-01-20 18:32:55 +0100121
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200122 /* for PLL fix */
123 hda_nid_t pll_nid;
124 unsigned int pll_coef_idx, pll_coef_bit;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200125 unsigned int coef0;
David Henningsson33f4acd2015-01-07 15:50:13 +0100126 struct input_dev *kb_dev;
Hui Wangc7b60a82015-12-28 11:35:25 +0800127 u8 alc_mute_keycode_map[1];
Kailang Yangdf694da2005-12-05 19:42:22 +0100128};
129
Takashi Iwai23f0c042009-02-26 13:03:58 +0100130/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200131 * COEF access helper functions
132 */
133
134static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
135 unsigned int coef_idx)
136{
137 unsigned int val;
138
139 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
140 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
141 return val;
142}
143
144#define alc_read_coef_idx(codec, coef_idx) \
145 alc_read_coefex_idx(codec, 0x20, coef_idx)
146
147static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
148 unsigned int coef_idx, unsigned int coef_val)
149{
150 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
151 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
152}
153
154#define alc_write_coef_idx(codec, coef_idx, coef_val) \
155 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
156
Takashi Iwai98b24882014-08-18 13:47:50 +0200157static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
158 unsigned int coef_idx, unsigned int mask,
159 unsigned int bits_set)
160{
161 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
162
163 if (val != -1)
164 alc_write_coefex_idx(codec, nid, coef_idx,
165 (val & ~mask) | bits_set);
166}
167
168#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
169 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
170
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200171/* a special bypass for COEF 0; read the cached value at the second time */
172static unsigned int alc_get_coef0(struct hda_codec *codec)
173{
174 struct alc_spec *spec = codec->spec;
175
176 if (!spec->coef0)
177 spec->coef0 = alc_read_coef_idx(codec, 0);
178 return spec->coef0;
179}
180
Takashi Iwai54db6c32014-08-18 15:11:19 +0200181/* coef writes/updates batch */
182struct coef_fw {
183 unsigned char nid;
184 unsigned char idx;
185 unsigned short mask;
186 unsigned short val;
187};
188
189#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
190 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
191#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
192#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
193#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
194
195static void alc_process_coef_fw(struct hda_codec *codec,
196 const struct coef_fw *fw)
197{
198 for (; fw->nid; fw++) {
199 if (fw->mask == (unsigned short)-1)
200 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
201 else
202 alc_update_coefex_idx(codec, fw->nid, fw->idx,
203 fw->mask, fw->val);
204 }
205}
206
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200207/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200208 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100209 */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200210
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200211/* Enable GPIO mask and set output */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200212static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
213{
214 struct alc_spec *spec = codec->spec;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200215
Takashi Iwai5579cd62018-06-19 22:22:41 +0200216 spec->gpio_mask |= mask;
217 spec->gpio_dir |= mask;
218 spec->gpio_data |= mask;
219}
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200220
Takashi Iwai5579cd62018-06-19 22:22:41 +0200221static void alc_write_gpio_data(struct hda_codec *codec)
222{
223 struct alc_spec *spec = codec->spec;
224
225 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
226 spec->gpio_data);
227}
228
Takashi Iwaiaaf312d2018-06-19 22:28:22 +0200229static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
230 bool on)
231{
232 struct alc_spec *spec = codec->spec;
233 unsigned int oldval = spec->gpio_data;
234
235 if (on)
236 spec->gpio_data |= mask;
237 else
238 spec->gpio_data &= ~mask;
239 if (oldval != spec->gpio_data)
240 alc_write_gpio_data(codec);
241}
242
Takashi Iwai5579cd62018-06-19 22:22:41 +0200243static void alc_write_gpio(struct hda_codec *codec)
244{
245 struct alc_spec *spec = codec->spec;
246
247 if (!spec->gpio_mask)
248 return;
249
250 snd_hda_codec_write(codec, codec->core.afg, 0,
251 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
252 snd_hda_codec_write(codec, codec->core.afg, 0,
253 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
Takashi Iwai215c8502018-06-19 22:34:26 +0200254 if (spec->gpio_write_delay)
255 msleep(1);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200256 alc_write_gpio_data(codec);
257}
258
259static void alc_fixup_gpio(struct hda_codec *codec, int action,
260 unsigned int mask)
261{
262 if (action == HDA_FIXUP_ACT_PRE_PROBE)
263 alc_setup_gpio(codec, mask);
264}
265
266static void alc_fixup_gpio1(struct hda_codec *codec,
267 const struct hda_fixup *fix, int action)
268{
269 alc_fixup_gpio(codec, action, 0x01);
270}
271
272static void alc_fixup_gpio2(struct hda_codec *codec,
273 const struct hda_fixup *fix, int action)
274{
275 alc_fixup_gpio(codec, action, 0x02);
276}
277
278static void alc_fixup_gpio3(struct hda_codec *codec,
279 const struct hda_fixup *fix, int action)
280{
281 alc_fixup_gpio(codec, action, 0x03);
282}
Kailang Yangbdd148a2007-05-08 15:19:08 +0200283
Takashi Iwaiae065f12018-06-19 23:00:03 +0200284static void alc_fixup_gpio4(struct hda_codec *codec,
285 const struct hda_fixup *fix, int action)
286{
287 alc_fixup_gpio(codec, action, 0x04);
288}
289
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200290/*
291 * Fix hardware PLL issue
292 * On some codecs, the analog PLL gating control must be off while
293 * the default value is 1.
294 */
295static void alc_fix_pll(struct hda_codec *codec)
296{
297 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200298
Takashi Iwai98b24882014-08-18 13:47:50 +0200299 if (spec->pll_nid)
300 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
301 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200302}
303
304static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
305 unsigned int coef_idx, unsigned int coef_bit)
306{
307 struct alc_spec *spec = codec->spec;
308 spec->pll_nid = nid;
309 spec->pll_coef_idx = coef_idx;
310 spec->pll_coef_bit = coef_bit;
311 alc_fix_pll(codec);
312}
313
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100314/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200315static void alc_update_knob_master(struct hda_codec *codec,
316 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100317{
318 unsigned int val;
319 struct snd_kcontrol *kctl;
320 struct snd_ctl_elem_value *uctl;
321
322 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
323 if (!kctl)
324 return;
325 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
326 if (!uctl)
327 return;
Takashi Iwai2ebab402016-02-09 10:23:52 +0100328 val = snd_hda_codec_read(codec, jack->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100329 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
330 val &= HDA_AMP_VOLMASK;
331 uctl->value.integer.value[0] = val;
332 uctl->value.integer.value[1] = val;
333 kctl->put(kctl, uctl);
334 kfree(uctl);
335}
336
David Henningsson29adc4b2012-09-25 11:31:00 +0200337static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100338{
David Henningsson29adc4b2012-09-25 11:31:00 +0200339 /* For some reason, the res given from ALC880 is broken.
340 Here we adjust it properly. */
341 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100342}
343
Kailang Yang394c97f2014-11-12 17:38:08 +0800344/* Change EAPD to verb control */
345static void alc_fill_eapd_coef(struct hda_codec *codec)
346{
347 int coef;
348
349 coef = alc_get_coef0(codec);
350
Takashi Iwai7639a062015-03-03 10:07:24 +0100351 switch (codec->core.vendor_id) {
Kailang Yang394c97f2014-11-12 17:38:08 +0800352 case 0x10ec0262:
353 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
354 break;
355 case 0x10ec0267:
356 case 0x10ec0268:
357 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
358 break;
359 case 0x10ec0269:
360 if ((coef & 0x00f0) == 0x0010)
361 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
362 if ((coef & 0x00f0) == 0x0020)
363 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
364 if ((coef & 0x00f0) == 0x0030)
365 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
366 break;
367 case 0x10ec0280:
368 case 0x10ec0284:
369 case 0x10ec0290:
370 case 0x10ec0292:
371 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
372 break;
Kailang Yang42314302016-02-03 15:03:50 +0800373 case 0x10ec0225:
Takashi Iwai44be77c2017-12-27 08:53:59 +0100374 case 0x10ec0295:
375 case 0x10ec0299:
376 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
377 /* fallthrough */
378 case 0x10ec0215:
Kailang Yang394c97f2014-11-12 17:38:08 +0800379 case 0x10ec0233:
Kailang Yangea04a1d2018-04-25 15:31:52 +0800380 case 0x10ec0235:
Kailang Yang736f20a2017-10-20 15:06:34 +0800381 case 0x10ec0236:
Kailang Yang394c97f2014-11-12 17:38:08 +0800382 case 0x10ec0255:
Kailang Yang4344aec2014-12-17 17:39:05 +0800383 case 0x10ec0256:
Kailang Yangf429e7e2017-12-05 15:38:24 +0800384 case 0x10ec0257:
Kailang Yang394c97f2014-11-12 17:38:08 +0800385 case 0x10ec0282:
386 case 0x10ec0283:
387 case 0x10ec0286:
388 case 0x10ec0288:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800389 case 0x10ec0285:
Kailang Yang506b62c2014-12-18 17:07:44 +0800390 case 0x10ec0298:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800391 case 0x10ec0289:
Kailang Yang1078bef2018-11-08 16:36:15 +0800392 case 0x10ec0300:
Kailang Yang394c97f2014-11-12 17:38:08 +0800393 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
394 break;
Kailang Yang3aabf942017-11-08 15:28:33 +0800395 case 0x10ec0275:
396 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
397 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800398 case 0x10ec0293:
399 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
400 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800401 case 0x10ec0234:
402 case 0x10ec0274:
403 case 0x10ec0294:
Kailang Yang6fbae352016-05-30 16:44:20 +0800404 case 0x10ec0700:
405 case 0x10ec0701:
406 case 0x10ec0703:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800407 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
408 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800409 case 0x10ec0662:
410 if ((coef & 0x00f0) == 0x0030)
411 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
412 break;
413 case 0x10ec0272:
414 case 0x10ec0273:
415 case 0x10ec0663:
416 case 0x10ec0665:
417 case 0x10ec0670:
418 case 0x10ec0671:
419 case 0x10ec0672:
420 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
421 break;
422 case 0x10ec0668:
423 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
424 break;
425 case 0x10ec0867:
426 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
427 break;
428 case 0x10ec0888:
429 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
430 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
431 break;
432 case 0x10ec0892:
433 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
434 break;
435 case 0x10ec0899:
436 case 0x10ec0900:
Kailang Yang65553b12017-07-11 15:15:47 +0800437 case 0x10ec1168:
Kailang Yanga535ad52017-01-16 16:59:26 +0800438 case 0x10ec1220:
Kailang Yang394c97f2014-11-12 17:38:08 +0800439 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
440 break;
441 }
442}
443
Kailang Yangf9423e72008-05-27 12:32:25 +0200444/* additional initialization for ALC888 variants */
445static void alc888_coef_init(struct hda_codec *codec)
446{
Kailang Yang1df88742014-10-29 16:10:13 +0800447 switch (alc_get_coef0(codec) & 0x00f0) {
448 /* alc888-VA */
449 case 0x00:
450 /* alc888-VB */
451 case 0x10:
452 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
453 break;
454 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200455}
456
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100457/* turn on/off EAPD control (only if available) */
458static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
459{
460 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
461 return;
462 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
463 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
464 on ? 2 : 0);
465}
466
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200467/* turn on/off EAPD controls of the codec */
468static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
469{
470 /* We currently only handle front, HP */
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200471 static hda_nid_t pins[] = {
Hui Wangaf95b412015-03-26 17:14:55 +0800472 0x0f, 0x10, 0x14, 0x15, 0x17, 0
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200473 };
474 hda_nid_t *p;
475 for (p = pins; *p; p++)
476 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200477}
478
Takashi Iwai1c7161532011-04-07 10:37:16 +0200479/* generic shutup callback;
Lars-Peter Clausen4ce8e6a2016-11-08 15:48:06 +0100480 * just turning off EAPD and a little pause for avoiding pop-noise
Takashi Iwai1c7161532011-04-07 10:37:16 +0200481 */
482static void alc_eapd_shutup(struct hda_codec *codec)
483{
Kailang Yang97a26572013-11-29 00:35:26 -0500484 struct alc_spec *spec = codec->spec;
485
Takashi Iwai1c7161532011-04-07 10:37:16 +0200486 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500487 if (!spec->no_depop_delay)
488 msleep(200);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200489 snd_hda_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200490}
491
Takashi Iwai1d045db2011-07-07 18:23:21 +0200492/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200493static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200494{
Kailang Yang394c97f2014-11-12 17:38:08 +0800495 alc_fill_eapd_coef(codec);
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200496 alc_auto_setup_eapd(codec, true);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200497 alc_write_gpio(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200498 switch (type) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200499 case ALC_INIT_DEFAULT:
Takashi Iwai7639a062015-03-03 10:07:24 +0100500 switch (codec->core.vendor_id) {
Kailang Yangc9b58002007-10-16 14:30:01 +0200501 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200502 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200503 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200504 case 0x10ec0880:
505 case 0x10ec0882:
506 case 0x10ec0883:
507 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800508 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200509 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200510 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200511 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200512 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200513 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200514 break;
515 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200516}
Kailang Yangea1fb292008-08-26 12:58:38 +0200517
Takashi Iwai35a39f92019-02-01 11:19:50 +0100518/* get a primary headphone pin if available */
519static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
520{
521 if (spec->gen.autocfg.hp_pins[0])
522 return spec->gen.autocfg.hp_pins[0];
523 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
524 return spec->gen.autocfg.line_out_pins[0];
525 return 0;
526}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200527
528/*
529 * Realtek SSID verification
530 */
531
David Henningsson90622912010-10-14 14:50:18 +0200532/* Could be any non-zero and even value. When used as fixup, tells
533 * the driver to ignore any present sku defines.
534 */
535#define ALC_FIXUP_SKU_IGNORE (2)
536
Takashi Iwai23d30f22012-05-07 17:17:32 +0200537static void alc_fixup_sku_ignore(struct hda_codec *codec,
538 const struct hda_fixup *fix, int action)
539{
540 struct alc_spec *spec = codec->spec;
541 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
542 spec->cdefine.fixup = 1;
543 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
544 }
545}
546
Mengdong Linb5c66112013-11-29 00:35:35 -0500547static void alc_fixup_no_depop_delay(struct hda_codec *codec,
548 const struct hda_fixup *fix, int action)
549{
550 struct alc_spec *spec = codec->spec;
551
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500552 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500553 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500554 codec->depop_delay = 0;
555 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500556}
557
Kailang Yangda00c242010-03-19 11:23:45 +0100558static int alc_auto_parse_customize_define(struct hda_codec *codec)
559{
560 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100561 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100562 struct alc_spec *spec = codec->spec;
563
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200564 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
565
David Henningsson90622912010-10-14 14:50:18 +0200566 if (spec->cdefine.fixup) {
567 ass = spec->cdefine.sku_cfg;
568 if (ass == ALC_FIXUP_SKU_IGNORE)
569 return -1;
570 goto do_sku;
571 }
572
Takashi Iwai5100cd02014-02-15 10:03:19 +0100573 if (!codec->bus->pci)
574 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100575 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200576 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100577 goto do_sku;
578
579 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100580 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100581 nid = 0x17;
582 ass = snd_hda_codec_get_pincfg(codec, nid);
583
584 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100585 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100586 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100587 return -1;
588 }
589
590 /* check sum */
591 tmp = 0;
592 for (i = 1; i < 16; i++) {
593 if ((ass >> i) & 1)
594 tmp++;
595 }
596 if (((ass >> 16) & 0xf) != tmp)
597 return -1;
598
599 spec->cdefine.port_connectivity = ass >> 30;
600 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
601 spec->cdefine.check_sum = (ass >> 16) & 0xf;
602 spec->cdefine.customization = ass >> 8;
603do_sku:
604 spec->cdefine.sku_cfg = ass;
605 spec->cdefine.external_amp = (ass & 0x38) >> 3;
606 spec->cdefine.platform_type = (ass & 0x4) >> 2;
607 spec->cdefine.swap = (ass & 0x2) >> 1;
608 spec->cdefine.override = ass & 0x1;
609
Takashi Iwai4e76a882014-02-25 12:21:03 +0100610 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100611 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100612 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100613 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100614 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
615 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
616 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
617 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
618 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
619 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
620 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100621
622 return 0;
623}
624
Takashi Iwai08c189f2012-12-19 15:22:24 +0100625/* return the position of NID in the list, or -1 if not found */
626static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
627{
628 int i;
629 for (i = 0; i < nums; i++)
630 if (list[i] == nid)
631 return i;
632 return -1;
633}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200634/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200635static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
636{
Takashi Iwai21268962011-07-07 15:01:13 +0200637 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200638}
639
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200640/* check subsystem ID and set up device-specific initialization;
641 * return 1 if initialized, 0 if invalid SSID
642 */
643/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
644 * 31 ~ 16 : Manufacture ID
645 * 15 ~ 8 : SKU ID
646 * 7 ~ 0 : Assembly ID
647 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
648 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100649static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200650{
651 unsigned int ass, tmp, i;
652 unsigned nid;
653 struct alc_spec *spec = codec->spec;
654
David Henningsson90622912010-10-14 14:50:18 +0200655 if (spec->cdefine.fixup) {
656 ass = spec->cdefine.sku_cfg;
657 if (ass == ALC_FIXUP_SKU_IGNORE)
658 return 0;
659 goto do_sku;
660 }
661
Takashi Iwai7639a062015-03-03 10:07:24 +0100662 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100663 if (codec->bus->pci &&
664 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200665 goto do_sku;
666
667 /* invalid SSID, check the special NID pin defcfg instead */
668 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400669 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200670 * 29~21 : reserve
671 * 20 : PCBEEP input
672 * 19~16 : Check sum (15:1)
673 * 15~1 : Custom
674 * 0 : override
675 */
676 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100677 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200678 nid = 0x17;
679 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100680 codec_dbg(codec,
681 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200682 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100683 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200684 return 0;
685 if ((ass >> 30) != 1) /* no physical connection */
686 return 0;
687
688 /* check sum */
689 tmp = 0;
690 for (i = 1; i < 16; i++) {
691 if ((ass >> i) & 1)
692 tmp++;
693 }
694 if (((ass >> 16) & 0xf) != tmp)
695 return 0;
696do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100697 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100698 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200699 /*
700 * 0 : override
701 * 1 : Swap Jack
702 * 2 : 0 --> Desktop, 1 --> Laptop
703 * 3~5 : External Amplifier control
704 * 7~6 : Reserved
705 */
706 tmp = (ass & 0x38) >> 3; /* external Amp control */
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200707 if (spec->init_amp == ALC_INIT_UNDEFINED) {
708 switch (tmp) {
709 case 1:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200710 alc_setup_gpio(codec, 0x01);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200711 break;
712 case 3:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200713 alc_setup_gpio(codec, 0x02);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200714 break;
715 case 7:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200716 alc_setup_gpio(codec, 0x03);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200717 break;
718 case 5:
719 default:
720 spec->init_amp = ALC_INIT_DEFAULT;
721 break;
722 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200723 }
724
725 /* is laptop or Desktop and enable the function "Mute internal speaker
726 * when the external headphone out jack is plugged"
727 */
728 if (!(ass & 0x8000))
729 return 1;
730 /*
731 * 10~8 : Jack location
732 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
733 * 14~13: Resvered
734 * 15 : 1 --> enable the function "Mute internal speaker
735 * when the external headphone out jack is plugged"
736 */
Takashi Iwai35a39f92019-02-01 11:19:50 +0100737 if (!alc_get_hp_pin(spec)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200738 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200739 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100740 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100741 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
742 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200743 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100744 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200745 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200746 return 1;
747}
Kailang Yangea1fb292008-08-26 12:58:38 +0200748
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200749/* Check the validity of ALC subsystem-id
750 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
751static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200752{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100753 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200754 struct alc_spec *spec = codec->spec;
Takashi Iwai4e76a882014-02-25 12:21:03 +0100755 codec_dbg(codec,
756 "realtek: Enable default setup for auto mode as fallback\n");
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200757 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200758 }
Takashi Iwai21268962011-07-07 15:01:13 +0200759}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200760
Takashi Iwai41e41f12005-06-08 14:48:49 +0200761/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200762 */
763
David Henningsson9d36a7d2014-10-07 10:18:42 +0200764static void alc_fixup_inv_dmic(struct hda_codec *codec,
765 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200766{
767 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100768
David Henningsson9d36a7d2014-10-07 10:18:42 +0200769 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200770}
771
Takashi Iwai603c4012008-07-30 15:01:44 +0200772
Takashi Iwai2eab6942012-12-18 15:30:41 +0100773static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700774{
Takashi Iwaia5cb4632018-06-20 12:50:11 +0200775 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776
Takashi Iwai08c189f2012-12-19 15:22:24 +0100777 err = snd_hda_gen_build_controls(codec);
778 if (err < 0)
779 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700780
Takashi Iwai1727a772013-01-10 09:52:52 +0100781 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100782 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700783}
784
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200785
Linus Torvalds1da177e2005-04-16 15:20:36 -0700786/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100787 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200788 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200789
Linus Torvalds1da177e2005-04-16 15:20:36 -0700790static int alc_init(struct hda_codec *codec)
791{
792 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200793
Takashi Iwai546bb672012-03-07 08:37:19 +0100794 if (spec->init_hook)
795 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100796
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200797 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200798 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200799
Takashi Iwai08c189f2012-12-19 15:22:24 +0100800 snd_hda_gen_init(codec);
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100801
Takashi Iwai1727a772013-01-10 09:52:52 +0100802 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200803
Linus Torvalds1da177e2005-04-16 15:20:36 -0700804 return 0;
805}
806
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100807static inline void alc_shutup(struct hda_codec *codec)
808{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200809 struct alc_spec *spec = codec->spec;
810
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200811 if (!snd_hda_get_bool_hint(codec, "shutup"))
812 return; /* disabled explicitly by hints */
813
Takashi Iwai1c7161532011-04-07 10:37:16 +0200814 if (spec && spec->shutup)
815 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200816 else
817 snd_hda_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100818}
819
Takashi Iwai70a09762015-12-15 14:59:58 +0100820static void alc_reboot_notify(struct hda_codec *codec)
821{
822 struct alc_spec *spec = codec->spec;
823
824 if (spec && spec->reboot_notify)
825 spec->reboot_notify(codec);
826 else
827 alc_shutup(codec);
828}
829
830/* power down codec to D3 at reboot/shutdown; set as reboot_notify ops */
831static void alc_d3_at_reboot(struct hda_codec *codec)
832{
833 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
834 snd_hda_codec_write(codec, codec->core.afg, 0,
835 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
836 msleep(10);
837}
838
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100839#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700840
Takashi Iwai83012a72012-08-24 18:38:08 +0200841#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500842static void alc_power_eapd(struct hda_codec *codec)
843{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200844 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500845}
846
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200847static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100848{
849 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100850 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100851 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500852 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100853 return 0;
854}
855#endif
856
Takashi Iwai2a439522011-07-26 09:52:50 +0200857#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100858static int alc_resume(struct hda_codec *codec)
859{
Kailang Yang97a26572013-11-29 00:35:26 -0500860 struct alc_spec *spec = codec->spec;
861
862 if (!spec->no_depop_delay)
863 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100864 codec->patch_ops.init(codec);
Takashi Iwaieeecd9d2015-02-25 15:18:50 +0100865 regcache_sync(codec->core.regmap);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200866 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100867 return 0;
868}
Takashi Iwaie044c392008-10-27 16:56:24 +0100869#endif
870
Linus Torvalds1da177e2005-04-16 15:20:36 -0700871/*
872 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200873static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700874 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100875 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700876 .init = alc_init,
877 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200878 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200879#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100880 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100881 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100882 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200883#endif
Takashi Iwai70a09762015-12-15 14:59:58 +0100884 .reboot_notify = alc_reboot_notify,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700885};
886
David Henningsson29adc4b2012-09-25 11:31:00 +0200887
Takashi Iwaided255b2015-10-01 17:59:43 +0200888#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100889
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200890/*
Kailang Yang4b016932013-11-28 11:55:09 +0100891 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200892 */
893struct alc_codec_rename_table {
894 unsigned int vendor_id;
895 unsigned short coef_mask;
896 unsigned short coef_bits;
897 const char *name;
898};
899
Kailang Yang4b016932013-11-28 11:55:09 +0100900struct alc_codec_rename_pci_table {
901 unsigned int codec_vendor_id;
902 unsigned short pci_subvendor;
903 unsigned short pci_subdevice;
904 const char *name;
905};
906
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200907static struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800908 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200909 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
910 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
911 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
912 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
913 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
914 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
915 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200916 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800917 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200918 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
919 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
920 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
921 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
922 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
923 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
924 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
925 { } /* terminator */
926};
927
Kailang Yang4b016932013-11-28 11:55:09 +0100928static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
929 { 0x10ec0280, 0x1028, 0, "ALC3220" },
930 { 0x10ec0282, 0x1028, 0, "ALC3221" },
931 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +0800932 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +0100933 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +0800934 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +0100935 { 0x10ec0255, 0x1028, 0, "ALC3234" },
936 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800937 { 0x10ec0275, 0x1028, 0, "ALC3260" },
938 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +0800939 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +0800940 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +0800941 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +0800942 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +0800943 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +0800944 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800945 { 0x10ec0670, 0x1025, 0, "ALC669X" },
946 { 0x10ec0676, 0x1025, 0, "ALC679X" },
947 { 0x10ec0282, 0x1043, 0, "ALC3229" },
948 { 0x10ec0233, 0x1043, 0, "ALC3236" },
949 { 0x10ec0280, 0x103c, 0, "ALC3228" },
950 { 0x10ec0282, 0x103c, 0, "ALC3227" },
951 { 0x10ec0286, 0x103c, 0, "ALC3242" },
952 { 0x10ec0290, 0x103c, 0, "ALC3241" },
953 { 0x10ec0668, 0x103c, 0, "ALC3662" },
954 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
955 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +0100956 { } /* terminator */
957};
958
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200959static int alc_codec_rename_from_preset(struct hda_codec *codec)
960{
961 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +0100962 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200963
964 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +0100965 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200966 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200967 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200968 return alc_codec_rename(codec, p->name);
969 }
Kailang Yang4b016932013-11-28 11:55:09 +0100970
Takashi Iwai5100cd02014-02-15 10:03:19 +0100971 if (!codec->bus->pci)
972 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +0100973 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +0100974 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +0100975 continue;
976 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
977 continue;
978 if (!q->pci_subdevice ||
979 q->pci_subdevice == codec->bus->pci->subsystem_device)
980 return alc_codec_rename(codec, q->name);
981 }
982
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200983 return 0;
984}
985
Takashi Iwaie4770622011-07-08 11:11:35 +0200986
987/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200988 * Digital-beep handlers
989 */
990#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwaifea80fa2018-06-20 12:52:46 +0200991
992/* additional beep mixers; private_value will be overwritten */
993static const struct snd_kcontrol_new alc_beep_mixer[] = {
994 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
995 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
996};
997
998/* set up and create beep controls */
999static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1000 int idx, int dir)
1001{
1002 struct snd_kcontrol_new *knew;
1003 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1004 int i;
1005
1006 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1007 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1008 &alc_beep_mixer[i]);
1009 if (!knew)
1010 return -ENOMEM;
1011 knew->private_value = beep_amp;
1012 }
1013 return 0;
1014}
Takashi Iwai1d045db2011-07-07 18:23:21 +02001015
1016static const struct snd_pci_quirk beep_white_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +02001017 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -07001018 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001019 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +01001020 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001021 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1022 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1023 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +01001024 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001025 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1026 {}
1027};
1028
1029static inline int has_cdefine_beep(struct hda_codec *codec)
1030{
1031 struct alc_spec *spec = codec->spec;
1032 const struct snd_pci_quirk *q;
1033 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
1034 if (q)
1035 return q->value;
1036 return spec->cdefine.enable_pcbeep;
1037}
1038#else
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001039#define set_beep_amp(spec, nid, idx, dir) 0
Takashi Iwai1d045db2011-07-07 18:23:21 +02001040#define has_cdefine_beep(codec) 0
1041#endif
1042
1043/* parse the BIOS configuration and set up the alc_spec */
1044/* return 1 if successful, 0 if the proper config is not found,
1045 * or a negative error code
1046 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001047static int alc_parse_auto_config(struct hda_codec *codec,
1048 const hda_nid_t *ignore_nids,
1049 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001050{
1051 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001052 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001053 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001054
Takashi Iwai53c334a2011-08-23 18:27:14 +02001055 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1056 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001057 if (err < 0)
1058 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001059
1060 if (ssid_nids)
1061 alc_ssid_check(codec, ssid_nids);
1062
Takashi Iwai08c189f2012-12-19 15:22:24 +01001063 err = snd_hda_gen_parse_auto_config(codec, cfg);
1064 if (err < 0)
1065 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001066
Takashi Iwai1d045db2011-07-07 18:23:21 +02001067 return 1;
1068}
1069
Takashi Iwai3de95172012-05-07 18:03:15 +02001070/* common preparation job for alc_spec */
1071static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1072{
1073 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1074 int err;
1075
1076 if (!spec)
1077 return -ENOMEM;
1078 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001079 snd_hda_gen_spec_init(&spec->gen);
1080 spec->gen.mixer_nid = mixer_nid;
1081 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001082 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001083 /* FIXME: do we need this for all Realtek codec models? */
1084 codec->spdif_status_reset = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001085 codec->patch_ops = alc_patch_ops;
Takashi Iwai3de95172012-05-07 18:03:15 +02001086
1087 err = alc_codec_rename_from_preset(codec);
1088 if (err < 0) {
1089 kfree(spec);
1090 return err;
1091 }
1092 return 0;
1093}
1094
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001095static int alc880_parse_auto_config(struct hda_codec *codec)
1096{
1097 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001098 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001099 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1100}
1101
Takashi Iwai1d045db2011-07-07 18:23:21 +02001102/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001103 * ALC880 fix-ups
1104 */
1105enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001106 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001107 ALC880_FIXUP_GPIO2,
1108 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001109 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001110 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001111 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001112 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001113 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001114 ALC880_FIXUP_VOL_KNOB,
1115 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001116 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001117 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001118 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001119 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001120 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001121 ALC880_FIXUP_3ST_BASE,
1122 ALC880_FIXUP_3ST,
1123 ALC880_FIXUP_3ST_DIG,
1124 ALC880_FIXUP_5ST_BASE,
1125 ALC880_FIXUP_5ST,
1126 ALC880_FIXUP_5ST_DIG,
1127 ALC880_FIXUP_6ST_BASE,
1128 ALC880_FIXUP_6ST,
1129 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001130 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001131};
1132
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001133/* enable the volume-knob widget support on NID 0x21 */
1134static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001135 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001136{
Takashi Iwai1727a772013-01-10 09:52:52 +01001137 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001138 snd_hda_jack_detect_enable_callback(codec, 0x21,
1139 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001140}
1141
Takashi Iwai1727a772013-01-10 09:52:52 +01001142static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001143 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001144 .type = HDA_FIXUP_FUNC,
1145 .v.func = alc_fixup_gpio1,
Takashi Iwai411225a2012-02-20 17:48:19 +01001146 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001147 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001148 .type = HDA_FIXUP_FUNC,
1149 .v.func = alc_fixup_gpio2,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001150 },
1151 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001152 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001153 .v.verbs = (const struct hda_verb[]) {
1154 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1155 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1156 { }
1157 },
1158 .chained = true,
1159 .chain_id = ALC880_FIXUP_GPIO2,
1160 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001161 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001162 .type = HDA_FIXUP_PINS,
1163 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001164 /* disable bogus unused pins */
1165 { 0x16, 0x411111f0 },
1166 { 0x18, 0x411111f0 },
1167 { 0x1a, 0x411111f0 },
1168 { }
1169 }
1170 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001171 [ALC880_FIXUP_LG_LW25] = {
1172 .type = HDA_FIXUP_PINS,
1173 .v.pins = (const struct hda_pintbl[]) {
1174 { 0x1a, 0x0181344f }, /* line-in */
1175 { 0x1b, 0x0321403f }, /* headphone */
1176 { }
1177 }
1178 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001179 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001180 .type = HDA_FIXUP_PINS,
1181 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001182 /* disable bogus unused pins */
1183 { 0x17, 0x411111f0 },
1184 { }
1185 },
1186 .chained = true,
1187 .chain_id = ALC880_FIXUP_GPIO2,
1188 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001189 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001190 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001191 .v.verbs = (const struct hda_verb[]) {
1192 /* change to EAPD mode */
1193 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1194 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1195 {}
1196 },
1197 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001198 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001199 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001200 .v.verbs = (const struct hda_verb[]) {
1201 /* change to EAPD mode */
1202 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1203 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1204 {}
1205 },
1206 .chained = true,
1207 .chain_id = ALC880_FIXUP_GPIO2,
1208 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001209 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001210 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001211 .v.func = alc880_fixup_vol_knob,
1212 },
1213 [ALC880_FIXUP_FUJITSU] = {
1214 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001215 .type = HDA_FIXUP_PINS,
1216 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001217 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001218 { 0x15, 0x99030120 }, /* speaker */
1219 { 0x16, 0x99030130 }, /* bass speaker */
1220 { 0x17, 0x411111f0 }, /* N/A */
1221 { 0x18, 0x411111f0 }, /* N/A */
1222 { 0x19, 0x01a19950 }, /* mic-in */
1223 { 0x1a, 0x411111f0 }, /* N/A */
1224 { 0x1b, 0x411111f0 }, /* N/A */
1225 { 0x1c, 0x411111f0 }, /* N/A */
1226 { 0x1d, 0x411111f0 }, /* N/A */
1227 { 0x1e, 0x01454140 }, /* SPDIF out */
1228 { }
1229 },
1230 .chained = true,
1231 .chain_id = ALC880_FIXUP_VOL_KNOB,
1232 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001233 [ALC880_FIXUP_F1734] = {
1234 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001235 .type = HDA_FIXUP_PINS,
1236 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001237 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001238 { 0x15, 0x99030120 }, /* speaker */
1239 { 0x16, 0x411111f0 }, /* N/A */
1240 { 0x17, 0x411111f0 }, /* N/A */
1241 { 0x18, 0x411111f0 }, /* N/A */
1242 { 0x19, 0x01a19950 }, /* mic-in */
1243 { 0x1a, 0x411111f0 }, /* N/A */
1244 { 0x1b, 0x411111f0 }, /* N/A */
1245 { 0x1c, 0x411111f0 }, /* N/A */
1246 { 0x1d, 0x411111f0 }, /* N/A */
1247 { 0x1e, 0x411111f0 }, /* N/A */
1248 { }
1249 },
1250 .chained = true,
1251 .chain_id = ALC880_FIXUP_VOL_KNOB,
1252 },
Takashi Iwai817de922012-02-20 17:20:48 +01001253 [ALC880_FIXUP_UNIWILL] = {
1254 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001255 .type = HDA_FIXUP_PINS,
1256 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001257 { 0x14, 0x0121411f }, /* HP */
1258 { 0x15, 0x99030120 }, /* speaker */
1259 { 0x16, 0x99030130 }, /* bass speaker */
1260 { }
1261 },
1262 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001263 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001264 .type = HDA_FIXUP_PINS,
1265 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001266 /* disable bogus unused pins */
1267 { 0x17, 0x411111f0 },
1268 { 0x19, 0x411111f0 },
1269 { 0x1b, 0x411111f0 },
1270 { 0x1f, 0x411111f0 },
1271 { }
1272 }
1273 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001274 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001275 .type = HDA_FIXUP_PINS,
1276 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001277 /* set up the whole pins as BIOS is utterly broken */
1278 { 0x14, 0x99030120 }, /* speaker */
1279 { 0x15, 0x0121411f }, /* HP */
1280 { 0x16, 0x411111f0 }, /* N/A */
1281 { 0x17, 0x411111f0 }, /* N/A */
1282 { 0x18, 0x01a19950 }, /* mic-in */
1283 { 0x19, 0x411111f0 }, /* N/A */
1284 { 0x1a, 0x01813031 }, /* line-in */
1285 { 0x1b, 0x411111f0 }, /* N/A */
1286 { 0x1c, 0x411111f0 }, /* N/A */
1287 { 0x1d, 0x411111f0 }, /* N/A */
1288 { 0x1e, 0x0144111e }, /* SPDIF */
1289 { }
1290 }
1291 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001292 [ALC880_FIXUP_ASUS_W5A] = {
1293 .type = HDA_FIXUP_PINS,
1294 .v.pins = (const struct hda_pintbl[]) {
1295 /* set up the whole pins as BIOS is utterly broken */
1296 { 0x14, 0x0121411f }, /* HP */
1297 { 0x15, 0x411111f0 }, /* N/A */
1298 { 0x16, 0x411111f0 }, /* N/A */
1299 { 0x17, 0x411111f0 }, /* N/A */
1300 { 0x18, 0x90a60160 }, /* mic */
1301 { 0x19, 0x411111f0 }, /* N/A */
1302 { 0x1a, 0x411111f0 }, /* N/A */
1303 { 0x1b, 0x411111f0 }, /* N/A */
1304 { 0x1c, 0x411111f0 }, /* N/A */
1305 { 0x1d, 0x411111f0 }, /* N/A */
1306 { 0x1e, 0xb743111e }, /* SPDIF out */
1307 { }
1308 },
1309 .chained = true,
1310 .chain_id = ALC880_FIXUP_GPIO1,
1311 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001312 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001313 .type = HDA_FIXUP_PINS,
1314 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001315 { 0x14, 0x01014010 }, /* line-out */
1316 { 0x15, 0x411111f0 }, /* N/A */
1317 { 0x16, 0x411111f0 }, /* N/A */
1318 { 0x17, 0x411111f0 }, /* N/A */
1319 { 0x18, 0x01a19c30 }, /* mic-in */
1320 { 0x19, 0x0121411f }, /* HP */
1321 { 0x1a, 0x01813031 }, /* line-in */
1322 { 0x1b, 0x02a19c40 }, /* front-mic */
1323 { 0x1c, 0x411111f0 }, /* N/A */
1324 { 0x1d, 0x411111f0 }, /* N/A */
1325 /* 0x1e is filled in below */
1326 { 0x1f, 0x411111f0 }, /* N/A */
1327 { }
1328 }
1329 },
1330 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001331 .type = HDA_FIXUP_PINS,
1332 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001333 { 0x1e, 0x411111f0 }, /* N/A */
1334 { }
1335 },
1336 .chained = true,
1337 .chain_id = ALC880_FIXUP_3ST_BASE,
1338 },
1339 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001340 .type = HDA_FIXUP_PINS,
1341 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001342 { 0x1e, 0x0144111e }, /* SPDIF */
1343 { }
1344 },
1345 .chained = true,
1346 .chain_id = ALC880_FIXUP_3ST_BASE,
1347 },
1348 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001349 .type = HDA_FIXUP_PINS,
1350 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001351 { 0x14, 0x01014010 }, /* front */
1352 { 0x15, 0x411111f0 }, /* N/A */
1353 { 0x16, 0x01011411 }, /* CLFE */
1354 { 0x17, 0x01016412 }, /* surr */
1355 { 0x18, 0x01a19c30 }, /* mic-in */
1356 { 0x19, 0x0121411f }, /* HP */
1357 { 0x1a, 0x01813031 }, /* line-in */
1358 { 0x1b, 0x02a19c40 }, /* front-mic */
1359 { 0x1c, 0x411111f0 }, /* N/A */
1360 { 0x1d, 0x411111f0 }, /* N/A */
1361 /* 0x1e is filled in below */
1362 { 0x1f, 0x411111f0 }, /* N/A */
1363 { }
1364 }
1365 },
1366 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001367 .type = HDA_FIXUP_PINS,
1368 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001369 { 0x1e, 0x411111f0 }, /* N/A */
1370 { }
1371 },
1372 .chained = true,
1373 .chain_id = ALC880_FIXUP_5ST_BASE,
1374 },
1375 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001376 .type = HDA_FIXUP_PINS,
1377 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001378 { 0x1e, 0x0144111e }, /* SPDIF */
1379 { }
1380 },
1381 .chained = true,
1382 .chain_id = ALC880_FIXUP_5ST_BASE,
1383 },
1384 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001385 .type = HDA_FIXUP_PINS,
1386 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001387 { 0x14, 0x01014010 }, /* front */
1388 { 0x15, 0x01016412 }, /* surr */
1389 { 0x16, 0x01011411 }, /* CLFE */
1390 { 0x17, 0x01012414 }, /* side */
1391 { 0x18, 0x01a19c30 }, /* mic-in */
1392 { 0x19, 0x02a19c40 }, /* front-mic */
1393 { 0x1a, 0x01813031 }, /* line-in */
1394 { 0x1b, 0x0121411f }, /* HP */
1395 { 0x1c, 0x411111f0 }, /* N/A */
1396 { 0x1d, 0x411111f0 }, /* N/A */
1397 /* 0x1e is filled in below */
1398 { 0x1f, 0x411111f0 }, /* N/A */
1399 { }
1400 }
1401 },
1402 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001403 .type = HDA_FIXUP_PINS,
1404 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001405 { 0x1e, 0x411111f0 }, /* N/A */
1406 { }
1407 },
1408 .chained = true,
1409 .chain_id = ALC880_FIXUP_6ST_BASE,
1410 },
1411 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001412 .type = HDA_FIXUP_PINS,
1413 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001414 { 0x1e, 0x0144111e }, /* SPDIF */
1415 { }
1416 },
1417 .chained = true,
1418 .chain_id = ALC880_FIXUP_6ST_BASE,
1419 },
Takashi Iwai53971452013-01-23 18:21:37 +01001420 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1421 .type = HDA_FIXUP_PINS,
1422 .v.pins = (const struct hda_pintbl[]) {
1423 { 0x1b, 0x0121401f }, /* HP with jack detect */
1424 { }
1425 },
1426 .chained_before = true,
1427 .chain_id = ALC880_FIXUP_6ST_BASE,
1428 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001429};
1430
1431static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001432 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001433 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001434 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001435 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001436 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001437 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001438 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001439 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001440 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001441 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001442 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001443 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001444 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001445 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001446 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001447 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001448 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001449 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001450 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1451 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1452 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001453 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001454 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001455
1456 /* Below is the copied entries from alc880_quirks.c.
1457 * It's not quite sure whether BIOS sets the correct pin-config table
1458 * on these machines, thus they are kept to be compatible with
1459 * the old static quirks. Once when it's confirmed to work without
1460 * these overrides, it'd be better to remove.
1461 */
1462 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1463 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1464 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1465 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1466 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1467 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1468 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1469 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1470 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1471 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1472 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1473 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1474 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1475 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1476 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1477 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1478 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1479 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1480 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1481 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1482 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1483 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1484 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1485 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1486 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1487 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1488 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1489 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1490 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1491 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1492 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1493 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1494 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1495 /* default Intel */
1496 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1497 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1498 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1499 {}
1500};
1501
Takashi Iwai1727a772013-01-10 09:52:52 +01001502static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001503 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1504 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1505 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1506 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1507 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1508 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001509 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001510 {}
1511};
1512
1513
1514/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001515 * OK, here we have finally the patch for ALC880
1516 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001517static int patch_alc880(struct hda_codec *codec)
1518{
1519 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001520 int err;
1521
Takashi Iwai3de95172012-05-07 18:03:15 +02001522 err = alc_alloc_spec(codec, 0x0b);
1523 if (err < 0)
1524 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001525
Takashi Iwai3de95172012-05-07 18:03:15 +02001526 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001527 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001528 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001529
Takashi Iwai225068a2015-05-29 10:42:14 +02001530 codec->patch_ops.unsol_event = alc880_unsol_event;
1531
Takashi Iwai1727a772013-01-10 09:52:52 +01001532 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001533 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001534 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001535
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001536 /* automatic parse from the BIOS config */
1537 err = alc880_parse_auto_config(codec);
1538 if (err < 0)
1539 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001540
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001541 if (!spec->gen.no_analog) {
1542 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1543 if (err < 0)
1544 goto error;
1545 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001546
Takashi Iwai1727a772013-01-10 09:52:52 +01001547 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001548
Takashi Iwai1d045db2011-07-07 18:23:21 +02001549 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001550
1551 error:
1552 alc_free(codec);
1553 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001554}
1555
1556
1557/*
1558 * ALC260 support
1559 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001560static int alc260_parse_auto_config(struct hda_codec *codec)
1561{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001562 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001563 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1564 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001565}
1566
Takashi Iwai1d045db2011-07-07 18:23:21 +02001567/*
1568 * Pin config fixes
1569 */
1570enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001571 ALC260_FIXUP_HP_DC5750,
1572 ALC260_FIXUP_HP_PIN_0F,
1573 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001574 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001575 ALC260_FIXUP_GPIO1_TOGGLE,
1576 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001577 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001578 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001579 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001580 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001581 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001582};
1583
Takashi Iwai20f7d922012-02-16 12:35:16 +01001584static void alc260_gpio1_automute(struct hda_codec *codec)
1585{
1586 struct alc_spec *spec = codec->spec;
Takashi Iwaiaaf312d2018-06-19 22:28:22 +02001587
1588 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001589}
1590
1591static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001592 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001593{
1594 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001595 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001596 /* although the machine has only one output pin, we need to
1597 * toggle GPIO1 according to the jack state
1598 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001599 spec->gen.automute_hook = alc260_gpio1_automute;
1600 spec->gen.detect_hp = 1;
1601 spec->gen.automute_speaker = 1;
1602 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001603 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001604 snd_hda_gen_hp_automute);
Takashi Iwai5579cd62018-06-19 22:22:41 +02001605 alc_setup_gpio(codec, 0x01);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001606 }
1607}
1608
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001609static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001610 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001611{
1612 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001613 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001614 { 0x0f, 0x02214000 }, /* HP/speaker */
1615 { 0x12, 0x90a60160 }, /* int mic */
1616 { 0x13, 0x02a19000 }, /* ext mic */
1617 { 0x18, 0x01446000 }, /* SPDIF out */
1618 /* disable bogus I/O pins */
1619 { 0x10, 0x411111f0 },
1620 { 0x11, 0x411111f0 },
1621 { 0x14, 0x411111f0 },
1622 { 0x15, 0x411111f0 },
1623 { 0x16, 0x411111f0 },
1624 { 0x17, 0x411111f0 },
1625 { 0x19, 0x411111f0 },
1626 { }
1627 };
1628
1629 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001630 case HDA_FIXUP_ACT_PRE_PROBE:
1631 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001632 spec->init_amp = ALC_INIT_NONE;
1633 break;
1634 }
1635}
1636
Takashi Iwai39aedee2013-01-10 17:10:40 +01001637static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1638 const struct hda_fixup *fix, int action)
1639{
1640 struct alc_spec *spec = codec->spec;
Takashi Iwai1c76aa52018-06-21 16:37:54 +02001641 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001642 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001643}
1644
1645static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1646 const struct hda_fixup *fix, int action)
1647{
1648 struct alc_spec *spec = codec->spec;
1649 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001650 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001651 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001652 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001653}
1654
Takashi Iwai1727a772013-01-10 09:52:52 +01001655static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001656 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001657 .type = HDA_FIXUP_PINS,
1658 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001659 { 0x11, 0x90130110 }, /* speaker */
1660 { }
1661 }
1662 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001663 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001664 .type = HDA_FIXUP_PINS,
1665 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001666 { 0x0f, 0x01214000 }, /* HP */
1667 { }
1668 }
1669 },
1670 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001671 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001672 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001673 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1674 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001675 { }
1676 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001677 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001678 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001679 .type = HDA_FIXUP_FUNC,
1680 .v.func = alc_fixup_gpio1,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001681 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001682 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001683 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001684 .v.func = alc260_fixup_gpio1_toggle,
1685 .chained = true,
1686 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1687 },
1688 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001689 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001690 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001691 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1692 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001693 { }
1694 },
1695 .chained = true,
1696 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1697 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001698 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001699 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001700 .v.func = alc260_fixup_gpio1_toggle,
1701 .chained = true,
1702 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001703 },
1704 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001705 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001706 .v.func = alc260_fixup_kn1,
1707 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001708 [ALC260_FIXUP_FSC_S7020] = {
1709 .type = HDA_FIXUP_FUNC,
1710 .v.func = alc260_fixup_fsc_s7020,
1711 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001712 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1713 .type = HDA_FIXUP_FUNC,
1714 .v.func = alc260_fixup_fsc_s7020_jwse,
1715 .chained = true,
1716 .chain_id = ALC260_FIXUP_FSC_S7020,
1717 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001718 [ALC260_FIXUP_VAIO_PINS] = {
1719 .type = HDA_FIXUP_PINS,
1720 .v.pins = (const struct hda_pintbl[]) {
1721 /* Pin configs are missing completely on some VAIOs */
1722 { 0x0f, 0x01211020 },
1723 { 0x10, 0x0001003f },
1724 { 0x11, 0x411111f0 },
1725 { 0x12, 0x01a15930 },
1726 { 0x13, 0x411111f0 },
1727 { 0x14, 0x411111f0 },
1728 { 0x15, 0x411111f0 },
1729 { 0x16, 0x411111f0 },
1730 { 0x17, 0x411111f0 },
1731 { 0x18, 0x411111f0 },
1732 { 0x19, 0x411111f0 },
1733 { }
1734 }
1735 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001736};
1737
1738static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001739 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001740 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001741 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001742 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001743 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001744 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001745 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001746 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001747 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001748 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001749 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001750 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001751 {}
1752};
1753
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001754static const struct hda_model_fixup alc260_fixup_models[] = {
1755 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1756 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1757 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1758 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1759 {}
1760};
1761
Takashi Iwai1d045db2011-07-07 18:23:21 +02001762/*
1763 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001764static int patch_alc260(struct hda_codec *codec)
1765{
1766 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001767 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001768
Takashi Iwai3de95172012-05-07 18:03:15 +02001769 err = alc_alloc_spec(codec, 0x07);
1770 if (err < 0)
1771 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001772
Takashi Iwai3de95172012-05-07 18:03:15 +02001773 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001774 /* as quite a few machines require HP amp for speaker outputs,
1775 * it's easier to enable it unconditionally; even if it's unneeded,
1776 * it's almost harmless.
1777 */
1778 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001779 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001780
Takashi Iwai225068a2015-05-29 10:42:14 +02001781 spec->shutup = alc_eapd_shutup;
1782
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001783 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1784 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001785 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001786
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001787 /* automatic parse from the BIOS config */
1788 err = alc260_parse_auto_config(codec);
1789 if (err < 0)
1790 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001791
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001792 if (!spec->gen.no_analog) {
1793 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1794 if (err < 0)
1795 goto error;
1796 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001797
Takashi Iwai1727a772013-01-10 09:52:52 +01001798 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001799
Takashi Iwai1d045db2011-07-07 18:23:21 +02001800 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001801
1802 error:
1803 alc_free(codec);
1804 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001805}
1806
1807
1808/*
1809 * ALC882/883/885/888/889 support
1810 *
1811 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1812 * configuration. Each pin widget can choose any input DACs and a mixer.
1813 * Each ADC is connected from a mixer of all inputs. This makes possible
1814 * 6-channel independent captures.
1815 *
1816 * In addition, an independent DAC for the multi-playback (not used in this
1817 * driver yet).
1818 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001819
1820/*
1821 * Pin config fixes
1822 */
1823enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001824 ALC882_FIXUP_ABIT_AW9D_MAX,
1825 ALC882_FIXUP_LENOVO_Y530,
1826 ALC882_FIXUP_PB_M5210,
1827 ALC882_FIXUP_ACER_ASPIRE_7736,
1828 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001829 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001830 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001831 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001832 ALC888_FIXUP_EEE1601,
Takashi Iwai177943a32011-11-09 12:55:18 +01001833 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001834 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001835 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001836 ALC882_FIXUP_GPIO1,
1837 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001838 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001839 ALC889_FIXUP_COEF,
1840 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001841 ALC882_FIXUP_ACER_ASPIRE_4930G,
1842 ALC882_FIXUP_ACER_ASPIRE_8930G,
1843 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001844 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001845 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001846 ALC889_FIXUP_MBP_VREF,
1847 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001848 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001849 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001850 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001851 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001852 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001853 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001854 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001855 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001856 ALC1220_FIXUP_GB_DUAL_CODECS,
Peisen0202f5c2017-10-26 10:35:36 +08001857 ALC1220_FIXUP_CLEVO_P950,
Jeremy Soller7f665b12019-02-13 10:56:19 -07001858 ALC1220_FIXUP_SYSTEM76_ORYP5,
1859 ALC1220_FIXUP_SYSTEM76_ORYP5_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001860};
1861
Takashi Iwai68ef0562011-11-09 18:24:44 +01001862static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001863 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001864{
Takashi Iwai1727a772013-01-10 09:52:52 +01001865 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001866 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001867 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001868}
1869
Takashi Iwai56710872011-11-14 17:42:11 +01001870/* set up GPIO at initialization */
1871static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001872 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001873{
Takashi Iwai215c8502018-06-19 22:34:26 +02001874 struct alc_spec *spec = codec->spec;
1875
1876 spec->gpio_write_delay = true;
1877 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001878}
1879
Takashi Iwai02a237b2012-02-13 15:25:07 +01001880/* Fix the connection of some pins for ALC889:
1881 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1882 * work correctly (bko#42740)
1883 */
1884static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001885 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001886{
Takashi Iwai1727a772013-01-10 09:52:52 +01001887 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001888 /* fake the connections during parsing the tree */
Takashi Iwai02a237b2012-02-13 15:25:07 +01001889 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1890 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1891 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1892 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1893 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1894 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001895 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001896 /* restore the connections */
1897 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1898 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1899 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1900 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1901 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001902 }
1903}
1904
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001905/* Set VREF on HP pin */
1906static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001907 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001908{
1909 struct alc_spec *spec = codec->spec;
Mario Kleiner9f660a12015-12-22 00:45:43 +01001910 static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001911 int i;
1912
Takashi Iwai1727a772013-01-10 09:52:52 +01001913 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001914 return;
1915 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1916 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1917 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1918 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001919 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001920 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001921 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01001922 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001923 break;
1924 }
1925}
1926
Takashi Iwai0756f092013-12-04 13:59:45 +01001927static void alc889_fixup_mac_pins(struct hda_codec *codec,
1928 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001929{
1930 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001931 int i;
1932
Takashi Iwai0756f092013-12-04 13:59:45 +01001933 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001934 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001935 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001936 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001937 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001938 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01001939 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001940}
1941
Takashi Iwai0756f092013-12-04 13:59:45 +01001942/* Set VREF on speaker pins on imac91 */
1943static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1944 const struct hda_fixup *fix, int action)
1945{
1946 static hda_nid_t nids[2] = { 0x18, 0x1a };
1947
1948 if (action == HDA_FIXUP_ACT_INIT)
1949 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1950}
1951
Adrien Vergée7729a42014-01-24 14:56:14 -05001952/* Set VREF on speaker pins on mba11 */
1953static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1954 const struct hda_fixup *fix, int action)
1955{
1956 static hda_nid_t nids[1] = { 0x18 };
1957
1958 if (action == HDA_FIXUP_ACT_INIT)
1959 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1960}
1961
Takashi Iwai0756f092013-12-04 13:59:45 +01001962/* Set VREF on speaker pins on mba21 */
1963static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1964 const struct hda_fixup *fix, int action)
1965{
1966 static hda_nid_t nids[2] = { 0x18, 0x19 };
1967
1968 if (action == HDA_FIXUP_ACT_INIT)
1969 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1970}
1971
Takashi Iwaie427c232012-07-29 10:04:08 +02001972/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09001973 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1974 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02001975 */
1976static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001977 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02001978{
1979 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02001980 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01001981 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02001982 spec->gen.no_multi_io = 1;
1983 }
Takashi Iwaie427c232012-07-29 10:04:08 +02001984}
1985
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001986static void alc_fixup_bass_chmap(struct hda_codec *codec,
1987 const struct hda_fixup *fix, int action);
1988
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001989/* For dual-codec configuration, we need to disable some features to avoid
1990 * conflicts of kctls and PCM streams
1991 */
1992static void alc_fixup_dual_codecs(struct hda_codec *codec,
1993 const struct hda_fixup *fix, int action)
1994{
1995 struct alc_spec *spec = codec->spec;
1996
1997 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1998 return;
1999 /* disable vmaster */
2000 spec->gen.suppress_vmaster = 1;
2001 /* auto-mute and auto-mic switch don't work with multiple codecs */
2002 spec->gen.suppress_auto_mute = 1;
2003 spec->gen.suppress_auto_mic = 1;
2004 /* disable aamix as well */
2005 spec->gen.mixer_nid = 0;
2006 /* add location prefix to avoid conflicts */
2007 codec->force_pin_prefix = 1;
2008}
2009
2010static void rename_ctl(struct hda_codec *codec, const char *oldname,
2011 const char *newname)
2012{
2013 struct snd_kcontrol *kctl;
2014
2015 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2016 if (kctl)
2017 strcpy(kctl->id.name, newname);
2018}
2019
2020static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2021 const struct hda_fixup *fix,
2022 int action)
2023{
2024 alc_fixup_dual_codecs(codec, fix, action);
2025 switch (action) {
2026 case HDA_FIXUP_ACT_PRE_PROBE:
2027 /* override card longname to provide a unique UCM profile */
2028 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2029 break;
2030 case HDA_FIXUP_ACT_BUILD:
2031 /* rename Capture controls depending on the codec */
2032 rename_ctl(codec, "Capture Volume",
2033 codec->addr == 0 ?
2034 "Rear-Panel Capture Volume" :
2035 "Front-Panel Capture Volume");
2036 rename_ctl(codec, "Capture Switch",
2037 codec->addr == 0 ?
2038 "Rear-Panel Capture Switch" :
2039 "Front-Panel Capture Switch");
2040 break;
2041 }
2042}
2043
Peisen0202f5c2017-10-26 10:35:36 +08002044static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2045 const struct hda_fixup *fix,
2046 int action)
2047{
2048 hda_nid_t conn1[1] = { 0x0c };
2049
2050 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2051 return;
2052
2053 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2054 /* We therefore want to make sure 0x14 (front headphone) and
2055 * 0x1b (speakers) use the stereo DAC 0x02
2056 */
2057 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
2058 snd_hda_override_conn_list(codec, 0x1b, 1, conn1);
2059}
2060
Jeremy Soller7f665b12019-02-13 10:56:19 -07002061static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2062 const struct hda_fixup *fix, int action);
2063
2064static void alc1220_fixup_system76_oryp5(struct hda_codec *codec,
2065 const struct hda_fixup *fix,
2066 int action)
2067{
2068 alc1220_fixup_clevo_p950(codec, fix, action);
2069 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2070}
2071
Takashi Iwai1727a772013-01-10 09:52:52 +01002072static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002073 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002074 .type = HDA_FIXUP_PINS,
2075 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002076 { 0x15, 0x01080104 }, /* side */
2077 { 0x16, 0x01011012 }, /* rear */
2078 { 0x17, 0x01016011 }, /* clfe */
2079 { }
2080 }
2081 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002082 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002083 .type = HDA_FIXUP_PINS,
2084 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002085 { 0x15, 0x99130112 }, /* rear int speakers */
2086 { 0x16, 0x99130111 }, /* subwoofer */
2087 { }
2088 }
2089 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002090 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002091 .type = HDA_FIXUP_PINCTLS,
2092 .v.pins = (const struct hda_pintbl[]) {
2093 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002094 {}
2095 }
2096 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002097 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002098 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002099 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002100 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002101 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002102 .type = HDA_FIXUP_PINS,
2103 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002104 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2105 { }
2106 }
2107 },
Marton Balint8f239212012-03-05 21:33:23 +01002108 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002109 .type = HDA_FIXUP_PINS,
2110 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002111 { 0x1c, 0x993301f0 }, /* CD */
2112 { }
2113 }
2114 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002115 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2116 .type = HDA_FIXUP_PINS,
2117 .v.pins = (const struct hda_pintbl[]) {
2118 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2119 { }
2120 },
2121 .chained = true,
2122 .chain_id = ALC889_FIXUP_CD,
2123 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002124 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002125 .type = HDA_FIXUP_PINS,
2126 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002127 { 0x17, 0x90170111 }, /* hidden surround speaker */
2128 { }
2129 }
2130 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002131 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002132 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002133 .v.verbs = (const struct hda_verb[]) {
2134 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2135 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2136 { }
2137 }
Takashi Iwai177943a32011-11-09 12:55:18 +01002138 },
2139 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002140 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a32011-11-09 12:55:18 +01002141 .v.verbs = (const struct hda_verb[]) {
2142 /* change to EAPD mode */
2143 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2144 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2145 { }
2146 }
2147 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002148 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002149 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002150 .v.verbs = (const struct hda_verb[]) {
2151 /* change to EAPD mode */
2152 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2153 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2154 { }
2155 }
2156 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002157 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002158 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002159 .v.verbs = (const struct hda_verb[]) {
2160 /* eanable EAPD on Acer laptops */
2161 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2162 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2163 { }
2164 }
2165 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002166 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002167 .type = HDA_FIXUP_FUNC,
2168 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002169 },
2170 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002171 .type = HDA_FIXUP_FUNC,
2172 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002173 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002174 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002175 .type = HDA_FIXUP_FUNC,
2176 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002177 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002178 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002179 .type = HDA_FIXUP_FUNC,
2180 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002181 .chained = true,
2182 .chain_id = ALC882_FIXUP_EAPD,
2183 },
2184 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002185 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002186 .v.func = alc889_fixup_coef,
2187 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002188 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002189 .type = HDA_FIXUP_PINS,
2190 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002191 { 0x16, 0x99130111 }, /* CLFE speaker */
2192 { 0x17, 0x99130112 }, /* surround speaker */
2193 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002194 },
2195 .chained = true,
2196 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002197 },
2198 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002199 .type = HDA_FIXUP_PINS,
2200 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002201 { 0x16, 0x99130111 }, /* CLFE speaker */
2202 { 0x1b, 0x99130112 }, /* surround speaker */
2203 { }
2204 },
2205 .chained = true,
2206 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2207 },
2208 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2209 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002210 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002211 .v.verbs = (const struct hda_verb[]) {
2212 /* Enable all DACs */
2213 /* DAC DISABLE/MUTE 1? */
2214 /* setting bits 1-5 disables DAC nids 0x02-0x06
2215 * apparently. Init=0x38 */
2216 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2217 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2218 /* DAC DISABLE/MUTE 2? */
2219 /* some bit here disables the other DACs.
2220 * Init=0x4900 */
2221 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2222 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2223 /* DMIC fix
2224 * This laptop has a stereo digital microphone.
2225 * The mics are only 1cm apart which makes the stereo
2226 * useless. However, either the mic or the ALC889
2227 * makes the signal become a difference/sum signal
2228 * instead of standard stereo, which is annoying.
2229 * So instead we flip this bit which makes the
2230 * codec replicate the sum signal to both channels,
2231 * turning it into a normal mono mic.
2232 */
2233 /* DMIC_CONTROL? Init value = 0x0001 */
2234 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2235 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2236 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2237 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2238 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002239 },
2240 .chained = true,
2241 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002242 },
Takashi Iwai56710872011-11-14 17:42:11 +01002243 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002244 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002245 .v.func = alc885_fixup_macpro_gpio,
2246 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002247 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002248 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002249 .v.func = alc889_fixup_dac_route,
2250 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002251 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002252 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002253 .v.func = alc889_fixup_mbp_vref,
2254 .chained = true,
2255 .chain_id = ALC882_FIXUP_GPIO1,
2256 },
2257 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002258 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002259 .v.func = alc889_fixup_imac91_vref,
2260 .chained = true,
2261 .chain_id = ALC882_FIXUP_GPIO1,
2262 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002263 [ALC889_FIXUP_MBA11_VREF] = {
2264 .type = HDA_FIXUP_FUNC,
2265 .v.func = alc889_fixup_mba11_vref,
2266 .chained = true,
2267 .chain_id = ALC889_FIXUP_MBP_VREF,
2268 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002269 [ALC889_FIXUP_MBA21_VREF] = {
2270 .type = HDA_FIXUP_FUNC,
2271 .v.func = alc889_fixup_mba21_vref,
2272 .chained = true,
2273 .chain_id = ALC889_FIXUP_MBP_VREF,
2274 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002275 [ALC889_FIXUP_MP11_VREF] = {
2276 .type = HDA_FIXUP_FUNC,
2277 .v.func = alc889_fixup_mba11_vref,
2278 .chained = true,
2279 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2280 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002281 [ALC889_FIXUP_MP41_VREF] = {
2282 .type = HDA_FIXUP_FUNC,
2283 .v.func = alc889_fixup_mbp_vref,
2284 .chained = true,
2285 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2286 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002287 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002288 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002289 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002290 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002291 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002292 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002293 .v.func = alc882_fixup_no_primary_hp,
2294 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002295 [ALC887_FIXUP_ASUS_BASS] = {
2296 .type = HDA_FIXUP_PINS,
2297 .v.pins = (const struct hda_pintbl[]) {
2298 {0x16, 0x99130130}, /* bass speaker */
2299 {}
2300 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002301 .chained = true,
2302 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2303 },
2304 [ALC887_FIXUP_BASS_CHMAP] = {
2305 .type = HDA_FIXUP_FUNC,
2306 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002307 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002308 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2309 .type = HDA_FIXUP_FUNC,
2310 .v.func = alc1220_fixup_gb_dual_codecs,
2311 },
Peisen0202f5c2017-10-26 10:35:36 +08002312 [ALC1220_FIXUP_CLEVO_P950] = {
2313 .type = HDA_FIXUP_FUNC,
2314 .v.func = alc1220_fixup_clevo_p950,
2315 },
Jeremy Soller7f665b12019-02-13 10:56:19 -07002316 [ALC1220_FIXUP_SYSTEM76_ORYP5] = {
2317 .type = HDA_FIXUP_FUNC,
2318 .v.func = alc1220_fixup_system76_oryp5,
2319 },
2320 [ALC1220_FIXUP_SYSTEM76_ORYP5_PINS] = {
2321 .type = HDA_FIXUP_PINS,
2322 .v.pins = (const struct hda_pintbl[]) {
2323 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2324 {}
2325 },
2326 .chained = true,
2327 .chain_id = ALC1220_FIXUP_SYSTEM76_ORYP5,
2328 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002329};
2330
2331static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002332 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2333 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002334 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002335 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2336 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2337 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2338 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002339 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2340 ALC882_FIXUP_ACER_ASPIRE_4930G),
2341 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2342 ALC882_FIXUP_ACER_ASPIRE_4930G),
2343 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2344 ALC882_FIXUP_ACER_ASPIRE_8930G),
2345 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2346 ALC882_FIXUP_ACER_ASPIRE_8930G),
2347 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2348 ALC882_FIXUP_ACER_ASPIRE_4930G),
2349 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2350 ALC882_FIXUP_ACER_ASPIRE_4930G),
2351 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2352 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002353 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002354 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2355 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002356 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002357 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002358 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a32011-11-09 12:55:18 +01002359 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002360 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002361 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002362 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002363 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002364 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002365 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002366 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002367 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Fernando Luis Vázquez Cao12e31a72013-02-12 16:47:44 +09002368 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaic44d9b12016-02-07 09:38:26 +01002369 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002370
2371 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002372 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2373 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2374 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002375 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002376 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2377 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002378 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2379 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002380 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002381 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002382 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002383 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2384 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002385 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002386 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2387 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2388 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002389 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002390 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002391 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2392 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002393 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002394
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002395 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002396 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002397 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002398 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai63691582017-05-22 16:32:46 +02002399 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002400 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002401 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
Peisen0202f5c2017-10-26 10:35:36 +08002402 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaif3d737b2018-07-17 17:08:32 +02002403 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
Jeremy Soller2f0d5202018-05-07 09:28:45 -06002404 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
Jeremy Soller7f665b12019-02-13 10:56:19 -07002405 SND_PCI_QUIRK(0x1558, 0x96e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
2406 SND_PCI_QUIRK(0x1558, 0x97e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002407 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2408 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002409 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002410 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002411 {}
2412};
2413
Takashi Iwai1727a772013-01-10 09:52:52 +01002414static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002415 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2416 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2417 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2418 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2419 {.id = ALC889_FIXUP_CD, .name = "cd"},
2420 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2421 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2422 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2423 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2424 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2425 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2426 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2427 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2428 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2429 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002430 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2431 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2432 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002433 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2434 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2435 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2436 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2437 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2438 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2439 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2440 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002441 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002442 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002443 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002444 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002445 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002446 {}
2447};
2448
Takashi Iwai1d045db2011-07-07 18:23:21 +02002449/*
2450 * BIOS auto configuration
2451 */
2452/* almost identical with ALC880 parser... */
2453static int alc882_parse_auto_config(struct hda_codec *codec)
2454{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002455 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002456 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2457 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002458}
2459
Takashi Iwai1d045db2011-07-07 18:23:21 +02002460/*
2461 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002462static int patch_alc882(struct hda_codec *codec)
2463{
2464 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002465 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002466
Takashi Iwai3de95172012-05-07 18:03:15 +02002467 err = alc_alloc_spec(codec, 0x0b);
2468 if (err < 0)
2469 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002470
Takashi Iwai3de95172012-05-07 18:03:15 +02002471 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002472
Takashi Iwai7639a062015-03-03 10:07:24 +01002473 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002474 case 0x10ec0882:
2475 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002476 case 0x10ec0900:
Kailang Yanga535ad52017-01-16 16:59:26 +08002477 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002478 break;
2479 default:
2480 /* ALC883 and variants */
2481 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2482 break;
2483 }
2484
Takashi Iwai1727a772013-01-10 09:52:52 +01002485 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002486 alc882_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002487 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002488
2489 alc_auto_parse_customize_define(codec);
2490
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002491 if (has_cdefine_beep(codec))
2492 spec->gen.beep_nid = 0x01;
2493
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002494 /* automatic parse from the BIOS config */
2495 err = alc882_parse_auto_config(codec);
2496 if (err < 0)
2497 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002498
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002499 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2500 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2501 if (err < 0)
2502 goto error;
2503 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002504
Takashi Iwai1727a772013-01-10 09:52:52 +01002505 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002506
Takashi Iwai1d045db2011-07-07 18:23:21 +02002507 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002508
2509 error:
2510 alc_free(codec);
2511 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002512}
2513
2514
2515/*
2516 * ALC262 support
2517 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002518static int alc262_parse_auto_config(struct hda_codec *codec)
2519{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002520 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002521 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2522 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002523}
2524
2525/*
2526 * Pin config fixes
2527 */
2528enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002529 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002530 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002531 ALC262_FIXUP_HP_Z200,
2532 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002533 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002534 ALC262_FIXUP_BENQ,
2535 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002536 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002537 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002538};
2539
Takashi Iwai1727a772013-01-10 09:52:52 +01002540static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002541 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002542 .type = HDA_FIXUP_PINS,
2543 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002544 { 0x14, 0x99130110 }, /* speaker */
2545 { 0x15, 0x0221142f }, /* front HP */
2546 { 0x1b, 0x0121141f }, /* rear HP */
2547 { }
2548 }
2549 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002550 [ALC262_FIXUP_FSC_S7110] = {
2551 .type = HDA_FIXUP_PINS,
2552 .v.pins = (const struct hda_pintbl[]) {
2553 { 0x15, 0x90170110 }, /* speaker */
2554 { }
2555 },
2556 .chained = true,
2557 .chain_id = ALC262_FIXUP_BENQ,
2558 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002559 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002560 .type = HDA_FIXUP_PINS,
2561 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002562 { 0x16, 0x99130120 }, /* internal speaker */
2563 { }
2564 }
2565 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002566 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002567 .type = HDA_FIXUP_PINS,
2568 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002569 { 0x14, 0x1993e1f0 }, /* int AUX */
2570 { }
2571 }
2572 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002573 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002574 .type = HDA_FIXUP_PINCTLS,
2575 .v.pins = (const struct hda_pintbl[]) {
2576 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002577 {}
2578 },
2579 .chained = true,
2580 .chain_id = ALC262_FIXUP_BENQ,
2581 },
2582 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002583 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002584 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002585 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2586 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2587 {}
2588 }
2589 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002590 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002591 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002592 .v.verbs = (const struct hda_verb[]) {
2593 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2594 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2595 {}
2596 }
2597 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002598 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002599 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002600 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002601 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002602 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2603 .type = HDA_FIXUP_FUNC,
2604 .v.func = alc_fixup_no_depop_delay,
2605 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002606};
2607
2608static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002609 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002610 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002611 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002612 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002613 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002614 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002615 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002616 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2617 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002618 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002619 {}
2620};
2621
Takashi Iwai1727a772013-01-10 09:52:52 +01002622static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002623 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002624 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2625 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2626 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2627 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2628 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2629 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2630 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2631 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002632 {}
2633};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002634
Takashi Iwai1d045db2011-07-07 18:23:21 +02002635/*
2636 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002637static int patch_alc262(struct hda_codec *codec)
2638{
2639 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002640 int err;
2641
Takashi Iwai3de95172012-05-07 18:03:15 +02002642 err = alc_alloc_spec(codec, 0x0b);
2643 if (err < 0)
2644 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002645
Takashi Iwai3de95172012-05-07 18:03:15 +02002646 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002647 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002648
Takashi Iwai225068a2015-05-29 10:42:14 +02002649 spec->shutup = alc_eapd_shutup;
2650
Takashi Iwai1d045db2011-07-07 18:23:21 +02002651#if 0
2652 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2653 * under-run
2654 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002655 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002656#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002657 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2658
Takashi Iwai1727a772013-01-10 09:52:52 +01002659 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002660 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002661 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002662
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002663 alc_auto_parse_customize_define(codec);
2664
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002665 if (has_cdefine_beep(codec))
2666 spec->gen.beep_nid = 0x01;
2667
Takashi Iwai42399f72011-11-07 17:18:44 +01002668 /* automatic parse from the BIOS config */
2669 err = alc262_parse_auto_config(codec);
2670 if (err < 0)
2671 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002672
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002673 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2674 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2675 if (err < 0)
2676 goto error;
2677 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002678
Takashi Iwai1727a772013-01-10 09:52:52 +01002679 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002680
Takashi Iwai1d045db2011-07-07 18:23:21 +02002681 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002682
2683 error:
2684 alc_free(codec);
2685 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002686}
2687
2688/*
2689 * ALC268
2690 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002691/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002692static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2693 struct snd_ctl_elem_value *ucontrol)
2694{
2695 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2696 unsigned long pval;
2697 int err;
2698
2699 mutex_lock(&codec->control_mutex);
2700 pval = kcontrol->private_value;
2701 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2702 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2703 if (err >= 0) {
2704 kcontrol->private_value = (pval & ~0xff) | 0x10;
2705 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2706 }
2707 kcontrol->private_value = pval;
2708 mutex_unlock(&codec->control_mutex);
2709 return err;
2710}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002711
2712static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2713 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002714 {
2715 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2716 .name = "Beep Playback Switch",
2717 .subdevice = HDA_SUBDEV_AMP_FLAG,
2718 .info = snd_hda_mixer_amp_switch_info,
2719 .get = snd_hda_mixer_amp_switch_get,
2720 .put = alc268_beep_switch_put,
2721 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2722 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002723};
2724
2725/* set PCBEEP vol = 0, mute connections */
2726static const struct hda_verb alc268_beep_init_verbs[] = {
2727 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2728 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2729 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2730 { }
2731};
2732
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002733enum {
2734 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002735 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002736 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002737};
2738
Takashi Iwai1727a772013-01-10 09:52:52 +01002739static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002740 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002741 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002742 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002743 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002744 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002745 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002746 .v.verbs = (const struct hda_verb[]) {
2747 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2748 {}
2749 }
2750 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002751 [ALC268_FIXUP_SPDIF] = {
2752 .type = HDA_FIXUP_PINS,
2753 .v.pins = (const struct hda_pintbl[]) {
2754 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2755 {}
2756 }
2757 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002758};
2759
Takashi Iwai1727a772013-01-10 09:52:52 +01002760static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002761 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002762 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02002763 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002764 {}
2765};
2766
2767static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002768 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002769 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002770 /* below is codec SSID since multiple Toshiba laptops have the
2771 * same PCI SSID 1179:ff00
2772 */
2773 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002774 {}
2775};
2776
Takashi Iwai1d045db2011-07-07 18:23:21 +02002777/*
2778 * BIOS auto configuration
2779 */
2780static int alc268_parse_auto_config(struct hda_codec *codec)
2781{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002782 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002783 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002784}
2785
Takashi Iwai1d045db2011-07-07 18:23:21 +02002786/*
2787 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002788static int patch_alc268(struct hda_codec *codec)
2789{
2790 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002791 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002792
Takashi Iwai1d045db2011-07-07 18:23:21 +02002793 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002794 err = alc_alloc_spec(codec, 0);
2795 if (err < 0)
2796 return err;
2797
2798 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002799 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002800
Takashi Iwai225068a2015-05-29 10:42:14 +02002801 spec->shutup = alc_eapd_shutup;
2802
Takashi Iwai1727a772013-01-10 09:52:52 +01002803 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2804 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002805
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002806 /* automatic parse from the BIOS config */
2807 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002808 if (err < 0)
2809 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002810
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002811 if (err > 0 && !spec->gen.no_analog &&
2812 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002813 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2814 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2815 &alc268_beep_mixer[i])) {
2816 err = -ENOMEM;
2817 goto error;
2818 }
2819 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002820 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002821 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2822 /* override the amp caps for beep generator */
2823 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2824 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2825 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2826 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2827 (0 << AC_AMPCAP_MUTE_SHIFT));
2828 }
2829
Takashi Iwai1727a772013-01-10 09:52:52 +01002830 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002831
Takashi Iwai1d045db2011-07-07 18:23:21 +02002832 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002833
2834 error:
2835 alc_free(codec);
2836 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002837}
2838
2839/*
2840 * ALC269
2841 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01002842
Takashi Iwai1d045db2011-07-07 18:23:21 +02002843static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002844 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002845};
2846
2847static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002848 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002849};
2850
Takashi Iwai1d045db2011-07-07 18:23:21 +02002851/* different alc269-variants */
2852enum {
2853 ALC269_TYPE_ALC269VA,
2854 ALC269_TYPE_ALC269VB,
2855 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02002856 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01002857 ALC269_TYPE_ALC280,
2858 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02002859 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01002860 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08002861 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02002862 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08002863 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02002864 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08002865 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08002866 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08002867 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08002868 ALC269_TYPE_ALC225,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08002869 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08002870 ALC269_TYPE_ALC300,
Kailang Yang6fbae352016-05-30 16:44:20 +08002871 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002872};
2873
2874/*
2875 * BIOS auto configuration
2876 */
2877static int alc269_parse_auto_config(struct hda_codec *codec)
2878{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002879 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002880 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2881 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2882 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02002883 const hda_nid_t *ssids;
2884
2885 switch (spec->codec_variant) {
2886 case ALC269_TYPE_ALC269VA:
2887 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01002888 case ALC269_TYPE_ALC280:
2889 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08002890 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02002891 ssids = alc269va_ssids;
2892 break;
2893 case ALC269_TYPE_ALC269VB:
2894 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01002895 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02002896 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02002897 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08002898 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02002899 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08002900 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08002901 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08002902 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08002903 case ALC269_TYPE_ALC225:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08002904 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08002905 case ALC269_TYPE_ALC300:
Kailang Yang6fbae352016-05-30 16:44:20 +08002906 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02002907 ssids = alc269_ssids;
2908 break;
2909 default:
2910 ssids = alc269_ssids;
2911 break;
2912 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002913
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002914 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002915}
2916
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002917static int find_ext_mic_pin(struct hda_codec *codec);
2918
2919static void alc286_shutup(struct hda_codec *codec)
2920{
Takashi Iwaia9c2dfc2018-04-23 17:24:56 +02002921 const struct hda_pincfg *pin;
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002922 int i;
2923 int mic_pin = find_ext_mic_pin(codec);
2924 /* don't shut up pins when unloading the driver; otherwise it breaks
2925 * the default pin setup at the next load of the driver
2926 */
2927 if (codec->bus->shutdown)
2928 return;
Takashi Iwaia9c2dfc2018-04-23 17:24:56 +02002929 snd_array_for_each(&codec->init_pins, i, pin) {
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002930 /* use read here for syncing after issuing each verb */
2931 if (pin->nid != mic_pin)
2932 snd_hda_codec_read(codec, pin->nid, 0,
2933 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2934 }
2935 codec->pins_shutup = 1;
2936}
2937
Kailang Yang1387e2d2012-11-08 10:23:18 +01002938static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02002939{
Takashi Iwai98b24882014-08-18 13:47:50 +02002940 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002941}
2942
2943static void alc269_shutup(struct hda_codec *codec)
2944{
Kailang Yangadcc70b2012-05-25 08:08:38 +02002945 struct alc_spec *spec = codec->spec;
2946
Kailang Yang1387e2d2012-11-08 10:23:18 +01002947 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2948 alc269vb_toggle_power_output(codec, 0);
2949 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2950 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002951 msleep(150);
2952 }
Takashi Iwai9bfb2842013-07-24 14:31:50 +02002953 snd_hda_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002954}
2955
Takashi Iwai54db6c32014-08-18 15:11:19 +02002956static struct coef_fw alc282_coefs[] = {
2957 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08002958 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02002959 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2960 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2961 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2962 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2963 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2964 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2965 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2966 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2967 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2968 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2969 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2970 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2971 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2972 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2973 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2974 WRITE_COEF(0x63, 0x2902), /* PLL */
2975 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2976 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2977 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2978 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2979 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2980 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2981 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2982 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2983 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2984 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2985 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2986 {}
2987};
2988
Kailang Yangcb149cb2014-03-18 16:45:32 +08002989static void alc282_restore_default_value(struct hda_codec *codec)
2990{
Takashi Iwai54db6c32014-08-18 15:11:19 +02002991 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08002992}
2993
Kailang Yang7b5c7a02014-03-18 16:15:54 +08002994static void alc282_init(struct hda_codec *codec)
2995{
2996 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01002997 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08002998 bool hp_pin_sense;
2999 int coef78;
3000
Kailang Yangcb149cb2014-03-18 16:45:32 +08003001 alc282_restore_default_value(codec);
3002
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003003 if (!hp_pin)
3004 return;
3005 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3006 coef78 = alc_read_coef_idx(codec, 0x78);
3007
3008 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3009 /* Headphone capless set to high power mode */
3010 alc_write_coef_idx(codec, 0x78, 0x9004);
3011
3012 if (hp_pin_sense)
3013 msleep(2);
3014
3015 snd_hda_codec_write(codec, hp_pin, 0,
3016 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3017
3018 if (hp_pin_sense)
3019 msleep(85);
3020
3021 snd_hda_codec_write(codec, hp_pin, 0,
3022 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3023
3024 if (hp_pin_sense)
3025 msleep(100);
3026
3027 /* Headphone capless set to normal mode */
3028 alc_write_coef_idx(codec, 0x78, coef78);
3029}
3030
3031static void alc282_shutup(struct hda_codec *codec)
3032{
3033 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003034 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003035 bool hp_pin_sense;
3036 int coef78;
3037
3038 if (!hp_pin) {
3039 alc269_shutup(codec);
3040 return;
3041 }
3042
3043 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3044 coef78 = alc_read_coef_idx(codec, 0x78);
3045 alc_write_coef_idx(codec, 0x78, 0x9004);
3046
3047 if (hp_pin_sense)
3048 msleep(2);
3049
3050 snd_hda_codec_write(codec, hp_pin, 0,
3051 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3052
3053 if (hp_pin_sense)
3054 msleep(85);
3055
3056 snd_hda_codec_write(codec, hp_pin, 0,
3057 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3058
3059 if (hp_pin_sense)
3060 msleep(100);
3061
3062 alc_auto_setup_eapd(codec, false);
3063 snd_hda_shutup_pins(codec);
3064 alc_write_coef_idx(codec, 0x78, coef78);
3065}
3066
Takashi Iwai54db6c32014-08-18 15:11:19 +02003067static struct coef_fw alc283_coefs[] = {
3068 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003069 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003070 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3071 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3072 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3073 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3074 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3075 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3076 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3077 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3078 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3079 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3080 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3081 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3082 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3083 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3084 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3085 WRITE_COEF(0x2e, 0x2902), /* PLL */
3086 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3087 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3088 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3089 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3090 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3091 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3092 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3093 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3094 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3095 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3096 WRITE_COEF(0x49, 0x0), /* test mode */
3097 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3098 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3099 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003100 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003101 {}
3102};
3103
Kailang Yang6bd55b02014-03-17 13:51:27 +08003104static void alc283_restore_default_value(struct hda_codec *codec)
3105{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003106 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003107}
3108
Kailang Yang2af02be2013-08-22 10:03:50 +02003109static void alc283_init(struct hda_codec *codec)
3110{
3111 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003112 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003113 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003114
Kailang Yang6bd55b02014-03-17 13:51:27 +08003115 alc283_restore_default_value(codec);
3116
Kailang Yang2af02be2013-08-22 10:03:50 +02003117 if (!hp_pin)
3118 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003119
3120 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003121 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3122
3123 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3124 /* Headphone capless set to high power mode */
3125 alc_write_coef_idx(codec, 0x43, 0x9004);
3126
3127 snd_hda_codec_write(codec, hp_pin, 0,
3128 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3129
3130 if (hp_pin_sense)
3131 msleep(85);
3132
3133 snd_hda_codec_write(codec, hp_pin, 0,
3134 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3135
3136 if (hp_pin_sense)
3137 msleep(85);
3138 /* Index 0x46 Combo jack auto switch control 2 */
3139 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003140 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003141 /* Headphone capless set to normal mode */
3142 alc_write_coef_idx(codec, 0x43, 0x9614);
3143}
3144
3145static void alc283_shutup(struct hda_codec *codec)
3146{
3147 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003148 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003149 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003150
3151 if (!hp_pin) {
3152 alc269_shutup(codec);
3153 return;
3154 }
3155
3156 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3157
3158 alc_write_coef_idx(codec, 0x43, 0x9004);
3159
Harsha Priyab450b172014-10-09 11:04:56 +00003160 /*depop hp during suspend*/
3161 alc_write_coef_idx(codec, 0x06, 0x2100);
3162
Kailang Yang2af02be2013-08-22 10:03:50 +02003163 snd_hda_codec_write(codec, hp_pin, 0,
3164 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3165
3166 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003167 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003168
3169 snd_hda_codec_write(codec, hp_pin, 0,
3170 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3171
Takashi Iwai98b24882014-08-18 13:47:50 +02003172 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003173
3174 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003175 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003176 alc_auto_setup_eapd(codec, false);
Kailang Yang2af02be2013-08-22 10:03:50 +02003177 snd_hda_shutup_pins(codec);
3178 alc_write_coef_idx(codec, 0x43, 0x9614);
3179}
3180
Kailang Yang4a219ef2017-06-16 16:54:35 +08003181static void alc256_init(struct hda_codec *codec)
3182{
3183 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003184 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003185 bool hp_pin_sense;
3186
3187 if (!hp_pin)
3188 return;
3189
3190 msleep(30);
3191
3192 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3193
3194 if (hp_pin_sense)
3195 msleep(2);
3196
3197 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3198
3199 snd_hda_codec_write(codec, hp_pin, 0,
3200 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3201
3202 if (hp_pin_sense)
3203 msleep(85);
3204
3205 snd_hda_codec_write(codec, hp_pin, 0,
3206 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3207
3208 if (hp_pin_sense)
3209 msleep(100);
3210
3211 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3212 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003213 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3214 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003215}
3216
3217static void alc256_shutup(struct hda_codec *codec)
3218{
3219 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003220 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003221 bool hp_pin_sense;
3222
3223 if (!hp_pin) {
3224 alc269_shutup(codec);
3225 return;
3226 }
3227
3228 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3229
3230 if (hp_pin_sense)
3231 msleep(2);
3232
3233 snd_hda_codec_write(codec, hp_pin, 0,
3234 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3235
3236 if (hp_pin_sense)
3237 msleep(85);
3238
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003239 /* 3k pull low control for Headset jack. */
3240 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3241 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3242
Kailang Yang4a219ef2017-06-16 16:54:35 +08003243 snd_hda_codec_write(codec, hp_pin, 0,
3244 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3245
Kailang Yang4a219ef2017-06-16 16:54:35 +08003246 if (hp_pin_sense)
3247 msleep(100);
3248
3249 alc_auto_setup_eapd(codec, false);
3250 snd_hda_shutup_pins(codec);
3251}
3252
Kailang Yangda911b12018-01-05 16:50:08 +08003253static void alc225_init(struct hda_codec *codec)
3254{
3255 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003256 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003257 bool hp1_pin_sense, hp2_pin_sense;
3258
3259 if (!hp_pin)
3260 return;
3261
3262 msleep(30);
3263
3264 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3265 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3266
3267 if (hp1_pin_sense || hp2_pin_sense)
3268 msleep(2);
3269
3270 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3271
3272 if (hp1_pin_sense)
3273 snd_hda_codec_write(codec, hp_pin, 0,
3274 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3275 if (hp2_pin_sense)
3276 snd_hda_codec_write(codec, 0x16, 0,
3277 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3278
3279 if (hp1_pin_sense || hp2_pin_sense)
3280 msleep(85);
3281
3282 if (hp1_pin_sense)
3283 snd_hda_codec_write(codec, hp_pin, 0,
3284 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3285 if (hp2_pin_sense)
3286 snd_hda_codec_write(codec, 0x16, 0,
3287 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3288
3289 if (hp1_pin_sense || hp2_pin_sense)
3290 msleep(100);
3291
3292 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3293 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3294}
3295
3296static void alc225_shutup(struct hda_codec *codec)
3297{
3298 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003299 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003300 bool hp1_pin_sense, hp2_pin_sense;
3301
3302 if (!hp_pin) {
3303 alc269_shutup(codec);
3304 return;
3305 }
3306
3307 /* 3k pull low control for Headset jack. */
3308 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3309
3310 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3311 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3312
3313 if (hp1_pin_sense || hp2_pin_sense)
3314 msleep(2);
3315
3316 if (hp1_pin_sense)
3317 snd_hda_codec_write(codec, hp_pin, 0,
3318 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3319 if (hp2_pin_sense)
3320 snd_hda_codec_write(codec, 0x16, 0,
3321 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3322
3323 if (hp1_pin_sense || hp2_pin_sense)
3324 msleep(85);
3325
3326 if (hp1_pin_sense)
3327 snd_hda_codec_write(codec, hp_pin, 0,
3328 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3329 if (hp2_pin_sense)
3330 snd_hda_codec_write(codec, 0x16, 0,
3331 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3332
3333 if (hp1_pin_sense || hp2_pin_sense)
3334 msleep(100);
3335
3336 alc_auto_setup_eapd(codec, false);
3337 snd_hda_shutup_pins(codec);
3338}
3339
Kailang Yangc2d6af52017-06-21 14:50:54 +08003340static void alc_default_init(struct hda_codec *codec)
3341{
3342 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003343 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003344 bool hp_pin_sense;
3345
3346 if (!hp_pin)
3347 return;
3348
3349 msleep(30);
3350
3351 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3352
3353 if (hp_pin_sense)
3354 msleep(2);
3355
3356 snd_hda_codec_write(codec, hp_pin, 0,
3357 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3358
3359 if (hp_pin_sense)
3360 msleep(85);
3361
3362 snd_hda_codec_write(codec, hp_pin, 0,
3363 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3364
3365 if (hp_pin_sense)
3366 msleep(100);
3367}
3368
3369static void alc_default_shutup(struct hda_codec *codec)
3370{
3371 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003372 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003373 bool hp_pin_sense;
3374
3375 if (!hp_pin) {
3376 alc269_shutup(codec);
3377 return;
3378 }
3379
3380 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3381
3382 if (hp_pin_sense)
3383 msleep(2);
3384
3385 snd_hda_codec_write(codec, hp_pin, 0,
3386 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3387
3388 if (hp_pin_sense)
3389 msleep(85);
3390
3391 snd_hda_codec_write(codec, hp_pin, 0,
3392 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3393
3394 if (hp_pin_sense)
3395 msleep(100);
3396
3397 alc_auto_setup_eapd(codec, false);
3398 snd_hda_shutup_pins(codec);
3399}
3400
Kailang Yang693abe12019-01-29 15:38:21 +08003401static void alc294_hp_init(struct hda_codec *codec)
3402{
3403 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003404 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang693abe12019-01-29 15:38:21 +08003405 int i, val;
3406
3407 if (!hp_pin)
3408 return;
3409
3410 snd_hda_codec_write(codec, hp_pin, 0,
3411 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3412
3413 msleep(100);
3414
3415 snd_hda_codec_write(codec, hp_pin, 0,
3416 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3417
3418 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3419 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3420
3421 /* Wait for depop procedure finish */
3422 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3423 for (i = 0; i < 20 && val & 0x0080; i++) {
3424 msleep(50);
3425 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3426 }
3427 /* Set HP depop to auto mode */
3428 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3429 msleep(50);
3430}
3431
3432static void alc294_init(struct hda_codec *codec)
3433{
3434 struct alc_spec *spec = codec->spec;
3435
3436 if (!spec->done_hp_init) {
3437 alc294_hp_init(codec);
3438 spec->done_hp_init = true;
3439 }
3440 alc_default_init(codec);
3441}
3442
Kailang Yangad60d502013-06-28 12:03:01 +02003443static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3444 unsigned int val)
3445{
3446 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3447 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3448 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3449}
3450
3451static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3452{
3453 unsigned int val;
3454
3455 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3456 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3457 & 0xffff;
3458 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3459 << 16;
3460 return val;
3461}
3462
3463static void alc5505_dsp_halt(struct hda_codec *codec)
3464{
3465 unsigned int val;
3466
3467 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3468 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3469 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3470 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3471 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3472 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3473 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3474 val = alc5505_coef_get(codec, 0x6220);
3475 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3476}
3477
3478static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3479{
3480 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3481 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3482 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3483 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3484 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3485 alc5505_coef_set(codec, 0x880c, 0x00000004);
3486}
3487
3488static void alc5505_dsp_init(struct hda_codec *codec)
3489{
3490 unsigned int val;
3491
3492 alc5505_dsp_halt(codec);
3493 alc5505_dsp_back_from_halt(codec);
3494 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3495 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3496 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3497 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3498 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3499 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3500 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3501 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3502 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3503 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3504 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3505 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3506 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3507
3508 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3509 if (val <= 3)
3510 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3511 else
3512 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3513
3514 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3515 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3516 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3517 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3518 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3519 alc5505_coef_set(codec, 0x880c, 0x00000003);
3520 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003521
3522#ifdef HALT_REALTEK_ALC5505
3523 alc5505_dsp_halt(codec);
3524#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003525}
3526
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003527#ifdef HALT_REALTEK_ALC5505
3528#define alc5505_dsp_suspend(codec) /* NOP */
3529#define alc5505_dsp_resume(codec) /* NOP */
3530#else
3531#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3532#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3533#endif
3534
Takashi Iwai2a439522011-07-26 09:52:50 +02003535#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003536static int alc269_suspend(struct hda_codec *codec)
3537{
3538 struct alc_spec *spec = codec->spec;
3539
3540 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003541 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003542 return alc_suspend(codec);
3543}
3544
Takashi Iwai1d045db2011-07-07 18:23:21 +02003545static int alc269_resume(struct hda_codec *codec)
3546{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003547 struct alc_spec *spec = codec->spec;
3548
Kailang Yang1387e2d2012-11-08 10:23:18 +01003549 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3550 alc269vb_toggle_power_output(codec, 0);
3551 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003552 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003553 msleep(150);
3554 }
3555
3556 codec->patch_ops.init(codec);
3557
Kailang Yang1387e2d2012-11-08 10:23:18 +01003558 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3559 alc269vb_toggle_power_output(codec, 1);
3560 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003561 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003562 msleep(200);
3563 }
3564
Takashi Iwaieeecd9d2015-02-25 15:18:50 +01003565 regcache_sync(codec->core.regmap);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003566 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003567
3568 /* on some machine, the BIOS will clear the codec gpio data when enter
3569 * suspend, and won't restore the data after resume, so we restore it
3570 * in the driver.
3571 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003572 if (spec->gpio_data)
3573 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003574
Kailang Yangad60d502013-06-28 12:03:01 +02003575 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003576 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003577
Takashi Iwai1d045db2011-07-07 18:23:21 +02003578 return 0;
3579}
Takashi Iwai2a439522011-07-26 09:52:50 +02003580#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003581
David Henningsson108cc102012-07-20 10:37:25 +02003582static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003583 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003584{
3585 struct alc_spec *spec = codec->spec;
3586
Takashi Iwai1727a772013-01-10 09:52:52 +01003587 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003588 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3589}
3590
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01003591static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3592 const struct hda_fixup *fix,
3593 int action)
3594{
3595 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3596 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3597
3598 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3599 snd_hda_codec_set_pincfg(codec, 0x19,
3600 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3601 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3602}
3603
Takashi Iwai1d045db2011-07-07 18:23:21 +02003604static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003605 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003606{
Takashi Iwai98b24882014-08-18 13:47:50 +02003607 if (action == HDA_FIXUP_ACT_INIT)
3608 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003609}
3610
David Henningsson7c478f02013-10-11 10:18:46 +02003611static void alc269_fixup_headset_mic(struct hda_codec *codec,
3612 const struct hda_fixup *fix, int action)
3613{
3614 struct alc_spec *spec = codec->spec;
3615
3616 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3617 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3618}
3619
Takashi Iwai1d045db2011-07-07 18:23:21 +02003620static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003621 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003622{
3623 static const struct hda_verb verbs[] = {
3624 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3625 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3626 {}
3627 };
3628 unsigned int cfg;
3629
Takashi Iwai7639a062015-03-03 10:07:24 +01003630 if (strcmp(codec->core.chip_name, "ALC271X") &&
3631 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02003632 return;
3633 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3634 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3635 snd_hda_sequence_write(codec, verbs);
3636}
3637
Takashi Iwai017f2a12011-07-09 14:42:25 +02003638static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003639 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003640{
3641 struct alc_spec *spec = codec->spec;
3642
Takashi Iwai1727a772013-01-10 09:52:52 +01003643 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003644 return;
3645
3646 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3647 * fix the sample rate of analog I/O to 44.1kHz
3648 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003649 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3650 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02003651}
3652
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003653static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003654 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003655{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003656 /* The digital-mic unit sends PDM (differential signal) instead of
3657 * the standard PCM, thus you can't record a valid mono stream as is.
3658 * Below is a workaround specific to ALC269 to control the dmic
3659 * signal source as mono.
3660 */
Takashi Iwai98b24882014-08-18 13:47:50 +02003661 if (action == HDA_FIXUP_ACT_INIT)
3662 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003663}
3664
Takashi Iwai24519912011-08-16 15:08:49 +02003665static void alc269_quanta_automute(struct hda_codec *codec)
3666{
Takashi Iwai08c189f2012-12-19 15:22:24 +01003667 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02003668
Takashi Iwai1687ccc2014-08-18 13:49:35 +02003669 alc_write_coef_idx(codec, 0x0c, 0x680);
3670 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02003671}
3672
3673static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003674 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02003675{
3676 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01003677 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02003678 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01003679 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02003680}
3681
David Henningssond240d1d2013-04-15 12:50:02 +02003682static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02003683 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02003684{
3685 struct alc_spec *spec = codec->spec;
3686 int vref;
3687 msleep(200);
3688 snd_hda_gen_hp_automute(codec, jack);
3689
3690 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3691 msleep(100);
3692 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3693 vref);
3694 msleep(500);
3695 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3696 vref);
3697}
3698
3699static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3700 const struct hda_fixup *fix, int action)
3701{
3702 struct alc_spec *spec = codec->spec;
3703 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3704 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3705 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3706 }
3707}
3708
3709
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003710/* update mute-LED according to the speaker mute state via mic VREF pin */
3711static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003712{
3713 struct hda_codec *codec = private_data;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003714 struct alc_spec *spec = codec->spec;
3715 unsigned int pinval;
3716
3717 if (spec->mute_led_polarity)
3718 enabled = !enabled;
Takashi Iwai415d5552014-04-03 11:51:21 +02003719 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3720 pinval &= ~AC_PINCTL_VREFEN;
3721 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
Takashi Iwaie40bdb02018-03-17 22:40:18 +01003722 if (spec->mute_led_nid) {
3723 /* temporarily power up/down for setting VREF */
3724 snd_hda_power_up_pm(codec);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003725 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
Takashi Iwaie40bdb02018-03-17 22:40:18 +01003726 snd_hda_power_down_pm(codec);
3727 }
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003728}
3729
David Henningssond5b6b652013-11-06 10:50:44 +01003730/* Make sure the led works even in runtime suspend */
3731static unsigned int led_power_filter(struct hda_codec *codec,
3732 hda_nid_t nid,
3733 unsigned int power_state)
3734{
3735 struct alc_spec *spec = codec->spec;
3736
Hui Wang50dd9052014-07-08 17:56:15 +08003737 if (power_state != AC_PWRST_D3 || nid == 0 ||
3738 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01003739 return power_state;
3740
3741 /* Set pin ctl again, it might have just been set to 0 */
3742 snd_hda_set_pin_ctl(codec, nid,
3743 snd_hda_codec_get_pin_target(codec, nid));
3744
Takashi Iwaicffd3962015-04-09 10:30:25 +02003745 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01003746}
3747
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003748static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3749 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003750{
3751 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003752 const struct dmi_device *dev = NULL;
3753
3754 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3755 return;
3756
3757 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3758 int pol, pin;
3759 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3760 continue;
3761 if (pin < 0x0a || pin >= 0x10)
3762 break;
3763 spec->mute_led_polarity = pol;
3764 spec->mute_led_nid = pin - 0x0a + 0x18;
3765 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
Takashi Iwaifd25a972012-12-20 14:57:18 +01003766 spec->gen.vmaster_mute_enum = 1;
David Henningssond5b6b652013-11-06 10:50:44 +01003767 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01003768 codec_dbg(codec,
3769 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003770 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003771 break;
3772 }
3773}
3774
Takashi Iwai85c467d2018-05-29 11:38:38 +02003775static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
3776 const struct hda_fixup *fix,
3777 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01003778{
3779 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02003780
David Henningssond06ac142013-02-18 11:41:55 +01003781 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3782 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02003783 spec->mute_led_nid = pin;
David Henningssond06ac142013-02-18 11:41:55 +01003784 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3785 spec->gen.vmaster_mute_enum = 1;
David Henningssond5b6b652013-11-06 10:50:44 +01003786 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01003787 }
3788}
3789
Takashi Iwai85c467d2018-05-29 11:38:38 +02003790static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3791 const struct hda_fixup *fix, int action)
3792{
3793 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
3794}
3795
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003796static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3797 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01003798{
Takashi Iwai85c467d2018-05-29 11:38:38 +02003799 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01003800}
3801
Tom Briden7f783bd2017-03-25 10:12:01 +00003802static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
3803 const struct hda_fixup *fix, int action)
3804{
Takashi Iwai85c467d2018-05-29 11:38:38 +02003805 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00003806}
3807
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003808/* update LED status via GPIO */
3809static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3810 bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003811{
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003812 struct alc_spec *spec = codec->spec;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003813
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003814 if (spec->mute_led_polarity)
3815 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02003816 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003817}
3818
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003819/* turn on/off mute LED via GPIO per vmaster hook */
3820static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3821{
3822 struct hda_codec *codec = private_data;
3823 struct alc_spec *spec = codec->spec;
3824
3825 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3826}
3827
3828/* turn on/off mic-mute LED via GPIO per capture hook */
Takashi Iwaid03abec2018-06-19 12:29:13 +02003829static void alc_gpio_micmute_update(struct hda_codec *codec)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003830{
3831 struct alc_spec *spec = codec->spec;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003832
Takashi Iwaid03abec2018-06-19 12:29:13 +02003833 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3834 spec->gen.micmute_led.led_value);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003835}
3836
Takashi Iwai01e4a272018-06-19 22:47:30 +02003837/* setup mute and mic-mute GPIO bits, add hooks appropriately */
3838static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
3839 int action,
3840 unsigned int mute_mask,
3841 unsigned int micmute_mask)
3842{
3843 struct alc_spec *spec = codec->spec;
3844
3845 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
3846
3847 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3848 return;
3849 if (mute_mask) {
3850 spec->gpio_mute_led_mask = mute_mask;
3851 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3852 }
3853 if (micmute_mask) {
3854 spec->gpio_mic_led_mask = micmute_mask;
3855 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
3856 }
3857}
3858
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003859static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3860 const struct hda_fixup *fix, int action)
3861{
Takashi Iwai01e4a272018-06-19 22:47:30 +02003862 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003863}
3864
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08003865static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3866 const struct hda_fixup *fix, int action)
3867{
Takashi Iwai01e4a272018-06-19 22:47:30 +02003868 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003869}
3870
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003871/* turn on/off mic-mute LED per capture hook */
Takashi Iwaid03abec2018-06-19 12:29:13 +02003872static void alc_cap_micmute_update(struct hda_codec *codec)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003873{
3874 struct alc_spec *spec = codec->spec;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003875 unsigned int pinval;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003876
Takashi Iwaid03abec2018-06-19 12:29:13 +02003877 if (!spec->cap_mute_led_nid)
3878 return;
Hui Wangfc1fad92014-07-08 17:56:14 +08003879 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003880 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003881 if (spec->gen.micmute_led.led_value)
3882 pinval |= AC_PINCTL_VREF_80;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003883 else
Takashi Iwaid03abec2018-06-19 12:29:13 +02003884 pinval |= AC_PINCTL_VREF_HIZ;
3885 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003886}
3887
3888static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3889 const struct hda_fixup *fix, int action)
3890{
3891 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003892
Takashi Iwai01e4a272018-06-19 22:47:30 +02003893 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003894 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02003895 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
3896 * enable headphone amp
3897 */
3898 spec->gpio_mask |= 0x10;
3899 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003900 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003901 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
Hui Wang50dd9052014-07-08 17:56:15 +08003902 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003903 }
3904}
3905
David Henningsson7a5255f2014-10-30 08:26:01 +01003906static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3907 const struct hda_fixup *fix, int action)
3908{
David Henningsson7a5255f2014-10-30 08:26:01 +01003909 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01003910
Takashi Iwai01e4a272018-06-19 22:47:30 +02003911 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01003912 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01003913 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003914 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
David Henningsson7a5255f2014-10-30 08:26:01 +01003915 codec->power_filter = led_power_filter;
3916 }
3917}
3918
Takashi Iwai6a30aba2018-04-27 17:17:35 +02003919#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01003920static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3921 struct hda_jack_callback *event)
3922{
3923 struct alc_spec *spec = codec->spec;
3924
3925 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3926 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08003927 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01003928 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08003929 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01003930 input_sync(spec->kb_dev);
3931}
David Henningsson33f4acd2015-01-07 15:50:13 +01003932
Kailang3694cb22015-12-28 11:35:24 +08003933static int alc_register_micmute_input_device(struct hda_codec *codec)
3934{
3935 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08003936 int i;
Kailang3694cb22015-12-28 11:35:24 +08003937
3938 spec->kb_dev = input_allocate_device();
3939 if (!spec->kb_dev) {
3940 codec_err(codec, "Out of memory (input_allocate_device)\n");
3941 return -ENOMEM;
3942 }
Hui Wangc7b60a82015-12-28 11:35:25 +08003943
3944 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
3945
Kailang3694cb22015-12-28 11:35:24 +08003946 spec->kb_dev->name = "Microphone Mute Button";
3947 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08003948 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
3949 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
3950 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
3951 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
3952 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08003953
3954 if (input_register_device(spec->kb_dev)) {
3955 codec_err(codec, "input_register_device failed\n");
3956 input_free_device(spec->kb_dev);
3957 spec->kb_dev = NULL;
3958 return -ENOMEM;
3959 }
3960
3961 return 0;
3962}
3963
Takashi Iwai01e4a272018-06-19 22:47:30 +02003964/* GPIO1 = set according to SKU external amp
3965 * GPIO2 = mic mute hotkey
3966 * GPIO3 = mute LED
3967 * GPIO4 = mic mute LED
3968 */
David Henningsson33f4acd2015-01-07 15:50:13 +01003969static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3970 const struct hda_fixup *fix, int action)
3971{
David Henningsson33f4acd2015-01-07 15:50:13 +01003972 struct alc_spec *spec = codec->spec;
3973
Takashi Iwai01e4a272018-06-19 22:47:30 +02003974 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01003975 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02003976 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08003977 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01003978 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01003979
Takashi Iwai01e4a272018-06-19 22:47:30 +02003980 spec->gpio_mask |= 0x06;
3981 spec->gpio_dir |= 0x02;
3982 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01003983 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01003984 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01003985 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01003986 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01003987 return;
3988 }
3989
3990 if (!spec->kb_dev)
3991 return;
3992
3993 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01003994 case HDA_FIXUP_ACT_FREE:
3995 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01003996 spec->kb_dev = NULL;
3997 }
David Henningsson33f4acd2015-01-07 15:50:13 +01003998}
3999
Takashi Iwai01e4a272018-06-19 22:47:30 +02004000/* Line2 = mic mute hotkey
4001 * GPIO2 = mic mute LED
4002 */
Kailang3694cb22015-12-28 11:35:24 +08004003static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4004 const struct hda_fixup *fix, int action)
4005{
Kailang3694cb22015-12-28 11:35:24 +08004006 struct alc_spec *spec = codec->spec;
4007
Takashi Iwai01e4a272018-06-19 22:47:30 +02004008 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08004009 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004010 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004011 if (alc_register_micmute_input_device(codec) != 0)
4012 return;
4013
Kailang3694cb22015-12-28 11:35:24 +08004014 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4015 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08004016 return;
4017 }
4018
4019 if (!spec->kb_dev)
4020 return;
4021
4022 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08004023 case HDA_FIXUP_ACT_FREE:
4024 input_unregister_device(spec->kb_dev);
4025 spec->kb_dev = NULL;
4026 }
4027}
Takashi Iwaic4696522018-01-15 10:44:35 +01004028#else /* INPUT */
4029#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4030#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4031#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004032
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004033static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4034 const struct hda_fixup *fix, int action)
4035{
4036 struct alc_spec *spec = codec->spec;
4037
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004038 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004039 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004040 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02004041 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004042 }
4043}
4044
Kailang Yang5a367672017-07-21 15:23:53 +08004045static struct coef_fw alc225_pre_hsmode[] = {
4046 UPDATE_COEF(0x4a, 1<<8, 0),
4047 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4048 UPDATE_COEF(0x63, 3<<14, 3<<14),
4049 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4050 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4051 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4052 UPDATE_COEF(0x4a, 3<<10, 0),
4053 {}
4054};
4055
David Henningsson73bdd592013-04-15 15:44:14 +02004056static void alc_headset_mode_unplugged(struct hda_codec *codec)
4057{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004058 static struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004059 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4060 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4061 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4062 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4063 {}
4064 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004065 static struct coef_fw coef0255_1[] = {
4066 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4067 {}
4068 };
4069 static struct coef_fw coef0256[] = {
4070 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4071 {}
4072 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004073 static struct coef_fw coef0233[] = {
4074 WRITE_COEF(0x1b, 0x0c0b),
4075 WRITE_COEF(0x45, 0xc429),
4076 UPDATE_COEF(0x35, 0x4000, 0),
4077 WRITE_COEF(0x06, 0x2104),
4078 WRITE_COEF(0x1a, 0x0001),
4079 WRITE_COEF(0x26, 0x0004),
4080 WRITE_COEF(0x32, 0x42a3),
4081 {}
4082 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004083 static struct coef_fw coef0288[] = {
4084 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4085 UPDATE_COEF(0x50, 0x2000, 0x2000),
4086 UPDATE_COEF(0x56, 0x0006, 0x0006),
4087 UPDATE_COEF(0x66, 0x0008, 0),
4088 UPDATE_COEF(0x67, 0x2000, 0),
4089 {}
4090 };
Kailang Yang89542932017-07-17 15:03:43 +08004091 static struct coef_fw coef0298[] = {
4092 UPDATE_COEF(0x19, 0x1300, 0x0300),
4093 {}
4094 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004095 static struct coef_fw coef0292[] = {
4096 WRITE_COEF(0x76, 0x000e),
4097 WRITE_COEF(0x6c, 0x2400),
4098 WRITE_COEF(0x18, 0x7308),
4099 WRITE_COEF(0x6b, 0xc429),
4100 {}
4101 };
4102 static struct coef_fw coef0293[] = {
4103 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4104 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4105 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4106 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4107 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4108 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4109 {}
4110 };
4111 static struct coef_fw coef0668[] = {
4112 WRITE_COEF(0x15, 0x0d40),
4113 WRITE_COEF(0xb7, 0x802b),
4114 {}
4115 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004116 static struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004117 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004118 {}
4119 };
Kailang Yang71683c32017-06-20 16:33:50 +08004120 static struct coef_fw coef0274[] = {
4121 UPDATE_COEF(0x4a, 0x0100, 0),
4122 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4123 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4124 UPDATE_COEF(0x4a, 0x0010, 0),
4125 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4126 WRITE_COEF(0x45, 0x5289),
4127 UPDATE_COEF(0x4a, 0x0c00, 0),
4128 {}
4129 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004130
Takashi Iwai7639a062015-03-03 10:07:24 +01004131 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004132 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004133 alc_process_coef_fw(codec, coef0255_1);
4134 alc_process_coef_fw(codec, coef0255);
4135 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004136 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004137 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004138 alc_process_coef_fw(codec, coef0256);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004139 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004140 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004141 case 0x10ec0234:
4142 case 0x10ec0274:
4143 case 0x10ec0294:
4144 alc_process_coef_fw(codec, coef0274);
4145 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004146 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004147 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004148 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004149 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004150 case 0x10ec0286:
4151 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004152 alc_process_coef_fw(codec, coef0288);
4153 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004154 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004155 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004156 alc_process_coef_fw(codec, coef0288);
4157 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004158 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004159 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004160 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004161 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004162 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004163 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004164 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004165 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004166 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004167 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004168 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004169 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004170 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004171 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004172 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004173 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004174 alc_process_coef_fw(codec, coef0225);
4175 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004176 case 0x10ec0867:
4177 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4178 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004179 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004180 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004181}
4182
4183
4184static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4185 hda_nid_t mic_pin)
4186{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004187 static struct coef_fw coef0255[] = {
4188 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4189 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4190 {}
4191 };
4192 static struct coef_fw coef0233[] = {
4193 UPDATE_COEF(0x35, 0, 1<<14),
4194 WRITE_COEF(0x06, 0x2100),
4195 WRITE_COEF(0x1a, 0x0021),
4196 WRITE_COEF(0x26, 0x008c),
4197 {}
4198 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004199 static struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004200 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004201 UPDATE_COEF(0x50, 0x2000, 0),
4202 UPDATE_COEF(0x56, 0x0006, 0),
4203 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4204 UPDATE_COEF(0x66, 0x0008, 0x0008),
4205 UPDATE_COEF(0x67, 0x2000, 0x2000),
4206 {}
4207 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004208 static struct coef_fw coef0292[] = {
4209 WRITE_COEF(0x19, 0xa208),
4210 WRITE_COEF(0x2e, 0xacf0),
4211 {}
4212 };
4213 static struct coef_fw coef0293[] = {
4214 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4215 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4216 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4217 {}
4218 };
4219 static struct coef_fw coef0688[] = {
4220 WRITE_COEF(0xb7, 0x802b),
4221 WRITE_COEF(0xb5, 0x1040),
4222 UPDATE_COEF(0xc3, 0, 1<<12),
4223 {}
4224 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004225 static struct coef_fw coef0225[] = {
4226 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4227 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4228 UPDATE_COEF(0x63, 3<<14, 0),
4229 {}
4230 };
Kailang Yang71683c32017-06-20 16:33:50 +08004231 static struct coef_fw coef0274[] = {
4232 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4233 UPDATE_COEF(0x4a, 0x0010, 0),
4234 UPDATE_COEF(0x6b, 0xf000, 0),
4235 {}
4236 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004237
Takashi Iwai7639a062015-03-03 10:07:24 +01004238 switch (codec->core.vendor_id) {
Kailang Yang736f20a2017-10-20 15:06:34 +08004239 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004240 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004241 case 0x10ec0256:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004242 alc_write_coef_idx(codec, 0x45, 0xc489);
4243 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004244 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004245 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4246 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004247 case 0x10ec0234:
4248 case 0x10ec0274:
4249 case 0x10ec0294:
4250 alc_write_coef_idx(codec, 0x45, 0x4689);
4251 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4252 alc_process_coef_fw(codec, coef0274);
4253 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4254 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004255 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004256 case 0x10ec0283:
4257 alc_write_coef_idx(codec, 0x45, 0xc429);
4258 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004259 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004260 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4261 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004262 case 0x10ec0286:
4263 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004264 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004265 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4266 alc_process_coef_fw(codec, coef0288);
4267 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4268 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004269 case 0x10ec0292:
4270 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004271 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004272 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004273 case 0x10ec0293:
4274 /* Set to TRS mode */
4275 alc_write_coef_idx(codec, 0x45, 0xc429);
4276 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004277 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004278 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4279 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004280 case 0x10ec0867:
4281 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4282 /* fallthru */
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004283 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004284 case 0x10ec0662:
4285 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4286 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4287 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004288 case 0x10ec0668:
4289 alc_write_coef_idx(codec, 0x11, 0x0001);
4290 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004291 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004292 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4293 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004294 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004295 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004296 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004297 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004298 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004299 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004300 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004301 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4302 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4303 alc_process_coef_fw(codec, coef0225);
4304 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4305 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004306 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004307 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004308}
4309
4310static void alc_headset_mode_default(struct hda_codec *codec)
4311{
David Henningsson2ae95572016-02-25 09:37:05 +01004312 static struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004313 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4314 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4315 UPDATE_COEF(0x49, 3<<8, 0<<8),
4316 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4317 UPDATE_COEF(0x63, 3<<14, 0),
4318 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01004319 {}
4320 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004321 static struct coef_fw coef0255[] = {
4322 WRITE_COEF(0x45, 0xc089),
4323 WRITE_COEF(0x45, 0xc489),
4324 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4325 WRITE_COEF(0x49, 0x0049),
4326 {}
4327 };
4328 static struct coef_fw coef0233[] = {
4329 WRITE_COEF(0x06, 0x2100),
4330 WRITE_COEF(0x32, 0x4ea3),
4331 {}
4332 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004333 static struct coef_fw coef0288[] = {
4334 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4335 UPDATE_COEF(0x50, 0x2000, 0x2000),
4336 UPDATE_COEF(0x56, 0x0006, 0x0006),
4337 UPDATE_COEF(0x66, 0x0008, 0),
4338 UPDATE_COEF(0x67, 0x2000, 0),
4339 {}
4340 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004341 static struct coef_fw coef0292[] = {
4342 WRITE_COEF(0x76, 0x000e),
4343 WRITE_COEF(0x6c, 0x2400),
4344 WRITE_COEF(0x6b, 0xc429),
4345 WRITE_COEF(0x18, 0x7308),
4346 {}
4347 };
4348 static struct coef_fw coef0293[] = {
4349 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4350 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4351 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4352 {}
4353 };
4354 static struct coef_fw coef0688[] = {
4355 WRITE_COEF(0x11, 0x0041),
4356 WRITE_COEF(0x15, 0x0d40),
4357 WRITE_COEF(0xb7, 0x802b),
4358 {}
4359 };
Kailang Yang71683c32017-06-20 16:33:50 +08004360 static struct coef_fw coef0274[] = {
4361 WRITE_COEF(0x45, 0x4289),
4362 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4363 UPDATE_COEF(0x6b, 0x0f00, 0),
4364 UPDATE_COEF(0x49, 0x0300, 0x0300),
4365 {}
4366 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004367
Takashi Iwai7639a062015-03-03 10:07:24 +01004368 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08004369 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01004370 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004371 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004372 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004373 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004374 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004375 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01004376 alc_process_coef_fw(codec, coef0225);
4377 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004378 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004379 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004380 case 0x10ec0256:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004381 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004382 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004383 case 0x10ec0234:
4384 case 0x10ec0274:
4385 case 0x10ec0294:
4386 alc_process_coef_fw(codec, coef0274);
4387 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004388 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004389 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004390 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004391 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004392 case 0x10ec0286:
4393 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004394 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004395 alc_process_coef_fw(codec, coef0288);
4396 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004397 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004398 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004399 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004400 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004401 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004402 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004403 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004404 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004405 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004406 case 0x10ec0867:
4407 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4408 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004409 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004410 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004411}
4412
4413/* Iphone type */
4414static void alc_headset_mode_ctia(struct hda_codec *codec)
4415{
Kailang Yang89542932017-07-17 15:03:43 +08004416 int val;
4417
Takashi Iwai54db6c32014-08-18 15:11:19 +02004418 static struct coef_fw coef0255[] = {
4419 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4420 WRITE_COEF(0x1b, 0x0c2b),
4421 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4422 {}
4423 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004424 static struct coef_fw coef0256[] = {
4425 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4426 WRITE_COEF(0x1b, 0x0c6b),
4427 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4428 {}
4429 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004430 static struct coef_fw coef0233[] = {
4431 WRITE_COEF(0x45, 0xd429),
4432 WRITE_COEF(0x1b, 0x0c2b),
4433 WRITE_COEF(0x32, 0x4ea3),
4434 {}
4435 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004436 static struct coef_fw coef0288[] = {
4437 UPDATE_COEF(0x50, 0x2000, 0x2000),
4438 UPDATE_COEF(0x56, 0x0006, 0x0006),
4439 UPDATE_COEF(0x66, 0x0008, 0),
4440 UPDATE_COEF(0x67, 0x2000, 0),
4441 {}
4442 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004443 static struct coef_fw coef0292[] = {
4444 WRITE_COEF(0x6b, 0xd429),
4445 WRITE_COEF(0x76, 0x0008),
4446 WRITE_COEF(0x18, 0x7388),
4447 {}
4448 };
4449 static struct coef_fw coef0293[] = {
4450 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4451 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4452 {}
4453 };
4454 static struct coef_fw coef0688[] = {
4455 WRITE_COEF(0x11, 0x0001),
4456 WRITE_COEF(0x15, 0x0d60),
4457 WRITE_COEF(0xc3, 0x0000),
4458 {}
4459 };
Kailang Yang5a367672017-07-21 15:23:53 +08004460 static struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004461 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004462 UPDATE_COEF(0x63, 3<<14, 2<<14),
4463 {}
4464 };
4465 static struct coef_fw coef0225_2[] = {
4466 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4467 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004468 {}
4469 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004470
Takashi Iwai7639a062015-03-03 10:07:24 +01004471 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004472 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004473 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004474 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004475 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004476 case 0x10ec0256:
4477 alc_process_coef_fw(codec, coef0256);
4478 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004479 case 0x10ec0234:
4480 case 0x10ec0274:
4481 case 0x10ec0294:
4482 alc_write_coef_idx(codec, 0x45, 0xd689);
4483 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004484 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004485 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004486 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004487 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004488 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004489 val = alc_read_coef_idx(codec, 0x50);
4490 if (val & (1 << 12)) {
4491 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4492 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4493 msleep(300);
4494 } else {
4495 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4496 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4497 msleep(300);
4498 }
4499 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004500 case 0x10ec0286:
4501 case 0x10ec0288:
4502 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4503 msleep(300);
4504 alc_process_coef_fw(codec, coef0288);
4505 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004506 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004507 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004508 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004509 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004510 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004511 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004512 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004513 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004514 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004515 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004516 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004517 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004518 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004519 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004520 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004521 val = alc_read_coef_idx(codec, 0x45);
4522 if (val & (1 << 9))
4523 alc_process_coef_fw(codec, coef0225_2);
4524 else
4525 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004526 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004527 case 0x10ec0867:
4528 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4529 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004530 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004531 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004532}
4533
4534/* Nokia type */
4535static void alc_headset_mode_omtp(struct hda_codec *codec)
4536{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004537 static struct coef_fw coef0255[] = {
4538 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4539 WRITE_COEF(0x1b, 0x0c2b),
4540 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4541 {}
4542 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004543 static struct coef_fw coef0256[] = {
4544 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4545 WRITE_COEF(0x1b, 0x0c6b),
4546 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4547 {}
4548 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004549 static struct coef_fw coef0233[] = {
4550 WRITE_COEF(0x45, 0xe429),
4551 WRITE_COEF(0x1b, 0x0c2b),
4552 WRITE_COEF(0x32, 0x4ea3),
4553 {}
4554 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004555 static struct coef_fw coef0288[] = {
4556 UPDATE_COEF(0x50, 0x2000, 0x2000),
4557 UPDATE_COEF(0x56, 0x0006, 0x0006),
4558 UPDATE_COEF(0x66, 0x0008, 0),
4559 UPDATE_COEF(0x67, 0x2000, 0),
4560 {}
4561 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004562 static struct coef_fw coef0292[] = {
4563 WRITE_COEF(0x6b, 0xe429),
4564 WRITE_COEF(0x76, 0x0008),
4565 WRITE_COEF(0x18, 0x7388),
4566 {}
4567 };
4568 static struct coef_fw coef0293[] = {
4569 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4570 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4571 {}
4572 };
4573 static struct coef_fw coef0688[] = {
4574 WRITE_COEF(0x11, 0x0001),
4575 WRITE_COEF(0x15, 0x0d50),
4576 WRITE_COEF(0xc3, 0x0000),
4577 {}
4578 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004579 static struct coef_fw coef0225[] = {
4580 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004581 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004582 {}
4583 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004584
Takashi Iwai7639a062015-03-03 10:07:24 +01004585 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004586 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004587 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004588 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004589 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004590 case 0x10ec0256:
4591 alc_process_coef_fw(codec, coef0256);
4592 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004593 case 0x10ec0234:
4594 case 0x10ec0274:
4595 case 0x10ec0294:
4596 alc_write_coef_idx(codec, 0x45, 0xe689);
4597 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004598 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004599 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004600 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004601 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004602 case 0x10ec0298:
4603 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08004604 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4605 msleep(300);
4606 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004607 case 0x10ec0286:
4608 case 0x10ec0288:
4609 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4610 msleep(300);
4611 alc_process_coef_fw(codec, coef0288);
4612 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004613 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004614 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004615 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004616 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004617 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004618 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004619 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004620 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004621 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004622 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004623 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004624 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004625 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004626 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004627 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004628 alc_process_coef_fw(codec, coef0225);
4629 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004630 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004631 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004632}
4633
4634static void alc_determine_headset_type(struct hda_codec *codec)
4635{
4636 int val;
4637 bool is_ctia = false;
4638 struct alc_spec *spec = codec->spec;
Takashi Iwai54db6c32014-08-18 15:11:19 +02004639 static struct coef_fw coef0255[] = {
4640 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4641 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4642 conteol) */
4643 {}
4644 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004645 static struct coef_fw coef0288[] = {
4646 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4647 {}
4648 };
Kailang Yang89542932017-07-17 15:03:43 +08004649 static struct coef_fw coef0298[] = {
4650 UPDATE_COEF(0x50, 0x2000, 0x2000),
4651 UPDATE_COEF(0x56, 0x0006, 0x0006),
4652 UPDATE_COEF(0x66, 0x0008, 0),
4653 UPDATE_COEF(0x67, 0x2000, 0),
4654 UPDATE_COEF(0x19, 0x1300, 0x1300),
4655 {}
4656 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004657 static struct coef_fw coef0293[] = {
4658 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4659 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4660 {}
4661 };
4662 static struct coef_fw coef0688[] = {
4663 WRITE_COEF(0x11, 0x0001),
4664 WRITE_COEF(0xb7, 0x802b),
4665 WRITE_COEF(0x15, 0x0d60),
4666 WRITE_COEF(0xc3, 0x0c00),
4667 {}
4668 };
Kailang Yang71683c32017-06-20 16:33:50 +08004669 static struct coef_fw coef0274[] = {
4670 UPDATE_COEF(0x4a, 0x0010, 0),
4671 UPDATE_COEF(0x4a, 0x8000, 0),
4672 WRITE_COEF(0x45, 0xd289),
4673 UPDATE_COEF(0x49, 0x0300, 0x0300),
4674 {}
4675 };
David Henningsson73bdd592013-04-15 15:44:14 +02004676
Takashi Iwai7639a062015-03-03 10:07:24 +01004677 switch (codec->core.vendor_id) {
Kailang Yang736f20a2017-10-20 15:06:34 +08004678 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004679 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004680 case 0x10ec0256:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004681 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004682 msleep(300);
4683 val = alc_read_coef_idx(codec, 0x46);
4684 is_ctia = (val & 0x0070) == 0x0070;
4685 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004686 case 0x10ec0234:
4687 case 0x10ec0274:
4688 case 0x10ec0294:
4689 alc_process_coef_fw(codec, coef0274);
4690 msleep(80);
4691 val = alc_read_coef_idx(codec, 0x46);
4692 is_ctia = (val & 0x00f0) == 0x00f0;
4693 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004694 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004695 case 0x10ec0283:
4696 alc_write_coef_idx(codec, 0x45, 0xd029);
4697 msleep(300);
4698 val = alc_read_coef_idx(codec, 0x46);
4699 is_ctia = (val & 0x0070) == 0x0070;
4700 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004701 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004702 snd_hda_codec_write(codec, 0x21, 0,
4703 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4704 msleep(100);
4705 snd_hda_codec_write(codec, 0x21, 0,
4706 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4707 msleep(200);
4708
4709 val = alc_read_coef_idx(codec, 0x50);
4710 if (val & (1 << 12)) {
4711 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4712 alc_process_coef_fw(codec, coef0288);
4713 msleep(350);
4714 val = alc_read_coef_idx(codec, 0x50);
4715 is_ctia = (val & 0x0070) == 0x0070;
4716 } else {
4717 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4718 alc_process_coef_fw(codec, coef0288);
4719 msleep(350);
4720 val = alc_read_coef_idx(codec, 0x50);
4721 is_ctia = (val & 0x0070) == 0x0070;
4722 }
4723 alc_process_coef_fw(codec, coef0298);
4724 snd_hda_codec_write(codec, 0x21, 0,
4725 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4726 msleep(75);
4727 snd_hda_codec_write(codec, 0x21, 0,
4728 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4729 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004730 case 0x10ec0286:
4731 case 0x10ec0288:
4732 alc_process_coef_fw(codec, coef0288);
4733 msleep(350);
4734 val = alc_read_coef_idx(codec, 0x50);
4735 is_ctia = (val & 0x0070) == 0x0070;
4736 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004737 case 0x10ec0292:
4738 alc_write_coef_idx(codec, 0x6b, 0xd429);
4739 msleep(300);
4740 val = alc_read_coef_idx(codec, 0x6c);
4741 is_ctia = (val & 0x001c) == 0x001c;
4742 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004743 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004744 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004745 msleep(300);
4746 val = alc_read_coef_idx(codec, 0x46);
4747 is_ctia = (val & 0x0070) == 0x0070;
4748 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004749 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004750 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004751 msleep(300);
4752 val = alc_read_coef_idx(codec, 0xbe);
4753 is_ctia = (val & 0x1c02) == 0x1c02;
4754 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004755 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004756 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004757 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004758 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004759 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004760 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08004761 snd_hda_codec_write(codec, 0x21, 0,
4762 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4763 msleep(80);
4764 snd_hda_codec_write(codec, 0x21, 0,
4765 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4766
Kailang Yang5a367672017-07-21 15:23:53 +08004767 alc_process_coef_fw(codec, alc225_pre_hsmode);
4768 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4769 val = alc_read_coef_idx(codec, 0x45);
4770 if (val & (1 << 9)) {
4771 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4772 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4773 msleep(800);
4774 val = alc_read_coef_idx(codec, 0x46);
4775 is_ctia = (val & 0x00f0) == 0x00f0;
4776 } else {
4777 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4778 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4779 msleep(800);
4780 val = alc_read_coef_idx(codec, 0x46);
4781 is_ctia = (val & 0x00f0) == 0x00f0;
4782 }
4783 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4784 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4785 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08004786
4787 snd_hda_codec_write(codec, 0x21, 0,
4788 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4789 msleep(80);
4790 snd_hda_codec_write(codec, 0x21, 0,
4791 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004792 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004793 case 0x10ec0867:
4794 is_ctia = true;
4795 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004796 }
4797
Takashi Iwai4e76a882014-02-25 12:21:03 +01004798 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02004799 is_ctia ? "yes" : "no");
4800 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4801}
4802
4803static void alc_update_headset_mode(struct hda_codec *codec)
4804{
4805 struct alc_spec *spec = codec->spec;
4806
4807 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
Takashi Iwai35a39f92019-02-01 11:19:50 +01004808 hda_nid_t hp_pin = alc_get_hp_pin(spec);
David Henningsson73bdd592013-04-15 15:44:14 +02004809
4810 int new_headset_mode;
4811
4812 if (!snd_hda_jack_detect(codec, hp_pin))
4813 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4814 else if (mux_pin == spec->headset_mic_pin)
4815 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4816 else if (mux_pin == spec->headphone_mic_pin)
4817 new_headset_mode = ALC_HEADSET_MODE_MIC;
4818 else
4819 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4820
David Henningsson5959a6b2013-11-12 11:10:57 +01004821 if (new_headset_mode == spec->current_headset_mode) {
4822 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02004823 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01004824 }
David Henningsson73bdd592013-04-15 15:44:14 +02004825
4826 switch (new_headset_mode) {
4827 case ALC_HEADSET_MODE_UNPLUGGED:
4828 alc_headset_mode_unplugged(codec);
4829 spec->gen.hp_jack_present = false;
4830 break;
4831 case ALC_HEADSET_MODE_HEADSET:
4832 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4833 alc_determine_headset_type(codec);
4834 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4835 alc_headset_mode_ctia(codec);
4836 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4837 alc_headset_mode_omtp(codec);
4838 spec->gen.hp_jack_present = true;
4839 break;
4840 case ALC_HEADSET_MODE_MIC:
4841 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4842 spec->gen.hp_jack_present = false;
4843 break;
4844 case ALC_HEADSET_MODE_HEADPHONE:
4845 alc_headset_mode_default(codec);
4846 spec->gen.hp_jack_present = true;
4847 break;
4848 }
4849 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4850 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4851 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02004852 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02004853 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4854 PIN_VREFHIZ);
4855 }
4856 spec->current_headset_mode = new_headset_mode;
4857
4858 snd_hda_gen_update_outputs(codec);
4859}
4860
4861static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01004862 struct snd_kcontrol *kcontrol,
4863 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02004864{
4865 alc_update_headset_mode(codec);
4866}
4867
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02004868static void alc_update_headset_jack_cb(struct hda_codec *codec,
4869 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02004870{
4871 struct alc_spec *spec = codec->spec;
David Henningsson5db4d342013-11-22 12:17:06 +01004872 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02004873 snd_hda_gen_hp_automute(codec, jack);
4874}
4875
4876static void alc_probe_headset_mode(struct hda_codec *codec)
4877{
4878 int i;
4879 struct alc_spec *spec = codec->spec;
4880 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4881
4882 /* Find mic pins */
4883 for (i = 0; i < cfg->num_inputs; i++) {
4884 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4885 spec->headset_mic_pin = cfg->inputs[i].pin;
4886 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4887 spec->headphone_mic_pin = cfg->inputs[i].pin;
4888 }
4889
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02004890 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02004891 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4892 spec->gen.automute_hook = alc_update_headset_mode;
4893 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4894}
4895
4896static void alc_fixup_headset_mode(struct hda_codec *codec,
4897 const struct hda_fixup *fix, int action)
4898{
4899 struct alc_spec *spec = codec->spec;
4900
4901 switch (action) {
4902 case HDA_FIXUP_ACT_PRE_PROBE:
4903 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4904 break;
4905 case HDA_FIXUP_ACT_PROBE:
4906 alc_probe_headset_mode(codec);
4907 break;
4908 case HDA_FIXUP_ACT_INIT:
4909 spec->current_headset_mode = 0;
4910 alc_update_headset_mode(codec);
4911 break;
4912 }
4913}
4914
4915static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4916 const struct hda_fixup *fix, int action)
4917{
4918 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4919 struct alc_spec *spec = codec->spec;
4920 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4921 }
4922 else
4923 alc_fixup_headset_mode(codec, fix, action);
4924}
4925
Kailang Yang31278992014-03-03 15:27:22 +08004926static void alc255_set_default_jack_type(struct hda_codec *codec)
4927{
4928 /* Set to iphone type */
Kailang Yange69e7e02016-05-30 15:58:28 +08004929 static struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004930 WRITE_COEF(0x1b, 0x880b),
4931 WRITE_COEF(0x45, 0xd089),
4932 WRITE_COEF(0x1b, 0x080b),
4933 WRITE_COEF(0x46, 0x0004),
4934 WRITE_COEF(0x1b, 0x0c0b),
4935 {}
4936 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004937 static struct coef_fw alc256fw[] = {
4938 WRITE_COEF(0x1b, 0x884b),
4939 WRITE_COEF(0x45, 0xd089),
4940 WRITE_COEF(0x1b, 0x084b),
4941 WRITE_COEF(0x46, 0x0004),
4942 WRITE_COEF(0x1b, 0x0c4b),
4943 {}
4944 };
4945 switch (codec->core.vendor_id) {
4946 case 0x10ec0255:
4947 alc_process_coef_fw(codec, alc255fw);
4948 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004949 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004950 case 0x10ec0256:
4951 alc_process_coef_fw(codec, alc256fw);
4952 break;
4953 }
Kailang Yang31278992014-03-03 15:27:22 +08004954 msleep(30);
4955}
4956
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004957static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4958 const struct hda_fixup *fix, int action)
4959{
4960 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08004961 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004962 }
4963 alc_fixup_headset_mode(codec, fix, action);
4964}
4965
Kailang Yang31278992014-03-03 15:27:22 +08004966static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
4967 const struct hda_fixup *fix, int action)
4968{
4969 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4970 struct alc_spec *spec = codec->spec;
4971 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4972 alc255_set_default_jack_type(codec);
4973 }
4974 else
4975 alc_fixup_headset_mode(codec, fix, action);
4976}
4977
Kailang Yange1e62b92015-04-08 16:01:22 +08004978static void alc288_update_headset_jack_cb(struct hda_codec *codec,
4979 struct hda_jack_callback *jack)
4980{
4981 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08004982
4983 alc_update_headset_jack_cb(codec, jack);
4984 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02004985 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08004986}
4987
4988static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
4989 const struct hda_fixup *fix, int action)
4990{
4991 alc_fixup_headset_mode(codec, fix, action);
4992 if (action == HDA_FIXUP_ACT_PROBE) {
4993 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02004994 /* toggled via hp_automute_hook */
4995 spec->gpio_mask |= 0x40;
4996 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08004997 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
4998 }
4999}
5000
Hui Wang493a52a2014-01-14 14:07:36 +08005001static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5002 const struct hda_fixup *fix, int action)
5003{
5004 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5005 struct alc_spec *spec = codec->spec;
5006 spec->gen.auto_mute_via_amp = 1;
5007 }
5008}
5009
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005010static void alc_no_shutup(struct hda_codec *codec)
5011{
5012}
5013
5014static void alc_fixup_no_shutup(struct hda_codec *codec,
5015 const struct hda_fixup *fix, int action)
5016{
Takashi Iwaiefe55732018-06-15 11:55:02 +02005017 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005018 struct alc_spec *spec = codec->spec;
5019 spec->shutup = alc_no_shutup;
5020 }
5021}
5022
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005023static void alc_fixup_disable_aamix(struct hda_codec *codec,
5024 const struct hda_fixup *fix, int action)
5025{
5026 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5027 struct alc_spec *spec = codec->spec;
5028 /* Disable AA-loopback as it causes white noise */
5029 spec->gen.mixer_nid = 0;
5030 }
5031}
5032
Takashi Iwai7f57d802015-09-24 17:36:51 +02005033/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5034static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5035 const struct hda_fixup *fix, int action)
5036{
5037 static const struct hda_pintbl pincfgs[] = {
5038 { 0x16, 0x21211010 }, /* dock headphone */
5039 { 0x19, 0x21a11010 }, /* dock mic */
5040 { }
5041 };
5042 struct alc_spec *spec = codec->spec;
5043
5044 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai70a09762015-12-15 14:59:58 +01005045 spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */
Takashi Iwai7f57d802015-09-24 17:36:51 +02005046 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5047 codec->power_save_node = 0; /* avoid click noises */
5048 snd_hda_apply_pincfgs(codec, pincfgs);
5049 }
5050}
5051
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005052static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5053 const struct hda_fixup *fix, int action)
5054{
5055 static const struct hda_pintbl pincfgs[] = {
5056 { 0x17, 0x21211010 }, /* dock headphone */
5057 { 0x19, 0x21a11010 }, /* dock mic */
5058 { }
5059 };
Takashi Iwai54947cd2018-12-03 10:44:15 +01005060 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5061 * the speaker output becomes too low by some reason on Thinkpads with
5062 * ALC298 codec
5063 */
5064 static hda_nid_t preferred_pairs[] = {
5065 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5066 0
5067 };
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005068 struct alc_spec *spec = codec->spec;
5069
5070 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai54947cd2018-12-03 10:44:15 +01005071 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005072 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005073 snd_hda_apply_pincfgs(codec, pincfgs);
5074 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005075 /* Enable DOCK device */
5076 snd_hda_codec_write(codec, 0x17, 0,
5077 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5078 /* Enable DOCK device */
5079 snd_hda_codec_write(codec, 0x19, 0,
5080 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005081 }
5082}
5083
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005084static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005085{
5086 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01005087 int hp_pin = alc_get_hp_pin(spec);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005088
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005089 /* Prevent pop noises when headphones are plugged in */
5090 snd_hda_codec_write(codec, hp_pin, 0,
5091 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5092 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005093}
5094
5095static void alc_fixup_dell_xps13(struct hda_codec *codec,
5096 const struct hda_fixup *fix, int action)
5097{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005098 struct alc_spec *spec = codec->spec;
5099 struct hda_input_mux *imux = &spec->gen.input_mux;
5100 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005101
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005102 switch (action) {
5103 case HDA_FIXUP_ACT_PRE_PROBE:
5104 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5105 * it causes a click noise at start up
5106 */
5107 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005108 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005109 break;
5110 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005111 /* Make the internal mic the default input source. */
5112 for (i = 0; i < imux->num_items; i++) {
5113 if (spec->gen.imux_pins[i] == 0x12) {
5114 spec->gen.cur_mux[0] = i;
5115 break;
5116 }
5117 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005118 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005119 }
5120}
5121
David Henningsson1f8b46c2015-05-12 14:38:15 +02005122static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5123 const struct hda_fixup *fix, int action)
5124{
5125 struct alc_spec *spec = codec->spec;
5126
5127 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5128 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5129 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005130
5131 /* Disable boost for mic-in permanently. (This code is only called
5132 from quirks that guarantee that the headphone is at NID 0x1b.) */
5133 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5134 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005135 } else
5136 alc_fixup_headset_mode(codec, fix, action);
5137}
5138
David Henningsson73bdd592013-04-15 15:44:14 +02005139static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5140 const struct hda_fixup *fix, int action)
5141{
5142 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005143 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005144 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005145 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5146 }
5147 alc_fixup_headset_mode(codec, fix, action);
5148}
5149
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005150/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5151static int find_ext_mic_pin(struct hda_codec *codec)
5152{
5153 struct alc_spec *spec = codec->spec;
5154 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5155 hda_nid_t nid;
5156 unsigned int defcfg;
5157 int i;
5158
5159 for (i = 0; i < cfg->num_inputs; i++) {
5160 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5161 continue;
5162 nid = cfg->inputs[i].pin;
5163 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5164 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5165 continue;
5166 return nid;
5167 }
5168
5169 return 0;
5170}
5171
Dylan Reid08a978d2012-11-18 22:56:40 -08005172static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005173 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005174 int action)
5175{
5176 struct alc_spec *spec = codec->spec;
5177
Takashi Iwai0db75792013-01-23 13:57:20 +01005178 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005179 int mic_pin = find_ext_mic_pin(codec);
Takashi Iwai35a39f92019-02-01 11:19:50 +01005180 int hp_pin = alc_get_hp_pin(spec);
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005181
5182 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005183 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005184 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005185 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005186}
David Henningsson693b6132012-06-22 19:12:10 +02005187
David Henningsson3e0d6112013-04-22 14:30:14 +02005188static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5189 const struct hda_fixup *fix,
5190 int action)
5191{
5192 struct alc_spec *spec = codec->spec;
5193 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5194 int i;
5195
5196 /* The mic boosts on level 2 and 3 are too noisy
5197 on the internal mic input.
5198 Therefore limit the boost to 0 or 1. */
5199
5200 if (action != HDA_FIXUP_ACT_PROBE)
5201 return;
5202
5203 for (i = 0; i < cfg->num_inputs; i++) {
5204 hda_nid_t nid = cfg->inputs[i].pin;
5205 unsigned int defcfg;
5206 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5207 continue;
5208 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5209 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5210 continue;
5211
5212 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5213 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5214 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5215 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5216 (0 << AC_AMPCAP_MUTE_SHIFT));
5217 }
5218}
5219
Kailang Yangcd217a62013-08-22 10:15:24 +02005220static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005221 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005222{
5223 struct alc_spec *spec = codec->spec;
5224 int vref;
5225
5226 msleep(200);
5227 snd_hda_gen_hp_automute(codec, jack);
5228
5229 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5230
5231 msleep(600);
5232 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5233 vref);
5234}
5235
Kailang Yangcd217a62013-08-22 10:15:24 +02005236static void alc283_fixup_chromebook(struct hda_codec *codec,
5237 const struct hda_fixup *fix, int action)
5238{
5239 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005240
5241 switch (action) {
5242 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005243 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005244 /* Disable AA-loopback as it causes white noise */
5245 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08005246 break;
5247 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08005248 /* MIC2-VREF control */
5249 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005250 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08005251 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02005252 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08005253 break;
5254 }
5255}
5256
5257static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5258 const struct hda_fixup *fix, int action)
5259{
5260 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08005261
5262 switch (action) {
5263 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02005264 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5265 break;
5266 case HDA_FIXUP_ACT_INIT:
5267 /* MIC2-VREF control */
5268 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005269 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02005270 break;
5271 }
5272}
5273
Takashi Iwai7bba2152013-09-06 15:45:38 +02005274/* mute tablet speaker pin (0x14) via dock plugging in addition */
5275static void asus_tx300_automute(struct hda_codec *codec)
5276{
5277 struct alc_spec *spec = codec->spec;
5278 snd_hda_gen_update_outputs(codec);
5279 if (snd_hda_jack_detect(codec, 0x1b))
5280 spec->gen.mute_bits |= (1ULL << 0x14);
5281}
5282
5283static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5284 const struct hda_fixup *fix, int action)
5285{
5286 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005287 static const struct hda_pintbl dock_pins[] = {
5288 { 0x1b, 0x21114000 }, /* dock speaker pin */
5289 {}
5290 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02005291
5292 switch (action) {
5293 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02005294 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02005295 /* TX300 needs to set up GPIO2 for the speaker amp */
5296 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02005297 snd_hda_apply_pincfgs(codec, dock_pins);
5298 spec->gen.auto_mute_via_amp = 1;
5299 spec->gen.automute_hook = asus_tx300_automute;
5300 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005301 snd_hda_gen_hp_automute);
5302 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02005303 case HDA_FIXUP_ACT_PROBE:
5304 spec->init_amp = ALC_INIT_DEFAULT;
5305 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005306 case HDA_FIXUP_ACT_BUILD:
5307 /* this is a bit tricky; give more sane names for the main
5308 * (tablet) speaker and the dock speaker, respectively
5309 */
Takashi Iwai56798e62017-04-11 08:10:52 +02005310 rename_ctl(codec, "Speaker Playback Switch",
5311 "Dock Speaker Playback Switch");
5312 rename_ctl(codec, "Bass Speaker Playback Switch",
5313 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02005314 break;
5315 }
5316}
5317
David Henningsson338cae52013-10-07 10:39:59 +02005318static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5319 const struct hda_fixup *fix, int action)
5320{
David Henningsson0f4881d2013-12-20 16:08:13 +01005321 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5322 /* DAC node 0x03 is giving mono output. We therefore want to
5323 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5324 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5325 hda_nid_t conn1[2] = { 0x0c };
5326 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
5327 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
5328 }
David Henningsson338cae52013-10-07 10:39:59 +02005329}
5330
Hui Wangdd9aa332016-08-01 10:20:32 +08005331static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5332 const struct hda_fixup *fix, int action)
5333{
5334 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5335 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5336 we can't adjust the speaker's volume since this node does not has
5337 Amp-out capability. we change the speaker's route to:
5338 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5339 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5340 speaker's volume now. */
5341
5342 hda_nid_t conn1[1] = { 0x0c };
5343 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
5344 }
5345}
5346
Takashi Iwaie312a862018-03-06 12:14:17 +01005347/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5348static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5349 const struct hda_fixup *fix, int action)
5350{
5351 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5352 hda_nid_t conn[2] = { 0x02, 0x03 };
5353 snd_hda_override_conn_list(codec, 0x17, 2, conn);
5354 }
5355}
5356
Keith Packard98973f22015-07-15 12:14:39 -07005357/* Hook to update amp GPIO4 for automute */
5358static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5359 struct hda_jack_callback *jack)
5360{
5361 struct alc_spec *spec = codec->spec;
5362
5363 snd_hda_gen_hp_automute(codec, jack);
5364 /* mute_led_polarity is set to 0, so we pass inverted value here */
5365 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
5366}
5367
5368/* Manage GPIOs for HP EliteBook Folio 9480m.
5369 *
5370 * GPIO4 is the headphone amplifier power control
5371 * GPIO3 is the audio output mute indicator LED
5372 */
5373
5374static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5375 const struct hda_fixup *fix,
5376 int action)
5377{
5378 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07005379
Takashi Iwai01e4a272018-06-19 22:47:30 +02005380 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07005381 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02005382 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5383 spec->gpio_mask |= 0x10;
5384 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07005385 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07005386 }
5387}
5388
Takashi Iwaiae065f12018-06-19 23:00:03 +02005389static void alc275_fixup_gpio4_off(struct hda_codec *codec,
5390 const struct hda_fixup *fix,
5391 int action)
5392{
5393 struct alc_spec *spec = codec->spec;
5394
5395 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5396 spec->gpio_mask |= 0x04;
5397 spec->gpio_dir |= 0x04;
5398 /* set data bit low */
5399 }
5400}
5401
Kailang Yangca169cc2017-04-25 16:17:40 +08005402static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5403 const struct hda_fixup *fix,
5404 int action)
5405{
5406 alc_fixup_dual_codecs(codec, fix, action);
5407 switch (action) {
5408 case HDA_FIXUP_ACT_PRE_PROBE:
5409 /* override card longname to provide a unique UCM profile */
5410 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5411 break;
5412 case HDA_FIXUP_ACT_BUILD:
5413 /* rename Capture controls depending on the codec */
5414 rename_ctl(codec, "Capture Volume",
5415 codec->addr == 0 ?
5416 "Rear-Panel Capture Volume" :
5417 "Front-Panel Capture Volume");
5418 rename_ctl(codec, "Capture Switch",
5419 codec->addr == 0 ?
5420 "Rear-Panel Capture Switch" :
5421 "Front-Panel Capture Switch");
5422 break;
5423 }
5424}
5425
Kailang Yang92266652017-12-14 15:28:58 +08005426/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5427static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5428 const struct hda_fixup *fix, int action)
5429{
5430 struct alc_spec *spec = codec->spec;
5431 static hda_nid_t preferred_pairs[] = {
5432 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5433 0
5434 };
5435
5436 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5437 return;
5438
5439 spec->gen.preferred_dacs = preferred_pairs;
5440}
5441
Hui Wangc4cfcf62018-11-26 14:17:16 +08005442/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
5443static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
5444 const struct hda_fixup *fix, int action)
5445{
5446 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5447 return;
5448
5449 snd_hda_override_wcaps(codec, 0x03, 0);
5450}
5451
Kailang Yange8547472018-11-28 15:32:45 +08005452static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
5453 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
5454 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
5455 { SND_JACK_BTN_2, KEY_VOLUMEUP },
5456 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
5457 {}
5458};
5459
5460static void alc_headset_btn_callback(struct hda_codec *codec,
5461 struct hda_jack_callback *jack)
5462{
5463 int report = 0;
5464
5465 if (jack->unsol_res & (7 << 13))
5466 report |= SND_JACK_BTN_0;
5467
5468 if (jack->unsol_res & (1 << 16 | 3 << 8))
5469 report |= SND_JACK_BTN_1;
5470
5471 /* Volume up key */
5472 if (jack->unsol_res & (7 << 23))
5473 report |= SND_JACK_BTN_2;
5474
5475 /* Volume down key */
5476 if (jack->unsol_res & (7 << 10))
5477 report |= SND_JACK_BTN_3;
5478
5479 jack->jack->button_state = report;
5480}
5481
5482static void alc_fixup_headset_jack(struct hda_codec *codec,
5483 const struct hda_fixup *fix, int action)
5484{
5485
5486 switch (action) {
5487 case HDA_FIXUP_ACT_PRE_PROBE:
5488 snd_hda_jack_detect_enable_callback(codec, 0x55,
5489 alc_headset_btn_callback);
5490 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
5491 SND_JACK_HEADSET, alc_headset_btn_keymap);
5492 break;
5493 case HDA_FIXUP_ACT_INIT:
5494 switch (codec->core.vendor_id) {
5495 case 0x10ec0225:
5496 case 0x10ec0295:
5497 case 0x10ec0299:
5498 alc_write_coef_idx(codec, 0x48, 0xd011);
5499 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
5500 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
5501 break;
5502 case 0x10ec0236:
5503 case 0x10ec0256:
5504 alc_write_coef_idx(codec, 0x48, 0xd011);
5505 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
5506 break;
5507 }
5508 break;
5509 }
5510}
5511
Kailang Yangd1dd4212019-01-09 17:05:24 +08005512static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
5513 const struct hda_fixup *fix, int action)
5514{
5515 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5516 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5517}
5518
Takashi Iwaib317b032014-01-08 11:44:21 +01005519/* for hda_fixup_thinkpad_acpi() */
5520#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01005521
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02005522static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5523 const struct hda_fixup *fix, int action)
5524{
5525 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5526 hda_fixup_thinkpad_acpi(codec, fix, action);
5527}
5528
Tom Bridenbbf8ff62018-05-29 17:34:20 +01005529/* for alc295_fixup_hp_top_speakers */
5530#include "hp_x360_helper.c"
5531
Takashi Iwai1d045db2011-07-07 18:23:21 +02005532enum {
5533 ALC269_FIXUP_SONY_VAIO,
5534 ALC275_FIXUP_SONY_VAIO_GPIO2,
5535 ALC269_FIXUP_DELL_M101Z,
5536 ALC269_FIXUP_SKU_IGNORE,
5537 ALC269_FIXUP_ASUS_G73JW,
5538 ALC269_FIXUP_LENOVO_EAPD,
5539 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02005540 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005541 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02005542 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005543 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02005544 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02005545 ALC269_FIXUP_QUANTA_MUTE,
5546 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02005547 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02005548 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02005549 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01005550 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02005551 ALC269_FIXUP_AMIC,
5552 ALC269_FIXUP_DMIC,
5553 ALC269VB_FIXUP_AMIC,
5554 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005555 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01005556 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005557 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00005558 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01005559 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08005560 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5561 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02005562 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02005563 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005564 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02005565 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02005566 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02005567 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5568 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02005569 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08005570 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02005571 ALC269_FIXUP_HEADSET_MODE,
5572 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02005573 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02005574 ALC269_FIXUP_ASUS_X101_FUNC,
5575 ALC269_FIXUP_ASUS_X101_VERB,
5576 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08005577 ALC271_FIXUP_AMIC_MIC2,
5578 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01005579 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07005580 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02005581 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01005582 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01005583 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01005584 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02005585 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02005586 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08005587 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005588 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02005589 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02005590 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01005591 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5592 ALC290_FIXUP_SUBWOOFER,
5593 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01005594 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01005595 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06005596 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06005597 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005598 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08005599 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005600 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08005601 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08005602 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02005603 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01005604 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02005605 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01005606 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02005607 ALC282_FIXUP_ASPIRE_V5_PINS,
David Henningsson7a5255f2014-10-30 08:26:01 +01005608 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08005609 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01005610 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01005611 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01005612 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07005613 ALC280_FIXUP_HP_9480M,
Kailang Yange1e62b92015-04-08 16:01:22 +08005614 ALC288_FIXUP_DELL_HEADSET_MODE,
5615 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08005616 ALC288_FIXUP_DELL_XPS_13,
5617 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02005618 ALC292_FIXUP_DELL_E7X,
5619 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01005620 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
Kailang Yang977e6272015-05-18 15:31:20 +08005621 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08005622 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08005623 ALC275_FIXUP_DELL_XPS,
Hui Wang8c697292015-11-24 11:08:18 +08005624 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
Hui Wang23adc192015-12-08 12:27:18 +08005625 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08005626 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08005627 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08005628 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01005629 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01005630 ALC295_FIXUP_DISABLE_DAC3,
Takashi Iwaif8839822016-02-25 14:31:59 +01005631 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08005632 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02005633 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08005634 ALC298_FIXUP_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08005635 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01005636 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08005637 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06005638 ALC256_FIXUP_ASUS_HEADSET_MODE,
5639 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06005640 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06005641 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
5642 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08005643 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Hui Wangf33f79f2017-07-07 12:08:29 +08005644 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08005645 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
PeiSen Houb84e8432017-09-01 15:11:56 +08005646 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08005647 ALC274_FIXUP_DELL_BIND_DACS,
5648 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005649 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08005650 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08005651 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05005652 ALC256_FIXUP_HUAWEI_MBXP_PINS,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01005653 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08005654 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08005655 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05005656 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08005657 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08005658 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08005659 ALC294_FIXUP_ASUS_HEADSET_MIC,
5660 ALC294_FIXUP_ASUS_SPK,
Kailang Yange8547472018-11-28 15:32:45 +08005661 ALC225_FIXUP_HEADSET_JACK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07005662 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005663};
5664
Takashi Iwai1727a772013-01-10 09:52:52 +01005665static const struct hda_fixup alc269_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005666 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01005667 .type = HDA_FIXUP_PINCTLS,
5668 .v.pins = (const struct hda_pintbl[]) {
5669 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02005670 {}
5671 }
5672 },
5673 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02005674 .type = HDA_FIXUP_FUNC,
5675 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005676 .chained = true,
5677 .chain_id = ALC269_FIXUP_SONY_VAIO
5678 },
5679 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005680 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005681 .v.verbs = (const struct hda_verb[]) {
5682 /* Enables internal speaker */
5683 {0x20, AC_VERB_SET_COEF_INDEX, 13},
5684 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
5685 {}
5686 }
5687 },
5688 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005689 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02005690 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005691 },
5692 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005693 .type = HDA_FIXUP_PINS,
5694 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005695 { 0x17, 0x99130111 }, /* subwoofer */
5696 { }
5697 }
5698 },
5699 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005700 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005701 .v.verbs = (const struct hda_verb[]) {
5702 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5703 {}
5704 }
5705 },
5706 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005707 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005708 .v.func = alc269_fixup_hweq,
5709 .chained = true,
5710 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5711 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02005712 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5713 .type = HDA_FIXUP_FUNC,
5714 .v.func = alc_fixup_disable_aamix,
5715 .chained = true,
5716 .chain_id = ALC269_FIXUP_SONY_VAIO
5717 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02005718 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005719 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005720 .v.func = alc271_fixup_dmic,
5721 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02005722 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005723 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02005724 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02005725 .chained = true,
5726 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02005727 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005728 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005729 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005730 .v.func = alc269_fixup_stereo_dmic,
5731 },
David Henningsson7c478f02013-10-11 10:18:46 +02005732 [ALC269_FIXUP_HEADSET_MIC] = {
5733 .type = HDA_FIXUP_FUNC,
5734 .v.func = alc269_fixup_headset_mic,
5735 },
Takashi Iwai24519912011-08-16 15:08:49 +02005736 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005737 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02005738 .v.func = alc269_fixup_quanta_mute,
5739 },
5740 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005741 .type = HDA_FIXUP_PINS,
5742 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02005743 { 0x1a, 0x2101103f }, /* dock line-out */
5744 { 0x1b, 0x23a11040 }, /* dock mic-in */
5745 { }
5746 },
5747 .chained = true,
5748 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5749 },
David Henningsson2041d562014-06-13 11:15:44 +02005750 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5751 .type = HDA_FIXUP_PINS,
5752 .v.pins = (const struct hda_pintbl[]) {
5753 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5754 { }
5755 },
5756 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02005757 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5758 .type = HDA_FIXUP_PINS,
5759 .v.pins = (const struct hda_pintbl[]) {
5760 { 0x21, 0x0221102f }, /* HP out */
5761 { }
5762 },
5763 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02005764 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5765 .type = HDA_FIXUP_FUNC,
5766 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5767 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01005768 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5769 .type = HDA_FIXUP_FUNC,
5770 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5771 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02005772 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005773 .type = HDA_FIXUP_PINS,
5774 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005775 { 0x14, 0x99130110 }, /* speaker */
5776 { 0x15, 0x0121401f }, /* HP out */
5777 { 0x18, 0x01a19c20 }, /* mic */
5778 { 0x19, 0x99a3092f }, /* int-mic */
5779 { }
5780 },
5781 },
5782 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005783 .type = HDA_FIXUP_PINS,
5784 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005785 { 0x12, 0x99a3092f }, /* int-mic */
5786 { 0x14, 0x99130110 }, /* speaker */
5787 { 0x15, 0x0121401f }, /* HP out */
5788 { 0x18, 0x01a19c20 }, /* mic */
5789 { }
5790 },
5791 },
5792 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005793 .type = HDA_FIXUP_PINS,
5794 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005795 { 0x14, 0x99130110 }, /* speaker */
5796 { 0x18, 0x01a19c20 }, /* mic */
5797 { 0x19, 0x99a3092f }, /* int-mic */
5798 { 0x21, 0x0121401f }, /* HP out */
5799 { }
5800 },
5801 },
David Henningsson2267ea92012-01-03 08:45:56 +01005802 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005803 .type = HDA_FIXUP_PINS,
5804 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005805 { 0x12, 0x99a3092f }, /* int-mic */
5806 { 0x14, 0x99130110 }, /* speaker */
5807 { 0x18, 0x01a19c20 }, /* mic */
5808 { 0x21, 0x0121401f }, /* HP out */
5809 { }
5810 },
5811 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005812 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005813 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005814 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01005815 },
David Henningssond06ac142013-02-18 11:41:55 +01005816 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5817 .type = HDA_FIXUP_FUNC,
5818 .v.func = alc269_fixup_hp_mute_led_mic1,
5819 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005820 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005821 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005822 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01005823 },
Tom Briden7f783bd2017-03-25 10:12:01 +00005824 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
5825 .type = HDA_FIXUP_FUNC,
5826 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05005827 .chained = true,
5828 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00005829 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01005830 [ALC269_FIXUP_HP_GPIO_LED] = {
5831 .type = HDA_FIXUP_FUNC,
5832 .v.func = alc269_fixup_hp_gpio_led,
5833 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08005834 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5835 .type = HDA_FIXUP_FUNC,
5836 .v.func = alc269_fixup_hp_gpio_mic1_led,
5837 },
5838 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5839 .type = HDA_FIXUP_FUNC,
5840 .v.func = alc269_fixup_hp_line1_mic1_led,
5841 },
David Henningsson693b6132012-06-22 19:12:10 +02005842 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005843 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02005844 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02005845 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005846 [ALC269_FIXUP_NO_SHUTUP] = {
5847 .type = HDA_FIXUP_FUNC,
5848 .v.func = alc_fixup_no_shutup,
5849 },
David Henningsson108cc102012-07-20 10:37:25 +02005850 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005851 .type = HDA_FIXUP_PINS,
5852 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02005853 { 0x19, 0x23a11040 }, /* dock mic */
5854 { 0x1b, 0x2121103f }, /* dock headphone */
5855 { }
5856 },
5857 .chained = true,
5858 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5859 },
5860 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005861 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02005862 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01005863 .chained = true,
5864 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02005865 },
David Henningsson73bdd592013-04-15 15:44:14 +02005866 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5867 .type = HDA_FIXUP_PINS,
5868 .v.pins = (const struct hda_pintbl[]) {
5869 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5870 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5871 { }
5872 },
5873 .chained = true,
5874 .chain_id = ALC269_FIXUP_HEADSET_MODE
5875 },
5876 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5877 .type = HDA_FIXUP_PINS,
5878 .v.pins = (const struct hda_pintbl[]) {
5879 { 0x16, 0x21014020 }, /* dock line out */
5880 { 0x19, 0x21a19030 }, /* dock mic */
5881 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5882 { }
5883 },
5884 .chained = true,
5885 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5886 },
David Henningsson338cae52013-10-07 10:39:59 +02005887 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5888 .type = HDA_FIXUP_PINS,
5889 .v.pins = (const struct hda_pintbl[]) {
5890 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5891 { }
5892 },
5893 .chained = true,
5894 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5895 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08005896 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
5897 .type = HDA_FIXUP_PINS,
5898 .v.pins = (const struct hda_pintbl[]) {
5899 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5900 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5901 { }
5902 },
5903 .chained = true,
5904 .chain_id = ALC269_FIXUP_HEADSET_MODE
5905 },
David Henningsson73bdd592013-04-15 15:44:14 +02005906 [ALC269_FIXUP_HEADSET_MODE] = {
5907 .type = HDA_FIXUP_FUNC,
5908 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08005909 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01005910 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02005911 },
5912 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5913 .type = HDA_FIXUP_FUNC,
5914 .v.func = alc_fixup_headset_mode_no_hp_mic,
5915 },
Takashi Iwai78197172015-06-27 10:21:13 +02005916 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
5917 .type = HDA_FIXUP_PINS,
5918 .v.pins = (const struct hda_pintbl[]) {
5919 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
5920 { }
5921 },
5922 .chained = true,
5923 .chain_id = ALC269_FIXUP_HEADSET_MODE,
5924 },
David Henningsson88cfcf82013-10-11 10:18:45 +02005925 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
5926 .type = HDA_FIXUP_PINS,
5927 .v.pins = (const struct hda_pintbl[]) {
5928 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5929 { }
5930 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02005931 .chained = true,
5932 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02005933 },
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05005934 [ALC256_FIXUP_HUAWEI_MBXP_PINS] = {
5935 .type = HDA_FIXUP_PINS,
5936 .v.pins = (const struct hda_pintbl[]) {
5937 {0x12, 0x90a60130},
5938 {0x13, 0x40000000},
5939 {0x14, 0x90170110},
5940 {0x18, 0x411111f0},
5941 {0x19, 0x04a11040},
5942 {0x1a, 0x411111f0},
5943 {0x1b, 0x90170112},
5944 {0x1d, 0x40759a05},
5945 {0x1e, 0x411111f0},
5946 {0x21, 0x04211020},
5947 { }
5948 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05005949 .chained = true,
5950 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05005951 },
David Henningssond240d1d2013-04-15 12:50:02 +02005952 [ALC269_FIXUP_ASUS_X101_FUNC] = {
5953 .type = HDA_FIXUP_FUNC,
5954 .v.func = alc269_fixup_x101_headset_mic,
5955 },
5956 [ALC269_FIXUP_ASUS_X101_VERB] = {
5957 .type = HDA_FIXUP_VERBS,
5958 .v.verbs = (const struct hda_verb[]) {
5959 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5960 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
5961 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
5962 { }
5963 },
5964 .chained = true,
5965 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
5966 },
5967 [ALC269_FIXUP_ASUS_X101] = {
5968 .type = HDA_FIXUP_PINS,
5969 .v.pins = (const struct hda_pintbl[]) {
5970 { 0x18, 0x04a1182c }, /* Headset mic */
5971 { }
5972 },
5973 .chained = true,
5974 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
5975 },
Dylan Reid08a978d2012-11-18 22:56:40 -08005976 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005977 .type = HDA_FIXUP_PINS,
5978 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08005979 { 0x14, 0x99130110 }, /* speaker */
5980 { 0x19, 0x01a19c20 }, /* mic */
5981 { 0x1b, 0x99a7012f }, /* int-mic */
5982 { 0x21, 0x0121401f }, /* HP out */
5983 { }
5984 },
5985 },
5986 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005987 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08005988 .v.func = alc271_hp_gate_mic_jack,
5989 .chained = true,
5990 .chain_id = ALC271_FIXUP_AMIC_MIC2,
5991 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01005992 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
5993 .type = HDA_FIXUP_FUNC,
5994 .v.func = alc269_fixup_limit_int_mic_boost,
5995 .chained = true,
5996 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
5997 },
Dylan Reid42397002013-04-05 14:58:22 -07005998 [ALC269_FIXUP_ACER_AC700] = {
5999 .type = HDA_FIXUP_PINS,
6000 .v.pins = (const struct hda_pintbl[]) {
6001 { 0x12, 0x99a3092f }, /* int-mic */
6002 { 0x14, 0x99130110 }, /* speaker */
6003 { 0x18, 0x03a11c20 }, /* mic */
6004 { 0x1e, 0x0346101e }, /* SPDIF1 */
6005 { 0x21, 0x0321101f }, /* HP out */
6006 { }
6007 },
6008 .chained = true,
6009 .chain_id = ALC271_FIXUP_DMIC,
6010 },
David Henningsson3e0d6112013-04-22 14:30:14 +02006011 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6012 .type = HDA_FIXUP_FUNC,
6013 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01006014 .chained = true,
6015 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02006016 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01006017 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6018 .type = HDA_FIXUP_FUNC,
6019 .v.func = alc269_fixup_limit_int_mic_boost,
6020 .chained = true,
6021 .chain_id = ALC269VB_FIXUP_DMIC,
6022 },
Takashi Iwai23870832013-11-29 14:13:12 +01006023 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6024 .type = HDA_FIXUP_VERBS,
6025 .v.verbs = (const struct hda_verb[]) {
6026 /* class-D output amp +5dB */
6027 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6028 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6029 {}
6030 },
6031 .chained = true,
6032 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6033 },
David Henningsson8e35cd42013-11-06 11:20:01 +01006034 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6035 .type = HDA_FIXUP_FUNC,
6036 .v.func = alc269_fixup_limit_int_mic_boost,
6037 .chained = true,
6038 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6039 },
Anisse Astier02b504d2013-06-03 11:53:10 +02006040 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6041 .type = HDA_FIXUP_PINS,
6042 .v.pins = (const struct hda_pintbl[]) {
6043 { 0x12, 0x99a3092f }, /* int-mic */
6044 { 0x18, 0x03a11d20 }, /* mic */
6045 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6046 { }
6047 },
6048 },
Kailang Yangcd217a62013-08-22 10:15:24 +02006049 [ALC283_FIXUP_CHROME_BOOK] = {
6050 .type = HDA_FIXUP_FUNC,
6051 .v.func = alc283_fixup_chromebook,
6052 },
Kailang Yang0202e992013-12-02 15:20:15 +08006053 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6054 .type = HDA_FIXUP_FUNC,
6055 .v.func = alc283_fixup_sense_combo_jack,
6056 .chained = true,
6057 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6058 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02006059 [ALC282_FIXUP_ASUS_TX300] = {
6060 .type = HDA_FIXUP_FUNC,
6061 .v.func = alc282_fixup_asus_tx300,
6062 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02006063 [ALC283_FIXUP_INT_MIC] = {
6064 .type = HDA_FIXUP_VERBS,
6065 .v.verbs = (const struct hda_verb[]) {
6066 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6067 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6068 { }
6069 },
6070 .chained = true,
6071 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6072 },
David Henningsson0f4881d2013-12-20 16:08:13 +01006073 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6074 .type = HDA_FIXUP_PINS,
6075 .v.pins = (const struct hda_pintbl[]) {
6076 { 0x17, 0x90170112 }, /* subwoofer */
6077 { }
6078 },
6079 .chained = true,
6080 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6081 },
6082 [ALC290_FIXUP_SUBWOOFER] = {
6083 .type = HDA_FIXUP_PINS,
6084 .v.pins = (const struct hda_pintbl[]) {
6085 { 0x17, 0x90170112 }, /* subwoofer */
6086 { }
6087 },
6088 .chained = true,
6089 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6090 },
David Henningsson338cae52013-10-07 10:39:59 +02006091 [ALC290_FIXUP_MONO_SPEAKERS] = {
6092 .type = HDA_FIXUP_FUNC,
6093 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01006094 },
6095 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6096 .type = HDA_FIXUP_FUNC,
6097 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02006098 .chained = true,
6099 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6100 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01006101 [ALC269_FIXUP_THINKPAD_ACPI] = {
6102 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006103 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02006104 .chained = true,
6105 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006106 },
David Henningsson56f27012016-01-11 09:33:14 +01006107 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6108 .type = HDA_FIXUP_FUNC,
6109 .v.func = alc_fixup_inv_dmic,
6110 .chained = true,
6111 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6112 },
Chris Chiu5824ce82017-02-28 14:17:11 -06006113 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
6114 .type = HDA_FIXUP_PINS,
6115 .v.pins = (const struct hda_pintbl[]) {
6116 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6117 { }
6118 },
6119 .chained = true,
6120 .chain_id = ALC255_FIXUP_HEADSET_MODE
6121 },
Chris Chiu615966a2017-02-28 14:17:12 -06006122 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6123 .type = HDA_FIXUP_PINS,
6124 .v.pins = (const struct hda_pintbl[]) {
6125 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6126 { }
6127 },
6128 .chained = true,
6129 .chain_id = ALC255_FIXUP_HEADSET_MODE
6130 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006131 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6132 .type = HDA_FIXUP_PINS,
6133 .v.pins = (const struct hda_pintbl[]) {
6134 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6135 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6136 { }
6137 },
6138 .chained = true,
6139 .chain_id = ALC255_FIXUP_HEADSET_MODE
6140 },
Kailang Yang31278992014-03-03 15:27:22 +08006141 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6142 .type = HDA_FIXUP_PINS,
6143 .v.pins = (const struct hda_pintbl[]) {
6144 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6145 { }
6146 },
6147 .chained = true,
6148 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6149 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006150 [ALC255_FIXUP_HEADSET_MODE] = {
6151 .type = HDA_FIXUP_FUNC,
6152 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08006153 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006154 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006155 },
Kailang Yang31278992014-03-03 15:27:22 +08006156 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6157 .type = HDA_FIXUP_FUNC,
6158 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6159 },
Kailang Yanga22aa262014-04-23 17:34:28 +08006160 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6161 .type = HDA_FIXUP_PINS,
6162 .v.pins = (const struct hda_pintbl[]) {
6163 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6164 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6165 { }
6166 },
6167 .chained = true,
6168 .chain_id = ALC269_FIXUP_HEADSET_MODE
6169 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02006170 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02006171 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02006172 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006173 .chained = true,
6174 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6175 },
Takashi Iwai9a811232015-12-09 15:17:43 +01006176 [ALC292_FIXUP_TPT440] = {
6177 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01006178 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01006179 .chained = true,
6180 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6181 },
Anisse Astierabaa22742016-08-24 09:14:13 +02006182 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01006183 .type = HDA_FIXUP_PINS,
6184 .v.pins = (const struct hda_pintbl[]) {
6185 { 0x19, 0x04a110f0 },
6186 { },
6187 },
6188 },
Takashi Iwaib3802782018-11-26 17:47:46 +01006189 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08006190 .type = HDA_FIXUP_FUNC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006191 .v.func = snd_hda_gen_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08006192 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006193 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6194 .type = HDA_FIXUP_PINS,
6195 .v.pins = (const struct hda_pintbl[]) {
6196 { 0x12, 0x90a60130 },
6197 { 0x14, 0x90170110 },
6198 { 0x17, 0x40000008 },
6199 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02006200 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006201 { 0x1a, 0x411111f0 },
6202 { 0x1b, 0x411111f0 },
6203 { 0x1d, 0x40f89b2d },
6204 { 0x1e, 0x411111f0 },
6205 { 0x21, 0x0321101f },
6206 { },
6207 },
6208 },
David Henningsson7a5255f2014-10-30 08:26:01 +01006209 [ALC280_FIXUP_HP_GPIO4] = {
6210 .type = HDA_FIXUP_FUNC,
6211 .v.func = alc280_fixup_hp_gpio4,
6212 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006213 [ALC286_FIXUP_HP_GPIO_LED] = {
6214 .type = HDA_FIXUP_FUNC,
6215 .v.func = alc286_fixup_hp_gpio_led,
6216 },
David Henningsson33f4acd2015-01-07 15:50:13 +01006217 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6218 .type = HDA_FIXUP_FUNC,
6219 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6220 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01006221 [ALC280_FIXUP_HP_DOCK_PINS] = {
6222 .type = HDA_FIXUP_PINS,
6223 .v.pins = (const struct hda_pintbl[]) {
6224 { 0x1b, 0x21011020 }, /* line-out */
6225 { 0x1a, 0x01a1903c }, /* headset mic */
6226 { 0x18, 0x2181103f }, /* line-in */
6227 { },
6228 },
6229 .chained = true,
6230 .chain_id = ALC280_FIXUP_HP_GPIO4
6231 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006232 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6233 .type = HDA_FIXUP_PINS,
6234 .v.pins = (const struct hda_pintbl[]) {
6235 { 0x1b, 0x21011020 }, /* line-out */
6236 { 0x18, 0x2181103f }, /* line-in */
6237 { },
6238 },
6239 .chained = true,
6240 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6241 },
Keith Packard98973f22015-07-15 12:14:39 -07006242 [ALC280_FIXUP_HP_9480M] = {
6243 .type = HDA_FIXUP_FUNC,
6244 .v.func = alc280_fixup_hp_9480m,
6245 },
Kailang Yange1e62b92015-04-08 16:01:22 +08006246 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6247 .type = HDA_FIXUP_FUNC,
6248 .v.func = alc_fixup_headset_mode_dell_alc288,
6249 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006250 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08006251 },
6252 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6253 .type = HDA_FIXUP_PINS,
6254 .v.pins = (const struct hda_pintbl[]) {
6255 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6256 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6257 { }
6258 },
6259 .chained = true,
6260 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6261 },
Hui Wang831bfdf92015-06-26 12:35:17 +08006262 [ALC288_FIXUP_DISABLE_AAMIX] = {
6263 .type = HDA_FIXUP_FUNC,
6264 .v.func = alc_fixup_disable_aamix,
6265 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02006266 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08006267 },
6268 [ALC288_FIXUP_DELL_XPS_13] = {
6269 .type = HDA_FIXUP_FUNC,
6270 .v.func = alc_fixup_dell_xps13,
6271 .chained = true,
6272 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6273 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006274 [ALC292_FIXUP_DISABLE_AAMIX] = {
6275 .type = HDA_FIXUP_FUNC,
6276 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08006277 .chained = true,
6278 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006279 },
David Henningssonc04017e2015-12-15 14:44:03 +01006280 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6281 .type = HDA_FIXUP_FUNC,
6282 .v.func = alc_fixup_disable_aamix,
6283 .chained = true,
6284 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6285 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006286 [ALC292_FIXUP_DELL_E7X] = {
6287 .type = HDA_FIXUP_FUNC,
6288 .v.func = alc_fixup_dell_xps13,
6289 .chained = true,
6290 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6291 },
Kailang Yang977e6272015-05-18 15:31:20 +08006292 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6293 .type = HDA_FIXUP_PINS,
6294 .v.pins = (const struct hda_pintbl[]) {
6295 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6296 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6297 { }
6298 },
6299 .chained = true,
6300 .chain_id = ALC269_FIXUP_HEADSET_MODE
6301 },
Hui Wang2f726ae2017-03-31 10:31:40 +08006302 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6303 .type = HDA_FIXUP_PINS,
6304 .v.pins = (const struct hda_pintbl[]) {
6305 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6306 { }
6307 },
6308 .chained = true,
6309 .chain_id = ALC269_FIXUP_HEADSET_MODE
6310 },
Kailang Yang6ed11312015-10-26 15:37:39 +08006311 [ALC275_FIXUP_DELL_XPS] = {
6312 .type = HDA_FIXUP_VERBS,
6313 .v.verbs = (const struct hda_verb[]) {
6314 /* Enables internal speaker */
6315 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6316 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6317 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6318 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6319 {}
6320 }
6321 },
Hui Wang8c697292015-11-24 11:08:18 +08006322 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
6323 .type = HDA_FIXUP_VERBS,
6324 .v.verbs = (const struct hda_verb[]) {
6325 /* Disable pass-through path for FRONT 14h */
6326 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
6327 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
6328 {}
6329 },
6330 .chained = true,
6331 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6332 },
Hui Wang23adc192015-12-08 12:27:18 +08006333 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6334 .type = HDA_FIXUP_FUNC,
6335 .v.func = alc_fixup_disable_aamix,
6336 .chained = true,
6337 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6338 },
Kailang3694cb22015-12-28 11:35:24 +08006339 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6340 .type = HDA_FIXUP_FUNC,
6341 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6342 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006343 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6344 .type = HDA_FIXUP_FUNC,
6345 .v.func = alc_fixup_disable_aamix,
6346 .chained = true,
6347 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6348 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08006349 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
6350 .type = HDA_FIXUP_FUNC,
6351 .v.func = alc_fixup_disable_mic_vref,
6352 .chained = true,
6353 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6354 },
David Henningsson2ae95572016-02-25 09:37:05 +01006355 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6356 .type = HDA_FIXUP_VERBS,
6357 .v.verbs = (const struct hda_verb[]) {
6358 /* Disable pass-through path for FRONT 14h */
6359 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6360 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6361 {}
6362 },
6363 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006364 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01006365 },
Takashi Iwaif8839822016-02-25 14:31:59 +01006366 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6367 .type = HDA_FIXUP_FUNC,
6368 .v.func = alc_fixup_disable_aamix,
6369 .chained = true,
6370 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6371 },
Hui Wange549d192016-04-01 11:00:15 +08006372 [ALC221_FIXUP_HP_FRONT_MIC] = {
6373 .type = HDA_FIXUP_PINS,
6374 .v.pins = (const struct hda_pintbl[]) {
6375 { 0x19, 0x02a19020 }, /* Front Mic */
6376 { }
6377 },
6378 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02006379 [ALC292_FIXUP_TPT460] = {
6380 .type = HDA_FIXUP_FUNC,
6381 .v.func = alc_fixup_tpt440_dock,
6382 .chained = true,
6383 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6384 },
Hui Wangdd9aa332016-08-01 10:20:32 +08006385 [ALC298_FIXUP_SPK_VOLUME] = {
6386 .type = HDA_FIXUP_FUNC,
6387 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08006388 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08006389 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08006390 },
Takashi Iwaie312a862018-03-06 12:14:17 +01006391 [ALC295_FIXUP_DISABLE_DAC3] = {
6392 .type = HDA_FIXUP_FUNC,
6393 .v.func = alc295_fixup_disable_dac3,
6394 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006395 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6396 .type = HDA_FIXUP_PINS,
6397 .v.pins = (const struct hda_pintbl[]) {
6398 { 0x1b, 0x90170151 },
6399 { }
6400 },
6401 .chained = true,
6402 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6403 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006404 [ALC269_FIXUP_ATIV_BOOK_8] = {
6405 .type = HDA_FIXUP_FUNC,
6406 .v.func = alc_fixup_auto_mute_via_amp,
6407 .chained = true,
6408 .chain_id = ALC269_FIXUP_NO_SHUTUP
6409 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006410 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6411 .type = HDA_FIXUP_PINS,
6412 .v.pins = (const struct hda_pintbl[]) {
6413 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6414 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6415 { }
6416 },
6417 .chained = true,
6418 .chain_id = ALC269_FIXUP_HEADSET_MODE
6419 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06006420 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6421 .type = HDA_FIXUP_FUNC,
6422 .v.func = alc_fixup_headset_mode,
6423 },
6424 [ALC256_FIXUP_ASUS_MIC] = {
6425 .type = HDA_FIXUP_PINS,
6426 .v.pins = (const struct hda_pintbl[]) {
6427 { 0x13, 0x90a60160 }, /* use as internal mic */
6428 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6429 { }
6430 },
6431 .chained = true,
6432 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6433 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06006434 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02006435 .type = HDA_FIXUP_FUNC,
6436 /* Set up GPIO2 for the speaker amp */
6437 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006438 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06006439 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6440 .type = HDA_FIXUP_PINS,
6441 .v.pins = (const struct hda_pintbl[]) {
6442 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6443 { }
6444 },
6445 .chained = true,
6446 .chain_id = ALC269_FIXUP_HEADSET_MIC
6447 },
6448 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6449 .type = HDA_FIXUP_VERBS,
6450 .v.verbs = (const struct hda_verb[]) {
6451 /* Enables internal speaker */
6452 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6453 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6454 {}
6455 },
6456 .chained = true,
6457 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6458 },
Kailang Yangca169cc2017-04-25 16:17:40 +08006459 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6460 .type = HDA_FIXUP_FUNC,
6461 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6462 },
Hui Wangf33f79f2017-07-07 12:08:29 +08006463 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6464 .type = HDA_FIXUP_PINS,
6465 .v.pins = (const struct hda_pintbl[]) {
6466 /* Change the mic location from front to right, otherwise there are
6467 two front mics with the same name, pulseaudio can't handle them.
6468 This is just a temporary workaround, after applying this fixup,
6469 there will be one "Front Mic" and one "Mic" in this machine.
6470 */
6471 { 0x1a, 0x04a19040 },
6472 { }
6473 },
6474 },
Kailang Yang5f364132017-07-25 16:28:16 +08006475 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6476 .type = HDA_FIXUP_PINS,
6477 .v.pins = (const struct hda_pintbl[]) {
6478 { 0x16, 0x0101102f }, /* Rear Headset HP */
6479 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6480 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6481 { 0x1b, 0x02011020 },
6482 { }
6483 },
6484 .chained = true,
6485 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6486 },
PeiSen Houb84e8432017-09-01 15:11:56 +08006487 [ALC700_FIXUP_INTEL_REFERENCE] = {
6488 .type = HDA_FIXUP_VERBS,
6489 .v.verbs = (const struct hda_verb[]) {
6490 /* Enables internal speaker */
6491 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6492 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6493 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6494 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6495 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6496 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6497 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6498 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6499 {}
6500 }
6501 },
Kailang Yang92266652017-12-14 15:28:58 +08006502 [ALC274_FIXUP_DELL_BIND_DACS] = {
6503 .type = HDA_FIXUP_FUNC,
6504 .v.func = alc274_fixup_bind_dacs,
6505 .chained = true,
6506 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6507 },
6508 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6509 .type = HDA_FIXUP_PINS,
6510 .v.pins = (const struct hda_pintbl[]) {
6511 { 0x1b, 0x0401102f },
6512 { }
6513 },
6514 .chained = true,
6515 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6516 },
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006517 [ALC298_FIXUP_TPT470_DOCK] = {
6518 .type = HDA_FIXUP_FUNC,
6519 .v.func = alc_fixup_tpt470_dock,
6520 .chained = true,
6521 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6522 },
Kailang Yangae104a22018-02-05 16:07:20 +08006523 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6524 .type = HDA_FIXUP_PINS,
6525 .v.pins = (const struct hda_pintbl[]) {
6526 { 0x14, 0x0201101f },
6527 { }
6528 },
6529 .chained = true,
6530 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6531 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006532 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
6533 .type = HDA_FIXUP_PINS,
6534 .v.pins = (const struct hda_pintbl[]) {
6535 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6536 { }
6537 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08006538 .chained = true,
6539 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006540 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006541 [ALC295_FIXUP_HP_X360] = {
6542 .type = HDA_FIXUP_FUNC,
6543 .v.func = alc295_fixup_hp_top_speakers,
6544 .chained = true,
6545 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08006546 },
6547 [ALC221_FIXUP_HP_HEADSET_MIC] = {
6548 .type = HDA_FIXUP_PINS,
6549 .v.pins = (const struct hda_pintbl[]) {
6550 { 0x19, 0x0181313f},
6551 { }
6552 },
6553 .chained = true,
6554 .chain_id = ALC269_FIXUP_HEADSET_MIC
6555 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08006556 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
6557 .type = HDA_FIXUP_FUNC,
6558 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08006559 .chained = true,
6560 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08006561 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006562 [ALC295_FIXUP_HP_AUTO_MUTE] = {
6563 .type = HDA_FIXUP_FUNC,
6564 .v.func = alc_fixup_auto_mute_via_amp,
6565 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08006566 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
6567 .type = HDA_FIXUP_PINS,
6568 .v.pins = (const struct hda_pintbl[]) {
6569 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6570 { }
6571 },
6572 .chained = true,
6573 .chain_id = ALC269_FIXUP_HEADSET_MIC
6574 },
Chris Chiud8ae4582018-12-07 17:17:11 +08006575 [ALC294_FIXUP_ASUS_MIC] = {
6576 .type = HDA_FIXUP_PINS,
6577 .v.pins = (const struct hda_pintbl[]) {
6578 { 0x13, 0x90a60160 }, /* use as internal mic */
6579 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6580 { }
6581 },
6582 .chained = true,
6583 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6584 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006585 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
6586 .type = HDA_FIXUP_PINS,
6587 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08006588 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006589 { }
6590 },
6591 .chained = true,
6592 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6593 },
6594 [ALC294_FIXUP_ASUS_SPK] = {
6595 .type = HDA_FIXUP_VERBS,
6596 .v.verbs = (const struct hda_verb[]) {
6597 /* Set EAPD high */
6598 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
6599 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
6600 { }
6601 },
6602 .chained = true,
6603 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
6604 },
Kailang Yange8547472018-11-28 15:32:45 +08006605 [ALC225_FIXUP_HEADSET_JACK] = {
6606 .type = HDA_FIXUP_FUNC,
6607 .v.func = alc_fixup_headset_jack,
6608 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07006609 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
6610 .type = HDA_FIXUP_PINS,
6611 .v.pins = (const struct hda_pintbl[]) {
6612 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6613 { }
6614 },
6615 .chained = true,
6616 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6617 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006618};
6619
6620static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01006621 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02006622 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6623 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02006624 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02006625 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6626 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02006627 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6628 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05006629 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006630 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02006631 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Chris Chiu705b65f2018-12-05 14:48:54 +08006632 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01006633 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiub72f9362018-12-05 14:48:56 +08006634 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6635 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Chris Chiu9f8aefe2018-12-05 14:48:55 +08006636 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
David Henningssonaaedfb42013-08-16 14:09:02 +02006637 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08006638 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01006639 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01006640 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006641 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
6642 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01006643 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02006644 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6645 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6646 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01006647 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6648 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01006649 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02006650 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01006651 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08006652 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6653 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08006654 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02006655 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02006656 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08006657 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08006658 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6659 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01006660 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6661 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6662 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6663 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6664 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Feng423cd782016-05-20 15:47:23 +08006665 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006666 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006667 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Kai-Heng Feng423cd782016-05-20 15:47:23 +08006668 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08006669 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08006670 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwaie312a862018-03-06 12:14:17 +01006671 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Takashi Iwai493de342017-02-28 17:27:57 +01006672 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kailang Yang5f364132017-07-25 16:28:16 +08006673 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Takashi Iwaie4c9fd12018-01-10 08:34:28 +01006674 SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08006675 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6676 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006677 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6678 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08006679 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08006680 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yanga22aa262014-04-23 17:34:28 +08006681 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6682 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006683 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006684 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01006685 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
David Henningsson33f4acd2015-01-07 15:50:13 +01006686 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08006687 /* ALC282 */
Hui Wang7976eb42015-02-13 11:14:41 +08006688 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006689 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006690 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006691 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6692 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6693 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6694 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006695 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006696 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006697 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6698 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006699 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006700 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
TienFu Chenb4b33f92015-01-20 15:06:21 +01006701 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
TienFu Chen3271cb22015-02-10 09:09:41 +01006702 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yangc60666b2014-02-21 16:23:35 +08006703 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006704 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6705 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6706 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006707 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Keith Packard98973f22015-07-15 12:14:39 -07006708 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006709 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6710 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006711 /* ALC290 */
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006712 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006713 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006714 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006715 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6716 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6717 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6718 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6719 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006720 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006721 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006722 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006723 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6724 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6725 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006726 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6727 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006728 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006729 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006730 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006731 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006732 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6733 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006734 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6735 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006736 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006737 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6738 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6739 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6740 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwaif8839822016-02-25 14:31:59 +01006741 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
Takashi Iwai563785e2018-11-12 09:43:12 +01006742 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08006743 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006744 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006745 SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6746 SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05006747 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006748 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02006749 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02006750 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01006751 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006752 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006753 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02006754 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006755 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6756 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6757 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006758 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
6759 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
6760 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01006761 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006762 SND_PCI_QUIRK(0x1043, 0x14a1, "ASUS UX533FD", ALC294_FIXUP_ASUS_SPK),
Takashi Iwai23870832013-11-29 14:13:12 +01006763 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02006764 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai017f2a12011-07-09 14:42:25 +02006765 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06006766 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
David Henningsson693b6132012-06-22 19:12:10 +02006767 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06006768 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006769 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006770 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Chris Chiueeed4cd2017-02-28 14:17:15 -06006771 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006772 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
6773 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
6774 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6775 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02006776 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwaif88abaa2014-02-07 12:07:59 +01006777 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
David Henningsson88cfcf82013-10-11 10:18:45 +02006778 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006779 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
6780 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6781 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006782 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwai24519912011-08-16 15:08:49 +02006783 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006784 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006785 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Takashi Iwai88776f32015-05-01 09:20:34 +02006786 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006787 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
David Henningsson2041d562014-06-13 11:15:44 +02006788 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08006789 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09006790 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02006791 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006792 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Anisse Astierabaa22742016-08-24 09:14:13 +02006793 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
6794 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01006795 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
Jeremy Soller89e3a562019-01-30 16:12:31 -07006796 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Kailang Yangca169cc2017-04-25 16:17:40 +08006797 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006798 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
6799 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
6800 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
6801 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
6802 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwai707fba32012-08-02 09:04:39 +02006803 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
Felix Kaechelec8415a42012-08-06 23:02:01 +02006804 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Stefán Freyr84f98fd2012-10-19 22:46:00 +02006805 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02006806 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02006807 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02006808 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01006809 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02006810 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02006811 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05006812 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02006813 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01006814 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02006815 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01006816 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07006817 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02006818 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006819 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6820 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02006821 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02006822 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006823 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
6824 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6825 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01006826 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006827 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6828 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6829 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01006830 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang3694cb22015-12-28 11:35:24 +08006831 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08006832 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08006833 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08006834 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08006835 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08006836 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
David Henningsson56f27012016-01-11 09:33:14 +01006837 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01006838 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006839 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
David Henningssona4a9e082013-08-16 14:09:01 +02006840 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02006841 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02006842 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02006843 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02006844 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01006845 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02006846 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02006847 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08006848 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02006849 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02006850 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02006851 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006852 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6853 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6854 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02006855 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006856 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6857 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningsson012e7eb2012-08-08 08:43:37 +02006858 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006859 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Ayman Bagabase2744fd2018-12-12 18:07:59 -05006860 SND_PCI_QUIRK(0x19e5, 0x3200, "Huawei MBX", ALC255_FIXUP_MIC_MUTE_LED),
6861 SND_PCI_QUIRK(0x19e5, 0x3201, "Huawei MBX", ALC255_FIXUP_MIC_MUTE_LED),
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006862 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MBXP", ALC256_FIXUP_HUAWEI_MBXP_PINS),
Anisse Astier02b504d2013-06-03 11:53:10 +02006863 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02006864
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01006865#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02006866 /* Below is a quirk table taken from the old code.
6867 * Basically the device should work as is without the fixup table.
6868 * If BIOS doesn't give a proper info, enable the corresponding
6869 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02006870 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02006871 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
6872 ALC269_FIXUP_AMIC),
6873 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02006874 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
6875 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
6876 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
6877 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
6878 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
6879 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
6880 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
6881 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
6882 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
6883 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
6884 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
6885 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
6886 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
6887 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
6888 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
6889 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
6890 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
6891 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
6892 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
6893 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
6894 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
6895 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
6896 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
6897 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
6898 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
6899 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
6900 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
6901 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
6902 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
6903 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
6904 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
6905 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
6906 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
6907 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
6908 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
6909 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
6910 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
6911 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
6912#endif
6913 {}
6914};
6915
David Henningsson214eef72014-07-22 14:09:35 +02006916static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
6917 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
6918 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
6919 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
6920 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
6921 {}
6922};
6923
Takashi Iwai1727a772013-01-10 09:52:52 +01006924static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006925 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
6926 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02006927 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
6928 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
6929 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02006930 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02006931 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
6932 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02006933 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006934 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006935 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02006936 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
6937 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02006938 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
6939 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08006940 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08006941 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02006942 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01006943 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02006944 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02006945 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02006946 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02006947 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02006948 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
6949 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
6950 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
6951 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
6952 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
6953 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
6954 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
6955 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
6956 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
6957 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
6958 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
6959 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
6960 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
6961 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
6962 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
6963 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
6964 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
6965 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
6966 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
6967 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
6968 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
6969 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
6970 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
6971 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
6972 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
6973 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
6974 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
6975 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
6976 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
6977 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
6978 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
6979 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
6980 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
6981 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
6982 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
6983 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
6984 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
6985 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
6986 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
6987 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01006988 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02006989 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
6990 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
6991 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
6992 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
6993 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
6994 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
6995 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
6996 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
6997 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
6998 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
6999 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
7000 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
7001 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
7002 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
7003 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
7004 {.id = ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE, .name = "alc256-dell-xps13"},
7005 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
7006 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
7007 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08007008 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02007009 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
7010 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
7011 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
7012 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
7013 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
7014 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
7015 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
7016 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
7017 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
7018 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
7019 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
7020 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
7021 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
7022 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
7023 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
7024 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
7025 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
7026 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yange8547472018-11-28 15:32:45 +08007027 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-sense-combo"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02007028 {}
7029};
Kailang Yangcfc5a842016-02-03 15:20:39 +08007030#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08007031 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02007032
Hui Wange8191a82015-04-24 13:39:59 +08007033#define ALC256_STANDARD_PINS \
7034 {0x12, 0x90a60140}, \
7035 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08007036 {0x21, 0x02211020}
7037
David Henningssonfea185e2014-09-03 10:23:04 +02007038#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08007039 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08007040
David Henningssonfea185e2014-09-03 10:23:04 +02007041#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08007042 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02007043
7044#define ALC292_STANDARD_PINS \
7045 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08007046 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08007047
Hui Wang3f6409702016-09-11 11:26:16 +08007048#define ALC295_STANDARD_PINS \
7049 {0x12, 0xb7a60130}, \
7050 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08007051 {0x21, 0x04211020}
7052
Woodrow Shen703867e2015-08-05 12:34:12 +08007053#define ALC298_STANDARD_PINS \
7054 {0x12, 0x90a60130}, \
7055 {0x21, 0x03211020}
7056
Hui Wange1918932014-05-26 16:22:44 +08007057static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08007058 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
7059 {0x14, 0x01014020},
7060 {0x17, 0x90170110},
7061 {0x18, 0x02a11030},
7062 {0x19, 0x0181303F},
7063 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06007064 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7065 {0x12, 0x90a601c0},
7066 {0x14, 0x90171120},
7067 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06007068 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7069 {0x14, 0x90170110},
7070 {0x1b, 0x90a70130},
7071 {0x21, 0x03211020}),
7072 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7073 {0x1a, 0x90a70130},
7074 {0x1b, 0x90170110},
7075 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01007076 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08007077 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08007078 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08007079 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01007080 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08007081 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08007082 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08007083 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08007084 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7085 ALC225_STANDARD_PINS,
7086 {0x12, 0xb7a60150},
7087 {0x14, 0x901701a0}),
7088 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7089 ALC225_STANDARD_PINS,
7090 {0x12, 0xb7a60150},
7091 {0x14, 0x901701b0}),
7092 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7093 ALC225_STANDARD_PINS,
7094 {0x12, 0xb7a60130},
7095 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05007096 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7097 {0x1b, 0x01111010},
7098 {0x1e, 0x01451130},
7099 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08007100 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7101 {0x12, 0x90a60140},
7102 {0x14, 0x90170110},
7103 {0x19, 0x02a11030},
7104 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08007105 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7106 {0x14, 0x90170110},
7107 {0x19, 0x02a11030},
7108 {0x1a, 0x02a11040},
7109 {0x1b, 0x01014020},
7110 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08007111 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7112 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08007113 {0x19, 0x02a11030},
7114 {0x1a, 0x02a11040},
7115 {0x1b, 0x01011020},
7116 {0x21, 0x0221101f}),
7117 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7118 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08007119 {0x19, 0x02a11020},
7120 {0x1a, 0x02a11030},
7121 {0x21, 0x0221101f}),
Hui Wangf2657882017-10-24 16:53:34 +08007122 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7123 {0x12, 0x90a60140},
7124 {0x14, 0x90170110},
7125 {0x21, 0x02211020}),
7126 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7127 {0x12, 0x90a60140},
7128 {0x14, 0x90170150},
7129 {0x21, 0x02211020}),
Hui Wangc77900e2014-09-03 11:31:07 +08007130 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08007131 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08007132 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02007133 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08007134 {0x14, 0x90170130},
7135 {0x21, 0x02211040}),
7136 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02007137 {0x12, 0x90a60140},
7138 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02007139 {0x21, 0x02211020}),
7140 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7141 {0x12, 0x90a60160},
7142 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02007143 {0x21, 0x02211030}),
7144 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08007145 {0x14, 0x90170110},
7146 {0x1b, 0x02011020},
7147 {0x21, 0x0221101f}),
7148 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08007149 {0x14, 0x90170110},
7150 {0x1b, 0x01011020},
7151 {0x21, 0x0221101f}),
7152 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02007153 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02007154 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02007155 {0x21, 0x0221103f}),
7156 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08007157 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08007158 {0x1b, 0x01011020},
7159 {0x21, 0x0221103f}),
7160 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7161 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08007162 {0x1b, 0x02011020},
7163 {0x21, 0x0221103f}),
7164 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08007165 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08007166 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08007167 {0x21, 0x0221105f}),
7168 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08007169 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08007170 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08007171 {0x21, 0x0221101f}),
7172 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02007173 {0x12, 0x90a60160},
7174 {0x14, 0x90170120},
7175 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02007176 {0x21, 0x0321102f}),
7177 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7178 {0x12, 0x90a60160},
7179 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02007180 {0x21, 0x02211040}),
7181 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7182 {0x12, 0x90a60160},
7183 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02007184 {0x21, 0x02211050}),
7185 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7186 {0x12, 0x90a60170},
7187 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02007188 {0x21, 0x02211030}),
7189 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7190 {0x12, 0x90a60170},
7191 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02007192 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08007193 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08007194 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08007195 {0x14, 0x90171130},
7196 {0x21, 0x02211040}),
7197 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7198 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08007199 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08007200 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02007201 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02007202 {0x12, 0x90a60180},
7203 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02007204 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08007205 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7206 {0x12, 0x90a60180},
7207 {0x14, 0x90170120},
7208 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08007209 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7210 {0x1b, 0x01011020},
7211 {0x21, 0x02211010}),
Kailang Yang7081adf2015-03-30 17:05:37 +08007212 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang285d5dd2017-12-22 11:17:45 +08007213 {0x12, 0x90a60130},
7214 {0x14, 0x90170110},
7215 {0x1b, 0x01011020},
7216 {0x21, 0x0221101f}),
7217 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang81a12312015-05-28 16:48:22 +08007218 {0x12, 0x90a60160},
7219 {0x14, 0x90170120},
Kailang Yang81a12312015-05-28 16:48:22 +08007220 {0x21, 0x02211030}),
7221 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shenf83c3292016-06-24 15:58:34 +08007222 {0x12, 0x90a60170},
7223 {0x14, 0x90170120},
7224 {0x21, 0x02211030}),
Shrirang Bagul311042d2016-08-29 15:19:27 +08007225 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7226 {0x12, 0x90a60180},
7227 {0x14, 0x90170120},
7228 {0x21, 0x02211030}),
Woodrow Shenf83c3292016-06-24 15:58:34 +08007229 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang3f6409702016-09-11 11:26:16 +08007230 {0x12, 0xb7a60130},
7231 {0x14, 0x90170110},
7232 {0x21, 0x02211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01007233 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang3f2f7c52018-01-29 14:23:15 +08007234 {0x12, 0x90a60130},
7235 {0x14, 0x90170110},
7236 {0x14, 0x01011020},
7237 {0x21, 0x0221101f}),
7238 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncf51eb92014-10-30 08:26:02 +01007239 ALC256_STANDARD_PINS),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007240 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7241 {0x14, 0x90170110},
7242 {0x1b, 0x90a70130},
7243 {0x21, 0x04211020}),
7244 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7245 {0x14, 0x90170110},
7246 {0x1b, 0x90a70130},
7247 {0x21, 0x03211020}),
Kailang Yang92266652017-12-14 15:28:58 +08007248 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Hui Wang75ee94b2017-11-09 08:48:08 +08007249 {0x12, 0xb7a60130},
7250 {0x13, 0xb8a61140},
7251 {0x16, 0x90170110},
7252 {0x21, 0x04211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01007253 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
7254 {0x12, 0x90a60130},
7255 {0x14, 0x90170110},
7256 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08007257 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08007258 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
7259 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08007260 {0x14, 0x90170110},
7261 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08007262 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08007263 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08007264 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02007265 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007266 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02007267 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02007268 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02007269 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08007270 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007271 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08007272 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08007273 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08007274 {0x21, 0x03211040}),
7275 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007276 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08007277 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08007278 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08007279 {0x21, 0x03211020}),
7280 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007281 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08007282 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08007283 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08007284 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08007285 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02007286 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08007287 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08007288 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08007289 {0x21, 0x04211020}),
David Henningsson76c21322014-06-24 14:46:54 +02007290 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007291 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02007292 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02007293 {0x21, 0x0321101f}),
7294 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7295 {0x12, 0x90a60160},
7296 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02007297 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08007298 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007299 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08007300 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08007301 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08007302 {0x21, 0x0321101f}),
Hui Wangc4cfcf62018-11-26 14:17:16 +08007303 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7304 {0x12, 0x90a60130},
7305 {0x14, 0x90170110},
7306 {0x19, 0x04a11040},
7307 {0x21, 0x04211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08007308 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7309 {0x12, 0x90a60130},
7310 {0x17, 0x90170110},
7311 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02007312 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08007313 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08007314 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08007315 {0x21, 0x0321101f}),
Hui Wangd5078192018-03-02 13:05:36 +08007316 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Hui Wang3f2f7c52018-01-29 14:23:15 +08007317 {0x12, 0xb7a60130},
7318 {0x14, 0x90170110},
7319 {0x21, 0x04211020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007320 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007321 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007322 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08007323 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08007324 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007325 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007326 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007327 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08007328 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08007329 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007330 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007331 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007332 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08007333 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007334 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007335 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007336 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08007337 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08007338 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007339 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007340 {0x14, 0x90170110},
7341 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08007342 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08007343 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007344 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007345 {0x14, 0x90170110},
7346 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08007347 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007348 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007349 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007350 {0x14, 0x90170110},
7351 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08007352 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08007353 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007354 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08007355 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08007356 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08007357 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08007358 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007359 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08007360 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08007361 {0x16, 0x01014020},
7362 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08007363 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02007364 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007365 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08007366 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02007367 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007368 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02007369 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02007370 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08007371 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02007372 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007373 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08007374 {0x13, 0x90a60140}),
Chris Chiud8ae4582018-12-07 17:17:11 +08007375 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
7376 {0x14, 0x90170110},
7377 {0x1b, 0x90a70130},
7378 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08007379 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7380 {0x12, 0x90a60130},
7381 {0x17, 0x90170110},
7382 {0x21, 0x04211020}),
Hui Wang3f6409702016-09-11 11:26:16 +08007383 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08007384 ALC295_STANDARD_PINS,
7385 {0x17, 0x21014020},
7386 {0x18, 0x21a19030}),
7387 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7388 ALC295_STANDARD_PINS,
7389 {0x17, 0x21014040},
7390 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08007391 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7392 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08007393 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08007394 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02007395 {0x17, 0x90170110}),
7396 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7397 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08007398 {0x17, 0x90170140}),
7399 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7400 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02007401 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08007402 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
7403 {0x12, 0xb7a60140},
7404 {0x13, 0xb7a60150},
7405 {0x17, 0x90170110},
7406 {0x1a, 0x03011020},
7407 {0x21, 0x03211030}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08007408 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7409 ALC225_STANDARD_PINS,
7410 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08007411 {0x17, 0x90170110}),
Hui Wange1918932014-05-26 16:22:44 +08007412 {}
7413};
Takashi Iwai1d045db2011-07-07 18:23:21 +02007414
Takashi Iwai546bb672012-03-07 08:37:19 +01007415static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02007416{
Kailang Yang526af6e2012-03-07 08:25:20 +01007417 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007418 int val;
7419
Kailang Yang526af6e2012-03-07 08:25:20 +01007420 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01007421 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01007422
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007423 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007424 alc_write_coef_idx(codec, 0xf, 0x960b);
7425 alc_write_coef_idx(codec, 0xe, 0x8817);
7426 }
7427
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007428 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007429 alc_write_coef_idx(codec, 0xf, 0x960b);
7430 alc_write_coef_idx(codec, 0xe, 0x8814);
7431 }
7432
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007433 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007434 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02007435 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007436 }
7437
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007438 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007439 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02007440 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007441 /* Capless ramp up clock control */
7442 alc_write_coef_idx(codec, 0xd, val | (1<<10));
7443 }
7444 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02007445 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007446 /* Class D power on reset */
7447 alc_write_coef_idx(codec, 0x17, val | (1<<7));
7448 }
7449 }
7450
Takashi Iwai98b24882014-08-18 13:47:50 +02007451 /* HP */
7452 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007453}
7454
7455/*
7456 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007457static int patch_alc269(struct hda_codec *codec)
7458{
7459 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02007460 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007461
Takashi Iwai3de95172012-05-07 18:03:15 +02007462 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007463 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02007464 return err;
7465
7466 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01007467 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007468 codec->power_save_node = 1;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007469
Takashi Iwai225068a2015-05-29 10:42:14 +02007470#ifdef CONFIG_PM
7471 codec->patch_ops.suspend = alc269_suspend;
7472 codec->patch_ops.resume = alc269_resume;
7473#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08007474 spec->shutup = alc_default_shutup;
7475 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02007476
Takashi Iwai7639a062015-03-03 10:07:24 +01007477 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01007478 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02007479 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007480 switch (alc_get_coef0(codec) & 0x00f0) {
7481 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01007482 if (codec->bus->pci &&
7483 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007484 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02007485 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02007486 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007487 break;
7488 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01007489 if (codec->bus->pci &&
7490 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007491 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02007492 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02007493 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007494 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02007495 case 0x0030:
7496 spec->codec_variant = ALC269_TYPE_ALC269VD;
7497 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007498 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02007499 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007500 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007501 if (err < 0)
7502 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08007503 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01007504 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007505 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01007506 break;
7507
7508 case 0x10ec0280:
7509 case 0x10ec0290:
7510 spec->codec_variant = ALC269_TYPE_ALC280;
7511 break;
7512 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01007513 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08007514 spec->shutup = alc282_shutup;
7515 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01007516 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02007517 case 0x10ec0233:
7518 case 0x10ec0283:
7519 spec->codec_variant = ALC269_TYPE_ALC283;
7520 spec->shutup = alc283_shutup;
7521 spec->init_hook = alc283_init;
7522 break;
Kailang Yang065380f2013-01-10 10:25:48 +01007523 case 0x10ec0284:
7524 case 0x10ec0292:
7525 spec->codec_variant = ALC269_TYPE_ALC284;
7526 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02007527 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08007528 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02007529 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02007530 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08007531 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02007532 spec->codec_variant = ALC269_TYPE_ALC286;
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08007533 spec->shutup = alc286_shutup;
Kailang Yang7fc7d042013-04-25 11:04:43 +02007534 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08007535 case 0x10ec0298:
7536 spec->codec_variant = ALC269_TYPE_ALC298;
7537 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08007538 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02007539 case 0x10ec0255:
7540 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08007541 spec->shutup = alc256_shutup;
7542 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02007543 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08007544 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08007545 case 0x10ec0256:
7546 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08007547 spec->shutup = alc256_shutup;
7548 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02007549 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yangd32b6662015-04-23 15:10:53 +08007550 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
Kailang Yang4344aec2014-12-17 17:39:05 +08007551 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08007552 case 0x10ec0257:
7553 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08007554 spec->shutup = alc256_shutup;
7555 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08007556 spec->gen.mixer_nid = 0;
7557 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08007558 case 0x10ec0215:
7559 case 0x10ec0285:
7560 case 0x10ec0289:
7561 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08007562 spec->shutup = alc225_shutup;
7563 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08007564 spec->gen.mixer_nid = 0;
7565 break;
Kailang Yang42314302016-02-03 15:03:50 +08007566 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08007567 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08007568 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08007569 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08007570 spec->shutup = alc225_shutup;
7571 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01007572 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08007573 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08007574 case 0x10ec0234:
7575 case 0x10ec0274:
7576 case 0x10ec0294:
7577 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08007578 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08007579 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +08007580 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08007581 break;
Kailang Yang1078bef2018-11-08 16:36:15 +08007582 case 0x10ec0300:
7583 spec->codec_variant = ALC269_TYPE_ALC300;
7584 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007585 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08007586 case 0x10ec0700:
7587 case 0x10ec0701:
7588 case 0x10ec0703:
7589 spec->codec_variant = ALC269_TYPE_ALC700;
7590 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08007591 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +08007592 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +08007593 break;
7594
Takashi Iwai1d045db2011-07-07 18:23:21 +02007595 }
7596
Kailang Yangad60d502013-06-28 12:03:01 +02007597 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05007598 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02007599 spec->init_hook = alc5505_dsp_init;
7600 }
7601
Takashi Iwaiefe55732018-06-15 11:55:02 +02007602 snd_hda_pick_fixup(codec, alc269_fixup_models,
7603 alc269_fixup_tbl, alc269_fixups);
7604 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
7605 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
7606 alc269_fixups);
7607 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7608
7609 alc_auto_parse_customize_define(codec);
7610
7611 if (has_cdefine_beep(codec))
7612 spec->gen.beep_nid = 0x01;
7613
Takashi Iwaia4297b52011-08-23 18:40:12 +02007614 /* automatic parse from the BIOS config */
7615 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007616 if (err < 0)
7617 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007618
Takashi Iwaifea80fa2018-06-20 12:52:46 +02007619 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
7620 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
7621 if (err < 0)
7622 goto error;
7623 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007624
Takashi Iwai1727a772013-01-10 09:52:52 +01007625 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007626
Takashi Iwai1d045db2011-07-07 18:23:21 +02007627 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007628
7629 error:
7630 alc_free(codec);
7631 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007632}
7633
7634/*
7635 * ALC861
7636 */
7637
Takashi Iwai1d045db2011-07-07 18:23:21 +02007638static int alc861_parse_auto_config(struct hda_codec *codec)
7639{
Takashi Iwai1d045db2011-07-07 18:23:21 +02007640 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007641 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
7642 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007643}
7644
Takashi Iwai1d045db2011-07-07 18:23:21 +02007645/* Pin config fixes */
7646enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007647 ALC861_FIXUP_FSC_AMILO_PI1505,
7648 ALC861_FIXUP_AMP_VREF_0F,
7649 ALC861_FIXUP_NO_JACK_DETECT,
7650 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007651 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007652};
7653
Takashi Iwai31150f22012-01-30 10:54:08 +01007654/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
7655static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007656 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01007657{
7658 struct alc_spec *spec = codec->spec;
7659 unsigned int val;
7660
Takashi Iwai1727a772013-01-10 09:52:52 +01007661 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01007662 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01007663 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01007664 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
7665 val |= AC_PINCTL_IN_EN;
7666 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02007667 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01007668 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01007669}
7670
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007671/* suppress the jack-detection */
7672static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007673 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007674{
Takashi Iwai1727a772013-01-10 09:52:52 +01007675 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007676 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02007677}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007678
Takashi Iwai1727a772013-01-10 09:52:52 +01007679static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007680 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007681 .type = HDA_FIXUP_PINS,
7682 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007683 { 0x0b, 0x0221101f }, /* HP */
7684 { 0x0f, 0x90170310 }, /* speaker */
7685 { }
7686 }
7687 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007688 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007689 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01007690 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01007691 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007692 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007693 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007694 .v.func = alc_fixup_no_jack_detect,
7695 },
7696 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007697 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007698 .v.func = alc861_fixup_asus_amp_vref_0f,
7699 .chained = true,
7700 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007701 },
7702 [ALC660_FIXUP_ASUS_W7J] = {
7703 .type = HDA_FIXUP_VERBS,
7704 .v.verbs = (const struct hda_verb[]) {
7705 /* ASUS W7J needs a magic pin setup on unused NID 0x10
7706 * for enabling outputs
7707 */
7708 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7709 { }
7710 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007711 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007712};
7713
7714static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007715 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01007716 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007717 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
7718 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
7719 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
7720 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
7721 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
7722 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007723 {}
7724};
7725
7726/*
7727 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007728static int patch_alc861(struct hda_codec *codec)
7729{
7730 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007731 int err;
7732
Takashi Iwai3de95172012-05-07 18:03:15 +02007733 err = alc_alloc_spec(codec, 0x15);
7734 if (err < 0)
7735 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007736
Takashi Iwai3de95172012-05-07 18:03:15 +02007737 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007738 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007739
Takashi Iwai225068a2015-05-29 10:42:14 +02007740#ifdef CONFIG_PM
7741 spec->power_hook = alc_power_eapd;
7742#endif
7743
Takashi Iwai1727a772013-01-10 09:52:52 +01007744 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
7745 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007746
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007747 /* automatic parse from the BIOS config */
7748 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007749 if (err < 0)
7750 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007751
Takashi Iwaifea80fa2018-06-20 12:52:46 +02007752 if (!spec->gen.no_analog) {
7753 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
7754 if (err < 0)
7755 goto error;
7756 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007757
Takashi Iwai1727a772013-01-10 09:52:52 +01007758 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007759
Takashi Iwai1d045db2011-07-07 18:23:21 +02007760 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007761
7762 error:
7763 alc_free(codec);
7764 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007765}
7766
7767/*
7768 * ALC861-VD support
7769 *
7770 * Based on ALC882
7771 *
7772 * In addition, an independent DAC
7773 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007774static int alc861vd_parse_auto_config(struct hda_codec *codec)
7775{
Takashi Iwai1d045db2011-07-07 18:23:21 +02007776 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007777 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7778 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007779}
7780
Takashi Iwai1d045db2011-07-07 18:23:21 +02007781enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007782 ALC660VD_FIX_ASUS_GPIO1,
7783 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007784};
7785
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007786/* exclude VREF80 */
7787static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007788 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007789{
Takashi Iwai1727a772013-01-10 09:52:52 +01007790 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01007791 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
7792 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007793 }
7794}
7795
Takashi Iwaidf73d832018-06-19 23:05:47 +02007796/* reset GPIO1 */
7797static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
7798 const struct hda_fixup *fix, int action)
7799{
7800 struct alc_spec *spec = codec->spec;
7801
7802 if (action == HDA_FIXUP_ACT_PRE_PROBE)
7803 spec->gpio_mask |= 0x02;
7804 alc_fixup_gpio(codec, action, 0x01);
7805}
7806
Takashi Iwai1727a772013-01-10 09:52:52 +01007807static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007808 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +02007809 .type = HDA_FIXUP_FUNC,
7810 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007811 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007812 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007813 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007814 .v.func = alc861vd_fixup_dallas,
7815 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02007816};
7817
7818static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007819 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007820 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007821 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007822 {}
7823};
7824
Takashi Iwai1d045db2011-07-07 18:23:21 +02007825/*
7826 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007827static int patch_alc861vd(struct hda_codec *codec)
7828{
7829 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007830 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007831
Takashi Iwai3de95172012-05-07 18:03:15 +02007832 err = alc_alloc_spec(codec, 0x0b);
7833 if (err < 0)
7834 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007835
Takashi Iwai3de95172012-05-07 18:03:15 +02007836 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007837 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007838
Takashi Iwai225068a2015-05-29 10:42:14 +02007839 spec->shutup = alc_eapd_shutup;
7840
Takashi Iwai1727a772013-01-10 09:52:52 +01007841 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
7842 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007843
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007844 /* automatic parse from the BIOS config */
7845 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007846 if (err < 0)
7847 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007848
Takashi Iwaifea80fa2018-06-20 12:52:46 +02007849 if (!spec->gen.no_analog) {
7850 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7851 if (err < 0)
7852 goto error;
7853 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007854
Takashi Iwai1727a772013-01-10 09:52:52 +01007855 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007856
Takashi Iwai1d045db2011-07-07 18:23:21 +02007857 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007858
7859 error:
7860 alc_free(codec);
7861 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007862}
7863
7864/*
7865 * ALC662 support
7866 *
7867 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
7868 * configuration. Each pin widget can choose any input DACs and a mixer.
7869 * Each ADC is connected from a mixer of all inputs. This makes possible
7870 * 6-channel independent captures.
7871 *
7872 * In addition, an independent DAC for the multi-playback (not used in this
7873 * driver yet).
7874 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007875
7876/*
7877 * BIOS auto configuration
7878 */
7879
Kailang Yangbc9f98a2007-04-12 13:06:07 +02007880static int alc662_parse_auto_config(struct hda_codec *codec)
7881{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02007882 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007883 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
7884 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7885 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02007886
Takashi Iwai7639a062015-03-03 10:07:24 +01007887 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
7888 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
7889 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007890 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01007891 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007892 ssids = alc662_ssids;
7893 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02007894}
7895
Todd Broch6be79482010-12-07 16:51:05 -08007896static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007897 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01007898{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01007899 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01007900 return;
Todd Broch6be79482010-12-07 16:51:05 -08007901 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
7902 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
7903 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
7904 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
7905 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01007906 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08007907}
7908
Takashi Iwai8e383952013-10-30 17:41:12 +01007909static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
7910 { .channels = 2,
7911 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
7912 { .channels = 4,
7913 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
7914 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
7915 { }
7916};
7917
7918/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01007919static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01007920 const struct hda_fixup *fix, int action)
7921{
7922 if (action == HDA_FIXUP_ACT_BUILD) {
7923 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +01007924 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +01007925 }
7926}
7927
Takashi Iwaibf686652014-01-13 16:18:25 +01007928/* avoid D3 for keeping GPIO up */
7929static unsigned int gpio_led_power_filter(struct hda_codec *codec,
7930 hda_nid_t nid,
7931 unsigned int power_state)
7932{
7933 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +02007934 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +01007935 return AC_PWRST_D0;
7936 return power_state;
7937}
7938
Takashi Iwai3e887f32014-01-10 17:50:58 +01007939static void alc662_fixup_led_gpio1(struct hda_codec *codec,
7940 const struct hda_fixup *fix, int action)
7941{
7942 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +01007943
Takashi Iwai01e4a272018-06-19 22:47:30 +02007944 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +01007945 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01007946 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +01007947 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01007948 }
7949}
7950
Kailang Yangc6790c82016-11-25 16:15:17 +08007951static void alc662_usi_automute_hook(struct hda_codec *codec,
7952 struct hda_jack_callback *jack)
7953{
7954 struct alc_spec *spec = codec->spec;
7955 int vref;
7956 msleep(200);
7957 snd_hda_gen_hp_automute(codec, jack);
7958
7959 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
7960 msleep(100);
7961 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7962 vref);
7963}
7964
7965static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
7966 const struct hda_fixup *fix, int action)
7967{
7968 struct alc_spec *spec = codec->spec;
7969 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7970 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7971 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
7972 }
7973}
7974
Kailang Yangf3f91852014-10-24 15:43:46 +08007975static struct coef_fw alc668_coefs[] = {
7976 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
7977 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
7978 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
7979 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
7980 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
7981 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
7982 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
7983 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
7984 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
7985 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
7986 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
7987 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
7988 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
7989 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
7990 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
7991 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
7992 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
7993 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
7994 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
7995 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
7996 {}
7997};
7998
7999static void alc668_restore_default_value(struct hda_codec *codec)
8000{
8001 alc_process_coef_fw(codec, alc668_coefs);
8002}
8003
David Henningsson6cb3b702010-09-09 08:51:44 +02008004enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04008005 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01008006 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02008007 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08008008 ALC272_FIXUP_MARIO,
Anisse Astierd2ebd472011-01-20 12:36:21 +01008009 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02008010 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02008011 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02008012 ALC662_FIXUP_ASUS_MODE1,
8013 ALC662_FIXUP_ASUS_MODE2,
8014 ALC662_FIXUP_ASUS_MODE3,
8015 ALC662_FIXUP_ASUS_MODE4,
8016 ALC662_FIXUP_ASUS_MODE5,
8017 ALC662_FIXUP_ASUS_MODE6,
8018 ALC662_FIXUP_ASUS_MODE7,
8019 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01008020 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02008021 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02008022 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +02008023 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02008024 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02008025 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +02008026 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01008027 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01008028 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008029 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01008030 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08008031 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02008032 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02008033 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02008034 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02008035 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008036 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02008037 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +02008038 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008039 ALC891_FIXUP_HEADSET_MODE,
8040 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08008041 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008042 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +08008043 ALC662_FIXUP_USI_FUNC,
8044 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +08008045 ALC662_FIXUP_LENOVO_MULTI_CODECS,
David Henningsson6cb3b702010-09-09 08:51:44 +02008046};
8047
Takashi Iwai1727a772013-01-10 09:52:52 +01008048static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04008049 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008050 .type = HDA_FIXUP_PINS,
8051 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04008052 { 0x15, 0x99130112 }, /* subwoofer */
8053 { }
8054 }
8055 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01008056 [ALC662_FIXUP_LED_GPIO1] = {
8057 .type = HDA_FIXUP_FUNC,
8058 .v.func = alc662_fixup_led_gpio1,
8059 },
David Henningsson6cb3b702010-09-09 08:51:44 +02008060 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008061 .type = HDA_FIXUP_PINS,
8062 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02008063 { 0x17, 0x99130112 }, /* subwoofer */
8064 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01008065 },
8066 .chained = true,
8067 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02008068 },
Todd Broch6be79482010-12-07 16:51:05 -08008069 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008070 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01008071 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01008072 },
8073 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008074 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +01008075 .v.verbs = (const struct hda_verb[]) {
8076 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
8077 {}
8078 }
8079 },
David Henningsson94024cd2011-04-29 14:10:55 +02008080 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008081 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02008082 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +02008083 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02008084 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008085 .type = HDA_FIXUP_PINS,
8086 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02008087 { 0x14, 0x0221201f }, /* HP out */
8088 { }
8089 },
8090 .chained = true,
8091 .chain_id = ALC662_FIXUP_SKU_IGNORE
8092 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02008093 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008094 .type = HDA_FIXUP_PINS,
8095 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008096 { 0x14, 0x99130110 }, /* speaker */
8097 { 0x18, 0x01a19c20 }, /* mic */
8098 { 0x19, 0x99a3092f }, /* int-mic */
8099 { 0x21, 0x0121401f }, /* HP out */
8100 { }
8101 },
8102 .chained = true,
8103 .chain_id = ALC662_FIXUP_SKU_IGNORE
8104 },
8105 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008106 .type = HDA_FIXUP_PINS,
8107 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +02008108 { 0x14, 0x99130110 }, /* speaker */
8109 { 0x18, 0x01a19820 }, /* mic */
8110 { 0x19, 0x99a3092f }, /* int-mic */
8111 { 0x1b, 0x0121401f }, /* HP out */
8112 { }
8113 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02008114 .chained = true,
8115 .chain_id = ALC662_FIXUP_SKU_IGNORE
8116 },
8117 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008118 .type = HDA_FIXUP_PINS,
8119 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008120 { 0x14, 0x99130110 }, /* speaker */
8121 { 0x15, 0x0121441f }, /* HP */
8122 { 0x18, 0x01a19840 }, /* mic */
8123 { 0x19, 0x99a3094f }, /* int-mic */
8124 { 0x21, 0x01211420 }, /* HP2 */
8125 { }
8126 },
8127 .chained = true,
8128 .chain_id = ALC662_FIXUP_SKU_IGNORE
8129 },
8130 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008131 .type = HDA_FIXUP_PINS,
8132 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008133 { 0x14, 0x99130110 }, /* speaker */
8134 { 0x16, 0x99130111 }, /* speaker */
8135 { 0x18, 0x01a19840 }, /* mic */
8136 { 0x19, 0x99a3094f }, /* int-mic */
8137 { 0x21, 0x0121441f }, /* HP */
8138 { }
8139 },
8140 .chained = true,
8141 .chain_id = ALC662_FIXUP_SKU_IGNORE
8142 },
8143 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008144 .type = HDA_FIXUP_PINS,
8145 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008146 { 0x14, 0x99130110 }, /* speaker */
8147 { 0x15, 0x0121441f }, /* HP */
8148 { 0x16, 0x99130111 }, /* speaker */
8149 { 0x18, 0x01a19840 }, /* mic */
8150 { 0x19, 0x99a3094f }, /* int-mic */
8151 { }
8152 },
8153 .chained = true,
8154 .chain_id = ALC662_FIXUP_SKU_IGNORE
8155 },
8156 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008157 .type = HDA_FIXUP_PINS,
8158 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008159 { 0x14, 0x99130110 }, /* speaker */
8160 { 0x15, 0x01211420 }, /* HP2 */
8161 { 0x18, 0x01a19840 }, /* mic */
8162 { 0x19, 0x99a3094f }, /* int-mic */
8163 { 0x1b, 0x0121441f }, /* HP */
8164 { }
8165 },
8166 .chained = true,
8167 .chain_id = ALC662_FIXUP_SKU_IGNORE
8168 },
8169 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008170 .type = HDA_FIXUP_PINS,
8171 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008172 { 0x14, 0x99130110 }, /* speaker */
8173 { 0x17, 0x99130111 }, /* speaker */
8174 { 0x18, 0x01a19840 }, /* mic */
8175 { 0x19, 0x99a3094f }, /* int-mic */
8176 { 0x1b, 0x01214020 }, /* HP */
8177 { 0x21, 0x0121401f }, /* HP */
8178 { }
8179 },
8180 .chained = true,
8181 .chain_id = ALC662_FIXUP_SKU_IGNORE
8182 },
8183 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008184 .type = HDA_FIXUP_PINS,
8185 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008186 { 0x14, 0x99130110 }, /* speaker */
8187 { 0x12, 0x99a30970 }, /* int-mic */
8188 { 0x15, 0x01214020 }, /* HP */
8189 { 0x17, 0x99130111 }, /* speaker */
8190 { 0x18, 0x01a19840 }, /* mic */
8191 { 0x21, 0x0121401f }, /* HP */
8192 { }
8193 },
8194 .chained = true,
8195 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +02008196 },
Takashi Iwai1565cc32012-02-13 12:03:25 +01008197 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008198 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +01008199 .v.func = alc_fixup_no_jack_detect,
8200 },
David Henningssonedfe3bf2012-06-12 13:15:12 +02008201 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008202 .type = HDA_FIXUP_PINS,
8203 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +02008204 { 0x1b, 0x02214020 }, /* Front HP */
8205 { }
8206 }
8207 },
Takashi Iwai125821a2012-06-22 14:30:29 +02008208 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008209 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02008210 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +02008211 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02008212 [ALC668_FIXUP_DELL_XPS13] = {
8213 .type = HDA_FIXUP_FUNC,
8214 .v.func = alc_fixup_dell_xps13,
8215 .chained = true,
8216 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
8217 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02008218 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
8219 .type = HDA_FIXUP_FUNC,
8220 .v.func = alc_fixup_disable_aamix,
8221 .chained = true,
8222 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8223 },
Hui Wang493a52a2014-01-14 14:07:36 +08008224 [ALC668_FIXUP_AUTO_MUTE] = {
8225 .type = HDA_FIXUP_FUNC,
8226 .v.func = alc_fixup_auto_mute_via_amp,
8227 .chained = true,
8228 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8229 },
David Henningsson1f8b46c2015-05-12 14:38:15 +02008230 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
8231 .type = HDA_FIXUP_PINS,
8232 .v.pins = (const struct hda_pintbl[]) {
8233 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8234 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
8235 { }
8236 },
8237 .chained = true,
8238 .chain_id = ALC662_FIXUP_HEADSET_MODE
8239 },
8240 [ALC662_FIXUP_HEADSET_MODE] = {
8241 .type = HDA_FIXUP_FUNC,
8242 .v.func = alc_fixup_headset_mode_alc662,
8243 },
David Henningsson73bdd592013-04-15 15:44:14 +02008244 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
8245 .type = HDA_FIXUP_PINS,
8246 .v.pins = (const struct hda_pintbl[]) {
8247 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8248 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8249 { }
8250 },
8251 .chained = true,
8252 .chain_id = ALC668_FIXUP_HEADSET_MODE
8253 },
8254 [ALC668_FIXUP_HEADSET_MODE] = {
8255 .type = HDA_FIXUP_FUNC,
8256 .v.func = alc_fixup_headset_mode_alc668,
8257 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01008258 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +01008259 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01008260 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +01008261 .chained = true,
8262 .chain_id = ALC662_FIXUP_ASUS_MODE4
8263 },
David Henningsson61a75f12014-02-07 09:31:08 +01008264 [ALC662_FIXUP_BASS_16] = {
8265 .type = HDA_FIXUP_PINS,
8266 .v.pins = (const struct hda_pintbl[]) {
8267 {0x16, 0x80106111}, /* bass speaker */
8268 {}
8269 },
8270 .chained = true,
8271 .chain_id = ALC662_FIXUP_BASS_CHMAP,
8272 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008273 [ALC662_FIXUP_BASS_1A] = {
8274 .type = HDA_FIXUP_PINS,
8275 .v.pins = (const struct hda_pintbl[]) {
8276 {0x1a, 0x80106111}, /* bass speaker */
8277 {}
8278 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01008279 .chained = true,
8280 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008281 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01008282 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008283 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01008284 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008285 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02008286 [ALC662_FIXUP_ASUS_Nx50] = {
8287 .type = HDA_FIXUP_FUNC,
8288 .v.func = alc_fixup_auto_mute_via_amp,
8289 .chained = true,
8290 .chain_id = ALC662_FIXUP_BASS_1A
8291 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02008292 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
8293 .type = HDA_FIXUP_FUNC,
8294 .v.func = alc_fixup_headset_mode_alc668,
8295 .chain_id = ALC662_FIXUP_BASS_CHMAP
8296 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008297 [ALC668_FIXUP_ASUS_Nx51] = {
8298 .type = HDA_FIXUP_PINS,
8299 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02008300 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8301 { 0x1a, 0x90170151 }, /* bass speaker */
8302 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008303 {}
8304 },
8305 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02008306 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008307 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02008308 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +02008309 .type = HDA_FIXUP_VERBS,
8310 .v.verbs = (const struct hda_verb[]) {
8311 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
8312 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
8313 {}
8314 },
8315 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02008316 [ALC668_FIXUP_ASUS_G751] = {
8317 .type = HDA_FIXUP_PINS,
8318 .v.pins = (const struct hda_pintbl[]) {
8319 { 0x16, 0x0421101f }, /* HP */
8320 {}
8321 },
8322 .chained = true,
8323 .chain_id = ALC668_FIXUP_MIC_COEF
8324 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008325 [ALC891_FIXUP_HEADSET_MODE] = {
8326 .type = HDA_FIXUP_FUNC,
8327 .v.func = alc_fixup_headset_mode,
8328 },
8329 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
8330 .type = HDA_FIXUP_PINS,
8331 .v.pins = (const struct hda_pintbl[]) {
8332 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8333 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8334 { }
8335 },
8336 .chained = true,
8337 .chain_id = ALC891_FIXUP_HEADSET_MODE
8338 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08008339 [ALC662_FIXUP_ACER_VERITON] = {
8340 .type = HDA_FIXUP_PINS,
8341 .v.pins = (const struct hda_pintbl[]) {
8342 { 0x15, 0x50170120 }, /* no internal speaker */
8343 { }
8344 }
8345 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008346 [ALC892_FIXUP_ASROCK_MOBO] = {
8347 .type = HDA_FIXUP_PINS,
8348 .v.pins = (const struct hda_pintbl[]) {
8349 { 0x15, 0x40f000f0 }, /* disabled */
8350 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008351 { }
8352 }
8353 },
Kailang Yangc6790c82016-11-25 16:15:17 +08008354 [ALC662_FIXUP_USI_FUNC] = {
8355 .type = HDA_FIXUP_FUNC,
8356 .v.func = alc662_fixup_usi_headset_mic,
8357 },
8358 [ALC662_FIXUP_USI_HEADSET_MODE] = {
8359 .type = HDA_FIXUP_PINS,
8360 .v.pins = (const struct hda_pintbl[]) {
8361 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
8362 { 0x18, 0x01a1903d },
8363 { }
8364 },
8365 .chained = true,
8366 .chain_id = ALC662_FIXUP_USI_FUNC
8367 },
Kailang Yangca169cc2017-04-25 16:17:40 +08008368 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
8369 .type = HDA_FIXUP_FUNC,
8370 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8371 },
David Henningsson6cb3b702010-09-09 08:51:44 +02008372};
8373
Takashi Iwaia9111322011-05-02 11:30:18 +02008374static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008375 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +02008376 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +01008377 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +01008378 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +02008379 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +02008380 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +02008381 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -04008382 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
David Henningsson73bdd592013-04-15 15:44:14 +02008383 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8384 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +02008385 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02008386 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +02008387 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +01008388 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +01008389 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +08008390 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8391 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +08008392 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02008393 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Kaho Ng2da2dc92016-05-09 00:27:49 +08008394 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +02008395 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwaidb8948e2016-01-18 09:17:30 +01008396 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02008397 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +02008398 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
David Henningsson8e54b4a2014-02-07 09:31:07 +01008399 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +01008400 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008401 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
8402 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Takashi Iwaic7efff92017-01-04 21:38:16 +01008403 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +01008404 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +01008405 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +01008406 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +02008407 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -05008408 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +08008409 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +08008410 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +06008411 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +02008412 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008413 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +02008414 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08008415 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Anisse Astierd2ebd472011-01-20 12:36:21 +01008416 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +02008417
8418#if 0
8419 /* Below is a quirk table taken from the old code.
8420 * Basically the device should work as is without the fixup table.
8421 * If BIOS doesn't give a proper info, enable the corresponding
8422 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008423 */
Takashi Iwai53c334a2011-08-23 18:27:14 +02008424 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
8425 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
8426 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
8427 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
8428 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8429 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8430 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8431 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
8432 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
8433 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8434 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
8435 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
8436 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
8437 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
8438 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
8439 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8440 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
8441 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
8442 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8443 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8444 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8445 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8446 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
8447 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
8448 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
8449 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8450 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
8451 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8452 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8453 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
8454 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8455 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8456 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
8457 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
8458 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
8459 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
8460 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
8461 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
8462 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
8463 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8464 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
8465 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
8466 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8467 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
8468 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
8469 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
8470 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
8471 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
8472 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8473 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
8474#endif
David Henningsson6cb3b702010-09-09 08:51:44 +02008475 {}
8476};
8477
Takashi Iwai1727a772013-01-10 09:52:52 +01008478static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008479 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
8480 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -08008481 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008482 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +02008483 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
8484 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
8485 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
8486 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
8487 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
8488 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
8489 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
8490 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008491 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02008492 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008493 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +02008494 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008495 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
8496 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
8497 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
8498 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
8499 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
8500 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
8501 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
8502 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +02008503 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008504 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
8505 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
8506 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
8507 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
8508 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02008509 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Todd Broch6be79482010-12-07 16:51:05 -08008510 {}
8511};
David Henningsson6cb3b702010-09-09 08:51:44 +02008512
Hui Wang532895c2014-05-29 15:59:19 +08008513static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008514 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8515 {0x17, 0x02211010},
8516 {0x18, 0x01a19030},
8517 {0x1a, 0x01813040},
8518 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +02008519 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02008520 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +02008521 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +02008522 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +08008523 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +02008524 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8525 {0x12, 0x99a30130},
8526 {0x14, 0x90170110},
8527 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008528 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008529 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8530 {0x12, 0x99a30140},
8531 {0x14, 0x90170110},
8532 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008533 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008534 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8535 {0x12, 0x99a30150},
8536 {0x14, 0x90170110},
8537 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008538 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008539 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +02008540 {0x14, 0x90170110},
8541 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008542 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008543 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
8544 {0x12, 0x90a60130},
8545 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08008546 {0x15, 0x0321101f}),
Hui Wang532895c2014-05-29 15:59:19 +08008547 {}
8548};
8549
Takashi Iwai1d045db2011-07-07 18:23:21 +02008550/*
8551 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008552static int patch_alc662(struct hda_codec *codec)
8553{
8554 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02008555 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008556
Takashi Iwai3de95172012-05-07 18:03:15 +02008557 err = alc_alloc_spec(codec, 0x0b);
8558 if (err < 0)
8559 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008560
Takashi Iwai3de95172012-05-07 18:03:15 +02008561 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008562
Takashi Iwai225068a2015-05-29 10:42:14 +02008563 spec->shutup = alc_eapd_shutup;
8564
Takashi Iwai53c334a2011-08-23 18:27:14 +02008565 /* handle multiple HPs as is */
8566 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
8567
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +02008568 alc_fix_pll_init(codec, 0x20, 0x04, 15);
8569
Takashi Iwai7639a062015-03-03 10:07:24 +01008570 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +08008571 case 0x10ec0668:
8572 spec->init_hook = alc668_restore_default_value;
8573 break;
Kailang Yangf3f91852014-10-24 15:43:46 +08008574 }
Kailang Yang8663ff72012-06-29 09:35:52 +02008575
Takashi Iwai1727a772013-01-10 09:52:52 +01008576 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +02008577 alc662_fixup_tbl, alc662_fixups);
Hui Wang532895c2014-05-29 15:59:19 +08008578 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01008579 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +02008580
8581 alc_auto_parse_customize_define(codec);
8582
Takashi Iwai7504b6c2013-03-18 11:25:51 +01008583 if (has_cdefine_beep(codec))
8584 spec->gen.beep_nid = 0x01;
8585
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008586 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +01008587 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008588 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +08008589 err = alc_codec_rename(codec, "ALC272X");
8590 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008591 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008592 }
Kailang Yang274693f2009-12-03 10:07:50 +01008593
Takashi Iwaib9c51062011-08-24 18:08:07 +02008594 /* automatic parse from the BIOS config */
8595 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008596 if (err < 0)
8597 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008598
Takashi Iwai7504b6c2013-03-18 11:25:51 +01008599 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +01008600 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +01008601 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008602 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +01008603 break;
8604 case 0x10ec0272:
8605 case 0x10ec0663:
8606 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +08008607 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008608 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +01008609 break;
8610 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008611 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +01008612 break;
8613 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008614 if (err < 0)
8615 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +01008616 }
Takashi Iwai2134ea42008-01-10 16:53:55 +01008617
Takashi Iwai1727a772013-01-10 09:52:52 +01008618 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01008619
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008620 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008621
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008622 error:
8623 alc_free(codec);
8624 return err;
Kailang Yangb478b992011-05-18 11:51:15 +02008625}
8626
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008627/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008628 * ALC680 support
8629 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008630
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008631static int alc680_parse_auto_config(struct hda_codec *codec)
8632{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02008633 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008634}
8635
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008636/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008637 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008638static int patch_alc680(struct hda_codec *codec)
8639{
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008640 int err;
8641
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008642 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02008643 err = alc_alloc_spec(codec, 0);
8644 if (err < 0)
8645 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008646
Takashi Iwai1ebec5f2011-08-15 13:21:48 +02008647 /* automatic parse from the BIOS config */
8648 err = alc680_parse_auto_config(codec);
8649 if (err < 0) {
8650 alc_free(codec);
8651 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008652 }
8653
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008654 return 0;
8655}
8656
8657/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07008658 * patch entries
8659 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008660static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +08008661 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008662 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +08008663 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008664 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
8665 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008666 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008667 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +08008668 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008669 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
8670 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +08008671 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008672 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
8673 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
8674 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
8675 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
8676 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
8677 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
8678 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008679 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008680 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
8681 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
8682 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
8683 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
8684 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
8685 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +08008686 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008687 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
8688 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +08008689 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008690 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
8691 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
8692 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008693 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +08008694 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008695 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +08008696 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +08008697 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008698 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
8699 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
8700 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
8701 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
8702 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
8703 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
8704 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
8705 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
8706 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
8707 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
8708 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
8709 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
8710 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
8711 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +08008712 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
8713 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
8714 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008715 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008716 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
8717 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
8718 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
8719 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
8720 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
8721 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
8722 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
8723 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
8724 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
8725 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
8726 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
8727 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
8728 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +08008729 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +08008730 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -07008731 {} /* terminator */
8732};
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008733MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +01008734
8735MODULE_LICENSE("GPL");
8736MODULE_DESCRIPTION("Realtek HD-audio codec");
8737
Takashi Iwaid8a766a2015-02-17 15:25:37 +01008738static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008739 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +01008740};
8741
Takashi Iwaid8a766a2015-02-17 15:25:37 +01008742module_hda_codec_driver(realtek_driver);