blob: f2523fab5fed6a1f75bd29a255e928c67b80641d [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 Iwai1d045db2011-07-07 18:23:21 +0200518
519/*
520 * Realtek SSID verification
521 */
522
David Henningsson90622912010-10-14 14:50:18 +0200523/* Could be any non-zero and even value. When used as fixup, tells
524 * the driver to ignore any present sku defines.
525 */
526#define ALC_FIXUP_SKU_IGNORE (2)
527
Takashi Iwai23d30f22012-05-07 17:17:32 +0200528static void alc_fixup_sku_ignore(struct hda_codec *codec,
529 const struct hda_fixup *fix, int action)
530{
531 struct alc_spec *spec = codec->spec;
532 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
533 spec->cdefine.fixup = 1;
534 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
535 }
536}
537
Mengdong Linb5c66112013-11-29 00:35:35 -0500538static void alc_fixup_no_depop_delay(struct hda_codec *codec,
539 const struct hda_fixup *fix, int action)
540{
541 struct alc_spec *spec = codec->spec;
542
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500543 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500544 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500545 codec->depop_delay = 0;
546 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500547}
548
Kailang Yangda00c242010-03-19 11:23:45 +0100549static int alc_auto_parse_customize_define(struct hda_codec *codec)
550{
551 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100552 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100553 struct alc_spec *spec = codec->spec;
554
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200555 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
556
David Henningsson90622912010-10-14 14:50:18 +0200557 if (spec->cdefine.fixup) {
558 ass = spec->cdefine.sku_cfg;
559 if (ass == ALC_FIXUP_SKU_IGNORE)
560 return -1;
561 goto do_sku;
562 }
563
Takashi Iwai5100cd02014-02-15 10:03:19 +0100564 if (!codec->bus->pci)
565 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100566 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200567 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100568 goto do_sku;
569
570 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100571 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100572 nid = 0x17;
573 ass = snd_hda_codec_get_pincfg(codec, nid);
574
575 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100576 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100577 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100578 return -1;
579 }
580
581 /* check sum */
582 tmp = 0;
583 for (i = 1; i < 16; i++) {
584 if ((ass >> i) & 1)
585 tmp++;
586 }
587 if (((ass >> 16) & 0xf) != tmp)
588 return -1;
589
590 spec->cdefine.port_connectivity = ass >> 30;
591 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
592 spec->cdefine.check_sum = (ass >> 16) & 0xf;
593 spec->cdefine.customization = ass >> 8;
594do_sku:
595 spec->cdefine.sku_cfg = ass;
596 spec->cdefine.external_amp = (ass & 0x38) >> 3;
597 spec->cdefine.platform_type = (ass & 0x4) >> 2;
598 spec->cdefine.swap = (ass & 0x2) >> 1;
599 spec->cdefine.override = ass & 0x1;
600
Takashi Iwai4e76a882014-02-25 12:21:03 +0100601 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100602 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100603 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100604 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100605 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
606 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
607 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
608 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
609 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
610 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
611 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100612
613 return 0;
614}
615
Takashi Iwai08c189f2012-12-19 15:22:24 +0100616/* return the position of NID in the list, or -1 if not found */
617static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
618{
619 int i;
620 for (i = 0; i < nums; i++)
621 if (list[i] == nid)
622 return i;
623 return -1;
624}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200625/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200626static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
627{
Takashi Iwai21268962011-07-07 15:01:13 +0200628 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200629}
630
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200631/* check subsystem ID and set up device-specific initialization;
632 * return 1 if initialized, 0 if invalid SSID
633 */
634/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
635 * 31 ~ 16 : Manufacture ID
636 * 15 ~ 8 : SKU ID
637 * 7 ~ 0 : Assembly ID
638 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
639 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100640static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200641{
642 unsigned int ass, tmp, i;
643 unsigned nid;
644 struct alc_spec *spec = codec->spec;
645
David Henningsson90622912010-10-14 14:50:18 +0200646 if (spec->cdefine.fixup) {
647 ass = spec->cdefine.sku_cfg;
648 if (ass == ALC_FIXUP_SKU_IGNORE)
649 return 0;
650 goto do_sku;
651 }
652
Takashi Iwai7639a062015-03-03 10:07:24 +0100653 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100654 if (codec->bus->pci &&
655 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200656 goto do_sku;
657
658 /* invalid SSID, check the special NID pin defcfg instead */
659 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400660 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200661 * 29~21 : reserve
662 * 20 : PCBEEP input
663 * 19~16 : Check sum (15:1)
664 * 15~1 : Custom
665 * 0 : override
666 */
667 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100668 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200669 nid = 0x17;
670 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100671 codec_dbg(codec,
672 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200673 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100674 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200675 return 0;
676 if ((ass >> 30) != 1) /* no physical connection */
677 return 0;
678
679 /* check sum */
680 tmp = 0;
681 for (i = 1; i < 16; i++) {
682 if ((ass >> i) & 1)
683 tmp++;
684 }
685 if (((ass >> 16) & 0xf) != tmp)
686 return 0;
687do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100688 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100689 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200690 /*
691 * 0 : override
692 * 1 : Swap Jack
693 * 2 : 0 --> Desktop, 1 --> Laptop
694 * 3~5 : External Amplifier control
695 * 7~6 : Reserved
696 */
697 tmp = (ass & 0x38) >> 3; /* external Amp control */
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200698 if (spec->init_amp == ALC_INIT_UNDEFINED) {
699 switch (tmp) {
700 case 1:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200701 alc_setup_gpio(codec, 0x01);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200702 break;
703 case 3:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200704 alc_setup_gpio(codec, 0x02);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200705 break;
706 case 7:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200707 alc_setup_gpio(codec, 0x03);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200708 break;
709 case 5:
710 default:
711 spec->init_amp = ALC_INIT_DEFAULT;
712 break;
713 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200714 }
715
716 /* is laptop or Desktop and enable the function "Mute internal speaker
717 * when the external headphone out jack is plugged"
718 */
719 if (!(ass & 0x8000))
720 return 1;
721 /*
722 * 10~8 : Jack location
723 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
724 * 14~13: Resvered
725 * 15 : 1 --> enable the function "Mute internal speaker
726 * when the external headphone out jack is plugged"
727 */
Takashi Iwai08c189f2012-12-19 15:22:24 +0100728 if (!spec->gen.autocfg.hp_pins[0] &&
729 !(spec->gen.autocfg.line_out_pins[0] &&
730 spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200731 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200732 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100733 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100734 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
735 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200736 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100737 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200738 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200739 return 1;
740}
Kailang Yangea1fb292008-08-26 12:58:38 +0200741
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200742/* Check the validity of ALC subsystem-id
743 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
744static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200745{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100746 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200747 struct alc_spec *spec = codec->spec;
Takashi Iwai4e76a882014-02-25 12:21:03 +0100748 codec_dbg(codec,
749 "realtek: Enable default setup for auto mode as fallback\n");
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200750 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200751 }
Takashi Iwai21268962011-07-07 15:01:13 +0200752}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200753
Takashi Iwai41e41f12005-06-08 14:48:49 +0200754/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200755 */
756
David Henningsson9d36a7d2014-10-07 10:18:42 +0200757static void alc_fixup_inv_dmic(struct hda_codec *codec,
758 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200759{
760 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100761
David Henningsson9d36a7d2014-10-07 10:18:42 +0200762 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200763}
764
Takashi Iwai603c4012008-07-30 15:01:44 +0200765
Takashi Iwai2eab6942012-12-18 15:30:41 +0100766static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700767{
Takashi Iwaia5cb4632018-06-20 12:50:11 +0200768 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700769
Takashi Iwai08c189f2012-12-19 15:22:24 +0100770 err = snd_hda_gen_build_controls(codec);
771 if (err < 0)
772 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773
Takashi Iwai1727a772013-01-10 09:52:52 +0100774 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100775 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700776}
777
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200778
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100780 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200781 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200782
Linus Torvalds1da177e2005-04-16 15:20:36 -0700783static int alc_init(struct hda_codec *codec)
784{
785 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200786
Takashi Iwai546bb672012-03-07 08:37:19 +0100787 if (spec->init_hook)
788 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100789
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200790 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200791 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200792
Takashi Iwai08c189f2012-12-19 15:22:24 +0100793 snd_hda_gen_init(codec);
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100794
Takashi Iwai1727a772013-01-10 09:52:52 +0100795 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200796
Linus Torvalds1da177e2005-04-16 15:20:36 -0700797 return 0;
798}
799
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100800static inline void alc_shutup(struct hda_codec *codec)
801{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200802 struct alc_spec *spec = codec->spec;
803
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200804 if (!snd_hda_get_bool_hint(codec, "shutup"))
805 return; /* disabled explicitly by hints */
806
Takashi Iwai1c7161532011-04-07 10:37:16 +0200807 if (spec && spec->shutup)
808 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200809 else
810 snd_hda_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100811}
812
Takashi Iwai70a09762015-12-15 14:59:58 +0100813static void alc_reboot_notify(struct hda_codec *codec)
814{
815 struct alc_spec *spec = codec->spec;
816
817 if (spec && spec->reboot_notify)
818 spec->reboot_notify(codec);
819 else
820 alc_shutup(codec);
821}
822
823/* power down codec to D3 at reboot/shutdown; set as reboot_notify ops */
824static void alc_d3_at_reboot(struct hda_codec *codec)
825{
826 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
827 snd_hda_codec_write(codec, codec->core.afg, 0,
828 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
829 msleep(10);
830}
831
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100832#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700833
Takashi Iwai83012a72012-08-24 18:38:08 +0200834#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500835static void alc_power_eapd(struct hda_codec *codec)
836{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200837 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500838}
839
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200840static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100841{
842 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100843 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100844 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500845 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100846 return 0;
847}
848#endif
849
Takashi Iwai2a439522011-07-26 09:52:50 +0200850#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100851static int alc_resume(struct hda_codec *codec)
852{
Kailang Yang97a26572013-11-29 00:35:26 -0500853 struct alc_spec *spec = codec->spec;
854
855 if (!spec->no_depop_delay)
856 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100857 codec->patch_ops.init(codec);
Takashi Iwaieeecd9d2015-02-25 15:18:50 +0100858 regcache_sync(codec->core.regmap);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200859 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100860 return 0;
861}
Takashi Iwaie044c392008-10-27 16:56:24 +0100862#endif
863
Linus Torvalds1da177e2005-04-16 15:20:36 -0700864/*
865 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200866static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700867 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100868 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700869 .init = alc_init,
870 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200871 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200872#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100873 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100874 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100875 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200876#endif
Takashi Iwai70a09762015-12-15 14:59:58 +0100877 .reboot_notify = alc_reboot_notify,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700878};
879
David Henningsson29adc4b2012-09-25 11:31:00 +0200880
Takashi Iwaided255b2015-10-01 17:59:43 +0200881#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100882
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200883/*
Kailang Yang4b016932013-11-28 11:55:09 +0100884 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200885 */
886struct alc_codec_rename_table {
887 unsigned int vendor_id;
888 unsigned short coef_mask;
889 unsigned short coef_bits;
890 const char *name;
891};
892
Kailang Yang4b016932013-11-28 11:55:09 +0100893struct alc_codec_rename_pci_table {
894 unsigned int codec_vendor_id;
895 unsigned short pci_subvendor;
896 unsigned short pci_subdevice;
897 const char *name;
898};
899
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200900static struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800901 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200902 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
903 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
904 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
905 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
906 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
907 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
908 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200909 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800910 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200911 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
912 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
913 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
914 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
915 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
916 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
917 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
918 { } /* terminator */
919};
920
Kailang Yang4b016932013-11-28 11:55:09 +0100921static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
922 { 0x10ec0280, 0x1028, 0, "ALC3220" },
923 { 0x10ec0282, 0x1028, 0, "ALC3221" },
924 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +0800925 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +0100926 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +0800927 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +0100928 { 0x10ec0255, 0x1028, 0, "ALC3234" },
929 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800930 { 0x10ec0275, 0x1028, 0, "ALC3260" },
931 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +0800932 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +0800933 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +0800934 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +0800935 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +0800936 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +0800937 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800938 { 0x10ec0670, 0x1025, 0, "ALC669X" },
939 { 0x10ec0676, 0x1025, 0, "ALC679X" },
940 { 0x10ec0282, 0x1043, 0, "ALC3229" },
941 { 0x10ec0233, 0x1043, 0, "ALC3236" },
942 { 0x10ec0280, 0x103c, 0, "ALC3228" },
943 { 0x10ec0282, 0x103c, 0, "ALC3227" },
944 { 0x10ec0286, 0x103c, 0, "ALC3242" },
945 { 0x10ec0290, 0x103c, 0, "ALC3241" },
946 { 0x10ec0668, 0x103c, 0, "ALC3662" },
947 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
948 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +0100949 { } /* terminator */
950};
951
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200952static int alc_codec_rename_from_preset(struct hda_codec *codec)
953{
954 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +0100955 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200956
957 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +0100958 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200959 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200960 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200961 return alc_codec_rename(codec, p->name);
962 }
Kailang Yang4b016932013-11-28 11:55:09 +0100963
Takashi Iwai5100cd02014-02-15 10:03:19 +0100964 if (!codec->bus->pci)
965 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +0100966 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +0100967 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +0100968 continue;
969 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
970 continue;
971 if (!q->pci_subdevice ||
972 q->pci_subdevice == codec->bus->pci->subsystem_device)
973 return alc_codec_rename(codec, q->name);
974 }
975
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200976 return 0;
977}
978
Takashi Iwaie4770622011-07-08 11:11:35 +0200979
980/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200981 * Digital-beep handlers
982 */
983#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwaifea80fa2018-06-20 12:52:46 +0200984
985/* additional beep mixers; private_value will be overwritten */
986static const struct snd_kcontrol_new alc_beep_mixer[] = {
987 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
988 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
989};
990
991/* set up and create beep controls */
992static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
993 int idx, int dir)
994{
995 struct snd_kcontrol_new *knew;
996 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
997 int i;
998
999 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1000 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1001 &alc_beep_mixer[i]);
1002 if (!knew)
1003 return -ENOMEM;
1004 knew->private_value = beep_amp;
1005 }
1006 return 0;
1007}
Takashi Iwai1d045db2011-07-07 18:23:21 +02001008
1009static const struct snd_pci_quirk beep_white_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +02001010 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -07001011 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001012 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +01001013 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001014 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1015 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1016 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +01001017 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001018 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1019 {}
1020};
1021
1022static inline int has_cdefine_beep(struct hda_codec *codec)
1023{
1024 struct alc_spec *spec = codec->spec;
1025 const struct snd_pci_quirk *q;
1026 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
1027 if (q)
1028 return q->value;
1029 return spec->cdefine.enable_pcbeep;
1030}
1031#else
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001032#define set_beep_amp(spec, nid, idx, dir) 0
Takashi Iwai1d045db2011-07-07 18:23:21 +02001033#define has_cdefine_beep(codec) 0
1034#endif
1035
1036/* parse the BIOS configuration and set up the alc_spec */
1037/* return 1 if successful, 0 if the proper config is not found,
1038 * or a negative error code
1039 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001040static int alc_parse_auto_config(struct hda_codec *codec,
1041 const hda_nid_t *ignore_nids,
1042 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001043{
1044 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001045 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001046 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001047
Takashi Iwai53c334a2011-08-23 18:27:14 +02001048 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1049 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001050 if (err < 0)
1051 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001052
1053 if (ssid_nids)
1054 alc_ssid_check(codec, ssid_nids);
1055
Takashi Iwai08c189f2012-12-19 15:22:24 +01001056 err = snd_hda_gen_parse_auto_config(codec, cfg);
1057 if (err < 0)
1058 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001059
Takashi Iwai1d045db2011-07-07 18:23:21 +02001060 return 1;
1061}
1062
Takashi Iwai3de95172012-05-07 18:03:15 +02001063/* common preparation job for alc_spec */
1064static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1065{
1066 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1067 int err;
1068
1069 if (!spec)
1070 return -ENOMEM;
1071 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001072 snd_hda_gen_spec_init(&spec->gen);
1073 spec->gen.mixer_nid = mixer_nid;
1074 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001075 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001076 /* FIXME: do we need this for all Realtek codec models? */
1077 codec->spdif_status_reset = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001078 codec->patch_ops = alc_patch_ops;
Takashi Iwai3de95172012-05-07 18:03:15 +02001079
1080 err = alc_codec_rename_from_preset(codec);
1081 if (err < 0) {
1082 kfree(spec);
1083 return err;
1084 }
1085 return 0;
1086}
1087
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001088static int alc880_parse_auto_config(struct hda_codec *codec)
1089{
1090 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001091 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001092 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1093}
1094
Takashi Iwai1d045db2011-07-07 18:23:21 +02001095/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001096 * ALC880 fix-ups
1097 */
1098enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001099 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001100 ALC880_FIXUP_GPIO2,
1101 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001102 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001103 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001104 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001105 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001106 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001107 ALC880_FIXUP_VOL_KNOB,
1108 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001109 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001110 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001111 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001112 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001113 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001114 ALC880_FIXUP_3ST_BASE,
1115 ALC880_FIXUP_3ST,
1116 ALC880_FIXUP_3ST_DIG,
1117 ALC880_FIXUP_5ST_BASE,
1118 ALC880_FIXUP_5ST,
1119 ALC880_FIXUP_5ST_DIG,
1120 ALC880_FIXUP_6ST_BASE,
1121 ALC880_FIXUP_6ST,
1122 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001123 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001124};
1125
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001126/* enable the volume-knob widget support on NID 0x21 */
1127static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001128 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001129{
Takashi Iwai1727a772013-01-10 09:52:52 +01001130 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001131 snd_hda_jack_detect_enable_callback(codec, 0x21,
1132 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001133}
1134
Takashi Iwai1727a772013-01-10 09:52:52 +01001135static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001136 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001137 .type = HDA_FIXUP_FUNC,
1138 .v.func = alc_fixup_gpio1,
Takashi Iwai411225a2012-02-20 17:48:19 +01001139 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001140 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001141 .type = HDA_FIXUP_FUNC,
1142 .v.func = alc_fixup_gpio2,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001143 },
1144 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001145 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001146 .v.verbs = (const struct hda_verb[]) {
1147 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1148 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1149 { }
1150 },
1151 .chained = true,
1152 .chain_id = ALC880_FIXUP_GPIO2,
1153 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001154 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001155 .type = HDA_FIXUP_PINS,
1156 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001157 /* disable bogus unused pins */
1158 { 0x16, 0x411111f0 },
1159 { 0x18, 0x411111f0 },
1160 { 0x1a, 0x411111f0 },
1161 { }
1162 }
1163 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001164 [ALC880_FIXUP_LG_LW25] = {
1165 .type = HDA_FIXUP_PINS,
1166 .v.pins = (const struct hda_pintbl[]) {
1167 { 0x1a, 0x0181344f }, /* line-in */
1168 { 0x1b, 0x0321403f }, /* headphone */
1169 { }
1170 }
1171 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001172 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001173 .type = HDA_FIXUP_PINS,
1174 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001175 /* disable bogus unused pins */
1176 { 0x17, 0x411111f0 },
1177 { }
1178 },
1179 .chained = true,
1180 .chain_id = ALC880_FIXUP_GPIO2,
1181 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001182 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001183 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001184 .v.verbs = (const struct hda_verb[]) {
1185 /* change to EAPD mode */
1186 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1187 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1188 {}
1189 },
1190 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001191 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001192 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001193 .v.verbs = (const struct hda_verb[]) {
1194 /* change to EAPD mode */
1195 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1196 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1197 {}
1198 },
1199 .chained = true,
1200 .chain_id = ALC880_FIXUP_GPIO2,
1201 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001202 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001203 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001204 .v.func = alc880_fixup_vol_knob,
1205 },
1206 [ALC880_FIXUP_FUJITSU] = {
1207 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001208 .type = HDA_FIXUP_PINS,
1209 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001210 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001211 { 0x15, 0x99030120 }, /* speaker */
1212 { 0x16, 0x99030130 }, /* bass speaker */
1213 { 0x17, 0x411111f0 }, /* N/A */
1214 { 0x18, 0x411111f0 }, /* N/A */
1215 { 0x19, 0x01a19950 }, /* mic-in */
1216 { 0x1a, 0x411111f0 }, /* N/A */
1217 { 0x1b, 0x411111f0 }, /* N/A */
1218 { 0x1c, 0x411111f0 }, /* N/A */
1219 { 0x1d, 0x411111f0 }, /* N/A */
1220 { 0x1e, 0x01454140 }, /* SPDIF out */
1221 { }
1222 },
1223 .chained = true,
1224 .chain_id = ALC880_FIXUP_VOL_KNOB,
1225 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001226 [ALC880_FIXUP_F1734] = {
1227 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001228 .type = HDA_FIXUP_PINS,
1229 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001230 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001231 { 0x15, 0x99030120 }, /* speaker */
1232 { 0x16, 0x411111f0 }, /* N/A */
1233 { 0x17, 0x411111f0 }, /* N/A */
1234 { 0x18, 0x411111f0 }, /* N/A */
1235 { 0x19, 0x01a19950 }, /* mic-in */
1236 { 0x1a, 0x411111f0 }, /* N/A */
1237 { 0x1b, 0x411111f0 }, /* N/A */
1238 { 0x1c, 0x411111f0 }, /* N/A */
1239 { 0x1d, 0x411111f0 }, /* N/A */
1240 { 0x1e, 0x411111f0 }, /* N/A */
1241 { }
1242 },
1243 .chained = true,
1244 .chain_id = ALC880_FIXUP_VOL_KNOB,
1245 },
Takashi Iwai817de922012-02-20 17:20:48 +01001246 [ALC880_FIXUP_UNIWILL] = {
1247 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001248 .type = HDA_FIXUP_PINS,
1249 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001250 { 0x14, 0x0121411f }, /* HP */
1251 { 0x15, 0x99030120 }, /* speaker */
1252 { 0x16, 0x99030130 }, /* bass speaker */
1253 { }
1254 },
1255 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001256 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001257 .type = HDA_FIXUP_PINS,
1258 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001259 /* disable bogus unused pins */
1260 { 0x17, 0x411111f0 },
1261 { 0x19, 0x411111f0 },
1262 { 0x1b, 0x411111f0 },
1263 { 0x1f, 0x411111f0 },
1264 { }
1265 }
1266 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001267 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001268 .type = HDA_FIXUP_PINS,
1269 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001270 /* set up the whole pins as BIOS is utterly broken */
1271 { 0x14, 0x99030120 }, /* speaker */
1272 { 0x15, 0x0121411f }, /* HP */
1273 { 0x16, 0x411111f0 }, /* N/A */
1274 { 0x17, 0x411111f0 }, /* N/A */
1275 { 0x18, 0x01a19950 }, /* mic-in */
1276 { 0x19, 0x411111f0 }, /* N/A */
1277 { 0x1a, 0x01813031 }, /* line-in */
1278 { 0x1b, 0x411111f0 }, /* N/A */
1279 { 0x1c, 0x411111f0 }, /* N/A */
1280 { 0x1d, 0x411111f0 }, /* N/A */
1281 { 0x1e, 0x0144111e }, /* SPDIF */
1282 { }
1283 }
1284 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001285 [ALC880_FIXUP_ASUS_W5A] = {
1286 .type = HDA_FIXUP_PINS,
1287 .v.pins = (const struct hda_pintbl[]) {
1288 /* set up the whole pins as BIOS is utterly broken */
1289 { 0x14, 0x0121411f }, /* HP */
1290 { 0x15, 0x411111f0 }, /* N/A */
1291 { 0x16, 0x411111f0 }, /* N/A */
1292 { 0x17, 0x411111f0 }, /* N/A */
1293 { 0x18, 0x90a60160 }, /* mic */
1294 { 0x19, 0x411111f0 }, /* N/A */
1295 { 0x1a, 0x411111f0 }, /* N/A */
1296 { 0x1b, 0x411111f0 }, /* N/A */
1297 { 0x1c, 0x411111f0 }, /* N/A */
1298 { 0x1d, 0x411111f0 }, /* N/A */
1299 { 0x1e, 0xb743111e }, /* SPDIF out */
1300 { }
1301 },
1302 .chained = true,
1303 .chain_id = ALC880_FIXUP_GPIO1,
1304 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001305 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001306 .type = HDA_FIXUP_PINS,
1307 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001308 { 0x14, 0x01014010 }, /* line-out */
1309 { 0x15, 0x411111f0 }, /* N/A */
1310 { 0x16, 0x411111f0 }, /* N/A */
1311 { 0x17, 0x411111f0 }, /* N/A */
1312 { 0x18, 0x01a19c30 }, /* mic-in */
1313 { 0x19, 0x0121411f }, /* HP */
1314 { 0x1a, 0x01813031 }, /* line-in */
1315 { 0x1b, 0x02a19c40 }, /* front-mic */
1316 { 0x1c, 0x411111f0 }, /* N/A */
1317 { 0x1d, 0x411111f0 }, /* N/A */
1318 /* 0x1e is filled in below */
1319 { 0x1f, 0x411111f0 }, /* N/A */
1320 { }
1321 }
1322 },
1323 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001324 .type = HDA_FIXUP_PINS,
1325 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001326 { 0x1e, 0x411111f0 }, /* N/A */
1327 { }
1328 },
1329 .chained = true,
1330 .chain_id = ALC880_FIXUP_3ST_BASE,
1331 },
1332 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001333 .type = HDA_FIXUP_PINS,
1334 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001335 { 0x1e, 0x0144111e }, /* SPDIF */
1336 { }
1337 },
1338 .chained = true,
1339 .chain_id = ALC880_FIXUP_3ST_BASE,
1340 },
1341 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001342 .type = HDA_FIXUP_PINS,
1343 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001344 { 0x14, 0x01014010 }, /* front */
1345 { 0x15, 0x411111f0 }, /* N/A */
1346 { 0x16, 0x01011411 }, /* CLFE */
1347 { 0x17, 0x01016412 }, /* surr */
1348 { 0x18, 0x01a19c30 }, /* mic-in */
1349 { 0x19, 0x0121411f }, /* HP */
1350 { 0x1a, 0x01813031 }, /* line-in */
1351 { 0x1b, 0x02a19c40 }, /* front-mic */
1352 { 0x1c, 0x411111f0 }, /* N/A */
1353 { 0x1d, 0x411111f0 }, /* N/A */
1354 /* 0x1e is filled in below */
1355 { 0x1f, 0x411111f0 }, /* N/A */
1356 { }
1357 }
1358 },
1359 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001360 .type = HDA_FIXUP_PINS,
1361 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001362 { 0x1e, 0x411111f0 }, /* N/A */
1363 { }
1364 },
1365 .chained = true,
1366 .chain_id = ALC880_FIXUP_5ST_BASE,
1367 },
1368 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001369 .type = HDA_FIXUP_PINS,
1370 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001371 { 0x1e, 0x0144111e }, /* SPDIF */
1372 { }
1373 },
1374 .chained = true,
1375 .chain_id = ALC880_FIXUP_5ST_BASE,
1376 },
1377 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001378 .type = HDA_FIXUP_PINS,
1379 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001380 { 0x14, 0x01014010 }, /* front */
1381 { 0x15, 0x01016412 }, /* surr */
1382 { 0x16, 0x01011411 }, /* CLFE */
1383 { 0x17, 0x01012414 }, /* side */
1384 { 0x18, 0x01a19c30 }, /* mic-in */
1385 { 0x19, 0x02a19c40 }, /* front-mic */
1386 { 0x1a, 0x01813031 }, /* line-in */
1387 { 0x1b, 0x0121411f }, /* HP */
1388 { 0x1c, 0x411111f0 }, /* N/A */
1389 { 0x1d, 0x411111f0 }, /* N/A */
1390 /* 0x1e is filled in below */
1391 { 0x1f, 0x411111f0 }, /* N/A */
1392 { }
1393 }
1394 },
1395 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001396 .type = HDA_FIXUP_PINS,
1397 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001398 { 0x1e, 0x411111f0 }, /* N/A */
1399 { }
1400 },
1401 .chained = true,
1402 .chain_id = ALC880_FIXUP_6ST_BASE,
1403 },
1404 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001405 .type = HDA_FIXUP_PINS,
1406 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001407 { 0x1e, 0x0144111e }, /* SPDIF */
1408 { }
1409 },
1410 .chained = true,
1411 .chain_id = ALC880_FIXUP_6ST_BASE,
1412 },
Takashi Iwai53971452013-01-23 18:21:37 +01001413 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1414 .type = HDA_FIXUP_PINS,
1415 .v.pins = (const struct hda_pintbl[]) {
1416 { 0x1b, 0x0121401f }, /* HP with jack detect */
1417 { }
1418 },
1419 .chained_before = true,
1420 .chain_id = ALC880_FIXUP_6ST_BASE,
1421 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001422};
1423
1424static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001425 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001426 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001427 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001428 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001429 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001430 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001431 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001432 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001433 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001434 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001435 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001436 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001437 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001438 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001439 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001440 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001441 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001442 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001443 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1444 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1445 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001446 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001447 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001448
1449 /* Below is the copied entries from alc880_quirks.c.
1450 * It's not quite sure whether BIOS sets the correct pin-config table
1451 * on these machines, thus they are kept to be compatible with
1452 * the old static quirks. Once when it's confirmed to work without
1453 * these overrides, it'd be better to remove.
1454 */
1455 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1456 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1457 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1458 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1459 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1460 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1461 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1462 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1463 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1464 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1465 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1466 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1467 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1468 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1469 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1470 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1471 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1472 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1473 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1474 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1475 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1476 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1477 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1478 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1479 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1480 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1481 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1482 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1483 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1484 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1485 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1486 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1487 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1488 /* default Intel */
1489 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1490 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1491 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1492 {}
1493};
1494
Takashi Iwai1727a772013-01-10 09:52:52 +01001495static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001496 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1497 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1498 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1499 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1500 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1501 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001502 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001503 {}
1504};
1505
1506
1507/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001508 * OK, here we have finally the patch for ALC880
1509 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001510static int patch_alc880(struct hda_codec *codec)
1511{
1512 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001513 int err;
1514
Takashi Iwai3de95172012-05-07 18:03:15 +02001515 err = alc_alloc_spec(codec, 0x0b);
1516 if (err < 0)
1517 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001518
Takashi Iwai3de95172012-05-07 18:03:15 +02001519 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001520 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001521 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001522
Takashi Iwai225068a2015-05-29 10:42:14 +02001523 codec->patch_ops.unsol_event = alc880_unsol_event;
1524
Takashi Iwai1727a772013-01-10 09:52:52 +01001525 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001526 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001527 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001528
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001529 /* automatic parse from the BIOS config */
1530 err = alc880_parse_auto_config(codec);
1531 if (err < 0)
1532 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001533
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001534 if (!spec->gen.no_analog) {
1535 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1536 if (err < 0)
1537 goto error;
1538 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001539
Takashi Iwai1727a772013-01-10 09:52:52 +01001540 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001541
Takashi Iwai1d045db2011-07-07 18:23:21 +02001542 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001543
1544 error:
1545 alc_free(codec);
1546 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001547}
1548
1549
1550/*
1551 * ALC260 support
1552 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001553static int alc260_parse_auto_config(struct hda_codec *codec)
1554{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001555 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001556 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1557 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001558}
1559
Takashi Iwai1d045db2011-07-07 18:23:21 +02001560/*
1561 * Pin config fixes
1562 */
1563enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001564 ALC260_FIXUP_HP_DC5750,
1565 ALC260_FIXUP_HP_PIN_0F,
1566 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001567 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001568 ALC260_FIXUP_GPIO1_TOGGLE,
1569 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001570 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001571 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001572 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001573 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001574 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001575};
1576
Takashi Iwai20f7d922012-02-16 12:35:16 +01001577static void alc260_gpio1_automute(struct hda_codec *codec)
1578{
1579 struct alc_spec *spec = codec->spec;
Takashi Iwaiaaf312d2018-06-19 22:28:22 +02001580
1581 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001582}
1583
1584static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001585 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001586{
1587 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001588 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001589 /* although the machine has only one output pin, we need to
1590 * toggle GPIO1 according to the jack state
1591 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001592 spec->gen.automute_hook = alc260_gpio1_automute;
1593 spec->gen.detect_hp = 1;
1594 spec->gen.automute_speaker = 1;
1595 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001596 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001597 snd_hda_gen_hp_automute);
Takashi Iwai5579cd62018-06-19 22:22:41 +02001598 alc_setup_gpio(codec, 0x01);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001599 }
1600}
1601
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001602static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001603 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001604{
1605 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001606 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001607 { 0x0f, 0x02214000 }, /* HP/speaker */
1608 { 0x12, 0x90a60160 }, /* int mic */
1609 { 0x13, 0x02a19000 }, /* ext mic */
1610 { 0x18, 0x01446000 }, /* SPDIF out */
1611 /* disable bogus I/O pins */
1612 { 0x10, 0x411111f0 },
1613 { 0x11, 0x411111f0 },
1614 { 0x14, 0x411111f0 },
1615 { 0x15, 0x411111f0 },
1616 { 0x16, 0x411111f0 },
1617 { 0x17, 0x411111f0 },
1618 { 0x19, 0x411111f0 },
1619 { }
1620 };
1621
1622 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001623 case HDA_FIXUP_ACT_PRE_PROBE:
1624 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001625 spec->init_amp = ALC_INIT_NONE;
1626 break;
1627 }
1628}
1629
Takashi Iwai39aedee2013-01-10 17:10:40 +01001630static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1631 const struct hda_fixup *fix, int action)
1632{
1633 struct alc_spec *spec = codec->spec;
Takashi Iwai1c76aa52018-06-21 16:37:54 +02001634 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001635 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001636}
1637
1638static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1639 const struct hda_fixup *fix, int action)
1640{
1641 struct alc_spec *spec = codec->spec;
1642 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001643 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001644 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001645 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001646}
1647
Takashi Iwai1727a772013-01-10 09:52:52 +01001648static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001649 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001650 .type = HDA_FIXUP_PINS,
1651 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001652 { 0x11, 0x90130110 }, /* speaker */
1653 { }
1654 }
1655 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001656 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001657 .type = HDA_FIXUP_PINS,
1658 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001659 { 0x0f, 0x01214000 }, /* HP */
1660 { }
1661 }
1662 },
1663 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001664 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001665 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001666 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1667 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001668 { }
1669 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001670 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001671 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001672 .type = HDA_FIXUP_FUNC,
1673 .v.func = alc_fixup_gpio1,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001674 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001675 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001676 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001677 .v.func = alc260_fixup_gpio1_toggle,
1678 .chained = true,
1679 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1680 },
1681 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001682 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001683 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001684 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1685 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001686 { }
1687 },
1688 .chained = true,
1689 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1690 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001691 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001692 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001693 .v.func = alc260_fixup_gpio1_toggle,
1694 .chained = true,
1695 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001696 },
1697 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001698 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001699 .v.func = alc260_fixup_kn1,
1700 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001701 [ALC260_FIXUP_FSC_S7020] = {
1702 .type = HDA_FIXUP_FUNC,
1703 .v.func = alc260_fixup_fsc_s7020,
1704 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001705 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1706 .type = HDA_FIXUP_FUNC,
1707 .v.func = alc260_fixup_fsc_s7020_jwse,
1708 .chained = true,
1709 .chain_id = ALC260_FIXUP_FSC_S7020,
1710 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001711 [ALC260_FIXUP_VAIO_PINS] = {
1712 .type = HDA_FIXUP_PINS,
1713 .v.pins = (const struct hda_pintbl[]) {
1714 /* Pin configs are missing completely on some VAIOs */
1715 { 0x0f, 0x01211020 },
1716 { 0x10, 0x0001003f },
1717 { 0x11, 0x411111f0 },
1718 { 0x12, 0x01a15930 },
1719 { 0x13, 0x411111f0 },
1720 { 0x14, 0x411111f0 },
1721 { 0x15, 0x411111f0 },
1722 { 0x16, 0x411111f0 },
1723 { 0x17, 0x411111f0 },
1724 { 0x18, 0x411111f0 },
1725 { 0x19, 0x411111f0 },
1726 { }
1727 }
1728 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001729};
1730
1731static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001732 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001733 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001734 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001735 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001736 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001737 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001738 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001739 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001740 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001741 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001742 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001743 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001744 {}
1745};
1746
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001747static const struct hda_model_fixup alc260_fixup_models[] = {
1748 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1749 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1750 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1751 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1752 {}
1753};
1754
Takashi Iwai1d045db2011-07-07 18:23:21 +02001755/*
1756 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001757static int patch_alc260(struct hda_codec *codec)
1758{
1759 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001760 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001761
Takashi Iwai3de95172012-05-07 18:03:15 +02001762 err = alc_alloc_spec(codec, 0x07);
1763 if (err < 0)
1764 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001765
Takashi Iwai3de95172012-05-07 18:03:15 +02001766 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001767 /* as quite a few machines require HP amp for speaker outputs,
1768 * it's easier to enable it unconditionally; even if it's unneeded,
1769 * it's almost harmless.
1770 */
1771 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001772 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001773
Takashi Iwai225068a2015-05-29 10:42:14 +02001774 spec->shutup = alc_eapd_shutup;
1775
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001776 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1777 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001778 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001779
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001780 /* automatic parse from the BIOS config */
1781 err = alc260_parse_auto_config(codec);
1782 if (err < 0)
1783 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001784
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001785 if (!spec->gen.no_analog) {
1786 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1787 if (err < 0)
1788 goto error;
1789 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001790
Takashi Iwai1727a772013-01-10 09:52:52 +01001791 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001792
Takashi Iwai1d045db2011-07-07 18:23:21 +02001793 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001794
1795 error:
1796 alc_free(codec);
1797 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001798}
1799
1800
1801/*
1802 * ALC882/883/885/888/889 support
1803 *
1804 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1805 * configuration. Each pin widget can choose any input DACs and a mixer.
1806 * Each ADC is connected from a mixer of all inputs. This makes possible
1807 * 6-channel independent captures.
1808 *
1809 * In addition, an independent DAC for the multi-playback (not used in this
1810 * driver yet).
1811 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001812
1813/*
1814 * Pin config fixes
1815 */
1816enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001817 ALC882_FIXUP_ABIT_AW9D_MAX,
1818 ALC882_FIXUP_LENOVO_Y530,
1819 ALC882_FIXUP_PB_M5210,
1820 ALC882_FIXUP_ACER_ASPIRE_7736,
1821 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001822 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001823 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001824 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001825 ALC888_FIXUP_EEE1601,
Takashi Iwai177943a2011-11-09 12:55:18 +01001826 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001827 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001828 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001829 ALC882_FIXUP_GPIO1,
1830 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001831 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001832 ALC889_FIXUP_COEF,
1833 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001834 ALC882_FIXUP_ACER_ASPIRE_4930G,
1835 ALC882_FIXUP_ACER_ASPIRE_8930G,
1836 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001837 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001838 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001839 ALC889_FIXUP_MBP_VREF,
1840 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001841 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001842 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001843 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001844 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001845 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001846 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001847 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001848 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001849 ALC1220_FIXUP_GB_DUAL_CODECS,
Peisen0202f5c2017-10-26 10:35:36 +08001850 ALC1220_FIXUP_CLEVO_P950,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001851};
1852
Takashi Iwai68ef0562011-11-09 18:24:44 +01001853static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001854 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001855{
Takashi Iwai1727a772013-01-10 09:52:52 +01001856 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001857 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001858 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001859}
1860
Takashi Iwai56710872011-11-14 17:42:11 +01001861/* set up GPIO at initialization */
1862static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001863 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001864{
Takashi Iwai215c8502018-06-19 22:34:26 +02001865 struct alc_spec *spec = codec->spec;
1866
1867 spec->gpio_write_delay = true;
1868 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001869}
1870
Takashi Iwai02a237b2012-02-13 15:25:07 +01001871/* Fix the connection of some pins for ALC889:
1872 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1873 * work correctly (bko#42740)
1874 */
1875static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001876 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001877{
Takashi Iwai1727a772013-01-10 09:52:52 +01001878 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001879 /* fake the connections during parsing the tree */
Takashi Iwai02a237b2012-02-13 15:25:07 +01001880 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1881 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1882 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1883 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1884 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1885 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001886 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001887 /* restore the connections */
1888 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1889 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1890 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1891 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1892 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001893 }
1894}
1895
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001896/* Set VREF on HP pin */
1897static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001898 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001899{
1900 struct alc_spec *spec = codec->spec;
Mario Kleiner9f660a12015-12-22 00:45:43 +01001901 static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001902 int i;
1903
Takashi Iwai1727a772013-01-10 09:52:52 +01001904 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001905 return;
1906 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1907 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1908 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1909 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001910 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001911 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001912 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01001913 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001914 break;
1915 }
1916}
1917
Takashi Iwai0756f092013-12-04 13:59:45 +01001918static void alc889_fixup_mac_pins(struct hda_codec *codec,
1919 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001920{
1921 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001922 int i;
1923
Takashi Iwai0756f092013-12-04 13:59:45 +01001924 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001925 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001926 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001927 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001928 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001929 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01001930 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001931}
1932
Takashi Iwai0756f092013-12-04 13:59:45 +01001933/* Set VREF on speaker pins on imac91 */
1934static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1935 const struct hda_fixup *fix, int action)
1936{
1937 static hda_nid_t nids[2] = { 0x18, 0x1a };
1938
1939 if (action == HDA_FIXUP_ACT_INIT)
1940 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1941}
1942
Adrien Vergée7729a42014-01-24 14:56:14 -05001943/* Set VREF on speaker pins on mba11 */
1944static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1945 const struct hda_fixup *fix, int action)
1946{
1947 static hda_nid_t nids[1] = { 0x18 };
1948
1949 if (action == HDA_FIXUP_ACT_INIT)
1950 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1951}
1952
Takashi Iwai0756f092013-12-04 13:59:45 +01001953/* Set VREF on speaker pins on mba21 */
1954static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1955 const struct hda_fixup *fix, int action)
1956{
1957 static hda_nid_t nids[2] = { 0x18, 0x19 };
1958
1959 if (action == HDA_FIXUP_ACT_INIT)
1960 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1961}
1962
Takashi Iwaie427c232012-07-29 10:04:08 +02001963/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09001964 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1965 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02001966 */
1967static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001968 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02001969{
1970 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02001971 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01001972 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02001973 spec->gen.no_multi_io = 1;
1974 }
Takashi Iwaie427c232012-07-29 10:04:08 +02001975}
1976
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001977static void alc_fixup_bass_chmap(struct hda_codec *codec,
1978 const struct hda_fixup *fix, int action);
1979
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001980/* For dual-codec configuration, we need to disable some features to avoid
1981 * conflicts of kctls and PCM streams
1982 */
1983static void alc_fixup_dual_codecs(struct hda_codec *codec,
1984 const struct hda_fixup *fix, int action)
1985{
1986 struct alc_spec *spec = codec->spec;
1987
1988 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1989 return;
1990 /* disable vmaster */
1991 spec->gen.suppress_vmaster = 1;
1992 /* auto-mute and auto-mic switch don't work with multiple codecs */
1993 spec->gen.suppress_auto_mute = 1;
1994 spec->gen.suppress_auto_mic = 1;
1995 /* disable aamix as well */
1996 spec->gen.mixer_nid = 0;
1997 /* add location prefix to avoid conflicts */
1998 codec->force_pin_prefix = 1;
1999}
2000
2001static void rename_ctl(struct hda_codec *codec, const char *oldname,
2002 const char *newname)
2003{
2004 struct snd_kcontrol *kctl;
2005
2006 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2007 if (kctl)
2008 strcpy(kctl->id.name, newname);
2009}
2010
2011static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2012 const struct hda_fixup *fix,
2013 int action)
2014{
2015 alc_fixup_dual_codecs(codec, fix, action);
2016 switch (action) {
2017 case HDA_FIXUP_ACT_PRE_PROBE:
2018 /* override card longname to provide a unique UCM profile */
2019 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2020 break;
2021 case HDA_FIXUP_ACT_BUILD:
2022 /* rename Capture controls depending on the codec */
2023 rename_ctl(codec, "Capture Volume",
2024 codec->addr == 0 ?
2025 "Rear-Panel Capture Volume" :
2026 "Front-Panel Capture Volume");
2027 rename_ctl(codec, "Capture Switch",
2028 codec->addr == 0 ?
2029 "Rear-Panel Capture Switch" :
2030 "Front-Panel Capture Switch");
2031 break;
2032 }
2033}
2034
Peisen0202f5c2017-10-26 10:35:36 +08002035static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2036 const struct hda_fixup *fix,
2037 int action)
2038{
2039 hda_nid_t conn1[1] = { 0x0c };
2040
2041 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2042 return;
2043
2044 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2045 /* We therefore want to make sure 0x14 (front headphone) and
2046 * 0x1b (speakers) use the stereo DAC 0x02
2047 */
2048 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
2049 snd_hda_override_conn_list(codec, 0x1b, 1, conn1);
2050}
2051
Takashi Iwai1727a772013-01-10 09:52:52 +01002052static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002053 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002054 .type = HDA_FIXUP_PINS,
2055 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002056 { 0x15, 0x01080104 }, /* side */
2057 { 0x16, 0x01011012 }, /* rear */
2058 { 0x17, 0x01016011 }, /* clfe */
2059 { }
2060 }
2061 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002062 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002063 .type = HDA_FIXUP_PINS,
2064 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002065 { 0x15, 0x99130112 }, /* rear int speakers */
2066 { 0x16, 0x99130111 }, /* subwoofer */
2067 { }
2068 }
2069 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002070 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002071 .type = HDA_FIXUP_PINCTLS,
2072 .v.pins = (const struct hda_pintbl[]) {
2073 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002074 {}
2075 }
2076 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002077 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002078 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002079 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002080 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002081 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002082 .type = HDA_FIXUP_PINS,
2083 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002084 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2085 { }
2086 }
2087 },
Marton Balint8f239212012-03-05 21:33:23 +01002088 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002089 .type = HDA_FIXUP_PINS,
2090 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002091 { 0x1c, 0x993301f0 }, /* CD */
2092 { }
2093 }
2094 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002095 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2096 .type = HDA_FIXUP_PINS,
2097 .v.pins = (const struct hda_pintbl[]) {
2098 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2099 { }
2100 },
2101 .chained = true,
2102 .chain_id = ALC889_FIXUP_CD,
2103 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002104 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002105 .type = HDA_FIXUP_PINS,
2106 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002107 { 0x17, 0x90170111 }, /* hidden surround speaker */
2108 { }
2109 }
2110 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002111 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002112 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002113 .v.verbs = (const struct hda_verb[]) {
2114 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2115 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2116 { }
2117 }
Takashi Iwai177943a2011-11-09 12:55:18 +01002118 },
2119 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002120 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a2011-11-09 12:55:18 +01002121 .v.verbs = (const struct hda_verb[]) {
2122 /* change to EAPD mode */
2123 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2124 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2125 { }
2126 }
2127 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002128 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002129 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002130 .v.verbs = (const struct hda_verb[]) {
2131 /* change to EAPD mode */
2132 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2133 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2134 { }
2135 }
2136 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002137 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002138 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002139 .v.verbs = (const struct hda_verb[]) {
2140 /* eanable EAPD on Acer laptops */
2141 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2142 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2143 { }
2144 }
2145 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002146 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002147 .type = HDA_FIXUP_FUNC,
2148 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002149 },
2150 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002151 .type = HDA_FIXUP_FUNC,
2152 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002153 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002154 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002155 .type = HDA_FIXUP_FUNC,
2156 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002157 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002158 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002159 .type = HDA_FIXUP_FUNC,
2160 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002161 .chained = true,
2162 .chain_id = ALC882_FIXUP_EAPD,
2163 },
2164 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002165 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002166 .v.func = alc889_fixup_coef,
2167 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002168 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002169 .type = HDA_FIXUP_PINS,
2170 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002171 { 0x16, 0x99130111 }, /* CLFE speaker */
2172 { 0x17, 0x99130112 }, /* surround speaker */
2173 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002174 },
2175 .chained = true,
2176 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002177 },
2178 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002179 .type = HDA_FIXUP_PINS,
2180 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002181 { 0x16, 0x99130111 }, /* CLFE speaker */
2182 { 0x1b, 0x99130112 }, /* surround speaker */
2183 { }
2184 },
2185 .chained = true,
2186 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2187 },
2188 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2189 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002190 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002191 .v.verbs = (const struct hda_verb[]) {
2192 /* Enable all DACs */
2193 /* DAC DISABLE/MUTE 1? */
2194 /* setting bits 1-5 disables DAC nids 0x02-0x06
2195 * apparently. Init=0x38 */
2196 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2197 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2198 /* DAC DISABLE/MUTE 2? */
2199 /* some bit here disables the other DACs.
2200 * Init=0x4900 */
2201 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2202 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2203 /* DMIC fix
2204 * This laptop has a stereo digital microphone.
2205 * The mics are only 1cm apart which makes the stereo
2206 * useless. However, either the mic or the ALC889
2207 * makes the signal become a difference/sum signal
2208 * instead of standard stereo, which is annoying.
2209 * So instead we flip this bit which makes the
2210 * codec replicate the sum signal to both channels,
2211 * turning it into a normal mono mic.
2212 */
2213 /* DMIC_CONTROL? Init value = 0x0001 */
2214 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2215 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2216 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2217 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2218 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002219 },
2220 .chained = true,
2221 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002222 },
Takashi Iwai56710872011-11-14 17:42:11 +01002223 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002224 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002225 .v.func = alc885_fixup_macpro_gpio,
2226 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002227 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002228 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002229 .v.func = alc889_fixup_dac_route,
2230 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002231 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002232 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002233 .v.func = alc889_fixup_mbp_vref,
2234 .chained = true,
2235 .chain_id = ALC882_FIXUP_GPIO1,
2236 },
2237 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002238 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002239 .v.func = alc889_fixup_imac91_vref,
2240 .chained = true,
2241 .chain_id = ALC882_FIXUP_GPIO1,
2242 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002243 [ALC889_FIXUP_MBA11_VREF] = {
2244 .type = HDA_FIXUP_FUNC,
2245 .v.func = alc889_fixup_mba11_vref,
2246 .chained = true,
2247 .chain_id = ALC889_FIXUP_MBP_VREF,
2248 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002249 [ALC889_FIXUP_MBA21_VREF] = {
2250 .type = HDA_FIXUP_FUNC,
2251 .v.func = alc889_fixup_mba21_vref,
2252 .chained = true,
2253 .chain_id = ALC889_FIXUP_MBP_VREF,
2254 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002255 [ALC889_FIXUP_MP11_VREF] = {
2256 .type = HDA_FIXUP_FUNC,
2257 .v.func = alc889_fixup_mba11_vref,
2258 .chained = true,
2259 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2260 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002261 [ALC889_FIXUP_MP41_VREF] = {
2262 .type = HDA_FIXUP_FUNC,
2263 .v.func = alc889_fixup_mbp_vref,
2264 .chained = true,
2265 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2266 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002267 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002268 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002269 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002270 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002271 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002272 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002273 .v.func = alc882_fixup_no_primary_hp,
2274 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002275 [ALC887_FIXUP_ASUS_BASS] = {
2276 .type = HDA_FIXUP_PINS,
2277 .v.pins = (const struct hda_pintbl[]) {
2278 {0x16, 0x99130130}, /* bass speaker */
2279 {}
2280 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002281 .chained = true,
2282 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2283 },
2284 [ALC887_FIXUP_BASS_CHMAP] = {
2285 .type = HDA_FIXUP_FUNC,
2286 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002287 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002288 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2289 .type = HDA_FIXUP_FUNC,
2290 .v.func = alc1220_fixup_gb_dual_codecs,
2291 },
Peisen0202f5c2017-10-26 10:35:36 +08002292 [ALC1220_FIXUP_CLEVO_P950] = {
2293 .type = HDA_FIXUP_FUNC,
2294 .v.func = alc1220_fixup_clevo_p950,
2295 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002296};
2297
2298static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002299 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2300 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002301 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002302 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2303 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2304 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2305 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002306 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2307 ALC882_FIXUP_ACER_ASPIRE_4930G),
2308 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2309 ALC882_FIXUP_ACER_ASPIRE_4930G),
2310 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2311 ALC882_FIXUP_ACER_ASPIRE_8930G),
2312 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2313 ALC882_FIXUP_ACER_ASPIRE_8930G),
2314 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2315 ALC882_FIXUP_ACER_ASPIRE_4930G),
2316 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2317 ALC882_FIXUP_ACER_ASPIRE_4930G),
2318 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2319 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002320 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002321 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2322 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002323 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002324 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002325 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a2011-11-09 12:55:18 +01002326 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002327 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002328 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002329 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002330 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002331 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002332 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002333 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002334 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Fernando Luis Vázquez Cao12e31a72013-02-12 16:47:44 +09002335 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaic44d9b12016-02-07 09:38:26 +01002336 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002337
2338 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002339 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2340 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2341 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002342 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002343 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2344 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002345 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2346 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002347 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002348 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002349 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002350 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2351 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002352 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002353 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2354 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2355 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002356 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002357 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002358 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2359 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002360 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002361
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002362 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002363 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002364 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002365 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai63691582017-05-22 16:32:46 +02002366 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002367 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002368 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
Peisen0202f5c2017-10-26 10:35:36 +08002369 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaif3d737b2018-07-17 17:08:32 +02002370 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
Jeremy Soller2f0d5202018-05-07 09:28:45 -06002371 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002372 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2373 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002374 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002375 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002376 {}
2377};
2378
Takashi Iwai1727a772013-01-10 09:52:52 +01002379static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002380 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2381 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2382 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2383 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2384 {.id = ALC889_FIXUP_CD, .name = "cd"},
2385 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2386 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2387 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2388 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2389 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2390 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2391 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2392 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2393 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2394 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002395 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2396 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2397 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002398 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2399 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2400 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2401 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2402 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2403 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2404 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2405 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002406 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002407 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002408 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002409 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002410 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002411 {}
2412};
2413
Takashi Iwai1d045db2011-07-07 18:23:21 +02002414/*
2415 * BIOS auto configuration
2416 */
2417/* almost identical with ALC880 parser... */
2418static int alc882_parse_auto_config(struct hda_codec *codec)
2419{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002420 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002421 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2422 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002423}
2424
Takashi Iwai1d045db2011-07-07 18:23:21 +02002425/*
2426 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002427static int patch_alc882(struct hda_codec *codec)
2428{
2429 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002430 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002431
Takashi Iwai3de95172012-05-07 18:03:15 +02002432 err = alc_alloc_spec(codec, 0x0b);
2433 if (err < 0)
2434 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002435
Takashi Iwai3de95172012-05-07 18:03:15 +02002436 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002437
Takashi Iwai7639a062015-03-03 10:07:24 +01002438 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002439 case 0x10ec0882:
2440 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002441 case 0x10ec0900:
Kailang Yanga535ad52017-01-16 16:59:26 +08002442 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002443 break;
2444 default:
2445 /* ALC883 and variants */
2446 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2447 break;
2448 }
2449
Takashi Iwai1727a772013-01-10 09:52:52 +01002450 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002451 alc882_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002452 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002453
2454 alc_auto_parse_customize_define(codec);
2455
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002456 if (has_cdefine_beep(codec))
2457 spec->gen.beep_nid = 0x01;
2458
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002459 /* automatic parse from the BIOS config */
2460 err = alc882_parse_auto_config(codec);
2461 if (err < 0)
2462 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002463
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002464 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2465 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2466 if (err < 0)
2467 goto error;
2468 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002469
Takashi Iwai1727a772013-01-10 09:52:52 +01002470 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002471
Takashi Iwai1d045db2011-07-07 18:23:21 +02002472 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002473
2474 error:
2475 alc_free(codec);
2476 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002477}
2478
2479
2480/*
2481 * ALC262 support
2482 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002483static int alc262_parse_auto_config(struct hda_codec *codec)
2484{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002485 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002486 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2487 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002488}
2489
2490/*
2491 * Pin config fixes
2492 */
2493enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002494 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002495 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002496 ALC262_FIXUP_HP_Z200,
2497 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002498 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002499 ALC262_FIXUP_BENQ,
2500 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002501 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002502 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002503};
2504
Takashi Iwai1727a772013-01-10 09:52:52 +01002505static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002506 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002507 .type = HDA_FIXUP_PINS,
2508 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002509 { 0x14, 0x99130110 }, /* speaker */
2510 { 0x15, 0x0221142f }, /* front HP */
2511 { 0x1b, 0x0121141f }, /* rear HP */
2512 { }
2513 }
2514 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002515 [ALC262_FIXUP_FSC_S7110] = {
2516 .type = HDA_FIXUP_PINS,
2517 .v.pins = (const struct hda_pintbl[]) {
2518 { 0x15, 0x90170110 }, /* speaker */
2519 { }
2520 },
2521 .chained = true,
2522 .chain_id = ALC262_FIXUP_BENQ,
2523 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002524 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002525 .type = HDA_FIXUP_PINS,
2526 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002527 { 0x16, 0x99130120 }, /* internal speaker */
2528 { }
2529 }
2530 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002531 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002532 .type = HDA_FIXUP_PINS,
2533 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002534 { 0x14, 0x1993e1f0 }, /* int AUX */
2535 { }
2536 }
2537 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002538 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002539 .type = HDA_FIXUP_PINCTLS,
2540 .v.pins = (const struct hda_pintbl[]) {
2541 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002542 {}
2543 },
2544 .chained = true,
2545 .chain_id = ALC262_FIXUP_BENQ,
2546 },
2547 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002548 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002549 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002550 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2551 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2552 {}
2553 }
2554 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002555 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002556 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002557 .v.verbs = (const struct hda_verb[]) {
2558 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2559 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2560 {}
2561 }
2562 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002563 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002564 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002565 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002566 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002567 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2568 .type = HDA_FIXUP_FUNC,
2569 .v.func = alc_fixup_no_depop_delay,
2570 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002571};
2572
2573static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002574 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002575 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002576 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002577 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002578 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002579 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002580 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002581 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2582 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002583 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002584 {}
2585};
2586
Takashi Iwai1727a772013-01-10 09:52:52 +01002587static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002588 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002589 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2590 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2591 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2592 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2593 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2594 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2595 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2596 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002597 {}
2598};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002599
Takashi Iwai1d045db2011-07-07 18:23:21 +02002600/*
2601 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002602static int patch_alc262(struct hda_codec *codec)
2603{
2604 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002605 int err;
2606
Takashi Iwai3de95172012-05-07 18:03:15 +02002607 err = alc_alloc_spec(codec, 0x0b);
2608 if (err < 0)
2609 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002610
Takashi Iwai3de95172012-05-07 18:03:15 +02002611 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002612 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002613
Takashi Iwai225068a2015-05-29 10:42:14 +02002614 spec->shutup = alc_eapd_shutup;
2615
Takashi Iwai1d045db2011-07-07 18:23:21 +02002616#if 0
2617 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2618 * under-run
2619 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002620 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002621#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002622 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2623
Takashi Iwai1727a772013-01-10 09:52:52 +01002624 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002625 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002626 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002627
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002628 alc_auto_parse_customize_define(codec);
2629
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002630 if (has_cdefine_beep(codec))
2631 spec->gen.beep_nid = 0x01;
2632
Takashi Iwai42399f72011-11-07 17:18:44 +01002633 /* automatic parse from the BIOS config */
2634 err = alc262_parse_auto_config(codec);
2635 if (err < 0)
2636 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002637
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002638 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2639 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2640 if (err < 0)
2641 goto error;
2642 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002643
Takashi Iwai1727a772013-01-10 09:52:52 +01002644 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002645
Takashi Iwai1d045db2011-07-07 18:23:21 +02002646 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002647
2648 error:
2649 alc_free(codec);
2650 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002651}
2652
2653/*
2654 * ALC268
2655 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002656/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002657static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2658 struct snd_ctl_elem_value *ucontrol)
2659{
2660 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2661 unsigned long pval;
2662 int err;
2663
2664 mutex_lock(&codec->control_mutex);
2665 pval = kcontrol->private_value;
2666 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2667 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2668 if (err >= 0) {
2669 kcontrol->private_value = (pval & ~0xff) | 0x10;
2670 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2671 }
2672 kcontrol->private_value = pval;
2673 mutex_unlock(&codec->control_mutex);
2674 return err;
2675}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002676
2677static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2678 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002679 {
2680 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2681 .name = "Beep Playback Switch",
2682 .subdevice = HDA_SUBDEV_AMP_FLAG,
2683 .info = snd_hda_mixer_amp_switch_info,
2684 .get = snd_hda_mixer_amp_switch_get,
2685 .put = alc268_beep_switch_put,
2686 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2687 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002688};
2689
2690/* set PCBEEP vol = 0, mute connections */
2691static const struct hda_verb alc268_beep_init_verbs[] = {
2692 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2693 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2694 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2695 { }
2696};
2697
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002698enum {
2699 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002700 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002701 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002702};
2703
Takashi Iwai1727a772013-01-10 09:52:52 +01002704static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002705 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002706 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002707 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002708 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002709 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002710 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002711 .v.verbs = (const struct hda_verb[]) {
2712 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2713 {}
2714 }
2715 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002716 [ALC268_FIXUP_SPDIF] = {
2717 .type = HDA_FIXUP_PINS,
2718 .v.pins = (const struct hda_pintbl[]) {
2719 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2720 {}
2721 }
2722 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002723};
2724
Takashi Iwai1727a772013-01-10 09:52:52 +01002725static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002726 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002727 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02002728 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002729 {}
2730};
2731
2732static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002733 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002734 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002735 /* below is codec SSID since multiple Toshiba laptops have the
2736 * same PCI SSID 1179:ff00
2737 */
2738 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002739 {}
2740};
2741
Takashi Iwai1d045db2011-07-07 18:23:21 +02002742/*
2743 * BIOS auto configuration
2744 */
2745static int alc268_parse_auto_config(struct hda_codec *codec)
2746{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002747 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002748 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002749}
2750
Takashi Iwai1d045db2011-07-07 18:23:21 +02002751/*
2752 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002753static int patch_alc268(struct hda_codec *codec)
2754{
2755 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002756 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002757
Takashi Iwai1d045db2011-07-07 18:23:21 +02002758 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002759 err = alc_alloc_spec(codec, 0);
2760 if (err < 0)
2761 return err;
2762
2763 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002764 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002765
Takashi Iwai225068a2015-05-29 10:42:14 +02002766 spec->shutup = alc_eapd_shutup;
2767
Takashi Iwai1727a772013-01-10 09:52:52 +01002768 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2769 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002770
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002771 /* automatic parse from the BIOS config */
2772 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002773 if (err < 0)
2774 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002775
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002776 if (err > 0 && !spec->gen.no_analog &&
2777 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002778 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2779 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2780 &alc268_beep_mixer[i])) {
2781 err = -ENOMEM;
2782 goto error;
2783 }
2784 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002785 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002786 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2787 /* override the amp caps for beep generator */
2788 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2789 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2790 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2791 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2792 (0 << AC_AMPCAP_MUTE_SHIFT));
2793 }
2794
Takashi Iwai1727a772013-01-10 09:52:52 +01002795 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002796
Takashi Iwai1d045db2011-07-07 18:23:21 +02002797 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002798
2799 error:
2800 alc_free(codec);
2801 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002802}
2803
2804/*
2805 * ALC269
2806 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01002807
Takashi Iwai1d045db2011-07-07 18:23:21 +02002808static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002809 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002810};
2811
2812static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002813 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002814};
2815
Takashi Iwai1d045db2011-07-07 18:23:21 +02002816/* different alc269-variants */
2817enum {
2818 ALC269_TYPE_ALC269VA,
2819 ALC269_TYPE_ALC269VB,
2820 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02002821 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01002822 ALC269_TYPE_ALC280,
2823 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02002824 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01002825 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08002826 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02002827 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08002828 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02002829 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08002830 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08002831 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08002832 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08002833 ALC269_TYPE_ALC225,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08002834 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08002835 ALC269_TYPE_ALC300,
Kailang Yang6fbae352016-05-30 16:44:20 +08002836 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002837};
2838
2839/*
2840 * BIOS auto configuration
2841 */
2842static int alc269_parse_auto_config(struct hda_codec *codec)
2843{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002844 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002845 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2846 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2847 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02002848 const hda_nid_t *ssids;
2849
2850 switch (spec->codec_variant) {
2851 case ALC269_TYPE_ALC269VA:
2852 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01002853 case ALC269_TYPE_ALC280:
2854 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08002855 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02002856 ssids = alc269va_ssids;
2857 break;
2858 case ALC269_TYPE_ALC269VB:
2859 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01002860 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02002861 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02002862 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08002863 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02002864 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08002865 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08002866 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08002867 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08002868 case ALC269_TYPE_ALC225:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08002869 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08002870 case ALC269_TYPE_ALC300:
Kailang Yang6fbae352016-05-30 16:44:20 +08002871 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02002872 ssids = alc269_ssids;
2873 break;
2874 default:
2875 ssids = alc269_ssids;
2876 break;
2877 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002878
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002879 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002880}
2881
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002882static int find_ext_mic_pin(struct hda_codec *codec);
2883
2884static void alc286_shutup(struct hda_codec *codec)
2885{
Takashi Iwaia9c2dfc2018-04-23 17:24:56 +02002886 const struct hda_pincfg *pin;
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002887 int i;
2888 int mic_pin = find_ext_mic_pin(codec);
2889 /* don't shut up pins when unloading the driver; otherwise it breaks
2890 * the default pin setup at the next load of the driver
2891 */
2892 if (codec->bus->shutdown)
2893 return;
Takashi Iwaia9c2dfc2018-04-23 17:24:56 +02002894 snd_array_for_each(&codec->init_pins, i, pin) {
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002895 /* use read here for syncing after issuing each verb */
2896 if (pin->nid != mic_pin)
2897 snd_hda_codec_read(codec, pin->nid, 0,
2898 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2899 }
2900 codec->pins_shutup = 1;
2901}
2902
Kailang Yang1387e2d2012-11-08 10:23:18 +01002903static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02002904{
Takashi Iwai98b24882014-08-18 13:47:50 +02002905 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002906}
2907
2908static void alc269_shutup(struct hda_codec *codec)
2909{
Kailang Yangadcc70b2012-05-25 08:08:38 +02002910 struct alc_spec *spec = codec->spec;
2911
Kailang Yang1387e2d2012-11-08 10:23:18 +01002912 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2913 alc269vb_toggle_power_output(codec, 0);
2914 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2915 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002916 msleep(150);
2917 }
Takashi Iwai9bfb2842013-07-24 14:31:50 +02002918 snd_hda_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002919}
2920
Takashi Iwai54db6c32014-08-18 15:11:19 +02002921static struct coef_fw alc282_coefs[] = {
2922 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08002923 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02002924 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2925 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2926 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2927 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2928 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2929 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2930 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2931 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2932 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2933 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2934 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2935 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2936 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2937 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2938 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2939 WRITE_COEF(0x63, 0x2902), /* PLL */
2940 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2941 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2942 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2943 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2944 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2945 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2946 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2947 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2948 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2949 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2950 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2951 {}
2952};
2953
Kailang Yangcb149cb2014-03-18 16:45:32 +08002954static void alc282_restore_default_value(struct hda_codec *codec)
2955{
Takashi Iwai54db6c32014-08-18 15:11:19 +02002956 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08002957}
2958
Kailang Yang7b5c7a02014-03-18 16:15:54 +08002959static void alc282_init(struct hda_codec *codec)
2960{
2961 struct alc_spec *spec = codec->spec;
2962 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2963 bool hp_pin_sense;
2964 int coef78;
2965
Kailang Yangcb149cb2014-03-18 16:45:32 +08002966 alc282_restore_default_value(codec);
2967
Kailang Yang7b5c7a02014-03-18 16:15:54 +08002968 if (!hp_pin)
2969 return;
2970 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2971 coef78 = alc_read_coef_idx(codec, 0x78);
2972
2973 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2974 /* Headphone capless set to high power mode */
2975 alc_write_coef_idx(codec, 0x78, 0x9004);
2976
2977 if (hp_pin_sense)
2978 msleep(2);
2979
2980 snd_hda_codec_write(codec, hp_pin, 0,
2981 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2982
2983 if (hp_pin_sense)
2984 msleep(85);
2985
2986 snd_hda_codec_write(codec, hp_pin, 0,
2987 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2988
2989 if (hp_pin_sense)
2990 msleep(100);
2991
2992 /* Headphone capless set to normal mode */
2993 alc_write_coef_idx(codec, 0x78, coef78);
2994}
2995
2996static void alc282_shutup(struct hda_codec *codec)
2997{
2998 struct alc_spec *spec = codec->spec;
2999 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3000 bool hp_pin_sense;
3001 int coef78;
3002
3003 if (!hp_pin) {
3004 alc269_shutup(codec);
3005 return;
3006 }
3007
3008 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3009 coef78 = alc_read_coef_idx(codec, 0x78);
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, 0x0);
3023
3024 if (hp_pin_sense)
3025 msleep(100);
3026
3027 alc_auto_setup_eapd(codec, false);
3028 snd_hda_shutup_pins(codec);
3029 alc_write_coef_idx(codec, 0x78, coef78);
3030}
3031
Takashi Iwai54db6c32014-08-18 15:11:19 +02003032static struct coef_fw alc283_coefs[] = {
3033 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003034 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003035 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3036 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3037 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3038 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3039 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3040 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3041 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3042 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3043 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3044 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3045 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3046 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3047 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3048 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3049 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3050 WRITE_COEF(0x2e, 0x2902), /* PLL */
3051 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3052 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3053 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3054 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3055 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3056 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3057 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3058 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3059 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3060 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3061 WRITE_COEF(0x49, 0x0), /* test mode */
3062 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3063 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3064 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003065 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003066 {}
3067};
3068
Kailang Yang6bd55b02014-03-17 13:51:27 +08003069static void alc283_restore_default_value(struct hda_codec *codec)
3070{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003071 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003072}
3073
Kailang Yang2af02be2013-08-22 10:03:50 +02003074static void alc283_init(struct hda_codec *codec)
3075{
3076 struct alc_spec *spec = codec->spec;
3077 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3078 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003079
Kailang Yang8314f222014-04-03 17:28:39 +08003080 if (!spec->gen.autocfg.hp_outs) {
3081 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3082 hp_pin = spec->gen.autocfg.line_out_pins[0];
3083 }
3084
Kailang Yang6bd55b02014-03-17 13:51:27 +08003085 alc283_restore_default_value(codec);
3086
Kailang Yang2af02be2013-08-22 10:03:50 +02003087 if (!hp_pin)
3088 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003089
3090 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003091 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3092
3093 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3094 /* Headphone capless set to high power mode */
3095 alc_write_coef_idx(codec, 0x43, 0x9004);
3096
3097 snd_hda_codec_write(codec, hp_pin, 0,
3098 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3099
3100 if (hp_pin_sense)
3101 msleep(85);
3102
3103 snd_hda_codec_write(codec, hp_pin, 0,
3104 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3105
3106 if (hp_pin_sense)
3107 msleep(85);
3108 /* Index 0x46 Combo jack auto switch control 2 */
3109 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003110 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003111 /* Headphone capless set to normal mode */
3112 alc_write_coef_idx(codec, 0x43, 0x9614);
3113}
3114
3115static void alc283_shutup(struct hda_codec *codec)
3116{
3117 struct alc_spec *spec = codec->spec;
3118 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3119 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003120
Kailang Yang8314f222014-04-03 17:28:39 +08003121 if (!spec->gen.autocfg.hp_outs) {
3122 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3123 hp_pin = spec->gen.autocfg.line_out_pins[0];
3124 }
3125
Kailang Yang2af02be2013-08-22 10:03:50 +02003126 if (!hp_pin) {
3127 alc269_shutup(codec);
3128 return;
3129 }
3130
3131 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3132
3133 alc_write_coef_idx(codec, 0x43, 0x9004);
3134
Harsha Priyab450b172014-10-09 11:04:56 +00003135 /*depop hp during suspend*/
3136 alc_write_coef_idx(codec, 0x06, 0x2100);
3137
Kailang Yang2af02be2013-08-22 10:03:50 +02003138 snd_hda_codec_write(codec, hp_pin, 0,
3139 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3140
3141 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003142 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003143
3144 snd_hda_codec_write(codec, hp_pin, 0,
3145 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3146
Takashi Iwai98b24882014-08-18 13:47:50 +02003147 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003148
3149 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003150 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003151 alc_auto_setup_eapd(codec, false);
Kailang Yang2af02be2013-08-22 10:03:50 +02003152 snd_hda_shutup_pins(codec);
3153 alc_write_coef_idx(codec, 0x43, 0x9614);
3154}
3155
Kailang Yang4a219ef2017-06-16 16:54:35 +08003156static void alc256_init(struct hda_codec *codec)
3157{
3158 struct alc_spec *spec = codec->spec;
3159 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3160 bool hp_pin_sense;
3161
3162 if (!hp_pin)
3163 return;
3164
3165 msleep(30);
3166
3167 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3168
3169 if (hp_pin_sense)
3170 msleep(2);
3171
3172 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3173
3174 snd_hda_codec_write(codec, hp_pin, 0,
3175 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3176
3177 if (hp_pin_sense)
3178 msleep(85);
3179
3180 snd_hda_codec_write(codec, hp_pin, 0,
3181 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3182
3183 if (hp_pin_sense)
3184 msleep(100);
3185
3186 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3187 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003188 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3189 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003190}
3191
3192static void alc256_shutup(struct hda_codec *codec)
3193{
3194 struct alc_spec *spec = codec->spec;
3195 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3196 bool hp_pin_sense;
3197
3198 if (!hp_pin) {
3199 alc269_shutup(codec);
3200 return;
3201 }
3202
3203 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3204
3205 if (hp_pin_sense)
3206 msleep(2);
3207
3208 snd_hda_codec_write(codec, hp_pin, 0,
3209 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3210
3211 if (hp_pin_sense)
3212 msleep(85);
3213
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003214 /* 3k pull low control for Headset jack. */
3215 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3216 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3217
Kailang Yang4a219ef2017-06-16 16:54:35 +08003218 snd_hda_codec_write(codec, hp_pin, 0,
3219 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3220
Kailang Yang4a219ef2017-06-16 16:54:35 +08003221 if (hp_pin_sense)
3222 msleep(100);
3223
3224 alc_auto_setup_eapd(codec, false);
3225 snd_hda_shutup_pins(codec);
3226}
3227
Kailang Yangda911b12018-01-05 16:50:08 +08003228static void alc225_init(struct hda_codec *codec)
3229{
3230 struct alc_spec *spec = codec->spec;
3231 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3232 bool hp1_pin_sense, hp2_pin_sense;
3233
3234 if (!hp_pin)
3235 return;
3236
3237 msleep(30);
3238
3239 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3240 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3241
3242 if (hp1_pin_sense || hp2_pin_sense)
3243 msleep(2);
3244
3245 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3246
3247 if (hp1_pin_sense)
3248 snd_hda_codec_write(codec, hp_pin, 0,
3249 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3250 if (hp2_pin_sense)
3251 snd_hda_codec_write(codec, 0x16, 0,
3252 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3253
3254 if (hp1_pin_sense || hp2_pin_sense)
3255 msleep(85);
3256
3257 if (hp1_pin_sense)
3258 snd_hda_codec_write(codec, hp_pin, 0,
3259 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3260 if (hp2_pin_sense)
3261 snd_hda_codec_write(codec, 0x16, 0,
3262 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3263
3264 if (hp1_pin_sense || hp2_pin_sense)
3265 msleep(100);
3266
3267 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3268 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3269}
3270
3271static void alc225_shutup(struct hda_codec *codec)
3272{
3273 struct alc_spec *spec = codec->spec;
3274 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3275 bool hp1_pin_sense, hp2_pin_sense;
3276
3277 if (!hp_pin) {
3278 alc269_shutup(codec);
3279 return;
3280 }
3281
3282 /* 3k pull low control for Headset jack. */
3283 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3284
3285 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3286 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3287
3288 if (hp1_pin_sense || hp2_pin_sense)
3289 msleep(2);
3290
3291 if (hp1_pin_sense)
3292 snd_hda_codec_write(codec, hp_pin, 0,
3293 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3294 if (hp2_pin_sense)
3295 snd_hda_codec_write(codec, 0x16, 0,
3296 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3297
3298 if (hp1_pin_sense || hp2_pin_sense)
3299 msleep(85);
3300
3301 if (hp1_pin_sense)
3302 snd_hda_codec_write(codec, hp_pin, 0,
3303 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3304 if (hp2_pin_sense)
3305 snd_hda_codec_write(codec, 0x16, 0,
3306 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3307
3308 if (hp1_pin_sense || hp2_pin_sense)
3309 msleep(100);
3310
3311 alc_auto_setup_eapd(codec, false);
3312 snd_hda_shutup_pins(codec);
3313}
3314
Kailang Yangc2d6af52017-06-21 14:50:54 +08003315static void alc_default_init(struct hda_codec *codec)
3316{
3317 struct alc_spec *spec = codec->spec;
3318 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3319 bool hp_pin_sense;
3320
3321 if (!hp_pin)
3322 return;
3323
3324 msleep(30);
3325
3326 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3327
3328 if (hp_pin_sense)
3329 msleep(2);
3330
3331 snd_hda_codec_write(codec, hp_pin, 0,
3332 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3333
3334 if (hp_pin_sense)
3335 msleep(85);
3336
3337 snd_hda_codec_write(codec, hp_pin, 0,
3338 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3339
3340 if (hp_pin_sense)
3341 msleep(100);
3342}
3343
3344static void alc_default_shutup(struct hda_codec *codec)
3345{
3346 struct alc_spec *spec = codec->spec;
3347 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3348 bool hp_pin_sense;
3349
3350 if (!hp_pin) {
3351 alc269_shutup(codec);
3352 return;
3353 }
3354
3355 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3356
3357 if (hp_pin_sense)
3358 msleep(2);
3359
3360 snd_hda_codec_write(codec, hp_pin, 0,
3361 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3362
3363 if (hp_pin_sense)
3364 msleep(85);
3365
3366 snd_hda_codec_write(codec, hp_pin, 0,
3367 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3368
3369 if (hp_pin_sense)
3370 msleep(100);
3371
3372 alc_auto_setup_eapd(codec, false);
3373 snd_hda_shutup_pins(codec);
3374}
3375
Kailang Yang693abe12019-01-29 15:38:21 +08003376static void alc294_hp_init(struct hda_codec *codec)
3377{
3378 struct alc_spec *spec = codec->spec;
3379 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3380 int i, val;
3381
3382 if (!hp_pin)
3383 return;
3384
3385 snd_hda_codec_write(codec, hp_pin, 0,
3386 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3387
3388 msleep(100);
3389
3390 snd_hda_codec_write(codec, hp_pin, 0,
3391 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3392
3393 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3394 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3395
3396 /* Wait for depop procedure finish */
3397 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3398 for (i = 0; i < 20 && val & 0x0080; i++) {
3399 msleep(50);
3400 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3401 }
3402 /* Set HP depop to auto mode */
3403 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3404 msleep(50);
3405}
3406
3407static void alc294_init(struct hda_codec *codec)
3408{
3409 struct alc_spec *spec = codec->spec;
3410
3411 if (!spec->done_hp_init) {
3412 alc294_hp_init(codec);
3413 spec->done_hp_init = true;
3414 }
3415 alc_default_init(codec);
3416}
3417
Kailang Yangad60d502013-06-28 12:03:01 +02003418static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3419 unsigned int val)
3420{
3421 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3422 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3423 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3424}
3425
3426static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3427{
3428 unsigned int val;
3429
3430 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3431 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3432 & 0xffff;
3433 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3434 << 16;
3435 return val;
3436}
3437
3438static void alc5505_dsp_halt(struct hda_codec *codec)
3439{
3440 unsigned int val;
3441
3442 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3443 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3444 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3445 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3446 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3447 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3448 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3449 val = alc5505_coef_get(codec, 0x6220);
3450 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3451}
3452
3453static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3454{
3455 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3456 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3457 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3458 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3459 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3460 alc5505_coef_set(codec, 0x880c, 0x00000004);
3461}
3462
3463static void alc5505_dsp_init(struct hda_codec *codec)
3464{
3465 unsigned int val;
3466
3467 alc5505_dsp_halt(codec);
3468 alc5505_dsp_back_from_halt(codec);
3469 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3470 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3471 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3472 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3473 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3474 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3475 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3476 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3477 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3478 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3479 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3480 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3481 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3482
3483 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3484 if (val <= 3)
3485 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3486 else
3487 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3488
3489 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3490 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3491 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3492 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3493 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3494 alc5505_coef_set(codec, 0x880c, 0x00000003);
3495 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003496
3497#ifdef HALT_REALTEK_ALC5505
3498 alc5505_dsp_halt(codec);
3499#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003500}
3501
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003502#ifdef HALT_REALTEK_ALC5505
3503#define alc5505_dsp_suspend(codec) /* NOP */
3504#define alc5505_dsp_resume(codec) /* NOP */
3505#else
3506#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3507#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3508#endif
3509
Takashi Iwai2a439522011-07-26 09:52:50 +02003510#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003511static int alc269_suspend(struct hda_codec *codec)
3512{
3513 struct alc_spec *spec = codec->spec;
3514
3515 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003516 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003517 return alc_suspend(codec);
3518}
3519
Takashi Iwai1d045db2011-07-07 18:23:21 +02003520static int alc269_resume(struct hda_codec *codec)
3521{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003522 struct alc_spec *spec = codec->spec;
3523
Kailang Yang1387e2d2012-11-08 10:23:18 +01003524 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3525 alc269vb_toggle_power_output(codec, 0);
3526 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003527 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003528 msleep(150);
3529 }
3530
3531 codec->patch_ops.init(codec);
3532
Kailang Yang1387e2d2012-11-08 10:23:18 +01003533 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3534 alc269vb_toggle_power_output(codec, 1);
3535 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003536 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003537 msleep(200);
3538 }
3539
Takashi Iwaieeecd9d2015-02-25 15:18:50 +01003540 regcache_sync(codec->core.regmap);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003541 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003542
3543 /* on some machine, the BIOS will clear the codec gpio data when enter
3544 * suspend, and won't restore the data after resume, so we restore it
3545 * in the driver.
3546 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003547 if (spec->gpio_data)
3548 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003549
Kailang Yangad60d502013-06-28 12:03:01 +02003550 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003551 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003552
Takashi Iwai1d045db2011-07-07 18:23:21 +02003553 return 0;
3554}
Takashi Iwai2a439522011-07-26 09:52:50 +02003555#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003556
David Henningsson108cc102012-07-20 10:37:25 +02003557static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003558 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003559{
3560 struct alc_spec *spec = codec->spec;
3561
Takashi Iwai1727a772013-01-10 09:52:52 +01003562 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003563 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3564}
3565
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01003566static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3567 const struct hda_fixup *fix,
3568 int action)
3569{
3570 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3571 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3572
3573 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3574 snd_hda_codec_set_pincfg(codec, 0x19,
3575 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3576 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3577}
3578
Takashi Iwai1d045db2011-07-07 18:23:21 +02003579static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003580 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003581{
Takashi Iwai98b24882014-08-18 13:47:50 +02003582 if (action == HDA_FIXUP_ACT_INIT)
3583 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003584}
3585
David Henningsson7c478f02013-10-11 10:18:46 +02003586static void alc269_fixup_headset_mic(struct hda_codec *codec,
3587 const struct hda_fixup *fix, int action)
3588{
3589 struct alc_spec *spec = codec->spec;
3590
3591 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3592 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3593}
3594
Takashi Iwai1d045db2011-07-07 18:23:21 +02003595static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003596 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003597{
3598 static const struct hda_verb verbs[] = {
3599 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3600 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3601 {}
3602 };
3603 unsigned int cfg;
3604
Takashi Iwai7639a062015-03-03 10:07:24 +01003605 if (strcmp(codec->core.chip_name, "ALC271X") &&
3606 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02003607 return;
3608 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3609 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3610 snd_hda_sequence_write(codec, verbs);
3611}
3612
Takashi Iwai017f2a12011-07-09 14:42:25 +02003613static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003614 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003615{
3616 struct alc_spec *spec = codec->spec;
3617
Takashi Iwai1727a772013-01-10 09:52:52 +01003618 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003619 return;
3620
3621 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3622 * fix the sample rate of analog I/O to 44.1kHz
3623 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003624 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3625 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02003626}
3627
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003628static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003629 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003630{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003631 /* The digital-mic unit sends PDM (differential signal) instead of
3632 * the standard PCM, thus you can't record a valid mono stream as is.
3633 * Below is a workaround specific to ALC269 to control the dmic
3634 * signal source as mono.
3635 */
Takashi Iwai98b24882014-08-18 13:47:50 +02003636 if (action == HDA_FIXUP_ACT_INIT)
3637 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003638}
3639
Takashi Iwai24519912011-08-16 15:08:49 +02003640static void alc269_quanta_automute(struct hda_codec *codec)
3641{
Takashi Iwai08c189f2012-12-19 15:22:24 +01003642 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02003643
Takashi Iwai1687ccc2014-08-18 13:49:35 +02003644 alc_write_coef_idx(codec, 0x0c, 0x680);
3645 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02003646}
3647
3648static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003649 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02003650{
3651 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01003652 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02003653 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01003654 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02003655}
3656
David Henningssond240d1d2013-04-15 12:50:02 +02003657static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02003658 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02003659{
3660 struct alc_spec *spec = codec->spec;
3661 int vref;
3662 msleep(200);
3663 snd_hda_gen_hp_automute(codec, jack);
3664
3665 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3666 msleep(100);
3667 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3668 vref);
3669 msleep(500);
3670 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3671 vref);
3672}
3673
3674static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3675 const struct hda_fixup *fix, int action)
3676{
3677 struct alc_spec *spec = codec->spec;
3678 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3679 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3680 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3681 }
3682}
3683
3684
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003685/* update mute-LED according to the speaker mute state via mic VREF pin */
3686static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003687{
3688 struct hda_codec *codec = private_data;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003689 struct alc_spec *spec = codec->spec;
3690 unsigned int pinval;
3691
3692 if (spec->mute_led_polarity)
3693 enabled = !enabled;
Takashi Iwai415d5552014-04-03 11:51:21 +02003694 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3695 pinval &= ~AC_PINCTL_VREFEN;
3696 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
Takashi Iwaie40bdb02018-03-17 22:40:18 +01003697 if (spec->mute_led_nid) {
3698 /* temporarily power up/down for setting VREF */
3699 snd_hda_power_up_pm(codec);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003700 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
Takashi Iwaie40bdb02018-03-17 22:40:18 +01003701 snd_hda_power_down_pm(codec);
3702 }
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003703}
3704
David Henningssond5b6b652013-11-06 10:50:44 +01003705/* Make sure the led works even in runtime suspend */
3706static unsigned int led_power_filter(struct hda_codec *codec,
3707 hda_nid_t nid,
3708 unsigned int power_state)
3709{
3710 struct alc_spec *spec = codec->spec;
3711
Hui Wang50dd9052014-07-08 17:56:15 +08003712 if (power_state != AC_PWRST_D3 || nid == 0 ||
3713 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01003714 return power_state;
3715
3716 /* Set pin ctl again, it might have just been set to 0 */
3717 snd_hda_set_pin_ctl(codec, nid,
3718 snd_hda_codec_get_pin_target(codec, nid));
3719
Takashi Iwaicffd3962015-04-09 10:30:25 +02003720 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01003721}
3722
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003723static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3724 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003725{
3726 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003727 const struct dmi_device *dev = NULL;
3728
3729 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3730 return;
3731
3732 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3733 int pol, pin;
3734 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3735 continue;
3736 if (pin < 0x0a || pin >= 0x10)
3737 break;
3738 spec->mute_led_polarity = pol;
3739 spec->mute_led_nid = pin - 0x0a + 0x18;
3740 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
Takashi Iwaifd25a972012-12-20 14:57:18 +01003741 spec->gen.vmaster_mute_enum = 1;
David Henningssond5b6b652013-11-06 10:50:44 +01003742 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01003743 codec_dbg(codec,
3744 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003745 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003746 break;
3747 }
3748}
3749
Takashi Iwai85c467d2018-05-29 11:38:38 +02003750static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
3751 const struct hda_fixup *fix,
3752 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01003753{
3754 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02003755
David Henningssond06ac142013-02-18 11:41:55 +01003756 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3757 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02003758 spec->mute_led_nid = pin;
David Henningssond06ac142013-02-18 11:41:55 +01003759 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3760 spec->gen.vmaster_mute_enum = 1;
David Henningssond5b6b652013-11-06 10:50:44 +01003761 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01003762 }
3763}
3764
Takashi Iwai85c467d2018-05-29 11:38:38 +02003765static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3766 const struct hda_fixup *fix, int action)
3767{
3768 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
3769}
3770
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003771static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3772 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01003773{
Takashi Iwai85c467d2018-05-29 11:38:38 +02003774 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01003775}
3776
Tom Briden7f783bd2017-03-25 10:12:01 +00003777static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
3778 const struct hda_fixup *fix, int action)
3779{
Takashi Iwai85c467d2018-05-29 11:38:38 +02003780 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00003781}
3782
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003783/* update LED status via GPIO */
3784static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3785 bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003786{
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003787 struct alc_spec *spec = codec->spec;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003788
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003789 if (spec->mute_led_polarity)
3790 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02003791 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003792}
3793
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003794/* turn on/off mute LED via GPIO per vmaster hook */
3795static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3796{
3797 struct hda_codec *codec = private_data;
3798 struct alc_spec *spec = codec->spec;
3799
3800 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3801}
3802
3803/* turn on/off mic-mute LED via GPIO per capture hook */
Takashi Iwaid03abec2018-06-19 12:29:13 +02003804static void alc_gpio_micmute_update(struct hda_codec *codec)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003805{
3806 struct alc_spec *spec = codec->spec;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003807
Takashi Iwaid03abec2018-06-19 12:29:13 +02003808 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3809 spec->gen.micmute_led.led_value);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003810}
3811
Takashi Iwai01e4a272018-06-19 22:47:30 +02003812/* setup mute and mic-mute GPIO bits, add hooks appropriately */
3813static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
3814 int action,
3815 unsigned int mute_mask,
3816 unsigned int micmute_mask)
3817{
3818 struct alc_spec *spec = codec->spec;
3819
3820 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
3821
3822 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3823 return;
3824 if (mute_mask) {
3825 spec->gpio_mute_led_mask = mute_mask;
3826 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3827 }
3828 if (micmute_mask) {
3829 spec->gpio_mic_led_mask = micmute_mask;
3830 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
3831 }
3832}
3833
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003834static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3835 const struct hda_fixup *fix, int action)
3836{
Takashi Iwai01e4a272018-06-19 22:47:30 +02003837 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003838}
3839
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08003840static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3841 const struct hda_fixup *fix, int action)
3842{
Takashi Iwai01e4a272018-06-19 22:47:30 +02003843 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003844}
3845
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003846/* turn on/off mic-mute LED per capture hook */
Takashi Iwaid03abec2018-06-19 12:29:13 +02003847static void alc_cap_micmute_update(struct hda_codec *codec)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003848{
3849 struct alc_spec *spec = codec->spec;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003850 unsigned int pinval;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003851
Takashi Iwaid03abec2018-06-19 12:29:13 +02003852 if (!spec->cap_mute_led_nid)
3853 return;
Hui Wangfc1fad92014-07-08 17:56:14 +08003854 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003855 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003856 if (spec->gen.micmute_led.led_value)
3857 pinval |= AC_PINCTL_VREF_80;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003858 else
Takashi Iwaid03abec2018-06-19 12:29:13 +02003859 pinval |= AC_PINCTL_VREF_HIZ;
3860 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003861}
3862
3863static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3864 const struct hda_fixup *fix, int action)
3865{
3866 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003867
Takashi Iwai01e4a272018-06-19 22:47:30 +02003868 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003869 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02003870 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
3871 * enable headphone amp
3872 */
3873 spec->gpio_mask |= 0x10;
3874 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003875 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003876 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
Hui Wang50dd9052014-07-08 17:56:15 +08003877 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003878 }
3879}
3880
David Henningsson7a5255f2014-10-30 08:26:01 +01003881static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3882 const struct hda_fixup *fix, int action)
3883{
David Henningsson7a5255f2014-10-30 08:26:01 +01003884 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01003885
Takashi Iwai01e4a272018-06-19 22:47:30 +02003886 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01003887 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01003888 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003889 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
David Henningsson7a5255f2014-10-30 08:26:01 +01003890 codec->power_filter = led_power_filter;
3891 }
3892}
3893
Takashi Iwai6a30aba2018-04-27 17:17:35 +02003894#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01003895static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3896 struct hda_jack_callback *event)
3897{
3898 struct alc_spec *spec = codec->spec;
3899
3900 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3901 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08003902 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01003903 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08003904 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01003905 input_sync(spec->kb_dev);
3906}
David Henningsson33f4acd2015-01-07 15:50:13 +01003907
Kailang3694cb22015-12-28 11:35:24 +08003908static int alc_register_micmute_input_device(struct hda_codec *codec)
3909{
3910 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08003911 int i;
Kailang3694cb22015-12-28 11:35:24 +08003912
3913 spec->kb_dev = input_allocate_device();
3914 if (!spec->kb_dev) {
3915 codec_err(codec, "Out of memory (input_allocate_device)\n");
3916 return -ENOMEM;
3917 }
Hui Wangc7b60a82015-12-28 11:35:25 +08003918
3919 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
3920
Kailang3694cb22015-12-28 11:35:24 +08003921 spec->kb_dev->name = "Microphone Mute Button";
3922 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08003923 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
3924 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
3925 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
3926 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
3927 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08003928
3929 if (input_register_device(spec->kb_dev)) {
3930 codec_err(codec, "input_register_device failed\n");
3931 input_free_device(spec->kb_dev);
3932 spec->kb_dev = NULL;
3933 return -ENOMEM;
3934 }
3935
3936 return 0;
3937}
3938
Takashi Iwai01e4a272018-06-19 22:47:30 +02003939/* GPIO1 = set according to SKU external amp
3940 * GPIO2 = mic mute hotkey
3941 * GPIO3 = mute LED
3942 * GPIO4 = mic mute LED
3943 */
David Henningsson33f4acd2015-01-07 15:50:13 +01003944static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3945 const struct hda_fixup *fix, int action)
3946{
David Henningsson33f4acd2015-01-07 15:50:13 +01003947 struct alc_spec *spec = codec->spec;
3948
Takashi Iwai01e4a272018-06-19 22:47:30 +02003949 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01003950 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02003951 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08003952 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01003953 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01003954
Takashi Iwai01e4a272018-06-19 22:47:30 +02003955 spec->gpio_mask |= 0x06;
3956 spec->gpio_dir |= 0x02;
3957 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01003958 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01003959 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01003960 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01003961 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01003962 return;
3963 }
3964
3965 if (!spec->kb_dev)
3966 return;
3967
3968 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01003969 case HDA_FIXUP_ACT_FREE:
3970 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01003971 spec->kb_dev = NULL;
3972 }
David Henningsson33f4acd2015-01-07 15:50:13 +01003973}
3974
Takashi Iwai01e4a272018-06-19 22:47:30 +02003975/* Line2 = mic mute hotkey
3976 * GPIO2 = mic mute LED
3977 */
Kailang3694cb22015-12-28 11:35:24 +08003978static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
3979 const struct hda_fixup *fix, int action)
3980{
Kailang3694cb22015-12-28 11:35:24 +08003981 struct alc_spec *spec = codec->spec;
3982
Takashi Iwai01e4a272018-06-19 22:47:30 +02003983 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08003984 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02003985 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08003986 if (alc_register_micmute_input_device(codec) != 0)
3987 return;
3988
Kailang3694cb22015-12-28 11:35:24 +08003989 snd_hda_jack_detect_enable_callback(codec, 0x1b,
3990 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08003991 return;
3992 }
3993
3994 if (!spec->kb_dev)
3995 return;
3996
3997 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08003998 case HDA_FIXUP_ACT_FREE:
3999 input_unregister_device(spec->kb_dev);
4000 spec->kb_dev = NULL;
4001 }
4002}
Takashi Iwaic4696522018-01-15 10:44:35 +01004003#else /* INPUT */
4004#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4005#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4006#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004007
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004008static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4009 const struct hda_fixup *fix, int action)
4010{
4011 struct alc_spec *spec = codec->spec;
4012
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004013 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004014 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004015 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02004016 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004017 }
4018}
4019
Kailang Yang5a367672017-07-21 15:23:53 +08004020static struct coef_fw alc225_pre_hsmode[] = {
4021 UPDATE_COEF(0x4a, 1<<8, 0),
4022 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4023 UPDATE_COEF(0x63, 3<<14, 3<<14),
4024 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4025 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4026 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4027 UPDATE_COEF(0x4a, 3<<10, 0),
4028 {}
4029};
4030
David Henningsson73bdd592013-04-15 15:44:14 +02004031static void alc_headset_mode_unplugged(struct hda_codec *codec)
4032{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004033 static struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004034 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4035 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4036 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4037 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4038 {}
4039 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004040 static struct coef_fw coef0255_1[] = {
4041 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4042 {}
4043 };
4044 static struct coef_fw coef0256[] = {
4045 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4046 {}
4047 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004048 static struct coef_fw coef0233[] = {
4049 WRITE_COEF(0x1b, 0x0c0b),
4050 WRITE_COEF(0x45, 0xc429),
4051 UPDATE_COEF(0x35, 0x4000, 0),
4052 WRITE_COEF(0x06, 0x2104),
4053 WRITE_COEF(0x1a, 0x0001),
4054 WRITE_COEF(0x26, 0x0004),
4055 WRITE_COEF(0x32, 0x42a3),
4056 {}
4057 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004058 static struct coef_fw coef0288[] = {
4059 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4060 UPDATE_COEF(0x50, 0x2000, 0x2000),
4061 UPDATE_COEF(0x56, 0x0006, 0x0006),
4062 UPDATE_COEF(0x66, 0x0008, 0),
4063 UPDATE_COEF(0x67, 0x2000, 0),
4064 {}
4065 };
Kailang Yang89542932017-07-17 15:03:43 +08004066 static struct coef_fw coef0298[] = {
4067 UPDATE_COEF(0x19, 0x1300, 0x0300),
4068 {}
4069 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004070 static struct coef_fw coef0292[] = {
4071 WRITE_COEF(0x76, 0x000e),
4072 WRITE_COEF(0x6c, 0x2400),
4073 WRITE_COEF(0x18, 0x7308),
4074 WRITE_COEF(0x6b, 0xc429),
4075 {}
4076 };
4077 static struct coef_fw coef0293[] = {
4078 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4079 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4080 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4081 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4082 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4083 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4084 {}
4085 };
4086 static struct coef_fw coef0668[] = {
4087 WRITE_COEF(0x15, 0x0d40),
4088 WRITE_COEF(0xb7, 0x802b),
4089 {}
4090 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004091 static struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004092 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004093 {}
4094 };
Kailang Yang71683c32017-06-20 16:33:50 +08004095 static struct coef_fw coef0274[] = {
4096 UPDATE_COEF(0x4a, 0x0100, 0),
4097 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4098 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4099 UPDATE_COEF(0x4a, 0x0010, 0),
4100 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4101 WRITE_COEF(0x45, 0x5289),
4102 UPDATE_COEF(0x4a, 0x0c00, 0),
4103 {}
4104 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004105
Takashi Iwai7639a062015-03-03 10:07:24 +01004106 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004107 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004108 alc_process_coef_fw(codec, coef0255_1);
4109 alc_process_coef_fw(codec, coef0255);
4110 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004111 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004112 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004113 alc_process_coef_fw(codec, coef0256);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004114 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004115 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004116 case 0x10ec0234:
4117 case 0x10ec0274:
4118 case 0x10ec0294:
4119 alc_process_coef_fw(codec, coef0274);
4120 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004121 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004122 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004123 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004124 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004125 case 0x10ec0286:
4126 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004127 alc_process_coef_fw(codec, coef0288);
4128 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004129 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004130 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004131 alc_process_coef_fw(codec, coef0288);
4132 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004133 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004134 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004135 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004136 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004137 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004138 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004139 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004140 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004141 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004142 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004143 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004144 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004145 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004146 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004147 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004148 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004149 alc_process_coef_fw(codec, coef0225);
4150 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004151 case 0x10ec0867:
4152 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4153 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004154 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004155 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004156}
4157
4158
4159static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4160 hda_nid_t mic_pin)
4161{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004162 static struct coef_fw coef0255[] = {
4163 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4164 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4165 {}
4166 };
4167 static struct coef_fw coef0233[] = {
4168 UPDATE_COEF(0x35, 0, 1<<14),
4169 WRITE_COEF(0x06, 0x2100),
4170 WRITE_COEF(0x1a, 0x0021),
4171 WRITE_COEF(0x26, 0x008c),
4172 {}
4173 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004174 static struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004175 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004176 UPDATE_COEF(0x50, 0x2000, 0),
4177 UPDATE_COEF(0x56, 0x0006, 0),
4178 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4179 UPDATE_COEF(0x66, 0x0008, 0x0008),
4180 UPDATE_COEF(0x67, 0x2000, 0x2000),
4181 {}
4182 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004183 static struct coef_fw coef0292[] = {
4184 WRITE_COEF(0x19, 0xa208),
4185 WRITE_COEF(0x2e, 0xacf0),
4186 {}
4187 };
4188 static struct coef_fw coef0293[] = {
4189 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4190 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4191 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4192 {}
4193 };
4194 static struct coef_fw coef0688[] = {
4195 WRITE_COEF(0xb7, 0x802b),
4196 WRITE_COEF(0xb5, 0x1040),
4197 UPDATE_COEF(0xc3, 0, 1<<12),
4198 {}
4199 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004200 static struct coef_fw coef0225[] = {
4201 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4202 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4203 UPDATE_COEF(0x63, 3<<14, 0),
4204 {}
4205 };
Kailang Yang71683c32017-06-20 16:33:50 +08004206 static struct coef_fw coef0274[] = {
4207 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4208 UPDATE_COEF(0x4a, 0x0010, 0),
4209 UPDATE_COEF(0x6b, 0xf000, 0),
4210 {}
4211 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004212
Takashi Iwai7639a062015-03-03 10:07:24 +01004213 switch (codec->core.vendor_id) {
Kailang Yang736f20a2017-10-20 15:06:34 +08004214 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004215 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004216 case 0x10ec0256:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004217 alc_write_coef_idx(codec, 0x45, 0xc489);
4218 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004219 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004220 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4221 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004222 case 0x10ec0234:
4223 case 0x10ec0274:
4224 case 0x10ec0294:
4225 alc_write_coef_idx(codec, 0x45, 0x4689);
4226 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4227 alc_process_coef_fw(codec, coef0274);
4228 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4229 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004230 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004231 case 0x10ec0283:
4232 alc_write_coef_idx(codec, 0x45, 0xc429);
4233 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004234 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004235 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4236 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004237 case 0x10ec0286:
4238 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004239 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004240 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4241 alc_process_coef_fw(codec, coef0288);
4242 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4243 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004244 case 0x10ec0292:
4245 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004246 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004247 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004248 case 0x10ec0293:
4249 /* Set to TRS mode */
4250 alc_write_coef_idx(codec, 0x45, 0xc429);
4251 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004252 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004253 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4254 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004255 case 0x10ec0867:
4256 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4257 /* fallthru */
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004258 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004259 case 0x10ec0662:
4260 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4261 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4262 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004263 case 0x10ec0668:
4264 alc_write_coef_idx(codec, 0x11, 0x0001);
4265 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004266 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004267 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4268 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004269 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004270 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004271 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004272 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004273 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004274 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004275 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004276 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4277 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4278 alc_process_coef_fw(codec, coef0225);
4279 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4280 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004281 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004282 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004283}
4284
4285static void alc_headset_mode_default(struct hda_codec *codec)
4286{
David Henningsson2ae95572016-02-25 09:37:05 +01004287 static struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004288 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4289 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4290 UPDATE_COEF(0x49, 3<<8, 0<<8),
4291 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4292 UPDATE_COEF(0x63, 3<<14, 0),
4293 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01004294 {}
4295 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004296 static struct coef_fw coef0255[] = {
4297 WRITE_COEF(0x45, 0xc089),
4298 WRITE_COEF(0x45, 0xc489),
4299 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4300 WRITE_COEF(0x49, 0x0049),
4301 {}
4302 };
4303 static struct coef_fw coef0233[] = {
4304 WRITE_COEF(0x06, 0x2100),
4305 WRITE_COEF(0x32, 0x4ea3),
4306 {}
4307 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004308 static struct coef_fw coef0288[] = {
4309 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4310 UPDATE_COEF(0x50, 0x2000, 0x2000),
4311 UPDATE_COEF(0x56, 0x0006, 0x0006),
4312 UPDATE_COEF(0x66, 0x0008, 0),
4313 UPDATE_COEF(0x67, 0x2000, 0),
4314 {}
4315 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004316 static struct coef_fw coef0292[] = {
4317 WRITE_COEF(0x76, 0x000e),
4318 WRITE_COEF(0x6c, 0x2400),
4319 WRITE_COEF(0x6b, 0xc429),
4320 WRITE_COEF(0x18, 0x7308),
4321 {}
4322 };
4323 static struct coef_fw coef0293[] = {
4324 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4325 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4326 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4327 {}
4328 };
4329 static struct coef_fw coef0688[] = {
4330 WRITE_COEF(0x11, 0x0041),
4331 WRITE_COEF(0x15, 0x0d40),
4332 WRITE_COEF(0xb7, 0x802b),
4333 {}
4334 };
Kailang Yang71683c32017-06-20 16:33:50 +08004335 static struct coef_fw coef0274[] = {
4336 WRITE_COEF(0x45, 0x4289),
4337 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4338 UPDATE_COEF(0x6b, 0x0f00, 0),
4339 UPDATE_COEF(0x49, 0x0300, 0x0300),
4340 {}
4341 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004342
Takashi Iwai7639a062015-03-03 10:07:24 +01004343 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08004344 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01004345 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004346 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004347 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004348 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004349 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004350 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01004351 alc_process_coef_fw(codec, coef0225);
4352 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004353 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004354 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004355 case 0x10ec0256:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004356 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004357 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004358 case 0x10ec0234:
4359 case 0x10ec0274:
4360 case 0x10ec0294:
4361 alc_process_coef_fw(codec, coef0274);
4362 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004363 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004364 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004365 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004366 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004367 case 0x10ec0286:
4368 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004369 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004370 alc_process_coef_fw(codec, coef0288);
4371 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004372 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004373 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004374 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004375 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004376 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004377 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004378 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004379 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004380 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004381 case 0x10ec0867:
4382 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4383 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004384 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004385 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004386}
4387
4388/* Iphone type */
4389static void alc_headset_mode_ctia(struct hda_codec *codec)
4390{
Kailang Yang89542932017-07-17 15:03:43 +08004391 int val;
4392
Takashi Iwai54db6c32014-08-18 15:11:19 +02004393 static struct coef_fw coef0255[] = {
4394 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4395 WRITE_COEF(0x1b, 0x0c2b),
4396 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4397 {}
4398 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004399 static struct coef_fw coef0256[] = {
4400 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4401 WRITE_COEF(0x1b, 0x0c6b),
4402 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4403 {}
4404 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004405 static struct coef_fw coef0233[] = {
4406 WRITE_COEF(0x45, 0xd429),
4407 WRITE_COEF(0x1b, 0x0c2b),
4408 WRITE_COEF(0x32, 0x4ea3),
4409 {}
4410 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004411 static struct coef_fw coef0288[] = {
4412 UPDATE_COEF(0x50, 0x2000, 0x2000),
4413 UPDATE_COEF(0x56, 0x0006, 0x0006),
4414 UPDATE_COEF(0x66, 0x0008, 0),
4415 UPDATE_COEF(0x67, 0x2000, 0),
4416 {}
4417 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004418 static struct coef_fw coef0292[] = {
4419 WRITE_COEF(0x6b, 0xd429),
4420 WRITE_COEF(0x76, 0x0008),
4421 WRITE_COEF(0x18, 0x7388),
4422 {}
4423 };
4424 static struct coef_fw coef0293[] = {
4425 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4426 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4427 {}
4428 };
4429 static struct coef_fw coef0688[] = {
4430 WRITE_COEF(0x11, 0x0001),
4431 WRITE_COEF(0x15, 0x0d60),
4432 WRITE_COEF(0xc3, 0x0000),
4433 {}
4434 };
Kailang Yang5a367672017-07-21 15:23:53 +08004435 static struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004436 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004437 UPDATE_COEF(0x63, 3<<14, 2<<14),
4438 {}
4439 };
4440 static struct coef_fw coef0225_2[] = {
4441 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4442 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004443 {}
4444 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004445
Takashi Iwai7639a062015-03-03 10:07:24 +01004446 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004447 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004448 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004449 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004450 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004451 case 0x10ec0256:
4452 alc_process_coef_fw(codec, coef0256);
4453 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004454 case 0x10ec0234:
4455 case 0x10ec0274:
4456 case 0x10ec0294:
4457 alc_write_coef_idx(codec, 0x45, 0xd689);
4458 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004459 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004460 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004461 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004462 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004463 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004464 val = alc_read_coef_idx(codec, 0x50);
4465 if (val & (1 << 12)) {
4466 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4467 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4468 msleep(300);
4469 } else {
4470 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4471 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4472 msleep(300);
4473 }
4474 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004475 case 0x10ec0286:
4476 case 0x10ec0288:
4477 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4478 msleep(300);
4479 alc_process_coef_fw(codec, coef0288);
4480 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004481 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004482 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004483 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004484 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004485 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004486 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004487 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004488 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004489 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004490 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004491 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004492 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004493 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004494 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004495 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004496 val = alc_read_coef_idx(codec, 0x45);
4497 if (val & (1 << 9))
4498 alc_process_coef_fw(codec, coef0225_2);
4499 else
4500 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004501 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004502 case 0x10ec0867:
4503 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4504 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004505 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004506 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004507}
4508
4509/* Nokia type */
4510static void alc_headset_mode_omtp(struct hda_codec *codec)
4511{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004512 static struct coef_fw coef0255[] = {
4513 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4514 WRITE_COEF(0x1b, 0x0c2b),
4515 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4516 {}
4517 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004518 static struct coef_fw coef0256[] = {
4519 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4520 WRITE_COEF(0x1b, 0x0c6b),
4521 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4522 {}
4523 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004524 static struct coef_fw coef0233[] = {
4525 WRITE_COEF(0x45, 0xe429),
4526 WRITE_COEF(0x1b, 0x0c2b),
4527 WRITE_COEF(0x32, 0x4ea3),
4528 {}
4529 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004530 static struct coef_fw coef0288[] = {
4531 UPDATE_COEF(0x50, 0x2000, 0x2000),
4532 UPDATE_COEF(0x56, 0x0006, 0x0006),
4533 UPDATE_COEF(0x66, 0x0008, 0),
4534 UPDATE_COEF(0x67, 0x2000, 0),
4535 {}
4536 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004537 static struct coef_fw coef0292[] = {
4538 WRITE_COEF(0x6b, 0xe429),
4539 WRITE_COEF(0x76, 0x0008),
4540 WRITE_COEF(0x18, 0x7388),
4541 {}
4542 };
4543 static struct coef_fw coef0293[] = {
4544 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4545 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4546 {}
4547 };
4548 static struct coef_fw coef0688[] = {
4549 WRITE_COEF(0x11, 0x0001),
4550 WRITE_COEF(0x15, 0x0d50),
4551 WRITE_COEF(0xc3, 0x0000),
4552 {}
4553 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004554 static struct coef_fw coef0225[] = {
4555 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004556 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004557 {}
4558 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004559
Takashi Iwai7639a062015-03-03 10:07:24 +01004560 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004561 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004562 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004563 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004564 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004565 case 0x10ec0256:
4566 alc_process_coef_fw(codec, coef0256);
4567 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004568 case 0x10ec0234:
4569 case 0x10ec0274:
4570 case 0x10ec0294:
4571 alc_write_coef_idx(codec, 0x45, 0xe689);
4572 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004573 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004574 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004575 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004576 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004577 case 0x10ec0298:
4578 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08004579 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4580 msleep(300);
4581 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004582 case 0x10ec0286:
4583 case 0x10ec0288:
4584 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4585 msleep(300);
4586 alc_process_coef_fw(codec, coef0288);
4587 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004588 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004589 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004590 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004591 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004592 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004593 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004594 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004595 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004596 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004597 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004598 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004599 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004600 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004601 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004602 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004603 alc_process_coef_fw(codec, coef0225);
4604 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004605 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004606 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004607}
4608
4609static void alc_determine_headset_type(struct hda_codec *codec)
4610{
4611 int val;
4612 bool is_ctia = false;
4613 struct alc_spec *spec = codec->spec;
Takashi Iwai54db6c32014-08-18 15:11:19 +02004614 static struct coef_fw coef0255[] = {
4615 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4616 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4617 conteol) */
4618 {}
4619 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004620 static struct coef_fw coef0288[] = {
4621 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4622 {}
4623 };
Kailang Yang89542932017-07-17 15:03:43 +08004624 static struct coef_fw coef0298[] = {
4625 UPDATE_COEF(0x50, 0x2000, 0x2000),
4626 UPDATE_COEF(0x56, 0x0006, 0x0006),
4627 UPDATE_COEF(0x66, 0x0008, 0),
4628 UPDATE_COEF(0x67, 0x2000, 0),
4629 UPDATE_COEF(0x19, 0x1300, 0x1300),
4630 {}
4631 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004632 static struct coef_fw coef0293[] = {
4633 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4634 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4635 {}
4636 };
4637 static struct coef_fw coef0688[] = {
4638 WRITE_COEF(0x11, 0x0001),
4639 WRITE_COEF(0xb7, 0x802b),
4640 WRITE_COEF(0x15, 0x0d60),
4641 WRITE_COEF(0xc3, 0x0c00),
4642 {}
4643 };
Kailang Yang71683c32017-06-20 16:33:50 +08004644 static struct coef_fw coef0274[] = {
4645 UPDATE_COEF(0x4a, 0x0010, 0),
4646 UPDATE_COEF(0x4a, 0x8000, 0),
4647 WRITE_COEF(0x45, 0xd289),
4648 UPDATE_COEF(0x49, 0x0300, 0x0300),
4649 {}
4650 };
David Henningsson73bdd592013-04-15 15:44:14 +02004651
Takashi Iwai7639a062015-03-03 10:07:24 +01004652 switch (codec->core.vendor_id) {
Kailang Yang736f20a2017-10-20 15:06:34 +08004653 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004654 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004655 case 0x10ec0256:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004656 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004657 msleep(300);
4658 val = alc_read_coef_idx(codec, 0x46);
4659 is_ctia = (val & 0x0070) == 0x0070;
4660 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004661 case 0x10ec0234:
4662 case 0x10ec0274:
4663 case 0x10ec0294:
4664 alc_process_coef_fw(codec, coef0274);
4665 msleep(80);
4666 val = alc_read_coef_idx(codec, 0x46);
4667 is_ctia = (val & 0x00f0) == 0x00f0;
4668 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004669 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004670 case 0x10ec0283:
4671 alc_write_coef_idx(codec, 0x45, 0xd029);
4672 msleep(300);
4673 val = alc_read_coef_idx(codec, 0x46);
4674 is_ctia = (val & 0x0070) == 0x0070;
4675 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004676 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004677 snd_hda_codec_write(codec, 0x21, 0,
4678 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4679 msleep(100);
4680 snd_hda_codec_write(codec, 0x21, 0,
4681 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4682 msleep(200);
4683
4684 val = alc_read_coef_idx(codec, 0x50);
4685 if (val & (1 << 12)) {
4686 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4687 alc_process_coef_fw(codec, coef0288);
4688 msleep(350);
4689 val = alc_read_coef_idx(codec, 0x50);
4690 is_ctia = (val & 0x0070) == 0x0070;
4691 } else {
4692 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4693 alc_process_coef_fw(codec, coef0288);
4694 msleep(350);
4695 val = alc_read_coef_idx(codec, 0x50);
4696 is_ctia = (val & 0x0070) == 0x0070;
4697 }
4698 alc_process_coef_fw(codec, coef0298);
4699 snd_hda_codec_write(codec, 0x21, 0,
4700 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4701 msleep(75);
4702 snd_hda_codec_write(codec, 0x21, 0,
4703 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4704 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004705 case 0x10ec0286:
4706 case 0x10ec0288:
4707 alc_process_coef_fw(codec, coef0288);
4708 msleep(350);
4709 val = alc_read_coef_idx(codec, 0x50);
4710 is_ctia = (val & 0x0070) == 0x0070;
4711 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004712 case 0x10ec0292:
4713 alc_write_coef_idx(codec, 0x6b, 0xd429);
4714 msleep(300);
4715 val = alc_read_coef_idx(codec, 0x6c);
4716 is_ctia = (val & 0x001c) == 0x001c;
4717 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004718 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004719 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004720 msleep(300);
4721 val = alc_read_coef_idx(codec, 0x46);
4722 is_ctia = (val & 0x0070) == 0x0070;
4723 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004724 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004725 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004726 msleep(300);
4727 val = alc_read_coef_idx(codec, 0xbe);
4728 is_ctia = (val & 0x1c02) == 0x1c02;
4729 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004730 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004731 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004732 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004733 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004734 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004735 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08004736 snd_hda_codec_write(codec, 0x21, 0,
4737 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4738 msleep(80);
4739 snd_hda_codec_write(codec, 0x21, 0,
4740 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4741
Kailang Yang5a367672017-07-21 15:23:53 +08004742 alc_process_coef_fw(codec, alc225_pre_hsmode);
4743 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4744 val = alc_read_coef_idx(codec, 0x45);
4745 if (val & (1 << 9)) {
4746 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4747 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4748 msleep(800);
4749 val = alc_read_coef_idx(codec, 0x46);
4750 is_ctia = (val & 0x00f0) == 0x00f0;
4751 } else {
4752 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4753 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4754 msleep(800);
4755 val = alc_read_coef_idx(codec, 0x46);
4756 is_ctia = (val & 0x00f0) == 0x00f0;
4757 }
4758 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4759 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4760 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08004761
4762 snd_hda_codec_write(codec, 0x21, 0,
4763 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4764 msleep(80);
4765 snd_hda_codec_write(codec, 0x21, 0,
4766 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004767 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004768 case 0x10ec0867:
4769 is_ctia = true;
4770 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004771 }
4772
Takashi Iwai4e76a882014-02-25 12:21:03 +01004773 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02004774 is_ctia ? "yes" : "no");
4775 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4776}
4777
4778static void alc_update_headset_mode(struct hda_codec *codec)
4779{
4780 struct alc_spec *spec = codec->spec;
4781
4782 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
4783 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
4784
4785 int new_headset_mode;
4786
4787 if (!snd_hda_jack_detect(codec, hp_pin))
4788 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4789 else if (mux_pin == spec->headset_mic_pin)
4790 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4791 else if (mux_pin == spec->headphone_mic_pin)
4792 new_headset_mode = ALC_HEADSET_MODE_MIC;
4793 else
4794 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4795
David Henningsson5959a6b2013-11-12 11:10:57 +01004796 if (new_headset_mode == spec->current_headset_mode) {
4797 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02004798 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01004799 }
David Henningsson73bdd592013-04-15 15:44:14 +02004800
4801 switch (new_headset_mode) {
4802 case ALC_HEADSET_MODE_UNPLUGGED:
4803 alc_headset_mode_unplugged(codec);
4804 spec->gen.hp_jack_present = false;
4805 break;
4806 case ALC_HEADSET_MODE_HEADSET:
4807 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4808 alc_determine_headset_type(codec);
4809 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4810 alc_headset_mode_ctia(codec);
4811 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4812 alc_headset_mode_omtp(codec);
4813 spec->gen.hp_jack_present = true;
4814 break;
4815 case ALC_HEADSET_MODE_MIC:
4816 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4817 spec->gen.hp_jack_present = false;
4818 break;
4819 case ALC_HEADSET_MODE_HEADPHONE:
4820 alc_headset_mode_default(codec);
4821 spec->gen.hp_jack_present = true;
4822 break;
4823 }
4824 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4825 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4826 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02004827 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02004828 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4829 PIN_VREFHIZ);
4830 }
4831 spec->current_headset_mode = new_headset_mode;
4832
4833 snd_hda_gen_update_outputs(codec);
4834}
4835
4836static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01004837 struct snd_kcontrol *kcontrol,
4838 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02004839{
4840 alc_update_headset_mode(codec);
4841}
4842
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02004843static void alc_update_headset_jack_cb(struct hda_codec *codec,
4844 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02004845{
4846 struct alc_spec *spec = codec->spec;
David Henningsson5db4d342013-11-22 12:17:06 +01004847 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02004848 snd_hda_gen_hp_automute(codec, jack);
4849}
4850
4851static void alc_probe_headset_mode(struct hda_codec *codec)
4852{
4853 int i;
4854 struct alc_spec *spec = codec->spec;
4855 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4856
4857 /* Find mic pins */
4858 for (i = 0; i < cfg->num_inputs; i++) {
4859 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4860 spec->headset_mic_pin = cfg->inputs[i].pin;
4861 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4862 spec->headphone_mic_pin = cfg->inputs[i].pin;
4863 }
4864
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02004865 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02004866 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4867 spec->gen.automute_hook = alc_update_headset_mode;
4868 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4869}
4870
4871static void alc_fixup_headset_mode(struct hda_codec *codec,
4872 const struct hda_fixup *fix, int action)
4873{
4874 struct alc_spec *spec = codec->spec;
4875
4876 switch (action) {
4877 case HDA_FIXUP_ACT_PRE_PROBE:
4878 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4879 break;
4880 case HDA_FIXUP_ACT_PROBE:
4881 alc_probe_headset_mode(codec);
4882 break;
4883 case HDA_FIXUP_ACT_INIT:
4884 spec->current_headset_mode = 0;
4885 alc_update_headset_mode(codec);
4886 break;
4887 }
4888}
4889
4890static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4891 const struct hda_fixup *fix, int action)
4892{
4893 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4894 struct alc_spec *spec = codec->spec;
4895 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4896 }
4897 else
4898 alc_fixup_headset_mode(codec, fix, action);
4899}
4900
Kailang Yang31278992014-03-03 15:27:22 +08004901static void alc255_set_default_jack_type(struct hda_codec *codec)
4902{
4903 /* Set to iphone type */
Kailang Yange69e7e02016-05-30 15:58:28 +08004904 static struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004905 WRITE_COEF(0x1b, 0x880b),
4906 WRITE_COEF(0x45, 0xd089),
4907 WRITE_COEF(0x1b, 0x080b),
4908 WRITE_COEF(0x46, 0x0004),
4909 WRITE_COEF(0x1b, 0x0c0b),
4910 {}
4911 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004912 static struct coef_fw alc256fw[] = {
4913 WRITE_COEF(0x1b, 0x884b),
4914 WRITE_COEF(0x45, 0xd089),
4915 WRITE_COEF(0x1b, 0x084b),
4916 WRITE_COEF(0x46, 0x0004),
4917 WRITE_COEF(0x1b, 0x0c4b),
4918 {}
4919 };
4920 switch (codec->core.vendor_id) {
4921 case 0x10ec0255:
4922 alc_process_coef_fw(codec, alc255fw);
4923 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004924 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004925 case 0x10ec0256:
4926 alc_process_coef_fw(codec, alc256fw);
4927 break;
4928 }
Kailang Yang31278992014-03-03 15:27:22 +08004929 msleep(30);
4930}
4931
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004932static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4933 const struct hda_fixup *fix, int action)
4934{
4935 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08004936 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004937 }
4938 alc_fixup_headset_mode(codec, fix, action);
4939}
4940
Kailang Yang31278992014-03-03 15:27:22 +08004941static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
4942 const struct hda_fixup *fix, int action)
4943{
4944 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4945 struct alc_spec *spec = codec->spec;
4946 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4947 alc255_set_default_jack_type(codec);
4948 }
4949 else
4950 alc_fixup_headset_mode(codec, fix, action);
4951}
4952
Kailang Yange1e62b92015-04-08 16:01:22 +08004953static void alc288_update_headset_jack_cb(struct hda_codec *codec,
4954 struct hda_jack_callback *jack)
4955{
4956 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08004957
4958 alc_update_headset_jack_cb(codec, jack);
4959 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02004960 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08004961}
4962
4963static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
4964 const struct hda_fixup *fix, int action)
4965{
4966 alc_fixup_headset_mode(codec, fix, action);
4967 if (action == HDA_FIXUP_ACT_PROBE) {
4968 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02004969 /* toggled via hp_automute_hook */
4970 spec->gpio_mask |= 0x40;
4971 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08004972 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
4973 }
4974}
4975
Hui Wang493a52a2014-01-14 14:07:36 +08004976static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
4977 const struct hda_fixup *fix, int action)
4978{
4979 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4980 struct alc_spec *spec = codec->spec;
4981 spec->gen.auto_mute_via_amp = 1;
4982 }
4983}
4984
Takashi Iwai9b745ab2014-03-07 08:37:19 +01004985static void alc_no_shutup(struct hda_codec *codec)
4986{
4987}
4988
4989static void alc_fixup_no_shutup(struct hda_codec *codec,
4990 const struct hda_fixup *fix, int action)
4991{
Takashi Iwaiefe55732018-06-15 11:55:02 +02004992 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01004993 struct alc_spec *spec = codec->spec;
4994 spec->shutup = alc_no_shutup;
4995 }
4996}
4997
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02004998static void alc_fixup_disable_aamix(struct hda_codec *codec,
4999 const struct hda_fixup *fix, int action)
5000{
5001 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5002 struct alc_spec *spec = codec->spec;
5003 /* Disable AA-loopback as it causes white noise */
5004 spec->gen.mixer_nid = 0;
5005 }
5006}
5007
Takashi Iwai7f57d802015-09-24 17:36:51 +02005008/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5009static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5010 const struct hda_fixup *fix, int action)
5011{
5012 static const struct hda_pintbl pincfgs[] = {
5013 { 0x16, 0x21211010 }, /* dock headphone */
5014 { 0x19, 0x21a11010 }, /* dock mic */
5015 { }
5016 };
5017 struct alc_spec *spec = codec->spec;
5018
5019 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai70a09762015-12-15 14:59:58 +01005020 spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */
Takashi Iwai7f57d802015-09-24 17:36:51 +02005021 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5022 codec->power_save_node = 0; /* avoid click noises */
5023 snd_hda_apply_pincfgs(codec, pincfgs);
5024 }
5025}
5026
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005027static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5028 const struct hda_fixup *fix, int action)
5029{
5030 static const struct hda_pintbl pincfgs[] = {
5031 { 0x17, 0x21211010 }, /* dock headphone */
5032 { 0x19, 0x21a11010 }, /* dock mic */
5033 { }
5034 };
Takashi Iwai54947cd2018-12-03 10:44:15 +01005035 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5036 * the speaker output becomes too low by some reason on Thinkpads with
5037 * ALC298 codec
5038 */
5039 static hda_nid_t preferred_pairs[] = {
5040 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5041 0
5042 };
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005043 struct alc_spec *spec = codec->spec;
5044
5045 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai54947cd2018-12-03 10:44:15 +01005046 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005047 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005048 snd_hda_apply_pincfgs(codec, pincfgs);
5049 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005050 /* Enable DOCK device */
5051 snd_hda_codec_write(codec, 0x17, 0,
5052 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5053 /* Enable DOCK device */
5054 snd_hda_codec_write(codec, 0x19, 0,
5055 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005056 }
5057}
5058
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005059static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005060{
5061 struct alc_spec *spec = codec->spec;
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005062 int hp_pin = spec->gen.autocfg.hp_pins[0];
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005063
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005064 /* Prevent pop noises when headphones are plugged in */
5065 snd_hda_codec_write(codec, hp_pin, 0,
5066 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5067 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005068}
5069
5070static void alc_fixup_dell_xps13(struct hda_codec *codec,
5071 const struct hda_fixup *fix, int action)
5072{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005073 struct alc_spec *spec = codec->spec;
5074 struct hda_input_mux *imux = &spec->gen.input_mux;
5075 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005076
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005077 switch (action) {
5078 case HDA_FIXUP_ACT_PRE_PROBE:
5079 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5080 * it causes a click noise at start up
5081 */
5082 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005083 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005084 break;
5085 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005086 /* Make the internal mic the default input source. */
5087 for (i = 0; i < imux->num_items; i++) {
5088 if (spec->gen.imux_pins[i] == 0x12) {
5089 spec->gen.cur_mux[0] = i;
5090 break;
5091 }
5092 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005093 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005094 }
5095}
5096
David Henningsson1f8b46c2015-05-12 14:38:15 +02005097static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5098 const struct hda_fixup *fix, int action)
5099{
5100 struct alc_spec *spec = codec->spec;
5101
5102 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5103 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5104 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005105
5106 /* Disable boost for mic-in permanently. (This code is only called
5107 from quirks that guarantee that the headphone is at NID 0x1b.) */
5108 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5109 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005110 } else
5111 alc_fixup_headset_mode(codec, fix, action);
5112}
5113
David Henningsson73bdd592013-04-15 15:44:14 +02005114static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5115 const struct hda_fixup *fix, int action)
5116{
5117 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005118 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005119 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005120 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5121 }
5122 alc_fixup_headset_mode(codec, fix, action);
5123}
5124
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005125/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5126static int find_ext_mic_pin(struct hda_codec *codec)
5127{
5128 struct alc_spec *spec = codec->spec;
5129 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5130 hda_nid_t nid;
5131 unsigned int defcfg;
5132 int i;
5133
5134 for (i = 0; i < cfg->num_inputs; i++) {
5135 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5136 continue;
5137 nid = cfg->inputs[i].pin;
5138 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5139 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5140 continue;
5141 return nid;
5142 }
5143
5144 return 0;
5145}
5146
Dylan Reid08a978d2012-11-18 22:56:40 -08005147static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005148 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005149 int action)
5150{
5151 struct alc_spec *spec = codec->spec;
5152
Takashi Iwai0db75792013-01-23 13:57:20 +01005153 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005154 int mic_pin = find_ext_mic_pin(codec);
5155 int hp_pin = spec->gen.autocfg.hp_pins[0];
5156
5157 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005158 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005159 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005160 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005161}
David Henningsson693b6132012-06-22 19:12:10 +02005162
David Henningsson3e0d6112013-04-22 14:30:14 +02005163static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5164 const struct hda_fixup *fix,
5165 int action)
5166{
5167 struct alc_spec *spec = codec->spec;
5168 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5169 int i;
5170
5171 /* The mic boosts on level 2 and 3 are too noisy
5172 on the internal mic input.
5173 Therefore limit the boost to 0 or 1. */
5174
5175 if (action != HDA_FIXUP_ACT_PROBE)
5176 return;
5177
5178 for (i = 0; i < cfg->num_inputs; i++) {
5179 hda_nid_t nid = cfg->inputs[i].pin;
5180 unsigned int defcfg;
5181 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5182 continue;
5183 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5184 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5185 continue;
5186
5187 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5188 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5189 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5190 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5191 (0 << AC_AMPCAP_MUTE_SHIFT));
5192 }
5193}
5194
Kailang Yangcd217a62013-08-22 10:15:24 +02005195static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005196 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005197{
5198 struct alc_spec *spec = codec->spec;
5199 int vref;
5200
5201 msleep(200);
5202 snd_hda_gen_hp_automute(codec, jack);
5203
5204 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5205
5206 msleep(600);
5207 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5208 vref);
5209}
5210
Kailang Yangcd217a62013-08-22 10:15:24 +02005211static void alc283_fixup_chromebook(struct hda_codec *codec,
5212 const struct hda_fixup *fix, int action)
5213{
5214 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005215
5216 switch (action) {
5217 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005218 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005219 /* Disable AA-loopback as it causes white noise */
5220 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08005221 break;
5222 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08005223 /* MIC2-VREF control */
5224 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005225 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08005226 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02005227 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08005228 break;
5229 }
5230}
5231
5232static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5233 const struct hda_fixup *fix, int action)
5234{
5235 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08005236
5237 switch (action) {
5238 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02005239 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5240 break;
5241 case HDA_FIXUP_ACT_INIT:
5242 /* MIC2-VREF control */
5243 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005244 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02005245 break;
5246 }
5247}
5248
Takashi Iwai7bba2152013-09-06 15:45:38 +02005249/* mute tablet speaker pin (0x14) via dock plugging in addition */
5250static void asus_tx300_automute(struct hda_codec *codec)
5251{
5252 struct alc_spec *spec = codec->spec;
5253 snd_hda_gen_update_outputs(codec);
5254 if (snd_hda_jack_detect(codec, 0x1b))
5255 spec->gen.mute_bits |= (1ULL << 0x14);
5256}
5257
5258static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5259 const struct hda_fixup *fix, int action)
5260{
5261 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005262 static const struct hda_pintbl dock_pins[] = {
5263 { 0x1b, 0x21114000 }, /* dock speaker pin */
5264 {}
5265 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02005266
5267 switch (action) {
5268 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02005269 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02005270 /* TX300 needs to set up GPIO2 for the speaker amp */
5271 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02005272 snd_hda_apply_pincfgs(codec, dock_pins);
5273 spec->gen.auto_mute_via_amp = 1;
5274 spec->gen.automute_hook = asus_tx300_automute;
5275 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005276 snd_hda_gen_hp_automute);
5277 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02005278 case HDA_FIXUP_ACT_PROBE:
5279 spec->init_amp = ALC_INIT_DEFAULT;
5280 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005281 case HDA_FIXUP_ACT_BUILD:
5282 /* this is a bit tricky; give more sane names for the main
5283 * (tablet) speaker and the dock speaker, respectively
5284 */
Takashi Iwai56798e62017-04-11 08:10:52 +02005285 rename_ctl(codec, "Speaker Playback Switch",
5286 "Dock Speaker Playback Switch");
5287 rename_ctl(codec, "Bass Speaker Playback Switch",
5288 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02005289 break;
5290 }
5291}
5292
David Henningsson338cae52013-10-07 10:39:59 +02005293static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5294 const struct hda_fixup *fix, int action)
5295{
David Henningsson0f4881d2013-12-20 16:08:13 +01005296 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5297 /* DAC node 0x03 is giving mono output. We therefore want to
5298 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5299 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5300 hda_nid_t conn1[2] = { 0x0c };
5301 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
5302 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
5303 }
David Henningsson338cae52013-10-07 10:39:59 +02005304}
5305
Hui Wangdd9aa332016-08-01 10:20:32 +08005306static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5307 const struct hda_fixup *fix, int action)
5308{
5309 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5310 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5311 we can't adjust the speaker's volume since this node does not has
5312 Amp-out capability. we change the speaker's route to:
5313 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5314 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5315 speaker's volume now. */
5316
5317 hda_nid_t conn1[1] = { 0x0c };
5318 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
5319 }
5320}
5321
Takashi Iwaie312a862018-03-06 12:14:17 +01005322/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5323static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5324 const struct hda_fixup *fix, int action)
5325{
5326 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5327 hda_nid_t conn[2] = { 0x02, 0x03 };
5328 snd_hda_override_conn_list(codec, 0x17, 2, conn);
5329 }
5330}
5331
Keith Packard98973f22015-07-15 12:14:39 -07005332/* Hook to update amp GPIO4 for automute */
5333static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5334 struct hda_jack_callback *jack)
5335{
5336 struct alc_spec *spec = codec->spec;
5337
5338 snd_hda_gen_hp_automute(codec, jack);
5339 /* mute_led_polarity is set to 0, so we pass inverted value here */
5340 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
5341}
5342
5343/* Manage GPIOs for HP EliteBook Folio 9480m.
5344 *
5345 * GPIO4 is the headphone amplifier power control
5346 * GPIO3 is the audio output mute indicator LED
5347 */
5348
5349static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5350 const struct hda_fixup *fix,
5351 int action)
5352{
5353 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07005354
Takashi Iwai01e4a272018-06-19 22:47:30 +02005355 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07005356 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02005357 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5358 spec->gpio_mask |= 0x10;
5359 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07005360 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07005361 }
5362}
5363
Takashi Iwaiae065f12018-06-19 23:00:03 +02005364static void alc275_fixup_gpio4_off(struct hda_codec *codec,
5365 const struct hda_fixup *fix,
5366 int action)
5367{
5368 struct alc_spec *spec = codec->spec;
5369
5370 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5371 spec->gpio_mask |= 0x04;
5372 spec->gpio_dir |= 0x04;
5373 /* set data bit low */
5374 }
5375}
5376
Kailang Yangca169cc2017-04-25 16:17:40 +08005377static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5378 const struct hda_fixup *fix,
5379 int action)
5380{
5381 alc_fixup_dual_codecs(codec, fix, action);
5382 switch (action) {
5383 case HDA_FIXUP_ACT_PRE_PROBE:
5384 /* override card longname to provide a unique UCM profile */
5385 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5386 break;
5387 case HDA_FIXUP_ACT_BUILD:
5388 /* rename Capture controls depending on the codec */
5389 rename_ctl(codec, "Capture Volume",
5390 codec->addr == 0 ?
5391 "Rear-Panel Capture Volume" :
5392 "Front-Panel Capture Volume");
5393 rename_ctl(codec, "Capture Switch",
5394 codec->addr == 0 ?
5395 "Rear-Panel Capture Switch" :
5396 "Front-Panel Capture Switch");
5397 break;
5398 }
5399}
5400
Kailang Yang92266652017-12-14 15:28:58 +08005401/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5402static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5403 const struct hda_fixup *fix, int action)
5404{
5405 struct alc_spec *spec = codec->spec;
5406 static hda_nid_t preferred_pairs[] = {
5407 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5408 0
5409 };
5410
5411 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5412 return;
5413
5414 spec->gen.preferred_dacs = preferred_pairs;
5415}
5416
Hui Wangc4cfcf62018-11-26 14:17:16 +08005417/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
5418static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
5419 const struct hda_fixup *fix, int action)
5420{
5421 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5422 return;
5423
5424 snd_hda_override_wcaps(codec, 0x03, 0);
5425}
5426
Kailang Yange8547472018-11-28 15:32:45 +08005427static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
5428 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
5429 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
5430 { SND_JACK_BTN_2, KEY_VOLUMEUP },
5431 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
5432 {}
5433};
5434
5435static void alc_headset_btn_callback(struct hda_codec *codec,
5436 struct hda_jack_callback *jack)
5437{
5438 int report = 0;
5439
5440 if (jack->unsol_res & (7 << 13))
5441 report |= SND_JACK_BTN_0;
5442
5443 if (jack->unsol_res & (1 << 16 | 3 << 8))
5444 report |= SND_JACK_BTN_1;
5445
5446 /* Volume up key */
5447 if (jack->unsol_res & (7 << 23))
5448 report |= SND_JACK_BTN_2;
5449
5450 /* Volume down key */
5451 if (jack->unsol_res & (7 << 10))
5452 report |= SND_JACK_BTN_3;
5453
5454 jack->jack->button_state = report;
5455}
5456
5457static void alc_fixup_headset_jack(struct hda_codec *codec,
5458 const struct hda_fixup *fix, int action)
5459{
5460
5461 switch (action) {
5462 case HDA_FIXUP_ACT_PRE_PROBE:
5463 snd_hda_jack_detect_enable_callback(codec, 0x55,
5464 alc_headset_btn_callback);
5465 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
5466 SND_JACK_HEADSET, alc_headset_btn_keymap);
5467 break;
5468 case HDA_FIXUP_ACT_INIT:
5469 switch (codec->core.vendor_id) {
5470 case 0x10ec0225:
5471 case 0x10ec0295:
5472 case 0x10ec0299:
5473 alc_write_coef_idx(codec, 0x48, 0xd011);
5474 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
5475 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
5476 break;
5477 case 0x10ec0236:
5478 case 0x10ec0256:
5479 alc_write_coef_idx(codec, 0x48, 0xd011);
5480 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
5481 break;
5482 }
5483 break;
5484 }
5485}
5486
Kailang Yangd1dd4212019-01-09 17:05:24 +08005487static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
5488 const struct hda_fixup *fix, int action)
5489{
5490 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5491 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5492}
5493
Takashi Iwaib317b032014-01-08 11:44:21 +01005494/* for hda_fixup_thinkpad_acpi() */
5495#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01005496
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02005497static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5498 const struct hda_fixup *fix, int action)
5499{
5500 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5501 hda_fixup_thinkpad_acpi(codec, fix, action);
5502}
5503
Tom Bridenbbf8ff62018-05-29 17:34:20 +01005504/* for alc295_fixup_hp_top_speakers */
5505#include "hp_x360_helper.c"
5506
Takashi Iwai1d045db2011-07-07 18:23:21 +02005507enum {
5508 ALC269_FIXUP_SONY_VAIO,
5509 ALC275_FIXUP_SONY_VAIO_GPIO2,
5510 ALC269_FIXUP_DELL_M101Z,
5511 ALC269_FIXUP_SKU_IGNORE,
5512 ALC269_FIXUP_ASUS_G73JW,
5513 ALC269_FIXUP_LENOVO_EAPD,
5514 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02005515 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005516 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02005517 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005518 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02005519 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02005520 ALC269_FIXUP_QUANTA_MUTE,
5521 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02005522 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02005523 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02005524 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01005525 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02005526 ALC269_FIXUP_AMIC,
5527 ALC269_FIXUP_DMIC,
5528 ALC269VB_FIXUP_AMIC,
5529 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005530 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01005531 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005532 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00005533 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01005534 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08005535 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5536 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02005537 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02005538 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005539 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02005540 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02005541 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02005542 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5543 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02005544 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08005545 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02005546 ALC269_FIXUP_HEADSET_MODE,
5547 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02005548 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02005549 ALC269_FIXUP_ASUS_X101_FUNC,
5550 ALC269_FIXUP_ASUS_X101_VERB,
5551 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08005552 ALC271_FIXUP_AMIC_MIC2,
5553 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01005554 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07005555 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02005556 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01005557 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01005558 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01005559 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02005560 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02005561 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08005562 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005563 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02005564 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02005565 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01005566 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5567 ALC290_FIXUP_SUBWOOFER,
5568 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01005569 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01005570 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06005571 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06005572 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005573 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08005574 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005575 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08005576 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08005577 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02005578 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01005579 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02005580 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01005581 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02005582 ALC282_FIXUP_ASPIRE_V5_PINS,
David Henningsson7a5255f2014-10-30 08:26:01 +01005583 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08005584 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01005585 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01005586 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01005587 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07005588 ALC280_FIXUP_HP_9480M,
Kailang Yange1e62b92015-04-08 16:01:22 +08005589 ALC288_FIXUP_DELL_HEADSET_MODE,
5590 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08005591 ALC288_FIXUP_DELL_XPS_13,
5592 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02005593 ALC292_FIXUP_DELL_E7X,
5594 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01005595 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
Kailang Yang977e6272015-05-18 15:31:20 +08005596 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08005597 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08005598 ALC275_FIXUP_DELL_XPS,
Hui Wang8c697292015-11-24 11:08:18 +08005599 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
Hui Wang23adc192015-12-08 12:27:18 +08005600 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08005601 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08005602 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08005603 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01005604 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01005605 ALC295_FIXUP_DISABLE_DAC3,
Takashi Iwaif8839822016-02-25 14:31:59 +01005606 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08005607 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02005608 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08005609 ALC298_FIXUP_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08005610 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01005611 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08005612 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06005613 ALC256_FIXUP_ASUS_HEADSET_MODE,
5614 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06005615 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06005616 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
5617 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08005618 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Hui Wangf33f79f2017-07-07 12:08:29 +08005619 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08005620 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
PeiSen Houb84e8432017-09-01 15:11:56 +08005621 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08005622 ALC274_FIXUP_DELL_BIND_DACS,
5623 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005624 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08005625 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08005626 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05005627 ALC256_FIXUP_HUAWEI_MBXP_PINS,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01005628 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08005629 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08005630 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05005631 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08005632 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08005633 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08005634 ALC294_FIXUP_ASUS_HEADSET_MIC,
5635 ALC294_FIXUP_ASUS_SPK,
Kailang Yange8547472018-11-28 15:32:45 +08005636 ALC225_FIXUP_HEADSET_JACK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07005637 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005638};
5639
Takashi Iwai1727a772013-01-10 09:52:52 +01005640static const struct hda_fixup alc269_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005641 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01005642 .type = HDA_FIXUP_PINCTLS,
5643 .v.pins = (const struct hda_pintbl[]) {
5644 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02005645 {}
5646 }
5647 },
5648 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02005649 .type = HDA_FIXUP_FUNC,
5650 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005651 .chained = true,
5652 .chain_id = ALC269_FIXUP_SONY_VAIO
5653 },
5654 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005655 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005656 .v.verbs = (const struct hda_verb[]) {
5657 /* Enables internal speaker */
5658 {0x20, AC_VERB_SET_COEF_INDEX, 13},
5659 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
5660 {}
5661 }
5662 },
5663 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005664 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02005665 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005666 },
5667 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005668 .type = HDA_FIXUP_PINS,
5669 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005670 { 0x17, 0x99130111 }, /* subwoofer */
5671 { }
5672 }
5673 },
5674 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005675 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005676 .v.verbs = (const struct hda_verb[]) {
5677 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5678 {}
5679 }
5680 },
5681 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005682 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005683 .v.func = alc269_fixup_hweq,
5684 .chained = true,
5685 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5686 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02005687 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5688 .type = HDA_FIXUP_FUNC,
5689 .v.func = alc_fixup_disable_aamix,
5690 .chained = true,
5691 .chain_id = ALC269_FIXUP_SONY_VAIO
5692 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02005693 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005694 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005695 .v.func = alc271_fixup_dmic,
5696 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02005697 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005698 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02005699 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02005700 .chained = true,
5701 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02005702 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005703 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005704 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005705 .v.func = alc269_fixup_stereo_dmic,
5706 },
David Henningsson7c478f02013-10-11 10:18:46 +02005707 [ALC269_FIXUP_HEADSET_MIC] = {
5708 .type = HDA_FIXUP_FUNC,
5709 .v.func = alc269_fixup_headset_mic,
5710 },
Takashi Iwai24519912011-08-16 15:08:49 +02005711 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005712 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02005713 .v.func = alc269_fixup_quanta_mute,
5714 },
5715 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005716 .type = HDA_FIXUP_PINS,
5717 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02005718 { 0x1a, 0x2101103f }, /* dock line-out */
5719 { 0x1b, 0x23a11040 }, /* dock mic-in */
5720 { }
5721 },
5722 .chained = true,
5723 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5724 },
David Henningsson2041d562014-06-13 11:15:44 +02005725 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5726 .type = HDA_FIXUP_PINS,
5727 .v.pins = (const struct hda_pintbl[]) {
5728 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5729 { }
5730 },
5731 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02005732 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5733 .type = HDA_FIXUP_PINS,
5734 .v.pins = (const struct hda_pintbl[]) {
5735 { 0x21, 0x0221102f }, /* HP out */
5736 { }
5737 },
5738 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02005739 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5740 .type = HDA_FIXUP_FUNC,
5741 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5742 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01005743 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5744 .type = HDA_FIXUP_FUNC,
5745 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5746 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02005747 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005748 .type = HDA_FIXUP_PINS,
5749 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005750 { 0x14, 0x99130110 }, /* speaker */
5751 { 0x15, 0x0121401f }, /* HP out */
5752 { 0x18, 0x01a19c20 }, /* mic */
5753 { 0x19, 0x99a3092f }, /* int-mic */
5754 { }
5755 },
5756 },
5757 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005758 .type = HDA_FIXUP_PINS,
5759 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005760 { 0x12, 0x99a3092f }, /* int-mic */
5761 { 0x14, 0x99130110 }, /* speaker */
5762 { 0x15, 0x0121401f }, /* HP out */
5763 { 0x18, 0x01a19c20 }, /* mic */
5764 { }
5765 },
5766 },
5767 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005768 .type = HDA_FIXUP_PINS,
5769 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005770 { 0x14, 0x99130110 }, /* speaker */
5771 { 0x18, 0x01a19c20 }, /* mic */
5772 { 0x19, 0x99a3092f }, /* int-mic */
5773 { 0x21, 0x0121401f }, /* HP out */
5774 { }
5775 },
5776 },
David Henningsson2267ea92012-01-03 08:45:56 +01005777 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005778 .type = HDA_FIXUP_PINS,
5779 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005780 { 0x12, 0x99a3092f }, /* int-mic */
5781 { 0x14, 0x99130110 }, /* speaker */
5782 { 0x18, 0x01a19c20 }, /* mic */
5783 { 0x21, 0x0121401f }, /* HP out */
5784 { }
5785 },
5786 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005787 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005788 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005789 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01005790 },
David Henningssond06ac142013-02-18 11:41:55 +01005791 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5792 .type = HDA_FIXUP_FUNC,
5793 .v.func = alc269_fixup_hp_mute_led_mic1,
5794 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005795 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005796 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005797 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01005798 },
Tom Briden7f783bd2017-03-25 10:12:01 +00005799 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
5800 .type = HDA_FIXUP_FUNC,
5801 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05005802 .chained = true,
5803 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00005804 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01005805 [ALC269_FIXUP_HP_GPIO_LED] = {
5806 .type = HDA_FIXUP_FUNC,
5807 .v.func = alc269_fixup_hp_gpio_led,
5808 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08005809 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5810 .type = HDA_FIXUP_FUNC,
5811 .v.func = alc269_fixup_hp_gpio_mic1_led,
5812 },
5813 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5814 .type = HDA_FIXUP_FUNC,
5815 .v.func = alc269_fixup_hp_line1_mic1_led,
5816 },
David Henningsson693b6132012-06-22 19:12:10 +02005817 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005818 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02005819 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02005820 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005821 [ALC269_FIXUP_NO_SHUTUP] = {
5822 .type = HDA_FIXUP_FUNC,
5823 .v.func = alc_fixup_no_shutup,
5824 },
David Henningsson108cc102012-07-20 10:37:25 +02005825 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005826 .type = HDA_FIXUP_PINS,
5827 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02005828 { 0x19, 0x23a11040 }, /* dock mic */
5829 { 0x1b, 0x2121103f }, /* dock headphone */
5830 { }
5831 },
5832 .chained = true,
5833 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5834 },
5835 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005836 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02005837 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01005838 .chained = true,
5839 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02005840 },
David Henningsson73bdd592013-04-15 15:44:14 +02005841 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5842 .type = HDA_FIXUP_PINS,
5843 .v.pins = (const struct hda_pintbl[]) {
5844 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5845 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5846 { }
5847 },
5848 .chained = true,
5849 .chain_id = ALC269_FIXUP_HEADSET_MODE
5850 },
5851 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5852 .type = HDA_FIXUP_PINS,
5853 .v.pins = (const struct hda_pintbl[]) {
5854 { 0x16, 0x21014020 }, /* dock line out */
5855 { 0x19, 0x21a19030 }, /* dock mic */
5856 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5857 { }
5858 },
5859 .chained = true,
5860 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5861 },
David Henningsson338cae52013-10-07 10:39:59 +02005862 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5863 .type = HDA_FIXUP_PINS,
5864 .v.pins = (const struct hda_pintbl[]) {
5865 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5866 { }
5867 },
5868 .chained = true,
5869 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5870 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08005871 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
5872 .type = HDA_FIXUP_PINS,
5873 .v.pins = (const struct hda_pintbl[]) {
5874 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5875 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5876 { }
5877 },
5878 .chained = true,
5879 .chain_id = ALC269_FIXUP_HEADSET_MODE
5880 },
David Henningsson73bdd592013-04-15 15:44:14 +02005881 [ALC269_FIXUP_HEADSET_MODE] = {
5882 .type = HDA_FIXUP_FUNC,
5883 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08005884 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01005885 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02005886 },
5887 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5888 .type = HDA_FIXUP_FUNC,
5889 .v.func = alc_fixup_headset_mode_no_hp_mic,
5890 },
Takashi Iwai78197172015-06-27 10:21:13 +02005891 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
5892 .type = HDA_FIXUP_PINS,
5893 .v.pins = (const struct hda_pintbl[]) {
5894 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
5895 { }
5896 },
5897 .chained = true,
5898 .chain_id = ALC269_FIXUP_HEADSET_MODE,
5899 },
David Henningsson88cfcf82013-10-11 10:18:45 +02005900 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
5901 .type = HDA_FIXUP_PINS,
5902 .v.pins = (const struct hda_pintbl[]) {
5903 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5904 { }
5905 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02005906 .chained = true,
5907 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02005908 },
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05005909 [ALC256_FIXUP_HUAWEI_MBXP_PINS] = {
5910 .type = HDA_FIXUP_PINS,
5911 .v.pins = (const struct hda_pintbl[]) {
5912 {0x12, 0x90a60130},
5913 {0x13, 0x40000000},
5914 {0x14, 0x90170110},
5915 {0x18, 0x411111f0},
5916 {0x19, 0x04a11040},
5917 {0x1a, 0x411111f0},
5918 {0x1b, 0x90170112},
5919 {0x1d, 0x40759a05},
5920 {0x1e, 0x411111f0},
5921 {0x21, 0x04211020},
5922 { }
5923 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05005924 .chained = true,
5925 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05005926 },
David Henningssond240d1d2013-04-15 12:50:02 +02005927 [ALC269_FIXUP_ASUS_X101_FUNC] = {
5928 .type = HDA_FIXUP_FUNC,
5929 .v.func = alc269_fixup_x101_headset_mic,
5930 },
5931 [ALC269_FIXUP_ASUS_X101_VERB] = {
5932 .type = HDA_FIXUP_VERBS,
5933 .v.verbs = (const struct hda_verb[]) {
5934 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5935 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
5936 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
5937 { }
5938 },
5939 .chained = true,
5940 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
5941 },
5942 [ALC269_FIXUP_ASUS_X101] = {
5943 .type = HDA_FIXUP_PINS,
5944 .v.pins = (const struct hda_pintbl[]) {
5945 { 0x18, 0x04a1182c }, /* Headset mic */
5946 { }
5947 },
5948 .chained = true,
5949 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
5950 },
Dylan Reid08a978d2012-11-18 22:56:40 -08005951 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005952 .type = HDA_FIXUP_PINS,
5953 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08005954 { 0x14, 0x99130110 }, /* speaker */
5955 { 0x19, 0x01a19c20 }, /* mic */
5956 { 0x1b, 0x99a7012f }, /* int-mic */
5957 { 0x21, 0x0121401f }, /* HP out */
5958 { }
5959 },
5960 },
5961 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005962 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08005963 .v.func = alc271_hp_gate_mic_jack,
5964 .chained = true,
5965 .chain_id = ALC271_FIXUP_AMIC_MIC2,
5966 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01005967 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
5968 .type = HDA_FIXUP_FUNC,
5969 .v.func = alc269_fixup_limit_int_mic_boost,
5970 .chained = true,
5971 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
5972 },
Dylan Reid42397002013-04-05 14:58:22 -07005973 [ALC269_FIXUP_ACER_AC700] = {
5974 .type = HDA_FIXUP_PINS,
5975 .v.pins = (const struct hda_pintbl[]) {
5976 { 0x12, 0x99a3092f }, /* int-mic */
5977 { 0x14, 0x99130110 }, /* speaker */
5978 { 0x18, 0x03a11c20 }, /* mic */
5979 { 0x1e, 0x0346101e }, /* SPDIF1 */
5980 { 0x21, 0x0321101f }, /* HP out */
5981 { }
5982 },
5983 .chained = true,
5984 .chain_id = ALC271_FIXUP_DMIC,
5985 },
David Henningsson3e0d6112013-04-22 14:30:14 +02005986 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
5987 .type = HDA_FIXUP_FUNC,
5988 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01005989 .chained = true,
5990 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02005991 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01005992 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
5993 .type = HDA_FIXUP_FUNC,
5994 .v.func = alc269_fixup_limit_int_mic_boost,
5995 .chained = true,
5996 .chain_id = ALC269VB_FIXUP_DMIC,
5997 },
Takashi Iwai23870832013-11-29 14:13:12 +01005998 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
5999 .type = HDA_FIXUP_VERBS,
6000 .v.verbs = (const struct hda_verb[]) {
6001 /* class-D output amp +5dB */
6002 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6003 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6004 {}
6005 },
6006 .chained = true,
6007 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6008 },
David Henningsson8e35cd42013-11-06 11:20:01 +01006009 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6010 .type = HDA_FIXUP_FUNC,
6011 .v.func = alc269_fixup_limit_int_mic_boost,
6012 .chained = true,
6013 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6014 },
Anisse Astier02b504d2013-06-03 11:53:10 +02006015 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6016 .type = HDA_FIXUP_PINS,
6017 .v.pins = (const struct hda_pintbl[]) {
6018 { 0x12, 0x99a3092f }, /* int-mic */
6019 { 0x18, 0x03a11d20 }, /* mic */
6020 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6021 { }
6022 },
6023 },
Kailang Yangcd217a62013-08-22 10:15:24 +02006024 [ALC283_FIXUP_CHROME_BOOK] = {
6025 .type = HDA_FIXUP_FUNC,
6026 .v.func = alc283_fixup_chromebook,
6027 },
Kailang Yang0202e992013-12-02 15:20:15 +08006028 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6029 .type = HDA_FIXUP_FUNC,
6030 .v.func = alc283_fixup_sense_combo_jack,
6031 .chained = true,
6032 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6033 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02006034 [ALC282_FIXUP_ASUS_TX300] = {
6035 .type = HDA_FIXUP_FUNC,
6036 .v.func = alc282_fixup_asus_tx300,
6037 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02006038 [ALC283_FIXUP_INT_MIC] = {
6039 .type = HDA_FIXUP_VERBS,
6040 .v.verbs = (const struct hda_verb[]) {
6041 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6042 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6043 { }
6044 },
6045 .chained = true,
6046 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6047 },
David Henningsson0f4881d2013-12-20 16:08:13 +01006048 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6049 .type = HDA_FIXUP_PINS,
6050 .v.pins = (const struct hda_pintbl[]) {
6051 { 0x17, 0x90170112 }, /* subwoofer */
6052 { }
6053 },
6054 .chained = true,
6055 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6056 },
6057 [ALC290_FIXUP_SUBWOOFER] = {
6058 .type = HDA_FIXUP_PINS,
6059 .v.pins = (const struct hda_pintbl[]) {
6060 { 0x17, 0x90170112 }, /* subwoofer */
6061 { }
6062 },
6063 .chained = true,
6064 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6065 },
David Henningsson338cae52013-10-07 10:39:59 +02006066 [ALC290_FIXUP_MONO_SPEAKERS] = {
6067 .type = HDA_FIXUP_FUNC,
6068 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01006069 },
6070 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6071 .type = HDA_FIXUP_FUNC,
6072 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02006073 .chained = true,
6074 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6075 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01006076 [ALC269_FIXUP_THINKPAD_ACPI] = {
6077 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006078 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02006079 .chained = true,
6080 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006081 },
David Henningsson56f27012016-01-11 09:33:14 +01006082 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6083 .type = HDA_FIXUP_FUNC,
6084 .v.func = alc_fixup_inv_dmic,
6085 .chained = true,
6086 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6087 },
Chris Chiu5824ce82017-02-28 14:17:11 -06006088 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
6089 .type = HDA_FIXUP_PINS,
6090 .v.pins = (const struct hda_pintbl[]) {
6091 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6092 { }
6093 },
6094 .chained = true,
6095 .chain_id = ALC255_FIXUP_HEADSET_MODE
6096 },
Chris Chiu615966a2017-02-28 14:17:12 -06006097 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6098 .type = HDA_FIXUP_PINS,
6099 .v.pins = (const struct hda_pintbl[]) {
6100 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6101 { }
6102 },
6103 .chained = true,
6104 .chain_id = ALC255_FIXUP_HEADSET_MODE
6105 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006106 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6107 .type = HDA_FIXUP_PINS,
6108 .v.pins = (const struct hda_pintbl[]) {
6109 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6110 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6111 { }
6112 },
6113 .chained = true,
6114 .chain_id = ALC255_FIXUP_HEADSET_MODE
6115 },
Kailang Yang31278992014-03-03 15:27:22 +08006116 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6117 .type = HDA_FIXUP_PINS,
6118 .v.pins = (const struct hda_pintbl[]) {
6119 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6120 { }
6121 },
6122 .chained = true,
6123 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6124 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006125 [ALC255_FIXUP_HEADSET_MODE] = {
6126 .type = HDA_FIXUP_FUNC,
6127 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08006128 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006129 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006130 },
Kailang Yang31278992014-03-03 15:27:22 +08006131 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6132 .type = HDA_FIXUP_FUNC,
6133 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6134 },
Kailang Yanga22aa262014-04-23 17:34:28 +08006135 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6136 .type = HDA_FIXUP_PINS,
6137 .v.pins = (const struct hda_pintbl[]) {
6138 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6139 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6140 { }
6141 },
6142 .chained = true,
6143 .chain_id = ALC269_FIXUP_HEADSET_MODE
6144 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02006145 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02006146 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02006147 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006148 .chained = true,
6149 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6150 },
Takashi Iwai9a811232015-12-09 15:17:43 +01006151 [ALC292_FIXUP_TPT440] = {
6152 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01006153 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01006154 .chained = true,
6155 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6156 },
Anisse Astierabaa22742016-08-24 09:14:13 +02006157 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01006158 .type = HDA_FIXUP_PINS,
6159 .v.pins = (const struct hda_pintbl[]) {
6160 { 0x19, 0x04a110f0 },
6161 { },
6162 },
6163 },
Takashi Iwaib3802782018-11-26 17:47:46 +01006164 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08006165 .type = HDA_FIXUP_FUNC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006166 .v.func = snd_hda_gen_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08006167 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006168 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6169 .type = HDA_FIXUP_PINS,
6170 .v.pins = (const struct hda_pintbl[]) {
6171 { 0x12, 0x90a60130 },
6172 { 0x14, 0x90170110 },
6173 { 0x17, 0x40000008 },
6174 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02006175 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006176 { 0x1a, 0x411111f0 },
6177 { 0x1b, 0x411111f0 },
6178 { 0x1d, 0x40f89b2d },
6179 { 0x1e, 0x411111f0 },
6180 { 0x21, 0x0321101f },
6181 { },
6182 },
6183 },
David Henningsson7a5255f2014-10-30 08:26:01 +01006184 [ALC280_FIXUP_HP_GPIO4] = {
6185 .type = HDA_FIXUP_FUNC,
6186 .v.func = alc280_fixup_hp_gpio4,
6187 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006188 [ALC286_FIXUP_HP_GPIO_LED] = {
6189 .type = HDA_FIXUP_FUNC,
6190 .v.func = alc286_fixup_hp_gpio_led,
6191 },
David Henningsson33f4acd2015-01-07 15:50:13 +01006192 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6193 .type = HDA_FIXUP_FUNC,
6194 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6195 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01006196 [ALC280_FIXUP_HP_DOCK_PINS] = {
6197 .type = HDA_FIXUP_PINS,
6198 .v.pins = (const struct hda_pintbl[]) {
6199 { 0x1b, 0x21011020 }, /* line-out */
6200 { 0x1a, 0x01a1903c }, /* headset mic */
6201 { 0x18, 0x2181103f }, /* line-in */
6202 { },
6203 },
6204 .chained = true,
6205 .chain_id = ALC280_FIXUP_HP_GPIO4
6206 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006207 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6208 .type = HDA_FIXUP_PINS,
6209 .v.pins = (const struct hda_pintbl[]) {
6210 { 0x1b, 0x21011020 }, /* line-out */
6211 { 0x18, 0x2181103f }, /* line-in */
6212 { },
6213 },
6214 .chained = true,
6215 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6216 },
Keith Packard98973f22015-07-15 12:14:39 -07006217 [ALC280_FIXUP_HP_9480M] = {
6218 .type = HDA_FIXUP_FUNC,
6219 .v.func = alc280_fixup_hp_9480m,
6220 },
Kailang Yange1e62b92015-04-08 16:01:22 +08006221 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6222 .type = HDA_FIXUP_FUNC,
6223 .v.func = alc_fixup_headset_mode_dell_alc288,
6224 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006225 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08006226 },
6227 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6228 .type = HDA_FIXUP_PINS,
6229 .v.pins = (const struct hda_pintbl[]) {
6230 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6231 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6232 { }
6233 },
6234 .chained = true,
6235 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6236 },
Hui Wang831bfdf92015-06-26 12:35:17 +08006237 [ALC288_FIXUP_DISABLE_AAMIX] = {
6238 .type = HDA_FIXUP_FUNC,
6239 .v.func = alc_fixup_disable_aamix,
6240 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02006241 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08006242 },
6243 [ALC288_FIXUP_DELL_XPS_13] = {
6244 .type = HDA_FIXUP_FUNC,
6245 .v.func = alc_fixup_dell_xps13,
6246 .chained = true,
6247 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6248 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006249 [ALC292_FIXUP_DISABLE_AAMIX] = {
6250 .type = HDA_FIXUP_FUNC,
6251 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08006252 .chained = true,
6253 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006254 },
David Henningssonc04017e2015-12-15 14:44:03 +01006255 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6256 .type = HDA_FIXUP_FUNC,
6257 .v.func = alc_fixup_disable_aamix,
6258 .chained = true,
6259 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6260 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006261 [ALC292_FIXUP_DELL_E7X] = {
6262 .type = HDA_FIXUP_FUNC,
6263 .v.func = alc_fixup_dell_xps13,
6264 .chained = true,
6265 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6266 },
Kailang Yang977e6272015-05-18 15:31:20 +08006267 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6268 .type = HDA_FIXUP_PINS,
6269 .v.pins = (const struct hda_pintbl[]) {
6270 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6271 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6272 { }
6273 },
6274 .chained = true,
6275 .chain_id = ALC269_FIXUP_HEADSET_MODE
6276 },
Hui Wang2f726ae2017-03-31 10:31:40 +08006277 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6278 .type = HDA_FIXUP_PINS,
6279 .v.pins = (const struct hda_pintbl[]) {
6280 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6281 { }
6282 },
6283 .chained = true,
6284 .chain_id = ALC269_FIXUP_HEADSET_MODE
6285 },
Kailang Yang6ed11312015-10-26 15:37:39 +08006286 [ALC275_FIXUP_DELL_XPS] = {
6287 .type = HDA_FIXUP_VERBS,
6288 .v.verbs = (const struct hda_verb[]) {
6289 /* Enables internal speaker */
6290 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6291 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6292 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6293 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6294 {}
6295 }
6296 },
Hui Wang8c697292015-11-24 11:08:18 +08006297 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
6298 .type = HDA_FIXUP_VERBS,
6299 .v.verbs = (const struct hda_verb[]) {
6300 /* Disable pass-through path for FRONT 14h */
6301 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
6302 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
6303 {}
6304 },
6305 .chained = true,
6306 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6307 },
Hui Wang23adc192015-12-08 12:27:18 +08006308 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6309 .type = HDA_FIXUP_FUNC,
6310 .v.func = alc_fixup_disable_aamix,
6311 .chained = true,
6312 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6313 },
Kailang3694cb22015-12-28 11:35:24 +08006314 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6315 .type = HDA_FIXUP_FUNC,
6316 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6317 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006318 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6319 .type = HDA_FIXUP_FUNC,
6320 .v.func = alc_fixup_disable_aamix,
6321 .chained = true,
6322 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6323 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08006324 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
6325 .type = HDA_FIXUP_FUNC,
6326 .v.func = alc_fixup_disable_mic_vref,
6327 .chained = true,
6328 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6329 },
David Henningsson2ae95572016-02-25 09:37:05 +01006330 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6331 .type = HDA_FIXUP_VERBS,
6332 .v.verbs = (const struct hda_verb[]) {
6333 /* Disable pass-through path for FRONT 14h */
6334 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6335 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6336 {}
6337 },
6338 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006339 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01006340 },
Takashi Iwaif8839822016-02-25 14:31:59 +01006341 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6342 .type = HDA_FIXUP_FUNC,
6343 .v.func = alc_fixup_disable_aamix,
6344 .chained = true,
6345 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6346 },
Hui Wange549d192016-04-01 11:00:15 +08006347 [ALC221_FIXUP_HP_FRONT_MIC] = {
6348 .type = HDA_FIXUP_PINS,
6349 .v.pins = (const struct hda_pintbl[]) {
6350 { 0x19, 0x02a19020 }, /* Front Mic */
6351 { }
6352 },
6353 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02006354 [ALC292_FIXUP_TPT460] = {
6355 .type = HDA_FIXUP_FUNC,
6356 .v.func = alc_fixup_tpt440_dock,
6357 .chained = true,
6358 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6359 },
Hui Wangdd9aa332016-08-01 10:20:32 +08006360 [ALC298_FIXUP_SPK_VOLUME] = {
6361 .type = HDA_FIXUP_FUNC,
6362 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08006363 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08006364 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08006365 },
Takashi Iwaie312a862018-03-06 12:14:17 +01006366 [ALC295_FIXUP_DISABLE_DAC3] = {
6367 .type = HDA_FIXUP_FUNC,
6368 .v.func = alc295_fixup_disable_dac3,
6369 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006370 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6371 .type = HDA_FIXUP_PINS,
6372 .v.pins = (const struct hda_pintbl[]) {
6373 { 0x1b, 0x90170151 },
6374 { }
6375 },
6376 .chained = true,
6377 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6378 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006379 [ALC269_FIXUP_ATIV_BOOK_8] = {
6380 .type = HDA_FIXUP_FUNC,
6381 .v.func = alc_fixup_auto_mute_via_amp,
6382 .chained = true,
6383 .chain_id = ALC269_FIXUP_NO_SHUTUP
6384 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006385 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6386 .type = HDA_FIXUP_PINS,
6387 .v.pins = (const struct hda_pintbl[]) {
6388 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6389 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6390 { }
6391 },
6392 .chained = true,
6393 .chain_id = ALC269_FIXUP_HEADSET_MODE
6394 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06006395 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6396 .type = HDA_FIXUP_FUNC,
6397 .v.func = alc_fixup_headset_mode,
6398 },
6399 [ALC256_FIXUP_ASUS_MIC] = {
6400 .type = HDA_FIXUP_PINS,
6401 .v.pins = (const struct hda_pintbl[]) {
6402 { 0x13, 0x90a60160 }, /* use as internal mic */
6403 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6404 { }
6405 },
6406 .chained = true,
6407 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6408 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06006409 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02006410 .type = HDA_FIXUP_FUNC,
6411 /* Set up GPIO2 for the speaker amp */
6412 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006413 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06006414 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6415 .type = HDA_FIXUP_PINS,
6416 .v.pins = (const struct hda_pintbl[]) {
6417 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6418 { }
6419 },
6420 .chained = true,
6421 .chain_id = ALC269_FIXUP_HEADSET_MIC
6422 },
6423 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6424 .type = HDA_FIXUP_VERBS,
6425 .v.verbs = (const struct hda_verb[]) {
6426 /* Enables internal speaker */
6427 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6428 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6429 {}
6430 },
6431 .chained = true,
6432 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6433 },
Kailang Yangca169cc2017-04-25 16:17:40 +08006434 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6435 .type = HDA_FIXUP_FUNC,
6436 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6437 },
Hui Wangf33f79f2017-07-07 12:08:29 +08006438 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6439 .type = HDA_FIXUP_PINS,
6440 .v.pins = (const struct hda_pintbl[]) {
6441 /* Change the mic location from front to right, otherwise there are
6442 two front mics with the same name, pulseaudio can't handle them.
6443 This is just a temporary workaround, after applying this fixup,
6444 there will be one "Front Mic" and one "Mic" in this machine.
6445 */
6446 { 0x1a, 0x04a19040 },
6447 { }
6448 },
6449 },
Kailang Yang5f364132017-07-25 16:28:16 +08006450 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6451 .type = HDA_FIXUP_PINS,
6452 .v.pins = (const struct hda_pintbl[]) {
6453 { 0x16, 0x0101102f }, /* Rear Headset HP */
6454 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6455 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6456 { 0x1b, 0x02011020 },
6457 { }
6458 },
6459 .chained = true,
6460 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6461 },
PeiSen Houb84e8432017-09-01 15:11:56 +08006462 [ALC700_FIXUP_INTEL_REFERENCE] = {
6463 .type = HDA_FIXUP_VERBS,
6464 .v.verbs = (const struct hda_verb[]) {
6465 /* Enables internal speaker */
6466 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6467 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6468 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6469 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6470 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6471 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6472 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6473 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6474 {}
6475 }
6476 },
Kailang Yang92266652017-12-14 15:28:58 +08006477 [ALC274_FIXUP_DELL_BIND_DACS] = {
6478 .type = HDA_FIXUP_FUNC,
6479 .v.func = alc274_fixup_bind_dacs,
6480 .chained = true,
6481 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6482 },
6483 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6484 .type = HDA_FIXUP_PINS,
6485 .v.pins = (const struct hda_pintbl[]) {
6486 { 0x1b, 0x0401102f },
6487 { }
6488 },
6489 .chained = true,
6490 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6491 },
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006492 [ALC298_FIXUP_TPT470_DOCK] = {
6493 .type = HDA_FIXUP_FUNC,
6494 .v.func = alc_fixup_tpt470_dock,
6495 .chained = true,
6496 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6497 },
Kailang Yangae104a22018-02-05 16:07:20 +08006498 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6499 .type = HDA_FIXUP_PINS,
6500 .v.pins = (const struct hda_pintbl[]) {
6501 { 0x14, 0x0201101f },
6502 { }
6503 },
6504 .chained = true,
6505 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6506 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006507 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
6508 .type = HDA_FIXUP_PINS,
6509 .v.pins = (const struct hda_pintbl[]) {
6510 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6511 { }
6512 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08006513 .chained = true,
6514 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006515 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006516 [ALC295_FIXUP_HP_X360] = {
6517 .type = HDA_FIXUP_FUNC,
6518 .v.func = alc295_fixup_hp_top_speakers,
6519 .chained = true,
6520 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08006521 },
6522 [ALC221_FIXUP_HP_HEADSET_MIC] = {
6523 .type = HDA_FIXUP_PINS,
6524 .v.pins = (const struct hda_pintbl[]) {
6525 { 0x19, 0x0181313f},
6526 { }
6527 },
6528 .chained = true,
6529 .chain_id = ALC269_FIXUP_HEADSET_MIC
6530 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08006531 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
6532 .type = HDA_FIXUP_FUNC,
6533 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08006534 .chained = true,
6535 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08006536 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006537 [ALC295_FIXUP_HP_AUTO_MUTE] = {
6538 .type = HDA_FIXUP_FUNC,
6539 .v.func = alc_fixup_auto_mute_via_amp,
6540 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08006541 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
6542 .type = HDA_FIXUP_PINS,
6543 .v.pins = (const struct hda_pintbl[]) {
6544 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6545 { }
6546 },
6547 .chained = true,
6548 .chain_id = ALC269_FIXUP_HEADSET_MIC
6549 },
Chris Chiud8ae4582018-12-07 17:17:11 +08006550 [ALC294_FIXUP_ASUS_MIC] = {
6551 .type = HDA_FIXUP_PINS,
6552 .v.pins = (const struct hda_pintbl[]) {
6553 { 0x13, 0x90a60160 }, /* use as internal mic */
6554 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6555 { }
6556 },
6557 .chained = true,
6558 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6559 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006560 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
6561 .type = HDA_FIXUP_PINS,
6562 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08006563 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006564 { }
6565 },
6566 .chained = true,
6567 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6568 },
6569 [ALC294_FIXUP_ASUS_SPK] = {
6570 .type = HDA_FIXUP_VERBS,
6571 .v.verbs = (const struct hda_verb[]) {
6572 /* Set EAPD high */
6573 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
6574 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
6575 { }
6576 },
6577 .chained = true,
6578 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
6579 },
Kailang Yange8547472018-11-28 15:32:45 +08006580 [ALC225_FIXUP_HEADSET_JACK] = {
6581 .type = HDA_FIXUP_FUNC,
6582 .v.func = alc_fixup_headset_jack,
6583 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07006584 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
6585 .type = HDA_FIXUP_PINS,
6586 .v.pins = (const struct hda_pintbl[]) {
6587 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6588 { }
6589 },
6590 .chained = true,
6591 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6592 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006593};
6594
6595static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01006596 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02006597 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6598 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02006599 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02006600 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6601 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02006602 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6603 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05006604 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006605 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02006606 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Chris Chiu705b65f2018-12-05 14:48:54 +08006607 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01006608 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiub72f9362018-12-05 14:48:56 +08006609 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
6610 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Chris Chiu9f8aefe2018-12-05 14:48:55 +08006611 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
David Henningssonaaedfb42013-08-16 14:09:02 +02006612 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08006613 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01006614 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01006615 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006616 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
6617 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01006618 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02006619 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6620 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6621 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01006622 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6623 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01006624 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02006625 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01006626 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08006627 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6628 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08006629 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02006630 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02006631 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08006632 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08006633 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6634 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01006635 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6636 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6637 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6638 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6639 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Feng423cd782016-05-20 15:47:23 +08006640 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006641 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006642 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Kai-Heng Feng423cd782016-05-20 15:47:23 +08006643 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08006644 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08006645 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwaie312a862018-03-06 12:14:17 +01006646 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Takashi Iwai493de342017-02-28 17:27:57 +01006647 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kailang Yang5f364132017-07-25 16:28:16 +08006648 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Takashi Iwaie4c9fd12018-01-10 08:34:28 +01006649 SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08006650 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6651 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006652 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6653 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08006654 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08006655 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yanga22aa262014-04-23 17:34:28 +08006656 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6657 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006658 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006659 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01006660 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
David Henningsson33f4acd2015-01-07 15:50:13 +01006661 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08006662 /* ALC282 */
Hui Wang7976eb42015-02-13 11:14:41 +08006663 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006664 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006665 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006666 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6667 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6668 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6669 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006670 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006671 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006672 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6673 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006674 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006675 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
TienFu Chenb4b33f92015-01-20 15:06:21 +01006676 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
TienFu Chen3271cb22015-02-10 09:09:41 +01006677 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yangc60666b2014-02-21 16:23:35 +08006678 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006679 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6680 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6681 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006682 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Keith Packard98973f22015-07-15 12:14:39 -07006683 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006684 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6685 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006686 /* ALC290 */
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006687 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006688 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006689 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006690 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6691 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6692 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6693 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6694 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006695 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006696 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006697 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006698 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6699 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6700 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006701 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6702 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006703 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006704 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006705 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006706 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006707 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6708 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006709 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6710 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006711 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006712 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6713 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6714 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6715 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwaif8839822016-02-25 14:31:59 +01006716 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
Takashi Iwai563785e2018-11-12 09:43:12 +01006717 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08006718 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006719 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006720 SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6721 SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05006722 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006723 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02006724 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02006725 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01006726 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006727 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006728 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02006729 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006730 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6731 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6732 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006733 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
6734 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
6735 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01006736 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006737 SND_PCI_QUIRK(0x1043, 0x14a1, "ASUS UX533FD", ALC294_FIXUP_ASUS_SPK),
Takashi Iwai23870832013-11-29 14:13:12 +01006738 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02006739 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai017f2a12011-07-09 14:42:25 +02006740 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06006741 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
David Henningsson693b6132012-06-22 19:12:10 +02006742 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06006743 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006744 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006745 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Chris Chiueeed4cd2017-02-28 14:17:15 -06006746 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006747 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
6748 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
6749 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6750 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02006751 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwaif88abaa2014-02-07 12:07:59 +01006752 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
David Henningsson88cfcf82013-10-11 10:18:45 +02006753 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006754 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
6755 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6756 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006757 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwai24519912011-08-16 15:08:49 +02006758 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006759 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006760 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Takashi Iwai88776f32015-05-01 09:20:34 +02006761 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006762 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
David Henningsson2041d562014-06-13 11:15:44 +02006763 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08006764 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09006765 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02006766 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006767 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Anisse Astierabaa22742016-08-24 09:14:13 +02006768 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
6769 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01006770 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
Jeremy Soller89e3a562019-01-30 16:12:31 -07006771 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Kailang Yangca169cc2017-04-25 16:17:40 +08006772 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006773 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
6774 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
6775 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
6776 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
6777 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwai707fba32012-08-02 09:04:39 +02006778 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
Felix Kaechelec8415a42012-08-06 23:02:01 +02006779 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Stefán Freyr84f98fd2012-10-19 22:46:00 +02006780 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02006781 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02006782 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02006783 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01006784 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02006785 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02006786 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05006787 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02006788 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01006789 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02006790 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01006791 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07006792 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02006793 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006794 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6795 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02006796 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02006797 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006798 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
6799 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6800 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01006801 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006802 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6803 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6804 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01006805 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang3694cb22015-12-28 11:35:24 +08006806 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08006807 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08006808 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08006809 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08006810 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08006811 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
David Henningsson56f27012016-01-11 09:33:14 +01006812 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01006813 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006814 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
David Henningssona4a9e082013-08-16 14:09:01 +02006815 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02006816 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02006817 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02006818 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02006819 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01006820 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02006821 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02006822 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08006823 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02006824 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02006825 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02006826 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006827 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6828 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6829 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02006830 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006831 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6832 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningsson012e7eb2012-08-08 08:43:37 +02006833 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006834 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Ayman Bagabase2744fd2018-12-12 18:07:59 -05006835 SND_PCI_QUIRK(0x19e5, 0x3200, "Huawei MBX", ALC255_FIXUP_MIC_MUTE_LED),
6836 SND_PCI_QUIRK(0x19e5, 0x3201, "Huawei MBX", ALC255_FIXUP_MIC_MUTE_LED),
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006837 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MBXP", ALC256_FIXUP_HUAWEI_MBXP_PINS),
Anisse Astier02b504d2013-06-03 11:53:10 +02006838 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02006839
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01006840#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02006841 /* Below is a quirk table taken from the old code.
6842 * Basically the device should work as is without the fixup table.
6843 * If BIOS doesn't give a proper info, enable the corresponding
6844 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02006845 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02006846 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
6847 ALC269_FIXUP_AMIC),
6848 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02006849 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
6850 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
6851 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
6852 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
6853 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
6854 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
6855 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
6856 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
6857 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
6858 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
6859 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
6860 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
6861 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
6862 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
6863 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
6864 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
6865 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
6866 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
6867 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
6868 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
6869 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
6870 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
6871 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
6872 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
6873 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
6874 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
6875 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
6876 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
6877 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
6878 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
6879 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
6880 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
6881 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
6882 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
6883 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
6884 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
6885 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
6886 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
6887#endif
6888 {}
6889};
6890
David Henningsson214eef72014-07-22 14:09:35 +02006891static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
6892 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
6893 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
6894 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
6895 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
6896 {}
6897};
6898
Takashi Iwai1727a772013-01-10 09:52:52 +01006899static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006900 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
6901 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02006902 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
6903 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
6904 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02006905 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02006906 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
6907 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02006908 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006909 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006910 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02006911 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
6912 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02006913 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
6914 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08006915 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08006916 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02006917 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01006918 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02006919 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02006920 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02006921 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02006922 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02006923 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
6924 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
6925 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
6926 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
6927 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
6928 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
6929 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
6930 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
6931 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
6932 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
6933 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
6934 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
6935 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
6936 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
6937 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
6938 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
6939 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
6940 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
6941 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
6942 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
6943 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
6944 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
6945 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
6946 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
6947 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
6948 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
6949 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
6950 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
6951 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
6952 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
6953 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
6954 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
6955 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
6956 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
6957 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
6958 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
6959 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
6960 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
6961 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
6962 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01006963 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02006964 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
6965 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
6966 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
6967 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
6968 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
6969 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
6970 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
6971 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
6972 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
6973 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
6974 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
6975 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
6976 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
6977 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
6978 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
6979 {.id = ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE, .name = "alc256-dell-xps13"},
6980 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
6981 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
6982 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08006983 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02006984 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
6985 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
6986 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
6987 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
6988 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
6989 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
6990 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
6991 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
6992 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
6993 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
6994 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
6995 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
6996 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
6997 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
6998 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
6999 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
7000 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
7001 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yange8547472018-11-28 15:32:45 +08007002 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-sense-combo"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02007003 {}
7004};
Kailang Yangcfc5a842016-02-03 15:20:39 +08007005#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08007006 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02007007
Hui Wange8191a82015-04-24 13:39:59 +08007008#define ALC256_STANDARD_PINS \
7009 {0x12, 0x90a60140}, \
7010 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08007011 {0x21, 0x02211020}
7012
David Henningssonfea185e2014-09-03 10:23:04 +02007013#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08007014 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08007015
David Henningssonfea185e2014-09-03 10:23:04 +02007016#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08007017 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02007018
7019#define ALC292_STANDARD_PINS \
7020 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08007021 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08007022
Hui Wang3f6409702016-09-11 11:26:16 +08007023#define ALC295_STANDARD_PINS \
7024 {0x12, 0xb7a60130}, \
7025 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08007026 {0x21, 0x04211020}
7027
Woodrow Shen703867e2015-08-05 12:34:12 +08007028#define ALC298_STANDARD_PINS \
7029 {0x12, 0x90a60130}, \
7030 {0x21, 0x03211020}
7031
Hui Wange1918932014-05-26 16:22:44 +08007032static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08007033 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
7034 {0x14, 0x01014020},
7035 {0x17, 0x90170110},
7036 {0x18, 0x02a11030},
7037 {0x19, 0x0181303F},
7038 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06007039 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7040 {0x12, 0x90a601c0},
7041 {0x14, 0x90171120},
7042 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06007043 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7044 {0x14, 0x90170110},
7045 {0x1b, 0x90a70130},
7046 {0x21, 0x03211020}),
7047 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7048 {0x1a, 0x90a70130},
7049 {0x1b, 0x90170110},
7050 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01007051 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08007052 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08007053 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08007054 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01007055 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08007056 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08007057 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08007058 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08007059 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7060 ALC225_STANDARD_PINS,
7061 {0x12, 0xb7a60150},
7062 {0x14, 0x901701a0}),
7063 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7064 ALC225_STANDARD_PINS,
7065 {0x12, 0xb7a60150},
7066 {0x14, 0x901701b0}),
7067 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7068 ALC225_STANDARD_PINS,
7069 {0x12, 0xb7a60130},
7070 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05007071 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7072 {0x1b, 0x01111010},
7073 {0x1e, 0x01451130},
7074 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08007075 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7076 {0x12, 0x90a60140},
7077 {0x14, 0x90170110},
7078 {0x19, 0x02a11030},
7079 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08007080 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7081 {0x14, 0x90170110},
7082 {0x19, 0x02a11030},
7083 {0x1a, 0x02a11040},
7084 {0x1b, 0x01014020},
7085 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08007086 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7087 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08007088 {0x19, 0x02a11030},
7089 {0x1a, 0x02a11040},
7090 {0x1b, 0x01011020},
7091 {0x21, 0x0221101f}),
7092 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7093 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08007094 {0x19, 0x02a11020},
7095 {0x1a, 0x02a11030},
7096 {0x21, 0x0221101f}),
Hui Wangf2657882017-10-24 16:53:34 +08007097 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7098 {0x12, 0x90a60140},
7099 {0x14, 0x90170110},
7100 {0x21, 0x02211020}),
7101 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7102 {0x12, 0x90a60140},
7103 {0x14, 0x90170150},
7104 {0x21, 0x02211020}),
Hui Wangc77900e2014-09-03 11:31:07 +08007105 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08007106 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08007107 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02007108 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08007109 {0x14, 0x90170130},
7110 {0x21, 0x02211040}),
7111 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02007112 {0x12, 0x90a60140},
7113 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02007114 {0x21, 0x02211020}),
7115 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7116 {0x12, 0x90a60160},
7117 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02007118 {0x21, 0x02211030}),
7119 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08007120 {0x14, 0x90170110},
7121 {0x1b, 0x02011020},
7122 {0x21, 0x0221101f}),
7123 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08007124 {0x14, 0x90170110},
7125 {0x1b, 0x01011020},
7126 {0x21, 0x0221101f}),
7127 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02007128 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02007129 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02007130 {0x21, 0x0221103f}),
7131 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08007132 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08007133 {0x1b, 0x01011020},
7134 {0x21, 0x0221103f}),
7135 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7136 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08007137 {0x1b, 0x02011020},
7138 {0x21, 0x0221103f}),
7139 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08007140 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08007141 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08007142 {0x21, 0x0221105f}),
7143 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08007144 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08007145 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08007146 {0x21, 0x0221101f}),
7147 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02007148 {0x12, 0x90a60160},
7149 {0x14, 0x90170120},
7150 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02007151 {0x21, 0x0321102f}),
7152 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7153 {0x12, 0x90a60160},
7154 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02007155 {0x21, 0x02211040}),
7156 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7157 {0x12, 0x90a60160},
7158 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02007159 {0x21, 0x02211050}),
7160 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7161 {0x12, 0x90a60170},
7162 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02007163 {0x21, 0x02211030}),
7164 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7165 {0x12, 0x90a60170},
7166 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02007167 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08007168 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08007169 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08007170 {0x14, 0x90171130},
7171 {0x21, 0x02211040}),
7172 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7173 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08007174 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08007175 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02007176 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02007177 {0x12, 0x90a60180},
7178 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02007179 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08007180 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7181 {0x12, 0x90a60180},
7182 {0x14, 0x90170120},
7183 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08007184 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7185 {0x1b, 0x01011020},
7186 {0x21, 0x02211010}),
Kailang Yang7081adf2015-03-30 17:05:37 +08007187 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang285d5dd2017-12-22 11:17:45 +08007188 {0x12, 0x90a60130},
7189 {0x14, 0x90170110},
7190 {0x1b, 0x01011020},
7191 {0x21, 0x0221101f}),
7192 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang81a12312015-05-28 16:48:22 +08007193 {0x12, 0x90a60160},
7194 {0x14, 0x90170120},
Kailang Yang81a12312015-05-28 16:48:22 +08007195 {0x21, 0x02211030}),
7196 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shenf83c3292016-06-24 15:58:34 +08007197 {0x12, 0x90a60170},
7198 {0x14, 0x90170120},
7199 {0x21, 0x02211030}),
Shrirang Bagul311042d2016-08-29 15:19:27 +08007200 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7201 {0x12, 0x90a60180},
7202 {0x14, 0x90170120},
7203 {0x21, 0x02211030}),
Woodrow Shenf83c3292016-06-24 15:58:34 +08007204 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang3f6409702016-09-11 11:26:16 +08007205 {0x12, 0xb7a60130},
7206 {0x14, 0x90170110},
7207 {0x21, 0x02211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01007208 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang3f2f7c52018-01-29 14:23:15 +08007209 {0x12, 0x90a60130},
7210 {0x14, 0x90170110},
7211 {0x14, 0x01011020},
7212 {0x21, 0x0221101f}),
7213 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncf51eb92014-10-30 08:26:02 +01007214 ALC256_STANDARD_PINS),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007215 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7216 {0x14, 0x90170110},
7217 {0x1b, 0x90a70130},
7218 {0x21, 0x04211020}),
7219 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7220 {0x14, 0x90170110},
7221 {0x1b, 0x90a70130},
7222 {0x21, 0x03211020}),
Kailang Yang92266652017-12-14 15:28:58 +08007223 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Hui Wang75ee94b2017-11-09 08:48:08 +08007224 {0x12, 0xb7a60130},
7225 {0x13, 0xb8a61140},
7226 {0x16, 0x90170110},
7227 {0x21, 0x04211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01007228 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
7229 {0x12, 0x90a60130},
7230 {0x14, 0x90170110},
7231 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08007232 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08007233 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
7234 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08007235 {0x14, 0x90170110},
7236 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08007237 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08007238 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08007239 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02007240 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007241 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02007242 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02007243 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02007244 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08007245 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007246 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08007247 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08007248 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08007249 {0x21, 0x03211040}),
7250 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007251 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08007252 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08007253 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08007254 {0x21, 0x03211020}),
7255 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007256 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08007257 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08007258 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08007259 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08007260 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02007261 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08007262 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08007263 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08007264 {0x21, 0x04211020}),
David Henningsson76c21322014-06-24 14:46:54 +02007265 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007266 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02007267 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02007268 {0x21, 0x0321101f}),
7269 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7270 {0x12, 0x90a60160},
7271 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02007272 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08007273 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007274 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08007275 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08007276 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08007277 {0x21, 0x0321101f}),
Hui Wangc4cfcf62018-11-26 14:17:16 +08007278 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
7279 {0x12, 0x90a60130},
7280 {0x14, 0x90170110},
7281 {0x19, 0x04a11040},
7282 {0x21, 0x04211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08007283 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7284 {0x12, 0x90a60130},
7285 {0x17, 0x90170110},
7286 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02007287 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08007288 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08007289 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08007290 {0x21, 0x0321101f}),
Hui Wangd5078192018-03-02 13:05:36 +08007291 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Hui Wang3f2f7c52018-01-29 14:23:15 +08007292 {0x12, 0xb7a60130},
7293 {0x14, 0x90170110},
7294 {0x21, 0x04211020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007295 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007296 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007297 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08007298 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08007299 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007300 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007301 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007302 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08007303 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08007304 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007305 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007306 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007307 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08007308 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007309 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007310 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007311 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08007312 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08007313 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007314 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007315 {0x14, 0x90170110},
7316 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08007317 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08007318 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007319 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007320 {0x14, 0x90170110},
7321 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08007322 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007323 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007324 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007325 {0x14, 0x90170110},
7326 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08007327 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08007328 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007329 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08007330 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08007331 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08007332 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08007333 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007334 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08007335 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08007336 {0x16, 0x01014020},
7337 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08007338 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02007339 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007340 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08007341 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02007342 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007343 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02007344 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02007345 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08007346 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02007347 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007348 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08007349 {0x13, 0x90a60140}),
Chris Chiud8ae4582018-12-07 17:17:11 +08007350 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
7351 {0x14, 0x90170110},
7352 {0x1b, 0x90a70130},
7353 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08007354 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7355 {0x12, 0x90a60130},
7356 {0x17, 0x90170110},
7357 {0x21, 0x04211020}),
Hui Wang3f6409702016-09-11 11:26:16 +08007358 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08007359 ALC295_STANDARD_PINS,
7360 {0x17, 0x21014020},
7361 {0x18, 0x21a19030}),
7362 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7363 ALC295_STANDARD_PINS,
7364 {0x17, 0x21014040},
7365 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08007366 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7367 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08007368 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08007369 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02007370 {0x17, 0x90170110}),
7371 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7372 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08007373 {0x17, 0x90170140}),
7374 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7375 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02007376 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08007377 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
7378 {0x12, 0xb7a60140},
7379 {0x13, 0xb7a60150},
7380 {0x17, 0x90170110},
7381 {0x1a, 0x03011020},
7382 {0x21, 0x03211030}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08007383 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7384 ALC225_STANDARD_PINS,
7385 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08007386 {0x17, 0x90170110}),
Hui Wange1918932014-05-26 16:22:44 +08007387 {}
7388};
Takashi Iwai1d045db2011-07-07 18:23:21 +02007389
Takashi Iwai546bb672012-03-07 08:37:19 +01007390static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02007391{
Kailang Yang526af6e2012-03-07 08:25:20 +01007392 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007393 int val;
7394
Kailang Yang526af6e2012-03-07 08:25:20 +01007395 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01007396 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01007397
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007398 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007399 alc_write_coef_idx(codec, 0xf, 0x960b);
7400 alc_write_coef_idx(codec, 0xe, 0x8817);
7401 }
7402
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007403 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007404 alc_write_coef_idx(codec, 0xf, 0x960b);
7405 alc_write_coef_idx(codec, 0xe, 0x8814);
7406 }
7407
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007408 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007409 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02007410 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007411 }
7412
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007413 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007414 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02007415 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007416 /* Capless ramp up clock control */
7417 alc_write_coef_idx(codec, 0xd, val | (1<<10));
7418 }
7419 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02007420 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007421 /* Class D power on reset */
7422 alc_write_coef_idx(codec, 0x17, val | (1<<7));
7423 }
7424 }
7425
Takashi Iwai98b24882014-08-18 13:47:50 +02007426 /* HP */
7427 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007428}
7429
7430/*
7431 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007432static int patch_alc269(struct hda_codec *codec)
7433{
7434 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02007435 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007436
Takashi Iwai3de95172012-05-07 18:03:15 +02007437 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007438 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02007439 return err;
7440
7441 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01007442 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007443 codec->power_save_node = 1;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007444
Takashi Iwai225068a2015-05-29 10:42:14 +02007445#ifdef CONFIG_PM
7446 codec->patch_ops.suspend = alc269_suspend;
7447 codec->patch_ops.resume = alc269_resume;
7448#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08007449 spec->shutup = alc_default_shutup;
7450 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02007451
Takashi Iwai7639a062015-03-03 10:07:24 +01007452 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01007453 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02007454 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007455 switch (alc_get_coef0(codec) & 0x00f0) {
7456 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01007457 if (codec->bus->pci &&
7458 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007459 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02007460 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02007461 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007462 break;
7463 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01007464 if (codec->bus->pci &&
7465 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007466 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02007467 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02007468 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007469 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02007470 case 0x0030:
7471 spec->codec_variant = ALC269_TYPE_ALC269VD;
7472 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007473 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02007474 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007475 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007476 if (err < 0)
7477 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08007478 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01007479 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007480 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01007481 break;
7482
7483 case 0x10ec0280:
7484 case 0x10ec0290:
7485 spec->codec_variant = ALC269_TYPE_ALC280;
7486 break;
7487 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01007488 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08007489 spec->shutup = alc282_shutup;
7490 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01007491 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02007492 case 0x10ec0233:
7493 case 0x10ec0283:
7494 spec->codec_variant = ALC269_TYPE_ALC283;
7495 spec->shutup = alc283_shutup;
7496 spec->init_hook = alc283_init;
7497 break;
Kailang Yang065380f2013-01-10 10:25:48 +01007498 case 0x10ec0284:
7499 case 0x10ec0292:
7500 spec->codec_variant = ALC269_TYPE_ALC284;
7501 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02007502 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08007503 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02007504 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02007505 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08007506 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02007507 spec->codec_variant = ALC269_TYPE_ALC286;
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08007508 spec->shutup = alc286_shutup;
Kailang Yang7fc7d042013-04-25 11:04:43 +02007509 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08007510 case 0x10ec0298:
7511 spec->codec_variant = ALC269_TYPE_ALC298;
7512 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08007513 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02007514 case 0x10ec0255:
7515 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08007516 spec->shutup = alc256_shutup;
7517 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02007518 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08007519 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08007520 case 0x10ec0256:
7521 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08007522 spec->shutup = alc256_shutup;
7523 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02007524 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yangd32b6662015-04-23 15:10:53 +08007525 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
Kailang Yang4344aec2014-12-17 17:39:05 +08007526 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08007527 case 0x10ec0257:
7528 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08007529 spec->shutup = alc256_shutup;
7530 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08007531 spec->gen.mixer_nid = 0;
7532 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08007533 case 0x10ec0215:
7534 case 0x10ec0285:
7535 case 0x10ec0289:
7536 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08007537 spec->shutup = alc225_shutup;
7538 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08007539 spec->gen.mixer_nid = 0;
7540 break;
Kailang Yang42314302016-02-03 15:03:50 +08007541 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08007542 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08007543 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08007544 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08007545 spec->shutup = alc225_shutup;
7546 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01007547 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08007548 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08007549 case 0x10ec0234:
7550 case 0x10ec0274:
7551 case 0x10ec0294:
7552 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08007553 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08007554 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +08007555 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08007556 break;
Kailang Yang1078bef2018-11-08 16:36:15 +08007557 case 0x10ec0300:
7558 spec->codec_variant = ALC269_TYPE_ALC300;
7559 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007560 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08007561 case 0x10ec0700:
7562 case 0x10ec0701:
7563 case 0x10ec0703:
7564 spec->codec_variant = ALC269_TYPE_ALC700;
7565 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08007566 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +08007567 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +08007568 break;
7569
Takashi Iwai1d045db2011-07-07 18:23:21 +02007570 }
7571
Kailang Yangad60d502013-06-28 12:03:01 +02007572 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05007573 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02007574 spec->init_hook = alc5505_dsp_init;
7575 }
7576
Takashi Iwaiefe55732018-06-15 11:55:02 +02007577 snd_hda_pick_fixup(codec, alc269_fixup_models,
7578 alc269_fixup_tbl, alc269_fixups);
7579 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
7580 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
7581 alc269_fixups);
7582 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7583
7584 alc_auto_parse_customize_define(codec);
7585
7586 if (has_cdefine_beep(codec))
7587 spec->gen.beep_nid = 0x01;
7588
Takashi Iwaia4297b52011-08-23 18:40:12 +02007589 /* automatic parse from the BIOS config */
7590 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007591 if (err < 0)
7592 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007593
Takashi Iwaifea80fa2018-06-20 12:52:46 +02007594 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
7595 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
7596 if (err < 0)
7597 goto error;
7598 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007599
Takashi Iwai1727a772013-01-10 09:52:52 +01007600 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007601
Takashi Iwai1d045db2011-07-07 18:23:21 +02007602 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007603
7604 error:
7605 alc_free(codec);
7606 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007607}
7608
7609/*
7610 * ALC861
7611 */
7612
Takashi Iwai1d045db2011-07-07 18:23:21 +02007613static int alc861_parse_auto_config(struct hda_codec *codec)
7614{
Takashi Iwai1d045db2011-07-07 18:23:21 +02007615 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007616 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
7617 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007618}
7619
Takashi Iwai1d045db2011-07-07 18:23:21 +02007620/* Pin config fixes */
7621enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007622 ALC861_FIXUP_FSC_AMILO_PI1505,
7623 ALC861_FIXUP_AMP_VREF_0F,
7624 ALC861_FIXUP_NO_JACK_DETECT,
7625 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007626 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007627};
7628
Takashi Iwai31150f22012-01-30 10:54:08 +01007629/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
7630static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007631 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01007632{
7633 struct alc_spec *spec = codec->spec;
7634 unsigned int val;
7635
Takashi Iwai1727a772013-01-10 09:52:52 +01007636 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01007637 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01007638 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01007639 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
7640 val |= AC_PINCTL_IN_EN;
7641 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02007642 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01007643 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01007644}
7645
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007646/* suppress the jack-detection */
7647static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007648 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007649{
Takashi Iwai1727a772013-01-10 09:52:52 +01007650 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007651 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02007652}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007653
Takashi Iwai1727a772013-01-10 09:52:52 +01007654static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007655 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007656 .type = HDA_FIXUP_PINS,
7657 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007658 { 0x0b, 0x0221101f }, /* HP */
7659 { 0x0f, 0x90170310 }, /* speaker */
7660 { }
7661 }
7662 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007663 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007664 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01007665 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01007666 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007667 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007668 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007669 .v.func = alc_fixup_no_jack_detect,
7670 },
7671 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007672 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007673 .v.func = alc861_fixup_asus_amp_vref_0f,
7674 .chained = true,
7675 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007676 },
7677 [ALC660_FIXUP_ASUS_W7J] = {
7678 .type = HDA_FIXUP_VERBS,
7679 .v.verbs = (const struct hda_verb[]) {
7680 /* ASUS W7J needs a magic pin setup on unused NID 0x10
7681 * for enabling outputs
7682 */
7683 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7684 { }
7685 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007686 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007687};
7688
7689static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007690 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01007691 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007692 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
7693 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
7694 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
7695 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
7696 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
7697 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007698 {}
7699};
7700
7701/*
7702 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007703static int patch_alc861(struct hda_codec *codec)
7704{
7705 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007706 int err;
7707
Takashi Iwai3de95172012-05-07 18:03:15 +02007708 err = alc_alloc_spec(codec, 0x15);
7709 if (err < 0)
7710 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007711
Takashi Iwai3de95172012-05-07 18:03:15 +02007712 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007713 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007714
Takashi Iwai225068a2015-05-29 10:42:14 +02007715#ifdef CONFIG_PM
7716 spec->power_hook = alc_power_eapd;
7717#endif
7718
Takashi Iwai1727a772013-01-10 09:52:52 +01007719 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
7720 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007721
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007722 /* automatic parse from the BIOS config */
7723 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007724 if (err < 0)
7725 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007726
Takashi Iwaifea80fa2018-06-20 12:52:46 +02007727 if (!spec->gen.no_analog) {
7728 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
7729 if (err < 0)
7730 goto error;
7731 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007732
Takashi Iwai1727a772013-01-10 09:52:52 +01007733 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007734
Takashi Iwai1d045db2011-07-07 18:23:21 +02007735 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007736
7737 error:
7738 alc_free(codec);
7739 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007740}
7741
7742/*
7743 * ALC861-VD support
7744 *
7745 * Based on ALC882
7746 *
7747 * In addition, an independent DAC
7748 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007749static int alc861vd_parse_auto_config(struct hda_codec *codec)
7750{
Takashi Iwai1d045db2011-07-07 18:23:21 +02007751 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007752 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7753 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007754}
7755
Takashi Iwai1d045db2011-07-07 18:23:21 +02007756enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007757 ALC660VD_FIX_ASUS_GPIO1,
7758 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007759};
7760
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007761/* exclude VREF80 */
7762static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007763 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007764{
Takashi Iwai1727a772013-01-10 09:52:52 +01007765 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01007766 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
7767 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007768 }
7769}
7770
Takashi Iwaidf73d832018-06-19 23:05:47 +02007771/* reset GPIO1 */
7772static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
7773 const struct hda_fixup *fix, int action)
7774{
7775 struct alc_spec *spec = codec->spec;
7776
7777 if (action == HDA_FIXUP_ACT_PRE_PROBE)
7778 spec->gpio_mask |= 0x02;
7779 alc_fixup_gpio(codec, action, 0x01);
7780}
7781
Takashi Iwai1727a772013-01-10 09:52:52 +01007782static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007783 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +02007784 .type = HDA_FIXUP_FUNC,
7785 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007786 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007787 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007788 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007789 .v.func = alc861vd_fixup_dallas,
7790 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02007791};
7792
7793static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007794 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007795 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007796 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007797 {}
7798};
7799
Takashi Iwai1d045db2011-07-07 18:23:21 +02007800/*
7801 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007802static int patch_alc861vd(struct hda_codec *codec)
7803{
7804 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007805 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007806
Takashi Iwai3de95172012-05-07 18:03:15 +02007807 err = alc_alloc_spec(codec, 0x0b);
7808 if (err < 0)
7809 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007810
Takashi Iwai3de95172012-05-07 18:03:15 +02007811 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007812 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007813
Takashi Iwai225068a2015-05-29 10:42:14 +02007814 spec->shutup = alc_eapd_shutup;
7815
Takashi Iwai1727a772013-01-10 09:52:52 +01007816 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
7817 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007818
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007819 /* automatic parse from the BIOS config */
7820 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007821 if (err < 0)
7822 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007823
Takashi Iwaifea80fa2018-06-20 12:52:46 +02007824 if (!spec->gen.no_analog) {
7825 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7826 if (err < 0)
7827 goto error;
7828 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007829
Takashi Iwai1727a772013-01-10 09:52:52 +01007830 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007831
Takashi Iwai1d045db2011-07-07 18:23:21 +02007832 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007833
7834 error:
7835 alc_free(codec);
7836 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007837}
7838
7839/*
7840 * ALC662 support
7841 *
7842 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
7843 * configuration. Each pin widget can choose any input DACs and a mixer.
7844 * Each ADC is connected from a mixer of all inputs. This makes possible
7845 * 6-channel independent captures.
7846 *
7847 * In addition, an independent DAC for the multi-playback (not used in this
7848 * driver yet).
7849 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007850
7851/*
7852 * BIOS auto configuration
7853 */
7854
Kailang Yangbc9f98a2007-04-12 13:06:07 +02007855static int alc662_parse_auto_config(struct hda_codec *codec)
7856{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02007857 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007858 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
7859 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7860 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02007861
Takashi Iwai7639a062015-03-03 10:07:24 +01007862 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
7863 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
7864 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007865 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01007866 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007867 ssids = alc662_ssids;
7868 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02007869}
7870
Todd Broch6be79482010-12-07 16:51:05 -08007871static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007872 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01007873{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01007874 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01007875 return;
Todd Broch6be79482010-12-07 16:51:05 -08007876 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
7877 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
7878 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
7879 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
7880 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01007881 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08007882}
7883
Takashi Iwai8e383952013-10-30 17:41:12 +01007884static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
7885 { .channels = 2,
7886 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
7887 { .channels = 4,
7888 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
7889 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
7890 { }
7891};
7892
7893/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01007894static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01007895 const struct hda_fixup *fix, int action)
7896{
7897 if (action == HDA_FIXUP_ACT_BUILD) {
7898 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +01007899 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +01007900 }
7901}
7902
Takashi Iwaibf686652014-01-13 16:18:25 +01007903/* avoid D3 for keeping GPIO up */
7904static unsigned int gpio_led_power_filter(struct hda_codec *codec,
7905 hda_nid_t nid,
7906 unsigned int power_state)
7907{
7908 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +02007909 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +01007910 return AC_PWRST_D0;
7911 return power_state;
7912}
7913
Takashi Iwai3e887f32014-01-10 17:50:58 +01007914static void alc662_fixup_led_gpio1(struct hda_codec *codec,
7915 const struct hda_fixup *fix, int action)
7916{
7917 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +01007918
Takashi Iwai01e4a272018-06-19 22:47:30 +02007919 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +01007920 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01007921 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +01007922 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01007923 }
7924}
7925
Kailang Yangc6790c82016-11-25 16:15:17 +08007926static void alc662_usi_automute_hook(struct hda_codec *codec,
7927 struct hda_jack_callback *jack)
7928{
7929 struct alc_spec *spec = codec->spec;
7930 int vref;
7931 msleep(200);
7932 snd_hda_gen_hp_automute(codec, jack);
7933
7934 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
7935 msleep(100);
7936 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7937 vref);
7938}
7939
7940static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
7941 const struct hda_fixup *fix, int action)
7942{
7943 struct alc_spec *spec = codec->spec;
7944 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7945 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7946 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
7947 }
7948}
7949
Kailang Yangf3f91852014-10-24 15:43:46 +08007950static struct coef_fw alc668_coefs[] = {
7951 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
7952 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
7953 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
7954 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
7955 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
7956 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
7957 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
7958 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
7959 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
7960 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
7961 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
7962 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
7963 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
7964 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
7965 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
7966 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
7967 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
7968 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
7969 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
7970 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
7971 {}
7972};
7973
7974static void alc668_restore_default_value(struct hda_codec *codec)
7975{
7976 alc_process_coef_fw(codec, alc668_coefs);
7977}
7978
David Henningsson6cb3b702010-09-09 08:51:44 +02007979enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04007980 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01007981 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02007982 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08007983 ALC272_FIXUP_MARIO,
Anisse Astierd2ebd472011-01-20 12:36:21 +01007984 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02007985 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02007986 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02007987 ALC662_FIXUP_ASUS_MODE1,
7988 ALC662_FIXUP_ASUS_MODE2,
7989 ALC662_FIXUP_ASUS_MODE3,
7990 ALC662_FIXUP_ASUS_MODE4,
7991 ALC662_FIXUP_ASUS_MODE5,
7992 ALC662_FIXUP_ASUS_MODE6,
7993 ALC662_FIXUP_ASUS_MODE7,
7994 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01007995 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02007996 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02007997 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +02007998 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02007999 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02008000 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +02008001 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01008002 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01008003 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008004 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01008005 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08008006 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02008007 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02008008 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02008009 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02008010 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008011 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02008012 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +02008013 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008014 ALC891_FIXUP_HEADSET_MODE,
8015 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08008016 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008017 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +08008018 ALC662_FIXUP_USI_FUNC,
8019 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +08008020 ALC662_FIXUP_LENOVO_MULTI_CODECS,
David Henningsson6cb3b702010-09-09 08:51:44 +02008021};
8022
Takashi Iwai1727a772013-01-10 09:52:52 +01008023static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04008024 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008025 .type = HDA_FIXUP_PINS,
8026 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04008027 { 0x15, 0x99130112 }, /* subwoofer */
8028 { }
8029 }
8030 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01008031 [ALC662_FIXUP_LED_GPIO1] = {
8032 .type = HDA_FIXUP_FUNC,
8033 .v.func = alc662_fixup_led_gpio1,
8034 },
David Henningsson6cb3b702010-09-09 08:51:44 +02008035 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008036 .type = HDA_FIXUP_PINS,
8037 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02008038 { 0x17, 0x99130112 }, /* subwoofer */
8039 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01008040 },
8041 .chained = true,
8042 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02008043 },
Todd Broch6be79482010-12-07 16:51:05 -08008044 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008045 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01008046 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01008047 },
8048 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008049 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +01008050 .v.verbs = (const struct hda_verb[]) {
8051 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
8052 {}
8053 }
8054 },
David Henningsson94024cd2011-04-29 14:10:55 +02008055 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008056 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02008057 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +02008058 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02008059 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008060 .type = HDA_FIXUP_PINS,
8061 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02008062 { 0x14, 0x0221201f }, /* HP out */
8063 { }
8064 },
8065 .chained = true,
8066 .chain_id = ALC662_FIXUP_SKU_IGNORE
8067 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02008068 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008069 .type = HDA_FIXUP_PINS,
8070 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008071 { 0x14, 0x99130110 }, /* speaker */
8072 { 0x18, 0x01a19c20 }, /* mic */
8073 { 0x19, 0x99a3092f }, /* int-mic */
8074 { 0x21, 0x0121401f }, /* HP out */
8075 { }
8076 },
8077 .chained = true,
8078 .chain_id = ALC662_FIXUP_SKU_IGNORE
8079 },
8080 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008081 .type = HDA_FIXUP_PINS,
8082 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +02008083 { 0x14, 0x99130110 }, /* speaker */
8084 { 0x18, 0x01a19820 }, /* mic */
8085 { 0x19, 0x99a3092f }, /* int-mic */
8086 { 0x1b, 0x0121401f }, /* HP out */
8087 { }
8088 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02008089 .chained = true,
8090 .chain_id = ALC662_FIXUP_SKU_IGNORE
8091 },
8092 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008093 .type = HDA_FIXUP_PINS,
8094 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008095 { 0x14, 0x99130110 }, /* speaker */
8096 { 0x15, 0x0121441f }, /* HP */
8097 { 0x18, 0x01a19840 }, /* mic */
8098 { 0x19, 0x99a3094f }, /* int-mic */
8099 { 0x21, 0x01211420 }, /* HP2 */
8100 { }
8101 },
8102 .chained = true,
8103 .chain_id = ALC662_FIXUP_SKU_IGNORE
8104 },
8105 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008106 .type = HDA_FIXUP_PINS,
8107 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008108 { 0x14, 0x99130110 }, /* speaker */
8109 { 0x16, 0x99130111 }, /* speaker */
8110 { 0x18, 0x01a19840 }, /* mic */
8111 { 0x19, 0x99a3094f }, /* int-mic */
8112 { 0x21, 0x0121441f }, /* HP */
8113 { }
8114 },
8115 .chained = true,
8116 .chain_id = ALC662_FIXUP_SKU_IGNORE
8117 },
8118 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008119 .type = HDA_FIXUP_PINS,
8120 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008121 { 0x14, 0x99130110 }, /* speaker */
8122 { 0x15, 0x0121441f }, /* HP */
8123 { 0x16, 0x99130111 }, /* speaker */
8124 { 0x18, 0x01a19840 }, /* mic */
8125 { 0x19, 0x99a3094f }, /* int-mic */
8126 { }
8127 },
8128 .chained = true,
8129 .chain_id = ALC662_FIXUP_SKU_IGNORE
8130 },
8131 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008132 .type = HDA_FIXUP_PINS,
8133 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008134 { 0x14, 0x99130110 }, /* speaker */
8135 { 0x15, 0x01211420 }, /* HP2 */
8136 { 0x18, 0x01a19840 }, /* mic */
8137 { 0x19, 0x99a3094f }, /* int-mic */
8138 { 0x1b, 0x0121441f }, /* HP */
8139 { }
8140 },
8141 .chained = true,
8142 .chain_id = ALC662_FIXUP_SKU_IGNORE
8143 },
8144 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008145 .type = HDA_FIXUP_PINS,
8146 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008147 { 0x14, 0x99130110 }, /* speaker */
8148 { 0x17, 0x99130111 }, /* speaker */
8149 { 0x18, 0x01a19840 }, /* mic */
8150 { 0x19, 0x99a3094f }, /* int-mic */
8151 { 0x1b, 0x01214020 }, /* HP */
8152 { 0x21, 0x0121401f }, /* HP */
8153 { }
8154 },
8155 .chained = true,
8156 .chain_id = ALC662_FIXUP_SKU_IGNORE
8157 },
8158 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008159 .type = HDA_FIXUP_PINS,
8160 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008161 { 0x14, 0x99130110 }, /* speaker */
8162 { 0x12, 0x99a30970 }, /* int-mic */
8163 { 0x15, 0x01214020 }, /* HP */
8164 { 0x17, 0x99130111 }, /* speaker */
8165 { 0x18, 0x01a19840 }, /* mic */
8166 { 0x21, 0x0121401f }, /* HP */
8167 { }
8168 },
8169 .chained = true,
8170 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +02008171 },
Takashi Iwai1565cc32012-02-13 12:03:25 +01008172 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008173 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +01008174 .v.func = alc_fixup_no_jack_detect,
8175 },
David Henningssonedfe3bf2012-06-12 13:15:12 +02008176 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008177 .type = HDA_FIXUP_PINS,
8178 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +02008179 { 0x1b, 0x02214020 }, /* Front HP */
8180 { }
8181 }
8182 },
Takashi Iwai125821a2012-06-22 14:30:29 +02008183 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008184 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02008185 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +02008186 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02008187 [ALC668_FIXUP_DELL_XPS13] = {
8188 .type = HDA_FIXUP_FUNC,
8189 .v.func = alc_fixup_dell_xps13,
8190 .chained = true,
8191 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
8192 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02008193 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
8194 .type = HDA_FIXUP_FUNC,
8195 .v.func = alc_fixup_disable_aamix,
8196 .chained = true,
8197 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8198 },
Hui Wang493a52a2014-01-14 14:07:36 +08008199 [ALC668_FIXUP_AUTO_MUTE] = {
8200 .type = HDA_FIXUP_FUNC,
8201 .v.func = alc_fixup_auto_mute_via_amp,
8202 .chained = true,
8203 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8204 },
David Henningsson1f8b46c2015-05-12 14:38:15 +02008205 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
8206 .type = HDA_FIXUP_PINS,
8207 .v.pins = (const struct hda_pintbl[]) {
8208 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8209 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
8210 { }
8211 },
8212 .chained = true,
8213 .chain_id = ALC662_FIXUP_HEADSET_MODE
8214 },
8215 [ALC662_FIXUP_HEADSET_MODE] = {
8216 .type = HDA_FIXUP_FUNC,
8217 .v.func = alc_fixup_headset_mode_alc662,
8218 },
David Henningsson73bdd592013-04-15 15:44:14 +02008219 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
8220 .type = HDA_FIXUP_PINS,
8221 .v.pins = (const struct hda_pintbl[]) {
8222 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8223 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8224 { }
8225 },
8226 .chained = true,
8227 .chain_id = ALC668_FIXUP_HEADSET_MODE
8228 },
8229 [ALC668_FIXUP_HEADSET_MODE] = {
8230 .type = HDA_FIXUP_FUNC,
8231 .v.func = alc_fixup_headset_mode_alc668,
8232 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01008233 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +01008234 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01008235 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +01008236 .chained = true,
8237 .chain_id = ALC662_FIXUP_ASUS_MODE4
8238 },
David Henningsson61a75f12014-02-07 09:31:08 +01008239 [ALC662_FIXUP_BASS_16] = {
8240 .type = HDA_FIXUP_PINS,
8241 .v.pins = (const struct hda_pintbl[]) {
8242 {0x16, 0x80106111}, /* bass speaker */
8243 {}
8244 },
8245 .chained = true,
8246 .chain_id = ALC662_FIXUP_BASS_CHMAP,
8247 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008248 [ALC662_FIXUP_BASS_1A] = {
8249 .type = HDA_FIXUP_PINS,
8250 .v.pins = (const struct hda_pintbl[]) {
8251 {0x1a, 0x80106111}, /* bass speaker */
8252 {}
8253 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01008254 .chained = true,
8255 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008256 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01008257 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008258 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01008259 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008260 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02008261 [ALC662_FIXUP_ASUS_Nx50] = {
8262 .type = HDA_FIXUP_FUNC,
8263 .v.func = alc_fixup_auto_mute_via_amp,
8264 .chained = true,
8265 .chain_id = ALC662_FIXUP_BASS_1A
8266 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02008267 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
8268 .type = HDA_FIXUP_FUNC,
8269 .v.func = alc_fixup_headset_mode_alc668,
8270 .chain_id = ALC662_FIXUP_BASS_CHMAP
8271 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008272 [ALC668_FIXUP_ASUS_Nx51] = {
8273 .type = HDA_FIXUP_PINS,
8274 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02008275 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8276 { 0x1a, 0x90170151 }, /* bass speaker */
8277 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008278 {}
8279 },
8280 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02008281 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008282 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02008283 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +02008284 .type = HDA_FIXUP_VERBS,
8285 .v.verbs = (const struct hda_verb[]) {
8286 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
8287 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
8288 {}
8289 },
8290 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02008291 [ALC668_FIXUP_ASUS_G751] = {
8292 .type = HDA_FIXUP_PINS,
8293 .v.pins = (const struct hda_pintbl[]) {
8294 { 0x16, 0x0421101f }, /* HP */
8295 {}
8296 },
8297 .chained = true,
8298 .chain_id = ALC668_FIXUP_MIC_COEF
8299 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008300 [ALC891_FIXUP_HEADSET_MODE] = {
8301 .type = HDA_FIXUP_FUNC,
8302 .v.func = alc_fixup_headset_mode,
8303 },
8304 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
8305 .type = HDA_FIXUP_PINS,
8306 .v.pins = (const struct hda_pintbl[]) {
8307 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8308 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8309 { }
8310 },
8311 .chained = true,
8312 .chain_id = ALC891_FIXUP_HEADSET_MODE
8313 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08008314 [ALC662_FIXUP_ACER_VERITON] = {
8315 .type = HDA_FIXUP_PINS,
8316 .v.pins = (const struct hda_pintbl[]) {
8317 { 0x15, 0x50170120 }, /* no internal speaker */
8318 { }
8319 }
8320 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008321 [ALC892_FIXUP_ASROCK_MOBO] = {
8322 .type = HDA_FIXUP_PINS,
8323 .v.pins = (const struct hda_pintbl[]) {
8324 { 0x15, 0x40f000f0 }, /* disabled */
8325 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008326 { }
8327 }
8328 },
Kailang Yangc6790c82016-11-25 16:15:17 +08008329 [ALC662_FIXUP_USI_FUNC] = {
8330 .type = HDA_FIXUP_FUNC,
8331 .v.func = alc662_fixup_usi_headset_mic,
8332 },
8333 [ALC662_FIXUP_USI_HEADSET_MODE] = {
8334 .type = HDA_FIXUP_PINS,
8335 .v.pins = (const struct hda_pintbl[]) {
8336 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
8337 { 0x18, 0x01a1903d },
8338 { }
8339 },
8340 .chained = true,
8341 .chain_id = ALC662_FIXUP_USI_FUNC
8342 },
Kailang Yangca169cc2017-04-25 16:17:40 +08008343 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
8344 .type = HDA_FIXUP_FUNC,
8345 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8346 },
David Henningsson6cb3b702010-09-09 08:51:44 +02008347};
8348
Takashi Iwaia9111322011-05-02 11:30:18 +02008349static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008350 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +02008351 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +01008352 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +01008353 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +02008354 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +02008355 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +02008356 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -04008357 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
David Henningsson73bdd592013-04-15 15:44:14 +02008358 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8359 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +02008360 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02008361 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +02008362 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +01008363 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff992013-11-07 09:28:59 +01008364 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +08008365 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8366 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +08008367 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02008368 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Kaho Ng2da2dc92016-05-09 00:27:49 +08008369 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +02008370 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwaidb8948e2016-01-18 09:17:30 +01008371 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02008372 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +02008373 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
David Henningsson8e54b4a2014-02-07 09:31:07 +01008374 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +01008375 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008376 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
8377 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Takashi Iwaic7efff92017-01-04 21:38:16 +01008378 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +01008379 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +01008380 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +01008381 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +02008382 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -05008383 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +08008384 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +08008385 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +06008386 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +02008387 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008388 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +02008389 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08008390 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Anisse Astierd2ebd472011-01-20 12:36:21 +01008391 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +02008392
8393#if 0
8394 /* Below is a quirk table taken from the old code.
8395 * Basically the device should work as is without the fixup table.
8396 * If BIOS doesn't give a proper info, enable the corresponding
8397 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008398 */
Takashi Iwai53c334a2011-08-23 18:27:14 +02008399 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
8400 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
8401 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
8402 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
8403 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8404 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8405 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8406 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
8407 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
8408 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8409 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
8410 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
8411 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
8412 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
8413 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
8414 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8415 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
8416 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
8417 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8418 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8419 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8420 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8421 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
8422 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
8423 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
8424 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8425 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
8426 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8427 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8428 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
8429 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8430 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8431 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
8432 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
8433 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
8434 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
8435 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
8436 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
8437 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
8438 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8439 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
8440 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
8441 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8442 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
8443 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
8444 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
8445 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
8446 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
8447 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8448 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
8449#endif
David Henningsson6cb3b702010-09-09 08:51:44 +02008450 {}
8451};
8452
Takashi Iwai1727a772013-01-10 09:52:52 +01008453static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008454 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
8455 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -08008456 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008457 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +02008458 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
8459 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
8460 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
8461 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
8462 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
8463 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
8464 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
8465 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008466 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02008467 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008468 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +02008469 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008470 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
8471 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
8472 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
8473 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
8474 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
8475 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
8476 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
8477 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +02008478 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008479 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
8480 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
8481 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
8482 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
8483 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02008484 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Todd Broch6be79482010-12-07 16:51:05 -08008485 {}
8486};
David Henningsson6cb3b702010-09-09 08:51:44 +02008487
Hui Wang532895c2014-05-29 15:59:19 +08008488static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008489 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8490 {0x17, 0x02211010},
8491 {0x18, 0x01a19030},
8492 {0x1a, 0x01813040},
8493 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +02008494 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02008495 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +02008496 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +02008497 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +08008498 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +02008499 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8500 {0x12, 0x99a30130},
8501 {0x14, 0x90170110},
8502 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008503 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008504 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8505 {0x12, 0x99a30140},
8506 {0x14, 0x90170110},
8507 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008508 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008509 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8510 {0x12, 0x99a30150},
8511 {0x14, 0x90170110},
8512 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008513 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008514 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +02008515 {0x14, 0x90170110},
8516 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008517 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008518 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
8519 {0x12, 0x90a60130},
8520 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08008521 {0x15, 0x0321101f}),
Hui Wang532895c2014-05-29 15:59:19 +08008522 {}
8523};
8524
Takashi Iwai1d045db2011-07-07 18:23:21 +02008525/*
8526 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008527static int patch_alc662(struct hda_codec *codec)
8528{
8529 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02008530 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008531
Takashi Iwai3de95172012-05-07 18:03:15 +02008532 err = alc_alloc_spec(codec, 0x0b);
8533 if (err < 0)
8534 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008535
Takashi Iwai3de95172012-05-07 18:03:15 +02008536 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008537
Takashi Iwai225068a2015-05-29 10:42:14 +02008538 spec->shutup = alc_eapd_shutup;
8539
Takashi Iwai53c334a2011-08-23 18:27:14 +02008540 /* handle multiple HPs as is */
8541 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
8542
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +02008543 alc_fix_pll_init(codec, 0x20, 0x04, 15);
8544
Takashi Iwai7639a062015-03-03 10:07:24 +01008545 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +08008546 case 0x10ec0668:
8547 spec->init_hook = alc668_restore_default_value;
8548 break;
Kailang Yangf3f91852014-10-24 15:43:46 +08008549 }
Kailang Yang8663ff72012-06-29 09:35:52 +02008550
Takashi Iwai1727a772013-01-10 09:52:52 +01008551 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +02008552 alc662_fixup_tbl, alc662_fixups);
Hui Wang532895c2014-05-29 15:59:19 +08008553 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01008554 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +02008555
8556 alc_auto_parse_customize_define(codec);
8557
Takashi Iwai7504b6c2013-03-18 11:25:51 +01008558 if (has_cdefine_beep(codec))
8559 spec->gen.beep_nid = 0x01;
8560
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008561 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +01008562 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008563 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +08008564 err = alc_codec_rename(codec, "ALC272X");
8565 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008566 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008567 }
Kailang Yang274693f2009-12-03 10:07:50 +01008568
Takashi Iwaib9c51062011-08-24 18:08:07 +02008569 /* automatic parse from the BIOS config */
8570 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008571 if (err < 0)
8572 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008573
Takashi Iwai7504b6c2013-03-18 11:25:51 +01008574 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +01008575 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +01008576 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008577 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +01008578 break;
8579 case 0x10ec0272:
8580 case 0x10ec0663:
8581 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +08008582 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008583 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +01008584 break;
8585 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008586 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +01008587 break;
8588 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008589 if (err < 0)
8590 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +01008591 }
Takashi Iwai2134ea42008-01-10 16:53:55 +01008592
Takashi Iwai1727a772013-01-10 09:52:52 +01008593 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01008594
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008595 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008596
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008597 error:
8598 alc_free(codec);
8599 return err;
Kailang Yangb478b992011-05-18 11:51:15 +02008600}
8601
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008602/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008603 * ALC680 support
8604 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008605
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008606static int alc680_parse_auto_config(struct hda_codec *codec)
8607{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02008608 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008609}
8610
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008611/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008612 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008613static int patch_alc680(struct hda_codec *codec)
8614{
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008615 int err;
8616
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008617 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02008618 err = alc_alloc_spec(codec, 0);
8619 if (err < 0)
8620 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008621
Takashi Iwai1ebec5f2011-08-15 13:21:48 +02008622 /* automatic parse from the BIOS config */
8623 err = alc680_parse_auto_config(codec);
8624 if (err < 0) {
8625 alc_free(codec);
8626 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008627 }
8628
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008629 return 0;
8630}
8631
8632/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07008633 * patch entries
8634 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008635static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +08008636 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008637 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +08008638 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008639 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
8640 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008641 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008642 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +08008643 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008644 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
8645 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +08008646 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008647 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
8648 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
8649 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
8650 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
8651 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
8652 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
8653 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008654 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008655 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
8656 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
8657 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
8658 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
8659 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
8660 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +08008661 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008662 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
8663 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +08008664 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008665 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
8666 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
8667 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008668 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +08008669 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008670 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +08008671 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +08008672 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008673 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
8674 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
8675 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
8676 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
8677 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
8678 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
8679 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
8680 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
8681 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
8682 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
8683 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
8684 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
8685 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
8686 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +08008687 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
8688 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
8689 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008690 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008691 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
8692 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
8693 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
8694 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
8695 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
8696 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
8697 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
8698 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
8699 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
8700 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
8701 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
8702 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
8703 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +08008704 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +08008705 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -07008706 {} /* terminator */
8707};
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008708MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +01008709
8710MODULE_LICENSE("GPL");
8711MODULE_DESCRIPTION("Realtek HD-audio codec");
8712
Takashi Iwaid8a766a2015-02-17 15:25:37 +01008713static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008714 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +01008715};
8716
Takashi Iwaid8a766a2015-02-17 15:25:37 +01008717module_hda_codec_driver(realtek_driver);