blob: 715ab2342151e406f76f6385c098846d2fc9f1d4 [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 Iwaic0ca5ec2019-02-20 16:15:45 +0100121 unsigned int no_shutup_pins:1;
Takashi Iwaie64f14f2009-01-20 18:32:55 +0100122
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200123 /* for PLL fix */
124 hda_nid_t pll_nid;
125 unsigned int pll_coef_idx, pll_coef_bit;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200126 unsigned int coef0;
David Henningsson33f4acd2015-01-07 15:50:13 +0100127 struct input_dev *kb_dev;
Hui Wangc7b60a82015-12-28 11:35:25 +0800128 u8 alc_mute_keycode_map[1];
Kailang Yangdf694da2005-12-05 19:42:22 +0100129};
130
Takashi Iwai23f0c042009-02-26 13:03:58 +0100131/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200132 * COEF access helper functions
133 */
134
135static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
136 unsigned int coef_idx)
137{
138 unsigned int val;
139
140 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
141 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
142 return val;
143}
144
145#define alc_read_coef_idx(codec, coef_idx) \
146 alc_read_coefex_idx(codec, 0x20, coef_idx)
147
148static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
149 unsigned int coef_idx, unsigned int coef_val)
150{
151 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
153}
154
155#define alc_write_coef_idx(codec, coef_idx, coef_val) \
156 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
157
Takashi Iwai98b24882014-08-18 13:47:50 +0200158static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
159 unsigned int coef_idx, unsigned int mask,
160 unsigned int bits_set)
161{
162 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
163
164 if (val != -1)
165 alc_write_coefex_idx(codec, nid, coef_idx,
166 (val & ~mask) | bits_set);
167}
168
169#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
170 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
171
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200172/* a special bypass for COEF 0; read the cached value at the second time */
173static unsigned int alc_get_coef0(struct hda_codec *codec)
174{
175 struct alc_spec *spec = codec->spec;
176
177 if (!spec->coef0)
178 spec->coef0 = alc_read_coef_idx(codec, 0);
179 return spec->coef0;
180}
181
Takashi Iwai54db6c32014-08-18 15:11:19 +0200182/* coef writes/updates batch */
183struct coef_fw {
184 unsigned char nid;
185 unsigned char idx;
186 unsigned short mask;
187 unsigned short val;
188};
189
190#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
191 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
192#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
193#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
194#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
195
196static void alc_process_coef_fw(struct hda_codec *codec,
197 const struct coef_fw *fw)
198{
199 for (; fw->nid; fw++) {
200 if (fw->mask == (unsigned short)-1)
201 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
202 else
203 alc_update_coefex_idx(codec, fw->nid, fw->idx,
204 fw->mask, fw->val);
205 }
206}
207
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200208/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200209 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100210 */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200211
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200212/* Enable GPIO mask and set output */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200213static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
214{
215 struct alc_spec *spec = codec->spec;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200216
Takashi Iwai5579cd62018-06-19 22:22:41 +0200217 spec->gpio_mask |= mask;
218 spec->gpio_dir |= mask;
219 spec->gpio_data |= mask;
220}
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200221
Takashi Iwai5579cd62018-06-19 22:22:41 +0200222static void alc_write_gpio_data(struct hda_codec *codec)
223{
224 struct alc_spec *spec = codec->spec;
225
226 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
227 spec->gpio_data);
228}
229
Takashi Iwaiaaf312d2018-06-19 22:28:22 +0200230static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
231 bool on)
232{
233 struct alc_spec *spec = codec->spec;
234 unsigned int oldval = spec->gpio_data;
235
236 if (on)
237 spec->gpio_data |= mask;
238 else
239 spec->gpio_data &= ~mask;
240 if (oldval != spec->gpio_data)
241 alc_write_gpio_data(codec);
242}
243
Takashi Iwai5579cd62018-06-19 22:22:41 +0200244static void alc_write_gpio(struct hda_codec *codec)
245{
246 struct alc_spec *spec = codec->spec;
247
248 if (!spec->gpio_mask)
249 return;
250
251 snd_hda_codec_write(codec, codec->core.afg, 0,
252 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
253 snd_hda_codec_write(codec, codec->core.afg, 0,
254 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
Takashi Iwai215c8502018-06-19 22:34:26 +0200255 if (spec->gpio_write_delay)
256 msleep(1);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200257 alc_write_gpio_data(codec);
258}
259
260static void alc_fixup_gpio(struct hda_codec *codec, int action,
261 unsigned int mask)
262{
263 if (action == HDA_FIXUP_ACT_PRE_PROBE)
264 alc_setup_gpio(codec, mask);
265}
266
267static void alc_fixup_gpio1(struct hda_codec *codec,
268 const struct hda_fixup *fix, int action)
269{
270 alc_fixup_gpio(codec, action, 0x01);
271}
272
273static void alc_fixup_gpio2(struct hda_codec *codec,
274 const struct hda_fixup *fix, int action)
275{
276 alc_fixup_gpio(codec, action, 0x02);
277}
278
279static void alc_fixup_gpio3(struct hda_codec *codec,
280 const struct hda_fixup *fix, int action)
281{
282 alc_fixup_gpio(codec, action, 0x03);
283}
Kailang Yangbdd148a2007-05-08 15:19:08 +0200284
Takashi Iwaiae065f12018-06-19 23:00:03 +0200285static void alc_fixup_gpio4(struct hda_codec *codec,
286 const struct hda_fixup *fix, int action)
287{
288 alc_fixup_gpio(codec, action, 0x04);
289}
290
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200291/*
292 * Fix hardware PLL issue
293 * On some codecs, the analog PLL gating control must be off while
294 * the default value is 1.
295 */
296static void alc_fix_pll(struct hda_codec *codec)
297{
298 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200299
Takashi Iwai98b24882014-08-18 13:47:50 +0200300 if (spec->pll_nid)
301 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
302 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200303}
304
305static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
306 unsigned int coef_idx, unsigned int coef_bit)
307{
308 struct alc_spec *spec = codec->spec;
309 spec->pll_nid = nid;
310 spec->pll_coef_idx = coef_idx;
311 spec->pll_coef_bit = coef_bit;
312 alc_fix_pll(codec);
313}
314
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100315/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200316static void alc_update_knob_master(struct hda_codec *codec,
317 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100318{
319 unsigned int val;
320 struct snd_kcontrol *kctl;
321 struct snd_ctl_elem_value *uctl;
322
323 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
324 if (!kctl)
325 return;
326 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
327 if (!uctl)
328 return;
Takashi Iwai2ebab402016-02-09 10:23:52 +0100329 val = snd_hda_codec_read(codec, jack->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100330 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
331 val &= HDA_AMP_VOLMASK;
332 uctl->value.integer.value[0] = val;
333 uctl->value.integer.value[1] = val;
334 kctl->put(kctl, uctl);
335 kfree(uctl);
336}
337
David Henningsson29adc4b2012-09-25 11:31:00 +0200338static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100339{
David Henningsson29adc4b2012-09-25 11:31:00 +0200340 /* For some reason, the res given from ALC880 is broken.
341 Here we adjust it properly. */
342 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100343}
344
Kailang Yang394c97f2014-11-12 17:38:08 +0800345/* Change EAPD to verb control */
346static void alc_fill_eapd_coef(struct hda_codec *codec)
347{
348 int coef;
349
350 coef = alc_get_coef0(codec);
351
Takashi Iwai7639a062015-03-03 10:07:24 +0100352 switch (codec->core.vendor_id) {
Kailang Yang394c97f2014-11-12 17:38:08 +0800353 case 0x10ec0262:
354 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
355 break;
356 case 0x10ec0267:
357 case 0x10ec0268:
358 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
359 break;
360 case 0x10ec0269:
361 if ((coef & 0x00f0) == 0x0010)
362 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
363 if ((coef & 0x00f0) == 0x0020)
364 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
365 if ((coef & 0x00f0) == 0x0030)
366 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
367 break;
368 case 0x10ec0280:
369 case 0x10ec0284:
370 case 0x10ec0290:
371 case 0x10ec0292:
372 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
373 break;
Kailang Yang42314302016-02-03 15:03:50 +0800374 case 0x10ec0225:
Takashi Iwai44be77c2017-12-27 08:53:59 +0100375 case 0x10ec0295:
376 case 0x10ec0299:
377 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
378 /* fallthrough */
379 case 0x10ec0215:
Kailang Yang394c97f2014-11-12 17:38:08 +0800380 case 0x10ec0233:
Kailang Yangea04a1d2018-04-25 15:31:52 +0800381 case 0x10ec0235:
Kailang Yang736f20a2017-10-20 15:06:34 +0800382 case 0x10ec0236:
Kailang Yang394c97f2014-11-12 17:38:08 +0800383 case 0x10ec0255:
Kailang Yang4344aec2014-12-17 17:39:05 +0800384 case 0x10ec0256:
Kailang Yangf429e7e2017-12-05 15:38:24 +0800385 case 0x10ec0257:
Kailang Yang394c97f2014-11-12 17:38:08 +0800386 case 0x10ec0282:
387 case 0x10ec0283:
388 case 0x10ec0286:
389 case 0x10ec0288:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800390 case 0x10ec0285:
Kailang Yang506b62c2014-12-18 17:07:44 +0800391 case 0x10ec0298:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800392 case 0x10ec0289:
Kailang Yang1078bef2018-11-08 16:36:15 +0800393 case 0x10ec0300:
Kailang Yang394c97f2014-11-12 17:38:08 +0800394 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
395 break;
Kailang Yang3aabf942017-11-08 15:28:33 +0800396 case 0x10ec0275:
397 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
398 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800399 case 0x10ec0293:
400 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
401 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800402 case 0x10ec0234:
403 case 0x10ec0274:
404 case 0x10ec0294:
Kailang Yang6fbae352016-05-30 16:44:20 +0800405 case 0x10ec0700:
406 case 0x10ec0701:
407 case 0x10ec0703:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800408 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
409 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800410 case 0x10ec0662:
411 if ((coef & 0x00f0) == 0x0030)
412 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
413 break;
414 case 0x10ec0272:
415 case 0x10ec0273:
416 case 0x10ec0663:
417 case 0x10ec0665:
418 case 0x10ec0670:
419 case 0x10ec0671:
420 case 0x10ec0672:
421 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
422 break;
423 case 0x10ec0668:
424 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
425 break;
426 case 0x10ec0867:
427 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
428 break;
429 case 0x10ec0888:
430 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
431 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
432 break;
433 case 0x10ec0892:
434 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
435 break;
436 case 0x10ec0899:
437 case 0x10ec0900:
Kailang Yang65553b12017-07-11 15:15:47 +0800438 case 0x10ec1168:
Kailang Yanga535ad52017-01-16 16:59:26 +0800439 case 0x10ec1220:
Kailang Yang394c97f2014-11-12 17:38:08 +0800440 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
441 break;
442 }
443}
444
Kailang Yangf9423e72008-05-27 12:32:25 +0200445/* additional initialization for ALC888 variants */
446static void alc888_coef_init(struct hda_codec *codec)
447{
Kailang Yang1df88742014-10-29 16:10:13 +0800448 switch (alc_get_coef0(codec) & 0x00f0) {
449 /* alc888-VA */
450 case 0x00:
451 /* alc888-VB */
452 case 0x10:
453 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
454 break;
455 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200456}
457
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100458/* turn on/off EAPD control (only if available) */
459static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
460{
461 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
462 return;
463 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
464 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
465 on ? 2 : 0);
466}
467
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200468/* turn on/off EAPD controls of the codec */
469static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
470{
471 /* We currently only handle front, HP */
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200472 static hda_nid_t pins[] = {
Hui Wangaf95b412015-03-26 17:14:55 +0800473 0x0f, 0x10, 0x14, 0x15, 0x17, 0
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200474 };
475 hda_nid_t *p;
476 for (p = pins; *p; p++)
477 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200478}
479
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100480static void alc_shutup_pins(struct hda_codec *codec)
481{
482 struct alc_spec *spec = codec->spec;
483
484 if (!spec->no_shutup_pins)
485 snd_hda_shutup_pins(codec);
486}
487
Takashi Iwai1c7161532011-04-07 10:37:16 +0200488/* generic shutup callback;
Lars-Peter Clausen4ce8e6a2016-11-08 15:48:06 +0100489 * just turning off EAPD and a little pause for avoiding pop-noise
Takashi Iwai1c7161532011-04-07 10:37:16 +0200490 */
491static void alc_eapd_shutup(struct hda_codec *codec)
492{
Kailang Yang97a26572013-11-29 00:35:26 -0500493 struct alc_spec *spec = codec->spec;
494
Takashi Iwai1c7161532011-04-07 10:37:16 +0200495 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500496 if (!spec->no_depop_delay)
497 msleep(200);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100498 alc_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200499}
500
Takashi Iwai1d045db2011-07-07 18:23:21 +0200501/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200502static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200503{
Kailang Yang394c97f2014-11-12 17:38:08 +0800504 alc_fill_eapd_coef(codec);
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200505 alc_auto_setup_eapd(codec, true);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200506 alc_write_gpio(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200507 switch (type) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200508 case ALC_INIT_DEFAULT:
Takashi Iwai7639a062015-03-03 10:07:24 +0100509 switch (codec->core.vendor_id) {
Kailang Yangc9b58002007-10-16 14:30:01 +0200510 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200511 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200512 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200513 case 0x10ec0880:
514 case 0x10ec0882:
515 case 0x10ec0883:
516 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800517 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200518 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200519 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200520 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200521 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200522 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200523 break;
524 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200525}
Kailang Yangea1fb292008-08-26 12:58:38 +0200526
Takashi Iwai35a39f92019-02-01 11:19:50 +0100527/* get a primary headphone pin if available */
528static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
529{
530 if (spec->gen.autocfg.hp_pins[0])
531 return spec->gen.autocfg.hp_pins[0];
532 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
533 return spec->gen.autocfg.line_out_pins[0];
534 return 0;
535}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200536
537/*
538 * Realtek SSID verification
539 */
540
David Henningsson90622912010-10-14 14:50:18 +0200541/* Could be any non-zero and even value. When used as fixup, tells
542 * the driver to ignore any present sku defines.
543 */
544#define ALC_FIXUP_SKU_IGNORE (2)
545
Takashi Iwai23d30f22012-05-07 17:17:32 +0200546static void alc_fixup_sku_ignore(struct hda_codec *codec,
547 const struct hda_fixup *fix, int action)
548{
549 struct alc_spec *spec = codec->spec;
550 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
551 spec->cdefine.fixup = 1;
552 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
553 }
554}
555
Mengdong Linb5c66112013-11-29 00:35:35 -0500556static void alc_fixup_no_depop_delay(struct hda_codec *codec,
557 const struct hda_fixup *fix, int action)
558{
559 struct alc_spec *spec = codec->spec;
560
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500561 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500562 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500563 codec->depop_delay = 0;
564 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500565}
566
Kailang Yangda00c242010-03-19 11:23:45 +0100567static int alc_auto_parse_customize_define(struct hda_codec *codec)
568{
569 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100570 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100571 struct alc_spec *spec = codec->spec;
572
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200573 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
574
David Henningsson90622912010-10-14 14:50:18 +0200575 if (spec->cdefine.fixup) {
576 ass = spec->cdefine.sku_cfg;
577 if (ass == ALC_FIXUP_SKU_IGNORE)
578 return -1;
579 goto do_sku;
580 }
581
Takashi Iwai5100cd02014-02-15 10:03:19 +0100582 if (!codec->bus->pci)
583 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100584 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200585 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100586 goto do_sku;
587
588 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100589 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100590 nid = 0x17;
591 ass = snd_hda_codec_get_pincfg(codec, nid);
592
593 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100594 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100595 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100596 return -1;
597 }
598
599 /* check sum */
600 tmp = 0;
601 for (i = 1; i < 16; i++) {
602 if ((ass >> i) & 1)
603 tmp++;
604 }
605 if (((ass >> 16) & 0xf) != tmp)
606 return -1;
607
608 spec->cdefine.port_connectivity = ass >> 30;
609 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
610 spec->cdefine.check_sum = (ass >> 16) & 0xf;
611 spec->cdefine.customization = ass >> 8;
612do_sku:
613 spec->cdefine.sku_cfg = ass;
614 spec->cdefine.external_amp = (ass & 0x38) >> 3;
615 spec->cdefine.platform_type = (ass & 0x4) >> 2;
616 spec->cdefine.swap = (ass & 0x2) >> 1;
617 spec->cdefine.override = ass & 0x1;
618
Takashi Iwai4e76a882014-02-25 12:21:03 +0100619 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100620 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100621 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100622 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100623 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
624 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
625 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
626 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
627 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
628 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
629 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100630
631 return 0;
632}
633
Takashi Iwai08c189f2012-12-19 15:22:24 +0100634/* return the position of NID in the list, or -1 if not found */
635static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
636{
637 int i;
638 for (i = 0; i < nums; i++)
639 if (list[i] == nid)
640 return i;
641 return -1;
642}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200643/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200644static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
645{
Takashi Iwai21268962011-07-07 15:01:13 +0200646 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200647}
648
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200649/* check subsystem ID and set up device-specific initialization;
650 * return 1 if initialized, 0 if invalid SSID
651 */
652/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
653 * 31 ~ 16 : Manufacture ID
654 * 15 ~ 8 : SKU ID
655 * 7 ~ 0 : Assembly ID
656 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
657 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100658static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200659{
660 unsigned int ass, tmp, i;
661 unsigned nid;
662 struct alc_spec *spec = codec->spec;
663
David Henningsson90622912010-10-14 14:50:18 +0200664 if (spec->cdefine.fixup) {
665 ass = spec->cdefine.sku_cfg;
666 if (ass == ALC_FIXUP_SKU_IGNORE)
667 return 0;
668 goto do_sku;
669 }
670
Takashi Iwai7639a062015-03-03 10:07:24 +0100671 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100672 if (codec->bus->pci &&
673 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200674 goto do_sku;
675
676 /* invalid SSID, check the special NID pin defcfg instead */
677 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400678 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200679 * 29~21 : reserve
680 * 20 : PCBEEP input
681 * 19~16 : Check sum (15:1)
682 * 15~1 : Custom
683 * 0 : override
684 */
685 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100686 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200687 nid = 0x17;
688 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100689 codec_dbg(codec,
690 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200691 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100692 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200693 return 0;
694 if ((ass >> 30) != 1) /* no physical connection */
695 return 0;
696
697 /* check sum */
698 tmp = 0;
699 for (i = 1; i < 16; i++) {
700 if ((ass >> i) & 1)
701 tmp++;
702 }
703 if (((ass >> 16) & 0xf) != tmp)
704 return 0;
705do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100706 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100707 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200708 /*
709 * 0 : override
710 * 1 : Swap Jack
711 * 2 : 0 --> Desktop, 1 --> Laptop
712 * 3~5 : External Amplifier control
713 * 7~6 : Reserved
714 */
715 tmp = (ass & 0x38) >> 3; /* external Amp control */
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200716 if (spec->init_amp == ALC_INIT_UNDEFINED) {
717 switch (tmp) {
718 case 1:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200719 alc_setup_gpio(codec, 0x01);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200720 break;
721 case 3:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200722 alc_setup_gpio(codec, 0x02);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200723 break;
724 case 7:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200725 alc_setup_gpio(codec, 0x03);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200726 break;
727 case 5:
728 default:
729 spec->init_amp = ALC_INIT_DEFAULT;
730 break;
731 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200732 }
733
734 /* is laptop or Desktop and enable the function "Mute internal speaker
735 * when the external headphone out jack is plugged"
736 */
737 if (!(ass & 0x8000))
738 return 1;
739 /*
740 * 10~8 : Jack location
741 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
742 * 14~13: Resvered
743 * 15 : 1 --> enable the function "Mute internal speaker
744 * when the external headphone out jack is plugged"
745 */
Takashi Iwai35a39f92019-02-01 11:19:50 +0100746 if (!alc_get_hp_pin(spec)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200747 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200748 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100749 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100750 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
751 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200752 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100753 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200754 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200755 return 1;
756}
Kailang Yangea1fb292008-08-26 12:58:38 +0200757
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200758/* Check the validity of ALC subsystem-id
759 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
760static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200761{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100762 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200763 struct alc_spec *spec = codec->spec;
Takashi Iwai4e76a882014-02-25 12:21:03 +0100764 codec_dbg(codec,
765 "realtek: Enable default setup for auto mode as fallback\n");
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200766 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200767 }
Takashi Iwai21268962011-07-07 15:01:13 +0200768}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200769
Takashi Iwai41e41f12005-06-08 14:48:49 +0200770/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200771 */
772
David Henningsson9d36a7d2014-10-07 10:18:42 +0200773static void alc_fixup_inv_dmic(struct hda_codec *codec,
774 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200775{
776 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100777
David Henningsson9d36a7d2014-10-07 10:18:42 +0200778 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200779}
780
Takashi Iwai603c4012008-07-30 15:01:44 +0200781
Takashi Iwai2eab6942012-12-18 15:30:41 +0100782static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700783{
Takashi Iwaia5cb4632018-06-20 12:50:11 +0200784 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700785
Takashi Iwai08c189f2012-12-19 15:22:24 +0100786 err = snd_hda_gen_build_controls(codec);
787 if (err < 0)
788 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789
Takashi Iwai1727a772013-01-10 09:52:52 +0100790 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100791 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700792}
793
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200794
Linus Torvalds1da177e2005-04-16 15:20:36 -0700795/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100796 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200797 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200798
Linus Torvalds1da177e2005-04-16 15:20:36 -0700799static int alc_init(struct hda_codec *codec)
800{
801 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200802
Takashi Iwai546bb672012-03-07 08:37:19 +0100803 if (spec->init_hook)
804 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100805
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200806 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200807 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200808
Takashi Iwai08c189f2012-12-19 15:22:24 +0100809 snd_hda_gen_init(codec);
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100810
Takashi Iwai1727a772013-01-10 09:52:52 +0100811 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200812
Linus Torvalds1da177e2005-04-16 15:20:36 -0700813 return 0;
814}
815
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100816static inline void alc_shutup(struct hda_codec *codec)
817{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200818 struct alc_spec *spec = codec->spec;
819
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200820 if (!snd_hda_get_bool_hint(codec, "shutup"))
821 return; /* disabled explicitly by hints */
822
Takashi Iwai1c7161532011-04-07 10:37:16 +0200823 if (spec && spec->shutup)
824 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200825 else
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100826 alc_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100827}
828
Takashi Iwai70a09762015-12-15 14:59:58 +0100829static void alc_reboot_notify(struct hda_codec *codec)
830{
831 struct alc_spec *spec = codec->spec;
832
833 if (spec && spec->reboot_notify)
834 spec->reboot_notify(codec);
835 else
836 alc_shutup(codec);
837}
838
839/* power down codec to D3 at reboot/shutdown; set as reboot_notify ops */
840static void alc_d3_at_reboot(struct hda_codec *codec)
841{
842 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
843 snd_hda_codec_write(codec, codec->core.afg, 0,
844 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
845 msleep(10);
846}
847
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100848#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700849
Takashi Iwai83012a72012-08-24 18:38:08 +0200850#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500851static void alc_power_eapd(struct hda_codec *codec)
852{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200853 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500854}
855
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200856static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100857{
858 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100859 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100860 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500861 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100862 return 0;
863}
864#endif
865
Takashi Iwai2a439522011-07-26 09:52:50 +0200866#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100867static int alc_resume(struct hda_codec *codec)
868{
Kailang Yang97a26572013-11-29 00:35:26 -0500869 struct alc_spec *spec = codec->spec;
870
871 if (!spec->no_depop_delay)
872 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100873 codec->patch_ops.init(codec);
Takashi Iwaieeecd9d2015-02-25 15:18:50 +0100874 regcache_sync(codec->core.regmap);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200875 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100876 return 0;
877}
Takashi Iwaie044c392008-10-27 16:56:24 +0100878#endif
879
Linus Torvalds1da177e2005-04-16 15:20:36 -0700880/*
881 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200882static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700883 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100884 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700885 .init = alc_init,
886 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200887 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200888#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100889 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100890 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100891 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200892#endif
Takashi Iwai70a09762015-12-15 14:59:58 +0100893 .reboot_notify = alc_reboot_notify,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700894};
895
David Henningsson29adc4b2012-09-25 11:31:00 +0200896
Takashi Iwaided255b2015-10-01 17:59:43 +0200897#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100898
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200899/*
Kailang Yang4b016932013-11-28 11:55:09 +0100900 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200901 */
902struct alc_codec_rename_table {
903 unsigned int vendor_id;
904 unsigned short coef_mask;
905 unsigned short coef_bits;
906 const char *name;
907};
908
Kailang Yang4b016932013-11-28 11:55:09 +0100909struct alc_codec_rename_pci_table {
910 unsigned int codec_vendor_id;
911 unsigned short pci_subvendor;
912 unsigned short pci_subdevice;
913 const char *name;
914};
915
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200916static struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800917 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200918 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
919 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
920 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
921 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
922 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
923 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
924 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200925 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800926 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200927 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
928 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
929 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
930 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
931 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
932 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
933 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
934 { } /* terminator */
935};
936
Kailang Yang4b016932013-11-28 11:55:09 +0100937static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
938 { 0x10ec0280, 0x1028, 0, "ALC3220" },
939 { 0x10ec0282, 0x1028, 0, "ALC3221" },
940 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +0800941 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +0100942 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +0800943 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +0100944 { 0x10ec0255, 0x1028, 0, "ALC3234" },
945 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800946 { 0x10ec0275, 0x1028, 0, "ALC3260" },
947 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +0800948 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +0800949 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +0800950 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +0800951 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +0800952 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +0800953 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800954 { 0x10ec0670, 0x1025, 0, "ALC669X" },
955 { 0x10ec0676, 0x1025, 0, "ALC679X" },
956 { 0x10ec0282, 0x1043, 0, "ALC3229" },
957 { 0x10ec0233, 0x1043, 0, "ALC3236" },
958 { 0x10ec0280, 0x103c, 0, "ALC3228" },
959 { 0x10ec0282, 0x103c, 0, "ALC3227" },
960 { 0x10ec0286, 0x103c, 0, "ALC3242" },
961 { 0x10ec0290, 0x103c, 0, "ALC3241" },
962 { 0x10ec0668, 0x103c, 0, "ALC3662" },
963 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
964 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +0100965 { } /* terminator */
966};
967
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200968static int alc_codec_rename_from_preset(struct hda_codec *codec)
969{
970 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +0100971 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200972
973 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +0100974 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200975 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200976 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200977 return alc_codec_rename(codec, p->name);
978 }
Kailang Yang4b016932013-11-28 11:55:09 +0100979
Takashi Iwai5100cd02014-02-15 10:03:19 +0100980 if (!codec->bus->pci)
981 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +0100982 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +0100983 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +0100984 continue;
985 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
986 continue;
987 if (!q->pci_subdevice ||
988 q->pci_subdevice == codec->bus->pci->subsystem_device)
989 return alc_codec_rename(codec, q->name);
990 }
991
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200992 return 0;
993}
994
Takashi Iwaie4770622011-07-08 11:11:35 +0200995
996/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200997 * Digital-beep handlers
998 */
999#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001000
1001/* additional beep mixers; private_value will be overwritten */
1002static const struct snd_kcontrol_new alc_beep_mixer[] = {
1003 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1004 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1005};
1006
1007/* set up and create beep controls */
1008static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1009 int idx, int dir)
1010{
1011 struct snd_kcontrol_new *knew;
1012 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1013 int i;
1014
1015 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1016 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1017 &alc_beep_mixer[i]);
1018 if (!knew)
1019 return -ENOMEM;
1020 knew->private_value = beep_amp;
1021 }
1022 return 0;
1023}
Takashi Iwai1d045db2011-07-07 18:23:21 +02001024
1025static const struct snd_pci_quirk beep_white_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +02001026 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -07001027 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001028 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +01001029 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001030 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1031 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1032 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +01001033 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001034 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1035 {}
1036};
1037
1038static inline int has_cdefine_beep(struct hda_codec *codec)
1039{
1040 struct alc_spec *spec = codec->spec;
1041 const struct snd_pci_quirk *q;
1042 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
1043 if (q)
1044 return q->value;
1045 return spec->cdefine.enable_pcbeep;
1046}
1047#else
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001048#define set_beep_amp(spec, nid, idx, dir) 0
Takashi Iwai1d045db2011-07-07 18:23:21 +02001049#define has_cdefine_beep(codec) 0
1050#endif
1051
1052/* parse the BIOS configuration and set up the alc_spec */
1053/* return 1 if successful, 0 if the proper config is not found,
1054 * or a negative error code
1055 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001056static int alc_parse_auto_config(struct hda_codec *codec,
1057 const hda_nid_t *ignore_nids,
1058 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001059{
1060 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001061 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001062 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001063
Takashi Iwai53c334a2011-08-23 18:27:14 +02001064 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1065 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001066 if (err < 0)
1067 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001068
1069 if (ssid_nids)
1070 alc_ssid_check(codec, ssid_nids);
1071
Takashi Iwai08c189f2012-12-19 15:22:24 +01001072 err = snd_hda_gen_parse_auto_config(codec, cfg);
1073 if (err < 0)
1074 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001075
Takashi Iwai1d045db2011-07-07 18:23:21 +02001076 return 1;
1077}
1078
Takashi Iwai3de95172012-05-07 18:03:15 +02001079/* common preparation job for alc_spec */
1080static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1081{
1082 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1083 int err;
1084
1085 if (!spec)
1086 return -ENOMEM;
1087 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001088 snd_hda_gen_spec_init(&spec->gen);
1089 spec->gen.mixer_nid = mixer_nid;
1090 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001091 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001092 /* FIXME: do we need this for all Realtek codec models? */
1093 codec->spdif_status_reset = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001094 codec->patch_ops = alc_patch_ops;
Takashi Iwai3de95172012-05-07 18:03:15 +02001095
1096 err = alc_codec_rename_from_preset(codec);
1097 if (err < 0) {
1098 kfree(spec);
1099 return err;
1100 }
1101 return 0;
1102}
1103
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001104static int alc880_parse_auto_config(struct hda_codec *codec)
1105{
1106 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001107 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001108 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1109}
1110
Takashi Iwai1d045db2011-07-07 18:23:21 +02001111/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001112 * ALC880 fix-ups
1113 */
1114enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001115 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001116 ALC880_FIXUP_GPIO2,
1117 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001118 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001119 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001120 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001121 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001122 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001123 ALC880_FIXUP_VOL_KNOB,
1124 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001125 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001126 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001127 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001128 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001129 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001130 ALC880_FIXUP_3ST_BASE,
1131 ALC880_FIXUP_3ST,
1132 ALC880_FIXUP_3ST_DIG,
1133 ALC880_FIXUP_5ST_BASE,
1134 ALC880_FIXUP_5ST,
1135 ALC880_FIXUP_5ST_DIG,
1136 ALC880_FIXUP_6ST_BASE,
1137 ALC880_FIXUP_6ST,
1138 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001139 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001140};
1141
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001142/* enable the volume-knob widget support on NID 0x21 */
1143static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001144 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001145{
Takashi Iwai1727a772013-01-10 09:52:52 +01001146 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001147 snd_hda_jack_detect_enable_callback(codec, 0x21,
1148 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001149}
1150
Takashi Iwai1727a772013-01-10 09:52:52 +01001151static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001152 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001153 .type = HDA_FIXUP_FUNC,
1154 .v.func = alc_fixup_gpio1,
Takashi Iwai411225a2012-02-20 17:48:19 +01001155 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001156 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001157 .type = HDA_FIXUP_FUNC,
1158 .v.func = alc_fixup_gpio2,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001159 },
1160 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001161 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001162 .v.verbs = (const struct hda_verb[]) {
1163 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1164 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1165 { }
1166 },
1167 .chained = true,
1168 .chain_id = ALC880_FIXUP_GPIO2,
1169 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001170 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001171 .type = HDA_FIXUP_PINS,
1172 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001173 /* disable bogus unused pins */
1174 { 0x16, 0x411111f0 },
1175 { 0x18, 0x411111f0 },
1176 { 0x1a, 0x411111f0 },
1177 { }
1178 }
1179 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001180 [ALC880_FIXUP_LG_LW25] = {
1181 .type = HDA_FIXUP_PINS,
1182 .v.pins = (const struct hda_pintbl[]) {
1183 { 0x1a, 0x0181344f }, /* line-in */
1184 { 0x1b, 0x0321403f }, /* headphone */
1185 { }
1186 }
1187 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001188 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001189 .type = HDA_FIXUP_PINS,
1190 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001191 /* disable bogus unused pins */
1192 { 0x17, 0x411111f0 },
1193 { }
1194 },
1195 .chained = true,
1196 .chain_id = ALC880_FIXUP_GPIO2,
1197 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001198 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001199 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001200 .v.verbs = (const struct hda_verb[]) {
1201 /* change to EAPD mode */
1202 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1203 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1204 {}
1205 },
1206 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001207 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001208 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001209 .v.verbs = (const struct hda_verb[]) {
1210 /* change to EAPD mode */
1211 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1212 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1213 {}
1214 },
1215 .chained = true,
1216 .chain_id = ALC880_FIXUP_GPIO2,
1217 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001218 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001219 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001220 .v.func = alc880_fixup_vol_knob,
1221 },
1222 [ALC880_FIXUP_FUJITSU] = {
1223 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001224 .type = HDA_FIXUP_PINS,
1225 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001226 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001227 { 0x15, 0x99030120 }, /* speaker */
1228 { 0x16, 0x99030130 }, /* bass speaker */
1229 { 0x17, 0x411111f0 }, /* N/A */
1230 { 0x18, 0x411111f0 }, /* N/A */
1231 { 0x19, 0x01a19950 }, /* mic-in */
1232 { 0x1a, 0x411111f0 }, /* N/A */
1233 { 0x1b, 0x411111f0 }, /* N/A */
1234 { 0x1c, 0x411111f0 }, /* N/A */
1235 { 0x1d, 0x411111f0 }, /* N/A */
1236 { 0x1e, 0x01454140 }, /* SPDIF out */
1237 { }
1238 },
1239 .chained = true,
1240 .chain_id = ALC880_FIXUP_VOL_KNOB,
1241 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001242 [ALC880_FIXUP_F1734] = {
1243 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001244 .type = HDA_FIXUP_PINS,
1245 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001246 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001247 { 0x15, 0x99030120 }, /* speaker */
1248 { 0x16, 0x411111f0 }, /* N/A */
1249 { 0x17, 0x411111f0 }, /* N/A */
1250 { 0x18, 0x411111f0 }, /* N/A */
1251 { 0x19, 0x01a19950 }, /* mic-in */
1252 { 0x1a, 0x411111f0 }, /* N/A */
1253 { 0x1b, 0x411111f0 }, /* N/A */
1254 { 0x1c, 0x411111f0 }, /* N/A */
1255 { 0x1d, 0x411111f0 }, /* N/A */
1256 { 0x1e, 0x411111f0 }, /* N/A */
1257 { }
1258 },
1259 .chained = true,
1260 .chain_id = ALC880_FIXUP_VOL_KNOB,
1261 },
Takashi Iwai817de922012-02-20 17:20:48 +01001262 [ALC880_FIXUP_UNIWILL] = {
1263 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001264 .type = HDA_FIXUP_PINS,
1265 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001266 { 0x14, 0x0121411f }, /* HP */
1267 { 0x15, 0x99030120 }, /* speaker */
1268 { 0x16, 0x99030130 }, /* bass speaker */
1269 { }
1270 },
1271 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001272 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001273 .type = HDA_FIXUP_PINS,
1274 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001275 /* disable bogus unused pins */
1276 { 0x17, 0x411111f0 },
1277 { 0x19, 0x411111f0 },
1278 { 0x1b, 0x411111f0 },
1279 { 0x1f, 0x411111f0 },
1280 { }
1281 }
1282 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001283 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001284 .type = HDA_FIXUP_PINS,
1285 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001286 /* set up the whole pins as BIOS is utterly broken */
1287 { 0x14, 0x99030120 }, /* speaker */
1288 { 0x15, 0x0121411f }, /* HP */
1289 { 0x16, 0x411111f0 }, /* N/A */
1290 { 0x17, 0x411111f0 }, /* N/A */
1291 { 0x18, 0x01a19950 }, /* mic-in */
1292 { 0x19, 0x411111f0 }, /* N/A */
1293 { 0x1a, 0x01813031 }, /* line-in */
1294 { 0x1b, 0x411111f0 }, /* N/A */
1295 { 0x1c, 0x411111f0 }, /* N/A */
1296 { 0x1d, 0x411111f0 }, /* N/A */
1297 { 0x1e, 0x0144111e }, /* SPDIF */
1298 { }
1299 }
1300 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001301 [ALC880_FIXUP_ASUS_W5A] = {
1302 .type = HDA_FIXUP_PINS,
1303 .v.pins = (const struct hda_pintbl[]) {
1304 /* set up the whole pins as BIOS is utterly broken */
1305 { 0x14, 0x0121411f }, /* HP */
1306 { 0x15, 0x411111f0 }, /* N/A */
1307 { 0x16, 0x411111f0 }, /* N/A */
1308 { 0x17, 0x411111f0 }, /* N/A */
1309 { 0x18, 0x90a60160 }, /* mic */
1310 { 0x19, 0x411111f0 }, /* N/A */
1311 { 0x1a, 0x411111f0 }, /* N/A */
1312 { 0x1b, 0x411111f0 }, /* N/A */
1313 { 0x1c, 0x411111f0 }, /* N/A */
1314 { 0x1d, 0x411111f0 }, /* N/A */
1315 { 0x1e, 0xb743111e }, /* SPDIF out */
1316 { }
1317 },
1318 .chained = true,
1319 .chain_id = ALC880_FIXUP_GPIO1,
1320 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001321 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001322 .type = HDA_FIXUP_PINS,
1323 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001324 { 0x14, 0x01014010 }, /* line-out */
1325 { 0x15, 0x411111f0 }, /* N/A */
1326 { 0x16, 0x411111f0 }, /* N/A */
1327 { 0x17, 0x411111f0 }, /* N/A */
1328 { 0x18, 0x01a19c30 }, /* mic-in */
1329 { 0x19, 0x0121411f }, /* HP */
1330 { 0x1a, 0x01813031 }, /* line-in */
1331 { 0x1b, 0x02a19c40 }, /* front-mic */
1332 { 0x1c, 0x411111f0 }, /* N/A */
1333 { 0x1d, 0x411111f0 }, /* N/A */
1334 /* 0x1e is filled in below */
1335 { 0x1f, 0x411111f0 }, /* N/A */
1336 { }
1337 }
1338 },
1339 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001340 .type = HDA_FIXUP_PINS,
1341 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001342 { 0x1e, 0x411111f0 }, /* N/A */
1343 { }
1344 },
1345 .chained = true,
1346 .chain_id = ALC880_FIXUP_3ST_BASE,
1347 },
1348 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001349 .type = HDA_FIXUP_PINS,
1350 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001351 { 0x1e, 0x0144111e }, /* SPDIF */
1352 { }
1353 },
1354 .chained = true,
1355 .chain_id = ALC880_FIXUP_3ST_BASE,
1356 },
1357 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001358 .type = HDA_FIXUP_PINS,
1359 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001360 { 0x14, 0x01014010 }, /* front */
1361 { 0x15, 0x411111f0 }, /* N/A */
1362 { 0x16, 0x01011411 }, /* CLFE */
1363 { 0x17, 0x01016412 }, /* surr */
1364 { 0x18, 0x01a19c30 }, /* mic-in */
1365 { 0x19, 0x0121411f }, /* HP */
1366 { 0x1a, 0x01813031 }, /* line-in */
1367 { 0x1b, 0x02a19c40 }, /* front-mic */
1368 { 0x1c, 0x411111f0 }, /* N/A */
1369 { 0x1d, 0x411111f0 }, /* N/A */
1370 /* 0x1e is filled in below */
1371 { 0x1f, 0x411111f0 }, /* N/A */
1372 { }
1373 }
1374 },
1375 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001376 .type = HDA_FIXUP_PINS,
1377 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001378 { 0x1e, 0x411111f0 }, /* N/A */
1379 { }
1380 },
1381 .chained = true,
1382 .chain_id = ALC880_FIXUP_5ST_BASE,
1383 },
1384 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001385 .type = HDA_FIXUP_PINS,
1386 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001387 { 0x1e, 0x0144111e }, /* SPDIF */
1388 { }
1389 },
1390 .chained = true,
1391 .chain_id = ALC880_FIXUP_5ST_BASE,
1392 },
1393 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001394 .type = HDA_FIXUP_PINS,
1395 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001396 { 0x14, 0x01014010 }, /* front */
1397 { 0x15, 0x01016412 }, /* surr */
1398 { 0x16, 0x01011411 }, /* CLFE */
1399 { 0x17, 0x01012414 }, /* side */
1400 { 0x18, 0x01a19c30 }, /* mic-in */
1401 { 0x19, 0x02a19c40 }, /* front-mic */
1402 { 0x1a, 0x01813031 }, /* line-in */
1403 { 0x1b, 0x0121411f }, /* HP */
1404 { 0x1c, 0x411111f0 }, /* N/A */
1405 { 0x1d, 0x411111f0 }, /* N/A */
1406 /* 0x1e is filled in below */
1407 { 0x1f, 0x411111f0 }, /* N/A */
1408 { }
1409 }
1410 },
1411 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001412 .type = HDA_FIXUP_PINS,
1413 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001414 { 0x1e, 0x411111f0 }, /* N/A */
1415 { }
1416 },
1417 .chained = true,
1418 .chain_id = ALC880_FIXUP_6ST_BASE,
1419 },
1420 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001421 .type = HDA_FIXUP_PINS,
1422 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001423 { 0x1e, 0x0144111e }, /* SPDIF */
1424 { }
1425 },
1426 .chained = true,
1427 .chain_id = ALC880_FIXUP_6ST_BASE,
1428 },
Takashi Iwai53971452013-01-23 18:21:37 +01001429 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1430 .type = HDA_FIXUP_PINS,
1431 .v.pins = (const struct hda_pintbl[]) {
1432 { 0x1b, 0x0121401f }, /* HP with jack detect */
1433 { }
1434 },
1435 .chained_before = true,
1436 .chain_id = ALC880_FIXUP_6ST_BASE,
1437 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001438};
1439
1440static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001441 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001442 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001443 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001444 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001445 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001446 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001447 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001448 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001449 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001450 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001451 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001452 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001453 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001454 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001455 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001456 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001457 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001458 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001459 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1460 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1461 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001462 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001463 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001464
1465 /* Below is the copied entries from alc880_quirks.c.
1466 * It's not quite sure whether BIOS sets the correct pin-config table
1467 * on these machines, thus they are kept to be compatible with
1468 * the old static quirks. Once when it's confirmed to work without
1469 * these overrides, it'd be better to remove.
1470 */
1471 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1472 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1473 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1474 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1475 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1476 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1477 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1478 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1479 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1480 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1481 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1482 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1483 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1484 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1485 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1486 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1487 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1488 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1489 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1490 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1491 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1492 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1493 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1494 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1495 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1496 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1497 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1498 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1499 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1500 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1501 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1502 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1503 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1504 /* default Intel */
1505 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1506 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1507 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1508 {}
1509};
1510
Takashi Iwai1727a772013-01-10 09:52:52 +01001511static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001512 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1513 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1514 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1515 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1516 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1517 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001518 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001519 {}
1520};
1521
1522
1523/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001524 * OK, here we have finally the patch for ALC880
1525 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001526static int patch_alc880(struct hda_codec *codec)
1527{
1528 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001529 int err;
1530
Takashi Iwai3de95172012-05-07 18:03:15 +02001531 err = alc_alloc_spec(codec, 0x0b);
1532 if (err < 0)
1533 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001534
Takashi Iwai3de95172012-05-07 18:03:15 +02001535 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001536 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001537 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001538
Takashi Iwai225068a2015-05-29 10:42:14 +02001539 codec->patch_ops.unsol_event = alc880_unsol_event;
1540
Takashi Iwai1727a772013-01-10 09:52:52 +01001541 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001542 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001543 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001544
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001545 /* automatic parse from the BIOS config */
1546 err = alc880_parse_auto_config(codec);
1547 if (err < 0)
1548 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001549
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001550 if (!spec->gen.no_analog) {
1551 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1552 if (err < 0)
1553 goto error;
1554 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001555
Takashi Iwai1727a772013-01-10 09:52:52 +01001556 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001557
Takashi Iwai1d045db2011-07-07 18:23:21 +02001558 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001559
1560 error:
1561 alc_free(codec);
1562 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001563}
1564
1565
1566/*
1567 * ALC260 support
1568 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001569static int alc260_parse_auto_config(struct hda_codec *codec)
1570{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001571 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001572 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1573 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001574}
1575
Takashi Iwai1d045db2011-07-07 18:23:21 +02001576/*
1577 * Pin config fixes
1578 */
1579enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001580 ALC260_FIXUP_HP_DC5750,
1581 ALC260_FIXUP_HP_PIN_0F,
1582 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001583 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001584 ALC260_FIXUP_GPIO1_TOGGLE,
1585 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001586 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001587 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001588 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001589 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001590 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001591};
1592
Takashi Iwai20f7d922012-02-16 12:35:16 +01001593static void alc260_gpio1_automute(struct hda_codec *codec)
1594{
1595 struct alc_spec *spec = codec->spec;
Takashi Iwaiaaf312d2018-06-19 22:28:22 +02001596
1597 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001598}
1599
1600static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001601 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001602{
1603 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001604 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001605 /* although the machine has only one output pin, we need to
1606 * toggle GPIO1 according to the jack state
1607 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001608 spec->gen.automute_hook = alc260_gpio1_automute;
1609 spec->gen.detect_hp = 1;
1610 spec->gen.automute_speaker = 1;
1611 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001612 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001613 snd_hda_gen_hp_automute);
Takashi Iwai5579cd62018-06-19 22:22:41 +02001614 alc_setup_gpio(codec, 0x01);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001615 }
1616}
1617
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001618static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001619 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001620{
1621 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001622 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001623 { 0x0f, 0x02214000 }, /* HP/speaker */
1624 { 0x12, 0x90a60160 }, /* int mic */
1625 { 0x13, 0x02a19000 }, /* ext mic */
1626 { 0x18, 0x01446000 }, /* SPDIF out */
1627 /* disable bogus I/O pins */
1628 { 0x10, 0x411111f0 },
1629 { 0x11, 0x411111f0 },
1630 { 0x14, 0x411111f0 },
1631 { 0x15, 0x411111f0 },
1632 { 0x16, 0x411111f0 },
1633 { 0x17, 0x411111f0 },
1634 { 0x19, 0x411111f0 },
1635 { }
1636 };
1637
1638 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001639 case HDA_FIXUP_ACT_PRE_PROBE:
1640 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001641 spec->init_amp = ALC_INIT_NONE;
1642 break;
1643 }
1644}
1645
Takashi Iwai39aedee2013-01-10 17:10:40 +01001646static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1647 const struct hda_fixup *fix, int action)
1648{
1649 struct alc_spec *spec = codec->spec;
Takashi Iwai1c76aa52018-06-21 16:37:54 +02001650 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001651 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001652}
1653
1654static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1655 const struct hda_fixup *fix, int action)
1656{
1657 struct alc_spec *spec = codec->spec;
1658 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001659 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001660 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001661 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001662}
1663
Takashi Iwai1727a772013-01-10 09:52:52 +01001664static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001665 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001666 .type = HDA_FIXUP_PINS,
1667 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001668 { 0x11, 0x90130110 }, /* speaker */
1669 { }
1670 }
1671 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001672 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001673 .type = HDA_FIXUP_PINS,
1674 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001675 { 0x0f, 0x01214000 }, /* HP */
1676 { }
1677 }
1678 },
1679 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001680 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001681 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001682 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1683 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001684 { }
1685 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001686 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001687 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001688 .type = HDA_FIXUP_FUNC,
1689 .v.func = alc_fixup_gpio1,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001690 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001691 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001692 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001693 .v.func = alc260_fixup_gpio1_toggle,
1694 .chained = true,
1695 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1696 },
1697 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001698 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001699 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001700 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1701 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001702 { }
1703 },
1704 .chained = true,
1705 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1706 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001707 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001708 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001709 .v.func = alc260_fixup_gpio1_toggle,
1710 .chained = true,
1711 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001712 },
1713 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001714 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001715 .v.func = alc260_fixup_kn1,
1716 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001717 [ALC260_FIXUP_FSC_S7020] = {
1718 .type = HDA_FIXUP_FUNC,
1719 .v.func = alc260_fixup_fsc_s7020,
1720 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001721 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1722 .type = HDA_FIXUP_FUNC,
1723 .v.func = alc260_fixup_fsc_s7020_jwse,
1724 .chained = true,
1725 .chain_id = ALC260_FIXUP_FSC_S7020,
1726 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001727 [ALC260_FIXUP_VAIO_PINS] = {
1728 .type = HDA_FIXUP_PINS,
1729 .v.pins = (const struct hda_pintbl[]) {
1730 /* Pin configs are missing completely on some VAIOs */
1731 { 0x0f, 0x01211020 },
1732 { 0x10, 0x0001003f },
1733 { 0x11, 0x411111f0 },
1734 { 0x12, 0x01a15930 },
1735 { 0x13, 0x411111f0 },
1736 { 0x14, 0x411111f0 },
1737 { 0x15, 0x411111f0 },
1738 { 0x16, 0x411111f0 },
1739 { 0x17, 0x411111f0 },
1740 { 0x18, 0x411111f0 },
1741 { 0x19, 0x411111f0 },
1742 { }
1743 }
1744 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001745};
1746
1747static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001748 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001749 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001750 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001751 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001752 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001753 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001754 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001755 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001756 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001757 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001758 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001759 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001760 {}
1761};
1762
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001763static const struct hda_model_fixup alc260_fixup_models[] = {
1764 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1765 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1766 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1767 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1768 {}
1769};
1770
Takashi Iwai1d045db2011-07-07 18:23:21 +02001771/*
1772 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001773static int patch_alc260(struct hda_codec *codec)
1774{
1775 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001776 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001777
Takashi Iwai3de95172012-05-07 18:03:15 +02001778 err = alc_alloc_spec(codec, 0x07);
1779 if (err < 0)
1780 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001781
Takashi Iwai3de95172012-05-07 18:03:15 +02001782 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001783 /* as quite a few machines require HP amp for speaker outputs,
1784 * it's easier to enable it unconditionally; even if it's unneeded,
1785 * it's almost harmless.
1786 */
1787 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001788 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001789
Takashi Iwai225068a2015-05-29 10:42:14 +02001790 spec->shutup = alc_eapd_shutup;
1791
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001792 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1793 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001794 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001795
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001796 /* automatic parse from the BIOS config */
1797 err = alc260_parse_auto_config(codec);
1798 if (err < 0)
1799 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001800
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001801 if (!spec->gen.no_analog) {
1802 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1803 if (err < 0)
1804 goto error;
1805 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001806
Takashi Iwai1727a772013-01-10 09:52:52 +01001807 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001808
Takashi Iwai1d045db2011-07-07 18:23:21 +02001809 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001810
1811 error:
1812 alc_free(codec);
1813 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001814}
1815
1816
1817/*
1818 * ALC882/883/885/888/889 support
1819 *
1820 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1821 * configuration. Each pin widget can choose any input DACs and a mixer.
1822 * Each ADC is connected from a mixer of all inputs. This makes possible
1823 * 6-channel independent captures.
1824 *
1825 * In addition, an independent DAC for the multi-playback (not used in this
1826 * driver yet).
1827 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001828
1829/*
1830 * Pin config fixes
1831 */
1832enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001833 ALC882_FIXUP_ABIT_AW9D_MAX,
1834 ALC882_FIXUP_LENOVO_Y530,
1835 ALC882_FIXUP_PB_M5210,
1836 ALC882_FIXUP_ACER_ASPIRE_7736,
1837 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001838 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001839 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001840 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001841 ALC888_FIXUP_EEE1601,
Takashi Iwai177943a2011-11-09 12:55:18 +01001842 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001843 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001844 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001845 ALC882_FIXUP_GPIO1,
1846 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001847 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001848 ALC889_FIXUP_COEF,
1849 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001850 ALC882_FIXUP_ACER_ASPIRE_4930G,
1851 ALC882_FIXUP_ACER_ASPIRE_8930G,
1852 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001853 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001854 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001855 ALC889_FIXUP_MBP_VREF,
1856 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001857 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001858 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001859 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001860 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001861 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001862 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001863 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001864 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001865 ALC1220_FIXUP_GB_DUAL_CODECS,
Peisen0202f5c2017-10-26 10:35:36 +08001866 ALC1220_FIXUP_CLEVO_P950,
Jeremy Soller7f665b12019-02-13 10:56:19 -07001867 ALC1220_FIXUP_SYSTEM76_ORYP5,
1868 ALC1220_FIXUP_SYSTEM76_ORYP5_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001869};
1870
Takashi Iwai68ef0562011-11-09 18:24:44 +01001871static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001872 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001873{
Takashi Iwai1727a772013-01-10 09:52:52 +01001874 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001875 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001876 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001877}
1878
Takashi Iwai56710872011-11-14 17:42:11 +01001879/* set up GPIO at initialization */
1880static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001881 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001882{
Takashi Iwai215c8502018-06-19 22:34:26 +02001883 struct alc_spec *spec = codec->spec;
1884
1885 spec->gpio_write_delay = true;
1886 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001887}
1888
Takashi Iwai02a237b2012-02-13 15:25:07 +01001889/* Fix the connection of some pins for ALC889:
1890 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1891 * work correctly (bko#42740)
1892 */
1893static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001894 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001895{
Takashi Iwai1727a772013-01-10 09:52:52 +01001896 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001897 /* fake the connections during parsing the tree */
Takashi Iwai02a237b2012-02-13 15:25:07 +01001898 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1899 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1900 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1901 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1902 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1903 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001904 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001905 /* restore the connections */
1906 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1907 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1908 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1909 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1910 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001911 }
1912}
1913
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001914/* Set VREF on HP pin */
1915static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001916 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001917{
1918 struct alc_spec *spec = codec->spec;
Mario Kleiner9f660a12015-12-22 00:45:43 +01001919 static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001920 int i;
1921
Takashi Iwai1727a772013-01-10 09:52:52 +01001922 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001923 return;
1924 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1925 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1926 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1927 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001928 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001929 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001930 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01001931 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001932 break;
1933 }
1934}
1935
Takashi Iwai0756f092013-12-04 13:59:45 +01001936static void alc889_fixup_mac_pins(struct hda_codec *codec,
1937 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001938{
1939 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001940 int i;
1941
Takashi Iwai0756f092013-12-04 13:59:45 +01001942 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001943 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001944 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001945 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001946 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001947 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01001948 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001949}
1950
Takashi Iwai0756f092013-12-04 13:59:45 +01001951/* Set VREF on speaker pins on imac91 */
1952static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1953 const struct hda_fixup *fix, int action)
1954{
1955 static hda_nid_t nids[2] = { 0x18, 0x1a };
1956
1957 if (action == HDA_FIXUP_ACT_INIT)
1958 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1959}
1960
Adrien Vergée7729a42014-01-24 14:56:14 -05001961/* Set VREF on speaker pins on mba11 */
1962static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1963 const struct hda_fixup *fix, int action)
1964{
1965 static hda_nid_t nids[1] = { 0x18 };
1966
1967 if (action == HDA_FIXUP_ACT_INIT)
1968 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1969}
1970
Takashi Iwai0756f092013-12-04 13:59:45 +01001971/* Set VREF on speaker pins on mba21 */
1972static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1973 const struct hda_fixup *fix, int action)
1974{
1975 static hda_nid_t nids[2] = { 0x18, 0x19 };
1976
1977 if (action == HDA_FIXUP_ACT_INIT)
1978 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1979}
1980
Takashi Iwaie427c232012-07-29 10:04:08 +02001981/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09001982 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1983 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02001984 */
1985static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001986 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02001987{
1988 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02001989 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01001990 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02001991 spec->gen.no_multi_io = 1;
1992 }
Takashi Iwaie427c232012-07-29 10:04:08 +02001993}
1994
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001995static void alc_fixup_bass_chmap(struct hda_codec *codec,
1996 const struct hda_fixup *fix, int action);
1997
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001998/* For dual-codec configuration, we need to disable some features to avoid
1999 * conflicts of kctls and PCM streams
2000 */
2001static void alc_fixup_dual_codecs(struct hda_codec *codec,
2002 const struct hda_fixup *fix, int action)
2003{
2004 struct alc_spec *spec = codec->spec;
2005
2006 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2007 return;
2008 /* disable vmaster */
2009 spec->gen.suppress_vmaster = 1;
2010 /* auto-mute and auto-mic switch don't work with multiple codecs */
2011 spec->gen.suppress_auto_mute = 1;
2012 spec->gen.suppress_auto_mic = 1;
2013 /* disable aamix as well */
2014 spec->gen.mixer_nid = 0;
2015 /* add location prefix to avoid conflicts */
2016 codec->force_pin_prefix = 1;
2017}
2018
2019static void rename_ctl(struct hda_codec *codec, const char *oldname,
2020 const char *newname)
2021{
2022 struct snd_kcontrol *kctl;
2023
2024 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2025 if (kctl)
2026 strcpy(kctl->id.name, newname);
2027}
2028
2029static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2030 const struct hda_fixup *fix,
2031 int action)
2032{
2033 alc_fixup_dual_codecs(codec, fix, action);
2034 switch (action) {
2035 case HDA_FIXUP_ACT_PRE_PROBE:
2036 /* override card longname to provide a unique UCM profile */
2037 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2038 break;
2039 case HDA_FIXUP_ACT_BUILD:
2040 /* rename Capture controls depending on the codec */
2041 rename_ctl(codec, "Capture Volume",
2042 codec->addr == 0 ?
2043 "Rear-Panel Capture Volume" :
2044 "Front-Panel Capture Volume");
2045 rename_ctl(codec, "Capture Switch",
2046 codec->addr == 0 ?
2047 "Rear-Panel Capture Switch" :
2048 "Front-Panel Capture Switch");
2049 break;
2050 }
2051}
2052
Peisen0202f5c2017-10-26 10:35:36 +08002053static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2054 const struct hda_fixup *fix,
2055 int action)
2056{
2057 hda_nid_t conn1[1] = { 0x0c };
2058
2059 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2060 return;
2061
2062 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2063 /* We therefore want to make sure 0x14 (front headphone) and
2064 * 0x1b (speakers) use the stereo DAC 0x02
2065 */
2066 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
2067 snd_hda_override_conn_list(codec, 0x1b, 1, conn1);
2068}
2069
Jeremy Soller7f665b12019-02-13 10:56:19 -07002070static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2071 const struct hda_fixup *fix, int action);
2072
2073static void alc1220_fixup_system76_oryp5(struct hda_codec *codec,
2074 const struct hda_fixup *fix,
2075 int action)
2076{
2077 alc1220_fixup_clevo_p950(codec, fix, action);
2078 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2079}
2080
Takashi Iwai1727a772013-01-10 09:52:52 +01002081static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002082 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002083 .type = HDA_FIXUP_PINS,
2084 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002085 { 0x15, 0x01080104 }, /* side */
2086 { 0x16, 0x01011012 }, /* rear */
2087 { 0x17, 0x01016011 }, /* clfe */
2088 { }
2089 }
2090 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002091 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002092 .type = HDA_FIXUP_PINS,
2093 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002094 { 0x15, 0x99130112 }, /* rear int speakers */
2095 { 0x16, 0x99130111 }, /* subwoofer */
2096 { }
2097 }
2098 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002099 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002100 .type = HDA_FIXUP_PINCTLS,
2101 .v.pins = (const struct hda_pintbl[]) {
2102 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002103 {}
2104 }
2105 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002106 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002107 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002108 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002109 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002110 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002111 .type = HDA_FIXUP_PINS,
2112 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002113 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2114 { }
2115 }
2116 },
Marton Balint8f239212012-03-05 21:33:23 +01002117 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002118 .type = HDA_FIXUP_PINS,
2119 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002120 { 0x1c, 0x993301f0 }, /* CD */
2121 { }
2122 }
2123 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002124 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2125 .type = HDA_FIXUP_PINS,
2126 .v.pins = (const struct hda_pintbl[]) {
2127 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2128 { }
2129 },
2130 .chained = true,
2131 .chain_id = ALC889_FIXUP_CD,
2132 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002133 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002134 .type = HDA_FIXUP_PINS,
2135 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002136 { 0x17, 0x90170111 }, /* hidden surround speaker */
2137 { }
2138 }
2139 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002140 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002141 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002142 .v.verbs = (const struct hda_verb[]) {
2143 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2144 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2145 { }
2146 }
Takashi Iwai177943a2011-11-09 12:55:18 +01002147 },
2148 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002149 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a2011-11-09 12:55:18 +01002150 .v.verbs = (const struct hda_verb[]) {
2151 /* change to EAPD mode */
2152 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2153 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2154 { }
2155 }
2156 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002157 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002158 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002159 .v.verbs = (const struct hda_verb[]) {
2160 /* change to EAPD mode */
2161 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2162 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2163 { }
2164 }
2165 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002166 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002167 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002168 .v.verbs = (const struct hda_verb[]) {
2169 /* eanable EAPD on Acer laptops */
2170 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2171 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2172 { }
2173 }
2174 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002175 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002176 .type = HDA_FIXUP_FUNC,
2177 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002178 },
2179 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002180 .type = HDA_FIXUP_FUNC,
2181 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002182 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002183 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002184 .type = HDA_FIXUP_FUNC,
2185 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002186 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002187 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002188 .type = HDA_FIXUP_FUNC,
2189 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002190 .chained = true,
2191 .chain_id = ALC882_FIXUP_EAPD,
2192 },
2193 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002194 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002195 .v.func = alc889_fixup_coef,
2196 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002197 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002198 .type = HDA_FIXUP_PINS,
2199 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002200 { 0x16, 0x99130111 }, /* CLFE speaker */
2201 { 0x17, 0x99130112 }, /* surround speaker */
2202 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002203 },
2204 .chained = true,
2205 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002206 },
2207 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002208 .type = HDA_FIXUP_PINS,
2209 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002210 { 0x16, 0x99130111 }, /* CLFE speaker */
2211 { 0x1b, 0x99130112 }, /* surround speaker */
2212 { }
2213 },
2214 .chained = true,
2215 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2216 },
2217 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2218 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002219 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002220 .v.verbs = (const struct hda_verb[]) {
2221 /* Enable all DACs */
2222 /* DAC DISABLE/MUTE 1? */
2223 /* setting bits 1-5 disables DAC nids 0x02-0x06
2224 * apparently. Init=0x38 */
2225 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2226 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2227 /* DAC DISABLE/MUTE 2? */
2228 /* some bit here disables the other DACs.
2229 * Init=0x4900 */
2230 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2231 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2232 /* DMIC fix
2233 * This laptop has a stereo digital microphone.
2234 * The mics are only 1cm apart which makes the stereo
2235 * useless. However, either the mic or the ALC889
2236 * makes the signal become a difference/sum signal
2237 * instead of standard stereo, which is annoying.
2238 * So instead we flip this bit which makes the
2239 * codec replicate the sum signal to both channels,
2240 * turning it into a normal mono mic.
2241 */
2242 /* DMIC_CONTROL? Init value = 0x0001 */
2243 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2244 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2245 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2246 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2247 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002248 },
2249 .chained = true,
2250 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002251 },
Takashi Iwai56710872011-11-14 17:42:11 +01002252 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002253 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002254 .v.func = alc885_fixup_macpro_gpio,
2255 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002256 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002257 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002258 .v.func = alc889_fixup_dac_route,
2259 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002260 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002261 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002262 .v.func = alc889_fixup_mbp_vref,
2263 .chained = true,
2264 .chain_id = ALC882_FIXUP_GPIO1,
2265 },
2266 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002267 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002268 .v.func = alc889_fixup_imac91_vref,
2269 .chained = true,
2270 .chain_id = ALC882_FIXUP_GPIO1,
2271 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002272 [ALC889_FIXUP_MBA11_VREF] = {
2273 .type = HDA_FIXUP_FUNC,
2274 .v.func = alc889_fixup_mba11_vref,
2275 .chained = true,
2276 .chain_id = ALC889_FIXUP_MBP_VREF,
2277 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002278 [ALC889_FIXUP_MBA21_VREF] = {
2279 .type = HDA_FIXUP_FUNC,
2280 .v.func = alc889_fixup_mba21_vref,
2281 .chained = true,
2282 .chain_id = ALC889_FIXUP_MBP_VREF,
2283 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002284 [ALC889_FIXUP_MP11_VREF] = {
2285 .type = HDA_FIXUP_FUNC,
2286 .v.func = alc889_fixup_mba11_vref,
2287 .chained = true,
2288 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2289 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002290 [ALC889_FIXUP_MP41_VREF] = {
2291 .type = HDA_FIXUP_FUNC,
2292 .v.func = alc889_fixup_mbp_vref,
2293 .chained = true,
2294 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2295 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002296 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002297 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002298 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002299 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002300 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002301 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002302 .v.func = alc882_fixup_no_primary_hp,
2303 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002304 [ALC887_FIXUP_ASUS_BASS] = {
2305 .type = HDA_FIXUP_PINS,
2306 .v.pins = (const struct hda_pintbl[]) {
2307 {0x16, 0x99130130}, /* bass speaker */
2308 {}
2309 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002310 .chained = true,
2311 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2312 },
2313 [ALC887_FIXUP_BASS_CHMAP] = {
2314 .type = HDA_FIXUP_FUNC,
2315 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002316 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002317 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2318 .type = HDA_FIXUP_FUNC,
2319 .v.func = alc1220_fixup_gb_dual_codecs,
2320 },
Peisen0202f5c2017-10-26 10:35:36 +08002321 [ALC1220_FIXUP_CLEVO_P950] = {
2322 .type = HDA_FIXUP_FUNC,
2323 .v.func = alc1220_fixup_clevo_p950,
2324 },
Jeremy Soller7f665b12019-02-13 10:56:19 -07002325 [ALC1220_FIXUP_SYSTEM76_ORYP5] = {
2326 .type = HDA_FIXUP_FUNC,
2327 .v.func = alc1220_fixup_system76_oryp5,
2328 },
2329 [ALC1220_FIXUP_SYSTEM76_ORYP5_PINS] = {
2330 .type = HDA_FIXUP_PINS,
2331 .v.pins = (const struct hda_pintbl[]) {
2332 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2333 {}
2334 },
2335 .chained = true,
2336 .chain_id = ALC1220_FIXUP_SYSTEM76_ORYP5,
2337 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002338};
2339
2340static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002341 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2342 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002343 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002344 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2345 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2346 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2347 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002348 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2349 ALC882_FIXUP_ACER_ASPIRE_4930G),
2350 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2351 ALC882_FIXUP_ACER_ASPIRE_4930G),
2352 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2353 ALC882_FIXUP_ACER_ASPIRE_8930G),
2354 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2355 ALC882_FIXUP_ACER_ASPIRE_8930G),
2356 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2357 ALC882_FIXUP_ACER_ASPIRE_4930G),
2358 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2359 ALC882_FIXUP_ACER_ASPIRE_4930G),
2360 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2361 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002362 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002363 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2364 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002365 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002366 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002367 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a2011-11-09 12:55:18 +01002368 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002369 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002370 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002371 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002372 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002373 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002374 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002375 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002376 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Fernando Luis Vázquez Cao12e31a72013-02-12 16:47:44 +09002377 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaic44d9b12016-02-07 09:38:26 +01002378 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002379
2380 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002381 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2382 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2383 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002384 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002385 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2386 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002387 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2388 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002389 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002390 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002391 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002392 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2393 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002394 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002395 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2396 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2397 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002398 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002399 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002400 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2401 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002402 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002403
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002404 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002405 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002406 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002407 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai63691582017-05-22 16:32:46 +02002408 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002409 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002410 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
Peisen0202f5c2017-10-26 10:35:36 +08002411 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaif3d737b2018-07-17 17:08:32 +02002412 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
Jeremy Soller2f0d5202018-05-07 09:28:45 -06002413 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
Jeremy Soller7f665b12019-02-13 10:56:19 -07002414 SND_PCI_QUIRK(0x1558, 0x96e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
2415 SND_PCI_QUIRK(0x1558, 0x97e1, "System76 Oryx Pro (oryp5)", ALC1220_FIXUP_SYSTEM76_ORYP5_PINS),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002416 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2417 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002418 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002419 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002420 {}
2421};
2422
Takashi Iwai1727a772013-01-10 09:52:52 +01002423static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002424 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2425 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2426 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2427 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2428 {.id = ALC889_FIXUP_CD, .name = "cd"},
2429 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2430 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2431 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2432 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2433 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2434 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2435 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2436 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2437 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2438 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002439 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2440 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2441 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002442 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2443 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2444 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2445 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2446 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2447 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2448 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2449 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002450 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002451 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002452 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002453 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002454 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002455 {}
2456};
2457
Takashi Iwai1d045db2011-07-07 18:23:21 +02002458/*
2459 * BIOS auto configuration
2460 */
2461/* almost identical with ALC880 parser... */
2462static int alc882_parse_auto_config(struct hda_codec *codec)
2463{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002464 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002465 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2466 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002467}
2468
Takashi Iwai1d045db2011-07-07 18:23:21 +02002469/*
2470 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002471static int patch_alc882(struct hda_codec *codec)
2472{
2473 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002474 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002475
Takashi Iwai3de95172012-05-07 18:03:15 +02002476 err = alc_alloc_spec(codec, 0x0b);
2477 if (err < 0)
2478 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002479
Takashi Iwai3de95172012-05-07 18:03:15 +02002480 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002481
Takashi Iwai7639a062015-03-03 10:07:24 +01002482 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002483 case 0x10ec0882:
2484 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002485 case 0x10ec0900:
Kailang Yanga535ad52017-01-16 16:59:26 +08002486 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002487 break;
2488 default:
2489 /* ALC883 and variants */
2490 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2491 break;
2492 }
2493
Takashi Iwai1727a772013-01-10 09:52:52 +01002494 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002495 alc882_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002496 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002497
2498 alc_auto_parse_customize_define(codec);
2499
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002500 if (has_cdefine_beep(codec))
2501 spec->gen.beep_nid = 0x01;
2502
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002503 /* automatic parse from the BIOS config */
2504 err = alc882_parse_auto_config(codec);
2505 if (err < 0)
2506 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002507
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002508 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2509 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2510 if (err < 0)
2511 goto error;
2512 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002513
Takashi Iwai1727a772013-01-10 09:52:52 +01002514 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002515
Takashi Iwai1d045db2011-07-07 18:23:21 +02002516 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002517
2518 error:
2519 alc_free(codec);
2520 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002521}
2522
2523
2524/*
2525 * ALC262 support
2526 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002527static int alc262_parse_auto_config(struct hda_codec *codec)
2528{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002529 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002530 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2531 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002532}
2533
2534/*
2535 * Pin config fixes
2536 */
2537enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002538 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002539 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002540 ALC262_FIXUP_HP_Z200,
2541 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002542 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002543 ALC262_FIXUP_BENQ,
2544 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002545 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002546 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002547};
2548
Takashi Iwai1727a772013-01-10 09:52:52 +01002549static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002550 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002551 .type = HDA_FIXUP_PINS,
2552 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002553 { 0x14, 0x99130110 }, /* speaker */
2554 { 0x15, 0x0221142f }, /* front HP */
2555 { 0x1b, 0x0121141f }, /* rear HP */
2556 { }
2557 }
2558 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002559 [ALC262_FIXUP_FSC_S7110] = {
2560 .type = HDA_FIXUP_PINS,
2561 .v.pins = (const struct hda_pintbl[]) {
2562 { 0x15, 0x90170110 }, /* speaker */
2563 { }
2564 },
2565 .chained = true,
2566 .chain_id = ALC262_FIXUP_BENQ,
2567 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002568 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002569 .type = HDA_FIXUP_PINS,
2570 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002571 { 0x16, 0x99130120 }, /* internal speaker */
2572 { }
2573 }
2574 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002575 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002576 .type = HDA_FIXUP_PINS,
2577 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002578 { 0x14, 0x1993e1f0 }, /* int AUX */
2579 { }
2580 }
2581 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002582 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002583 .type = HDA_FIXUP_PINCTLS,
2584 .v.pins = (const struct hda_pintbl[]) {
2585 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002586 {}
2587 },
2588 .chained = true,
2589 .chain_id = ALC262_FIXUP_BENQ,
2590 },
2591 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002592 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002593 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002594 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2595 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2596 {}
2597 }
2598 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002599 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002600 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002601 .v.verbs = (const struct hda_verb[]) {
2602 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2603 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2604 {}
2605 }
2606 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002607 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002608 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002609 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002610 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002611 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2612 .type = HDA_FIXUP_FUNC,
2613 .v.func = alc_fixup_no_depop_delay,
2614 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002615};
2616
2617static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002618 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002619 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002620 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002621 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002622 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002623 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002624 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002625 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2626 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002627 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002628 {}
2629};
2630
Takashi Iwai1727a772013-01-10 09:52:52 +01002631static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002632 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002633 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2634 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2635 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2636 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2637 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2638 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2639 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2640 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002641 {}
2642};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002643
Takashi Iwai1d045db2011-07-07 18:23:21 +02002644/*
2645 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002646static int patch_alc262(struct hda_codec *codec)
2647{
2648 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002649 int err;
2650
Takashi Iwai3de95172012-05-07 18:03:15 +02002651 err = alc_alloc_spec(codec, 0x0b);
2652 if (err < 0)
2653 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002654
Takashi Iwai3de95172012-05-07 18:03:15 +02002655 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002656 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002657
Takashi Iwai225068a2015-05-29 10:42:14 +02002658 spec->shutup = alc_eapd_shutup;
2659
Takashi Iwai1d045db2011-07-07 18:23:21 +02002660#if 0
2661 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2662 * under-run
2663 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002664 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002665#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002666 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2667
Takashi Iwai1727a772013-01-10 09:52:52 +01002668 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002669 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002670 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002671
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002672 alc_auto_parse_customize_define(codec);
2673
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002674 if (has_cdefine_beep(codec))
2675 spec->gen.beep_nid = 0x01;
2676
Takashi Iwai42399f72011-11-07 17:18:44 +01002677 /* automatic parse from the BIOS config */
2678 err = alc262_parse_auto_config(codec);
2679 if (err < 0)
2680 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002681
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002682 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2683 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2684 if (err < 0)
2685 goto error;
2686 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002687
Takashi Iwai1727a772013-01-10 09:52:52 +01002688 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002689
Takashi Iwai1d045db2011-07-07 18:23:21 +02002690 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002691
2692 error:
2693 alc_free(codec);
2694 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002695}
2696
2697/*
2698 * ALC268
2699 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002700/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002701static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2702 struct snd_ctl_elem_value *ucontrol)
2703{
2704 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2705 unsigned long pval;
2706 int err;
2707
2708 mutex_lock(&codec->control_mutex);
2709 pval = kcontrol->private_value;
2710 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2711 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2712 if (err >= 0) {
2713 kcontrol->private_value = (pval & ~0xff) | 0x10;
2714 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2715 }
2716 kcontrol->private_value = pval;
2717 mutex_unlock(&codec->control_mutex);
2718 return err;
2719}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002720
2721static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2722 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002723 {
2724 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2725 .name = "Beep Playback Switch",
2726 .subdevice = HDA_SUBDEV_AMP_FLAG,
2727 .info = snd_hda_mixer_amp_switch_info,
2728 .get = snd_hda_mixer_amp_switch_get,
2729 .put = alc268_beep_switch_put,
2730 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2731 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002732};
2733
2734/* set PCBEEP vol = 0, mute connections */
2735static const struct hda_verb alc268_beep_init_verbs[] = {
2736 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2737 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2738 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2739 { }
2740};
2741
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002742enum {
2743 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002744 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002745 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002746};
2747
Takashi Iwai1727a772013-01-10 09:52:52 +01002748static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002749 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002750 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002751 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002752 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002753 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002754 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002755 .v.verbs = (const struct hda_verb[]) {
2756 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2757 {}
2758 }
2759 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002760 [ALC268_FIXUP_SPDIF] = {
2761 .type = HDA_FIXUP_PINS,
2762 .v.pins = (const struct hda_pintbl[]) {
2763 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2764 {}
2765 }
2766 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002767};
2768
Takashi Iwai1727a772013-01-10 09:52:52 +01002769static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002770 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002771 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02002772 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002773 {}
2774};
2775
2776static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002777 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002778 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002779 /* below is codec SSID since multiple Toshiba laptops have the
2780 * same PCI SSID 1179:ff00
2781 */
2782 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002783 {}
2784};
2785
Takashi Iwai1d045db2011-07-07 18:23:21 +02002786/*
2787 * BIOS auto configuration
2788 */
2789static int alc268_parse_auto_config(struct hda_codec *codec)
2790{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002791 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002792 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002793}
2794
Takashi Iwai1d045db2011-07-07 18:23:21 +02002795/*
2796 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002797static int patch_alc268(struct hda_codec *codec)
2798{
2799 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002800 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002801
Takashi Iwai1d045db2011-07-07 18:23:21 +02002802 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002803 err = alc_alloc_spec(codec, 0);
2804 if (err < 0)
2805 return err;
2806
2807 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002808 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002809
Takashi Iwai225068a2015-05-29 10:42:14 +02002810 spec->shutup = alc_eapd_shutup;
2811
Takashi Iwai1727a772013-01-10 09:52:52 +01002812 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2813 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002814
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002815 /* automatic parse from the BIOS config */
2816 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002817 if (err < 0)
2818 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002819
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002820 if (err > 0 && !spec->gen.no_analog &&
2821 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02002822 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
2823 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
2824 &alc268_beep_mixer[i])) {
2825 err = -ENOMEM;
2826 goto error;
2827 }
2828 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002829 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002830 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2831 /* override the amp caps for beep generator */
2832 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2833 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2834 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2835 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2836 (0 << AC_AMPCAP_MUTE_SHIFT));
2837 }
2838
Takashi Iwai1727a772013-01-10 09:52:52 +01002839 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002840
Takashi Iwai1d045db2011-07-07 18:23:21 +02002841 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002842
2843 error:
2844 alc_free(codec);
2845 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002846}
2847
2848/*
2849 * ALC269
2850 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01002851
Takashi Iwai1d045db2011-07-07 18:23:21 +02002852static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002853 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002854};
2855
2856static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002857 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002858};
2859
Takashi Iwai1d045db2011-07-07 18:23:21 +02002860/* different alc269-variants */
2861enum {
2862 ALC269_TYPE_ALC269VA,
2863 ALC269_TYPE_ALC269VB,
2864 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02002865 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01002866 ALC269_TYPE_ALC280,
2867 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02002868 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01002869 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08002870 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02002871 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08002872 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02002873 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08002874 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08002875 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08002876 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08002877 ALC269_TYPE_ALC225,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08002878 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08002879 ALC269_TYPE_ALC300,
Kailang Yang6fbae352016-05-30 16:44:20 +08002880 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002881};
2882
2883/*
2884 * BIOS auto configuration
2885 */
2886static int alc269_parse_auto_config(struct hda_codec *codec)
2887{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002888 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002889 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2890 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2891 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02002892 const hda_nid_t *ssids;
2893
2894 switch (spec->codec_variant) {
2895 case ALC269_TYPE_ALC269VA:
2896 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01002897 case ALC269_TYPE_ALC280:
2898 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08002899 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02002900 ssids = alc269va_ssids;
2901 break;
2902 case ALC269_TYPE_ALC269VB:
2903 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01002904 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02002905 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02002906 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08002907 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02002908 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08002909 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08002910 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08002911 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08002912 case ALC269_TYPE_ALC225:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08002913 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08002914 case ALC269_TYPE_ALC300:
Kailang Yang6fbae352016-05-30 16:44:20 +08002915 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02002916 ssids = alc269_ssids;
2917 break;
2918 default:
2919 ssids = alc269_ssids;
2920 break;
2921 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002922
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002923 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002924}
2925
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002926static int find_ext_mic_pin(struct hda_codec *codec);
2927
2928static void alc286_shutup(struct hda_codec *codec)
2929{
Takashi Iwaia9c2dfc2018-04-23 17:24:56 +02002930 const struct hda_pincfg *pin;
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002931 int i;
2932 int mic_pin = find_ext_mic_pin(codec);
2933 /* don't shut up pins when unloading the driver; otherwise it breaks
2934 * the default pin setup at the next load of the driver
2935 */
2936 if (codec->bus->shutdown)
2937 return;
Takashi Iwaia9c2dfc2018-04-23 17:24:56 +02002938 snd_array_for_each(&codec->init_pins, i, pin) {
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002939 /* use read here for syncing after issuing each verb */
2940 if (pin->nid != mic_pin)
2941 snd_hda_codec_read(codec, pin->nid, 0,
2942 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2943 }
2944 codec->pins_shutup = 1;
2945}
2946
Kailang Yang1387e2d2012-11-08 10:23:18 +01002947static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02002948{
Takashi Iwai98b24882014-08-18 13:47:50 +02002949 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002950}
2951
2952static void alc269_shutup(struct hda_codec *codec)
2953{
Kailang Yangadcc70b2012-05-25 08:08:38 +02002954 struct alc_spec *spec = codec->spec;
2955
Kailang Yang1387e2d2012-11-08 10:23:18 +01002956 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2957 alc269vb_toggle_power_output(codec, 0);
2958 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2959 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002960 msleep(150);
2961 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01002962 alc_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002963}
2964
Takashi Iwai54db6c32014-08-18 15:11:19 +02002965static struct coef_fw alc282_coefs[] = {
2966 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08002967 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02002968 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2969 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2970 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2971 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2972 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2973 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2974 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2975 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2976 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2977 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2978 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2979 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2980 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2981 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2982 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2983 WRITE_COEF(0x63, 0x2902), /* PLL */
2984 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2985 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2986 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2987 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2988 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2989 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2990 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2991 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2992 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2993 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2994 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2995 {}
2996};
2997
Kailang Yangcb149cb2014-03-18 16:45:32 +08002998static void alc282_restore_default_value(struct hda_codec *codec)
2999{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003000 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08003001}
3002
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003003static void alc282_init(struct hda_codec *codec)
3004{
3005 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003006 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003007 bool hp_pin_sense;
3008 int coef78;
3009
Kailang Yangcb149cb2014-03-18 16:45:32 +08003010 alc282_restore_default_value(codec);
3011
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003012 if (!hp_pin)
3013 return;
3014 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3015 coef78 = alc_read_coef_idx(codec, 0x78);
3016
3017 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3018 /* Headphone capless set to high power mode */
3019 alc_write_coef_idx(codec, 0x78, 0x9004);
3020
3021 if (hp_pin_sense)
3022 msleep(2);
3023
3024 snd_hda_codec_write(codec, hp_pin, 0,
3025 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3026
3027 if (hp_pin_sense)
3028 msleep(85);
3029
3030 snd_hda_codec_write(codec, hp_pin, 0,
3031 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3032
3033 if (hp_pin_sense)
3034 msleep(100);
3035
3036 /* Headphone capless set to normal mode */
3037 alc_write_coef_idx(codec, 0x78, coef78);
3038}
3039
3040static void alc282_shutup(struct hda_codec *codec)
3041{
3042 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003043 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003044 bool hp_pin_sense;
3045 int coef78;
3046
3047 if (!hp_pin) {
3048 alc269_shutup(codec);
3049 return;
3050 }
3051
3052 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3053 coef78 = alc_read_coef_idx(codec, 0x78);
3054 alc_write_coef_idx(codec, 0x78, 0x9004);
3055
3056 if (hp_pin_sense)
3057 msleep(2);
3058
3059 snd_hda_codec_write(codec, hp_pin, 0,
3060 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3061
3062 if (hp_pin_sense)
3063 msleep(85);
3064
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003065 if (!spec->no_shutup_pins)
3066 snd_hda_codec_write(codec, hp_pin, 0,
3067 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003068
3069 if (hp_pin_sense)
3070 msleep(100);
3071
3072 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003073 alc_shutup_pins(codec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003074 alc_write_coef_idx(codec, 0x78, coef78);
3075}
3076
Takashi Iwai54db6c32014-08-18 15:11:19 +02003077static struct coef_fw alc283_coefs[] = {
3078 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003079 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003080 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3081 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3082 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3083 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3084 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3085 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3086 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3087 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3088 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3089 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3090 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3091 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3092 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3093 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3094 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3095 WRITE_COEF(0x2e, 0x2902), /* PLL */
3096 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3097 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3098 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3099 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3100 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3101 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3102 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3103 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3104 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3105 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3106 WRITE_COEF(0x49, 0x0), /* test mode */
3107 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3108 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3109 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003110 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003111 {}
3112};
3113
Kailang Yang6bd55b02014-03-17 13:51:27 +08003114static void alc283_restore_default_value(struct hda_codec *codec)
3115{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003116 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003117}
3118
Kailang Yang2af02be2013-08-22 10:03:50 +02003119static void alc283_init(struct hda_codec *codec)
3120{
3121 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003122 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003123 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003124
Kailang Yang6bd55b02014-03-17 13:51:27 +08003125 alc283_restore_default_value(codec);
3126
Kailang Yang2af02be2013-08-22 10:03:50 +02003127 if (!hp_pin)
3128 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003129
3130 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003131 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3132
3133 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3134 /* Headphone capless set to high power mode */
3135 alc_write_coef_idx(codec, 0x43, 0x9004);
3136
3137 snd_hda_codec_write(codec, hp_pin, 0,
3138 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3139
3140 if (hp_pin_sense)
3141 msleep(85);
3142
3143 snd_hda_codec_write(codec, hp_pin, 0,
3144 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3145
3146 if (hp_pin_sense)
3147 msleep(85);
3148 /* Index 0x46 Combo jack auto switch control 2 */
3149 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003150 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003151 /* Headphone capless set to normal mode */
3152 alc_write_coef_idx(codec, 0x43, 0x9614);
3153}
3154
3155static void alc283_shutup(struct hda_codec *codec)
3156{
3157 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003158 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003159 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003160
3161 if (!hp_pin) {
3162 alc269_shutup(codec);
3163 return;
3164 }
3165
3166 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3167
3168 alc_write_coef_idx(codec, 0x43, 0x9004);
3169
Harsha Priyab450b172014-10-09 11:04:56 +00003170 /*depop hp during suspend*/
3171 alc_write_coef_idx(codec, 0x06, 0x2100);
3172
Kailang Yang2af02be2013-08-22 10:03:50 +02003173 snd_hda_codec_write(codec, hp_pin, 0,
3174 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3175
3176 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003177 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003178
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003179 if (!spec->no_shutup_pins)
3180 snd_hda_codec_write(codec, hp_pin, 0,
3181 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003182
Takashi Iwai98b24882014-08-18 13:47:50 +02003183 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003184
3185 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003186 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003187 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003188 alc_shutup_pins(codec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003189 alc_write_coef_idx(codec, 0x43, 0x9614);
3190}
3191
Kailang Yang4a219ef2017-06-16 16:54:35 +08003192static void alc256_init(struct hda_codec *codec)
3193{
3194 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003195 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003196 bool hp_pin_sense;
3197
3198 if (!hp_pin)
3199 return;
3200
3201 msleep(30);
3202
3203 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3204
3205 if (hp_pin_sense)
3206 msleep(2);
3207
3208 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3209
3210 snd_hda_codec_write(codec, hp_pin, 0,
3211 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3212
3213 if (hp_pin_sense)
3214 msleep(85);
3215
3216 snd_hda_codec_write(codec, hp_pin, 0,
3217 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3218
3219 if (hp_pin_sense)
3220 msleep(100);
3221
3222 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3223 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003224 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3225 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003226}
3227
3228static void alc256_shutup(struct hda_codec *codec)
3229{
3230 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003231 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003232 bool hp_pin_sense;
3233
3234 if (!hp_pin) {
3235 alc269_shutup(codec);
3236 return;
3237 }
3238
3239 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3240
3241 if (hp_pin_sense)
3242 msleep(2);
3243
3244 snd_hda_codec_write(codec, hp_pin, 0,
3245 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3246
3247 if (hp_pin_sense)
3248 msleep(85);
3249
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003250 /* 3k pull low control for Headset jack. */
3251 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3252 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3253
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003254 if (!spec->no_shutup_pins)
3255 snd_hda_codec_write(codec, hp_pin, 0,
3256 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003257
Kailang Yang4a219ef2017-06-16 16:54:35 +08003258 if (hp_pin_sense)
3259 msleep(100);
3260
3261 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003262 alc_shutup_pins(codec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003263}
3264
Kailang Yangda911b12018-01-05 16:50:08 +08003265static void alc225_init(struct hda_codec *codec)
3266{
3267 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003268 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003269 bool hp1_pin_sense, hp2_pin_sense;
3270
3271 if (!hp_pin)
3272 return;
3273
3274 msleep(30);
3275
3276 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3277 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3278
3279 if (hp1_pin_sense || hp2_pin_sense)
3280 msleep(2);
3281
3282 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3283
3284 if (hp1_pin_sense)
3285 snd_hda_codec_write(codec, hp_pin, 0,
3286 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3287 if (hp2_pin_sense)
3288 snd_hda_codec_write(codec, 0x16, 0,
3289 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3290
3291 if (hp1_pin_sense || hp2_pin_sense)
3292 msleep(85);
3293
3294 if (hp1_pin_sense)
3295 snd_hda_codec_write(codec, hp_pin, 0,
3296 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3297 if (hp2_pin_sense)
3298 snd_hda_codec_write(codec, 0x16, 0,
3299 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3300
3301 if (hp1_pin_sense || hp2_pin_sense)
3302 msleep(100);
3303
3304 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3305 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3306}
3307
3308static void alc225_shutup(struct hda_codec *codec)
3309{
3310 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003311 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003312 bool hp1_pin_sense, hp2_pin_sense;
3313
3314 if (!hp_pin) {
3315 alc269_shutup(codec);
3316 return;
3317 }
3318
3319 /* 3k pull low control for Headset jack. */
3320 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3321
3322 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3323 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3324
3325 if (hp1_pin_sense || hp2_pin_sense)
3326 msleep(2);
3327
3328 if (hp1_pin_sense)
3329 snd_hda_codec_write(codec, hp_pin, 0,
3330 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3331 if (hp2_pin_sense)
3332 snd_hda_codec_write(codec, 0x16, 0,
3333 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3334
3335 if (hp1_pin_sense || hp2_pin_sense)
3336 msleep(85);
3337
3338 if (hp1_pin_sense)
3339 snd_hda_codec_write(codec, hp_pin, 0,
3340 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3341 if (hp2_pin_sense)
3342 snd_hda_codec_write(codec, 0x16, 0,
3343 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3344
3345 if (hp1_pin_sense || hp2_pin_sense)
3346 msleep(100);
3347
3348 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003349 alc_shutup_pins(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003350}
3351
Kailang Yangc2d6af52017-06-21 14:50:54 +08003352static void alc_default_init(struct hda_codec *codec)
3353{
3354 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003355 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003356 bool hp_pin_sense;
3357
3358 if (!hp_pin)
3359 return;
3360
3361 msleep(30);
3362
3363 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3364
3365 if (hp_pin_sense)
3366 msleep(2);
3367
3368 snd_hda_codec_write(codec, hp_pin, 0,
3369 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3370
3371 if (hp_pin_sense)
3372 msleep(85);
3373
3374 snd_hda_codec_write(codec, hp_pin, 0,
3375 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3376
3377 if (hp_pin_sense)
3378 msleep(100);
3379}
3380
3381static void alc_default_shutup(struct hda_codec *codec)
3382{
3383 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003384 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003385 bool hp_pin_sense;
3386
3387 if (!hp_pin) {
3388 alc269_shutup(codec);
3389 return;
3390 }
3391
3392 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3393
3394 if (hp_pin_sense)
3395 msleep(2);
3396
3397 snd_hda_codec_write(codec, hp_pin, 0,
3398 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3399
3400 if (hp_pin_sense)
3401 msleep(85);
3402
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003403 if (!spec->no_shutup_pins)
3404 snd_hda_codec_write(codec, hp_pin, 0,
3405 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003406
3407 if (hp_pin_sense)
3408 msleep(100);
3409
3410 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003411 alc_shutup_pins(codec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003412}
3413
Kailang Yang693abe12019-01-29 15:38:21 +08003414static void alc294_hp_init(struct hda_codec *codec)
3415{
3416 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003417 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang693abe12019-01-29 15:38:21 +08003418 int i, val;
3419
3420 if (!hp_pin)
3421 return;
3422
3423 snd_hda_codec_write(codec, hp_pin, 0,
3424 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3425
3426 msleep(100);
3427
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003428 if (!spec->no_shutup_pins)
3429 snd_hda_codec_write(codec, hp_pin, 0,
3430 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang693abe12019-01-29 15:38:21 +08003431
3432 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3433 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3434
3435 /* Wait for depop procedure finish */
3436 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3437 for (i = 0; i < 20 && val & 0x0080; i++) {
3438 msleep(50);
3439 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3440 }
3441 /* Set HP depop to auto mode */
3442 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3443 msleep(50);
3444}
3445
3446static void alc294_init(struct hda_codec *codec)
3447{
3448 struct alc_spec *spec = codec->spec;
3449
Takashi Iwaif6ef4e02019-01-29 14:14:51 +01003450 /* required only at boot or S4 resume time */
3451 if (!spec->done_hp_init ||
3452 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
Kailang Yang693abe12019-01-29 15:38:21 +08003453 alc294_hp_init(codec);
3454 spec->done_hp_init = true;
3455 }
3456 alc_default_init(codec);
3457}
3458
Kailang Yangad60d502013-06-28 12:03:01 +02003459static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3460 unsigned int val)
3461{
3462 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3463 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3464 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3465}
3466
3467static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3468{
3469 unsigned int val;
3470
3471 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3472 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3473 & 0xffff;
3474 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3475 << 16;
3476 return val;
3477}
3478
3479static void alc5505_dsp_halt(struct hda_codec *codec)
3480{
3481 unsigned int val;
3482
3483 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3484 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3485 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3486 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3487 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3488 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3489 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3490 val = alc5505_coef_get(codec, 0x6220);
3491 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3492}
3493
3494static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3495{
3496 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3497 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3498 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3499 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3500 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3501 alc5505_coef_set(codec, 0x880c, 0x00000004);
3502}
3503
3504static void alc5505_dsp_init(struct hda_codec *codec)
3505{
3506 unsigned int val;
3507
3508 alc5505_dsp_halt(codec);
3509 alc5505_dsp_back_from_halt(codec);
3510 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3511 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3512 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3513 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3514 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3515 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3516 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3517 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3518 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3519 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3520 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3521 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3522 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3523
3524 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3525 if (val <= 3)
3526 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3527 else
3528 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3529
3530 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3531 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3532 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3533 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3534 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3535 alc5505_coef_set(codec, 0x880c, 0x00000003);
3536 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003537
3538#ifdef HALT_REALTEK_ALC5505
3539 alc5505_dsp_halt(codec);
3540#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003541}
3542
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003543#ifdef HALT_REALTEK_ALC5505
3544#define alc5505_dsp_suspend(codec) /* NOP */
3545#define alc5505_dsp_resume(codec) /* NOP */
3546#else
3547#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3548#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3549#endif
3550
Takashi Iwai2a439522011-07-26 09:52:50 +02003551#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003552static int alc269_suspend(struct hda_codec *codec)
3553{
3554 struct alc_spec *spec = codec->spec;
3555
3556 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003557 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003558 return alc_suspend(codec);
3559}
3560
Takashi Iwai1d045db2011-07-07 18:23:21 +02003561static int alc269_resume(struct hda_codec *codec)
3562{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003563 struct alc_spec *spec = codec->spec;
3564
Kailang Yang1387e2d2012-11-08 10:23:18 +01003565 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3566 alc269vb_toggle_power_output(codec, 0);
3567 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003568 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003569 msleep(150);
3570 }
3571
3572 codec->patch_ops.init(codec);
3573
Kailang Yang1387e2d2012-11-08 10:23:18 +01003574 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3575 alc269vb_toggle_power_output(codec, 1);
3576 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003577 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003578 msleep(200);
3579 }
3580
Takashi Iwaieeecd9d2015-02-25 15:18:50 +01003581 regcache_sync(codec->core.regmap);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003582 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003583
3584 /* on some machine, the BIOS will clear the codec gpio data when enter
3585 * suspend, and won't restore the data after resume, so we restore it
3586 * in the driver.
3587 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003588 if (spec->gpio_data)
3589 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003590
Kailang Yangad60d502013-06-28 12:03:01 +02003591 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003592 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003593
Takashi Iwai1d045db2011-07-07 18:23:21 +02003594 return 0;
3595}
Takashi Iwai2a439522011-07-26 09:52:50 +02003596#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003597
David Henningsson108cc102012-07-20 10:37:25 +02003598static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003599 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003600{
3601 struct alc_spec *spec = codec->spec;
3602
Takashi Iwai1727a772013-01-10 09:52:52 +01003603 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003604 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3605}
3606
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01003607static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3608 const struct hda_fixup *fix,
3609 int action)
3610{
3611 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3612 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3613
3614 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3615 snd_hda_codec_set_pincfg(codec, 0x19,
3616 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3617 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3618}
3619
Takashi Iwai1d045db2011-07-07 18:23:21 +02003620static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003621 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003622{
Takashi Iwai98b24882014-08-18 13:47:50 +02003623 if (action == HDA_FIXUP_ACT_INIT)
3624 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003625}
3626
David Henningsson7c478f02013-10-11 10:18:46 +02003627static void alc269_fixup_headset_mic(struct hda_codec *codec,
3628 const struct hda_fixup *fix, int action)
3629{
3630 struct alc_spec *spec = codec->spec;
3631
3632 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3633 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3634}
3635
Takashi Iwai1d045db2011-07-07 18:23:21 +02003636static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003637 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003638{
3639 static const struct hda_verb verbs[] = {
3640 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3641 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3642 {}
3643 };
3644 unsigned int cfg;
3645
Takashi Iwai7639a062015-03-03 10:07:24 +01003646 if (strcmp(codec->core.chip_name, "ALC271X") &&
3647 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02003648 return;
3649 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3650 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3651 snd_hda_sequence_write(codec, verbs);
3652}
3653
Takashi Iwai017f2a12011-07-09 14:42:25 +02003654static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003655 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003656{
3657 struct alc_spec *spec = codec->spec;
3658
Takashi Iwai1727a772013-01-10 09:52:52 +01003659 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003660 return;
3661
3662 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3663 * fix the sample rate of analog I/O to 44.1kHz
3664 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003665 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3666 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02003667}
3668
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003669static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003670 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003671{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003672 /* The digital-mic unit sends PDM (differential signal) instead of
3673 * the standard PCM, thus you can't record a valid mono stream as is.
3674 * Below is a workaround specific to ALC269 to control the dmic
3675 * signal source as mono.
3676 */
Takashi Iwai98b24882014-08-18 13:47:50 +02003677 if (action == HDA_FIXUP_ACT_INIT)
3678 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003679}
3680
Takashi Iwai24519912011-08-16 15:08:49 +02003681static void alc269_quanta_automute(struct hda_codec *codec)
3682{
Takashi Iwai08c189f2012-12-19 15:22:24 +01003683 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02003684
Takashi Iwai1687ccc2014-08-18 13:49:35 +02003685 alc_write_coef_idx(codec, 0x0c, 0x680);
3686 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02003687}
3688
3689static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003690 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02003691{
3692 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01003693 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02003694 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01003695 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02003696}
3697
David Henningssond240d1d2013-04-15 12:50:02 +02003698static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02003699 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02003700{
3701 struct alc_spec *spec = codec->spec;
3702 int vref;
3703 msleep(200);
3704 snd_hda_gen_hp_automute(codec, jack);
3705
3706 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3707 msleep(100);
3708 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3709 vref);
3710 msleep(500);
3711 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3712 vref);
3713}
3714
3715static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3716 const struct hda_fixup *fix, int action)
3717{
3718 struct alc_spec *spec = codec->spec;
3719 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3720 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3721 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3722 }
3723}
3724
3725
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003726/* update mute-LED according to the speaker mute state via mic VREF pin */
3727static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003728{
3729 struct hda_codec *codec = private_data;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003730 struct alc_spec *spec = codec->spec;
3731 unsigned int pinval;
3732
3733 if (spec->mute_led_polarity)
3734 enabled = !enabled;
Takashi Iwai415d5552014-04-03 11:51:21 +02003735 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3736 pinval &= ~AC_PINCTL_VREFEN;
3737 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
Takashi Iwaie40bdb02018-03-17 22:40:18 +01003738 if (spec->mute_led_nid) {
3739 /* temporarily power up/down for setting VREF */
3740 snd_hda_power_up_pm(codec);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003741 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
Takashi Iwaie40bdb02018-03-17 22:40:18 +01003742 snd_hda_power_down_pm(codec);
3743 }
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003744}
3745
David Henningssond5b6b652013-11-06 10:50:44 +01003746/* Make sure the led works even in runtime suspend */
3747static unsigned int led_power_filter(struct hda_codec *codec,
3748 hda_nid_t nid,
3749 unsigned int power_state)
3750{
3751 struct alc_spec *spec = codec->spec;
3752
Hui Wang50dd9052014-07-08 17:56:15 +08003753 if (power_state != AC_PWRST_D3 || nid == 0 ||
3754 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01003755 return power_state;
3756
3757 /* Set pin ctl again, it might have just been set to 0 */
3758 snd_hda_set_pin_ctl(codec, nid,
3759 snd_hda_codec_get_pin_target(codec, nid));
3760
Takashi Iwaicffd3962015-04-09 10:30:25 +02003761 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01003762}
3763
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003764static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3765 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003766{
3767 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003768 const struct dmi_device *dev = NULL;
3769
3770 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3771 return;
3772
3773 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3774 int pol, pin;
3775 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3776 continue;
3777 if (pin < 0x0a || pin >= 0x10)
3778 break;
3779 spec->mute_led_polarity = pol;
3780 spec->mute_led_nid = pin - 0x0a + 0x18;
3781 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
Takashi Iwaifd25a972012-12-20 14:57:18 +01003782 spec->gen.vmaster_mute_enum = 1;
David Henningssond5b6b652013-11-06 10:50:44 +01003783 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01003784 codec_dbg(codec,
3785 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003786 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003787 break;
3788 }
3789}
3790
Takashi Iwai85c467d2018-05-29 11:38:38 +02003791static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
3792 const struct hda_fixup *fix,
3793 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01003794{
3795 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02003796
David Henningssond06ac142013-02-18 11:41:55 +01003797 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3798 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02003799 spec->mute_led_nid = pin;
David Henningssond06ac142013-02-18 11:41:55 +01003800 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3801 spec->gen.vmaster_mute_enum = 1;
David Henningssond5b6b652013-11-06 10:50:44 +01003802 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01003803 }
3804}
3805
Takashi Iwai85c467d2018-05-29 11:38:38 +02003806static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3807 const struct hda_fixup *fix, int action)
3808{
3809 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
3810}
3811
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003812static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3813 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01003814{
Takashi Iwai85c467d2018-05-29 11:38:38 +02003815 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01003816}
3817
Tom Briden7f783bd2017-03-25 10:12:01 +00003818static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
3819 const struct hda_fixup *fix, int action)
3820{
Takashi Iwai85c467d2018-05-29 11:38:38 +02003821 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00003822}
3823
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003824/* update LED status via GPIO */
3825static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3826 bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003827{
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003828 struct alc_spec *spec = codec->spec;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003829
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003830 if (spec->mute_led_polarity)
3831 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02003832 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003833}
3834
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003835/* turn on/off mute LED via GPIO per vmaster hook */
3836static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3837{
3838 struct hda_codec *codec = private_data;
3839 struct alc_spec *spec = codec->spec;
3840
3841 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3842}
3843
3844/* turn on/off mic-mute LED via GPIO per capture hook */
Takashi Iwaid03abec2018-06-19 12:29:13 +02003845static void alc_gpio_micmute_update(struct hda_codec *codec)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003846{
3847 struct alc_spec *spec = codec->spec;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003848
Takashi Iwaid03abec2018-06-19 12:29:13 +02003849 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3850 spec->gen.micmute_led.led_value);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003851}
3852
Takashi Iwai01e4a272018-06-19 22:47:30 +02003853/* setup mute and mic-mute GPIO bits, add hooks appropriately */
3854static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
3855 int action,
3856 unsigned int mute_mask,
3857 unsigned int micmute_mask)
3858{
3859 struct alc_spec *spec = codec->spec;
3860
3861 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
3862
3863 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3864 return;
3865 if (mute_mask) {
3866 spec->gpio_mute_led_mask = mute_mask;
3867 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3868 }
3869 if (micmute_mask) {
3870 spec->gpio_mic_led_mask = micmute_mask;
3871 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
3872 }
3873}
3874
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003875static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3876 const struct hda_fixup *fix, int action)
3877{
Takashi Iwai01e4a272018-06-19 22:47:30 +02003878 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003879}
3880
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08003881static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3882 const struct hda_fixup *fix, int action)
3883{
Takashi Iwai01e4a272018-06-19 22:47:30 +02003884 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003885}
3886
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003887/* turn on/off mic-mute LED per capture hook */
Takashi Iwaid03abec2018-06-19 12:29:13 +02003888static void alc_cap_micmute_update(struct hda_codec *codec)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003889{
3890 struct alc_spec *spec = codec->spec;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003891 unsigned int pinval;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003892
Takashi Iwaid03abec2018-06-19 12:29:13 +02003893 if (!spec->cap_mute_led_nid)
3894 return;
Hui Wangfc1fad92014-07-08 17:56:14 +08003895 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003896 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003897 if (spec->gen.micmute_led.led_value)
3898 pinval |= AC_PINCTL_VREF_80;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003899 else
Takashi Iwaid03abec2018-06-19 12:29:13 +02003900 pinval |= AC_PINCTL_VREF_HIZ;
3901 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003902}
3903
3904static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3905 const struct hda_fixup *fix, int action)
3906{
3907 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003908
Takashi Iwai01e4a272018-06-19 22:47:30 +02003909 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003910 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02003911 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
3912 * enable headphone amp
3913 */
3914 spec->gpio_mask |= 0x10;
3915 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003916 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003917 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
Hui Wang50dd9052014-07-08 17:56:15 +08003918 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003919 }
3920}
3921
David Henningsson7a5255f2014-10-30 08:26:01 +01003922static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3923 const struct hda_fixup *fix, int action)
3924{
David Henningsson7a5255f2014-10-30 08:26:01 +01003925 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01003926
Takashi Iwai01e4a272018-06-19 22:47:30 +02003927 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01003928 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01003929 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003930 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
David Henningsson7a5255f2014-10-30 08:26:01 +01003931 codec->power_filter = led_power_filter;
3932 }
3933}
3934
Takashi Iwai6a30aba2018-04-27 17:17:35 +02003935#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01003936static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3937 struct hda_jack_callback *event)
3938{
3939 struct alc_spec *spec = codec->spec;
3940
3941 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3942 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08003943 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01003944 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08003945 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01003946 input_sync(spec->kb_dev);
3947}
David Henningsson33f4acd2015-01-07 15:50:13 +01003948
Kailang3694cb22015-12-28 11:35:24 +08003949static int alc_register_micmute_input_device(struct hda_codec *codec)
3950{
3951 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08003952 int i;
Kailang3694cb22015-12-28 11:35:24 +08003953
3954 spec->kb_dev = input_allocate_device();
3955 if (!spec->kb_dev) {
3956 codec_err(codec, "Out of memory (input_allocate_device)\n");
3957 return -ENOMEM;
3958 }
Hui Wangc7b60a82015-12-28 11:35:25 +08003959
3960 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
3961
Kailang3694cb22015-12-28 11:35:24 +08003962 spec->kb_dev->name = "Microphone Mute Button";
3963 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08003964 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
3965 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
3966 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
3967 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
3968 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08003969
3970 if (input_register_device(spec->kb_dev)) {
3971 codec_err(codec, "input_register_device failed\n");
3972 input_free_device(spec->kb_dev);
3973 spec->kb_dev = NULL;
3974 return -ENOMEM;
3975 }
3976
3977 return 0;
3978}
3979
Takashi Iwai01e4a272018-06-19 22:47:30 +02003980/* GPIO1 = set according to SKU external amp
3981 * GPIO2 = mic mute hotkey
3982 * GPIO3 = mute LED
3983 * GPIO4 = mic mute LED
3984 */
David Henningsson33f4acd2015-01-07 15:50:13 +01003985static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3986 const struct hda_fixup *fix, int action)
3987{
David Henningsson33f4acd2015-01-07 15:50:13 +01003988 struct alc_spec *spec = codec->spec;
3989
Takashi Iwai01e4a272018-06-19 22:47:30 +02003990 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01003991 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02003992 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08003993 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01003994 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01003995
Takashi Iwai01e4a272018-06-19 22:47:30 +02003996 spec->gpio_mask |= 0x06;
3997 spec->gpio_dir |= 0x02;
3998 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01003999 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01004000 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01004001 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01004002 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01004003 return;
4004 }
4005
4006 if (!spec->kb_dev)
4007 return;
4008
4009 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01004010 case HDA_FIXUP_ACT_FREE:
4011 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01004012 spec->kb_dev = NULL;
4013 }
David Henningsson33f4acd2015-01-07 15:50:13 +01004014}
4015
Takashi Iwai01e4a272018-06-19 22:47:30 +02004016/* Line2 = mic mute hotkey
4017 * GPIO2 = mic mute LED
4018 */
Kailang3694cb22015-12-28 11:35:24 +08004019static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4020 const struct hda_fixup *fix, int action)
4021{
Kailang3694cb22015-12-28 11:35:24 +08004022 struct alc_spec *spec = codec->spec;
4023
Takashi Iwai01e4a272018-06-19 22:47:30 +02004024 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08004025 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004026 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004027 if (alc_register_micmute_input_device(codec) != 0)
4028 return;
4029
Kailang3694cb22015-12-28 11:35:24 +08004030 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4031 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08004032 return;
4033 }
4034
4035 if (!spec->kb_dev)
4036 return;
4037
4038 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08004039 case HDA_FIXUP_ACT_FREE:
4040 input_unregister_device(spec->kb_dev);
4041 spec->kb_dev = NULL;
4042 }
4043}
Takashi Iwaic4696522018-01-15 10:44:35 +01004044#else /* INPUT */
4045#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4046#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4047#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004048
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004049static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4050 const struct hda_fixup *fix, int action)
4051{
4052 struct alc_spec *spec = codec->spec;
4053
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004054 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004055 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004056 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02004057 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004058 }
4059}
4060
Kailang Yang5a367672017-07-21 15:23:53 +08004061static struct coef_fw alc225_pre_hsmode[] = {
4062 UPDATE_COEF(0x4a, 1<<8, 0),
4063 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4064 UPDATE_COEF(0x63, 3<<14, 3<<14),
4065 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4066 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4067 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4068 UPDATE_COEF(0x4a, 3<<10, 0),
4069 {}
4070};
4071
David Henningsson73bdd592013-04-15 15:44:14 +02004072static void alc_headset_mode_unplugged(struct hda_codec *codec)
4073{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004074 static struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004075 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4076 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4077 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4078 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4079 {}
4080 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004081 static struct coef_fw coef0255_1[] = {
4082 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4083 {}
4084 };
4085 static struct coef_fw coef0256[] = {
4086 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4087 {}
4088 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004089 static struct coef_fw coef0233[] = {
4090 WRITE_COEF(0x1b, 0x0c0b),
4091 WRITE_COEF(0x45, 0xc429),
4092 UPDATE_COEF(0x35, 0x4000, 0),
4093 WRITE_COEF(0x06, 0x2104),
4094 WRITE_COEF(0x1a, 0x0001),
4095 WRITE_COEF(0x26, 0x0004),
4096 WRITE_COEF(0x32, 0x42a3),
4097 {}
4098 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004099 static struct coef_fw coef0288[] = {
4100 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4101 UPDATE_COEF(0x50, 0x2000, 0x2000),
4102 UPDATE_COEF(0x56, 0x0006, 0x0006),
4103 UPDATE_COEF(0x66, 0x0008, 0),
4104 UPDATE_COEF(0x67, 0x2000, 0),
4105 {}
4106 };
Kailang Yang89542932017-07-17 15:03:43 +08004107 static struct coef_fw coef0298[] = {
4108 UPDATE_COEF(0x19, 0x1300, 0x0300),
4109 {}
4110 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004111 static struct coef_fw coef0292[] = {
4112 WRITE_COEF(0x76, 0x000e),
4113 WRITE_COEF(0x6c, 0x2400),
4114 WRITE_COEF(0x18, 0x7308),
4115 WRITE_COEF(0x6b, 0xc429),
4116 {}
4117 };
4118 static struct coef_fw coef0293[] = {
4119 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4120 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4121 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4122 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4123 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4124 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4125 {}
4126 };
4127 static struct coef_fw coef0668[] = {
4128 WRITE_COEF(0x15, 0x0d40),
4129 WRITE_COEF(0xb7, 0x802b),
4130 {}
4131 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004132 static struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004133 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004134 {}
4135 };
Kailang Yang71683c32017-06-20 16:33:50 +08004136 static struct coef_fw coef0274[] = {
4137 UPDATE_COEF(0x4a, 0x0100, 0),
4138 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4139 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4140 UPDATE_COEF(0x4a, 0x0010, 0),
4141 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4142 WRITE_COEF(0x45, 0x5289),
4143 UPDATE_COEF(0x4a, 0x0c00, 0),
4144 {}
4145 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004146
Takashi Iwai7639a062015-03-03 10:07:24 +01004147 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004148 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004149 alc_process_coef_fw(codec, coef0255_1);
4150 alc_process_coef_fw(codec, coef0255);
4151 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004152 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004153 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004154 alc_process_coef_fw(codec, coef0256);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004155 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004156 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004157 case 0x10ec0234:
4158 case 0x10ec0274:
4159 case 0x10ec0294:
4160 alc_process_coef_fw(codec, coef0274);
4161 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004162 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004163 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004164 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004165 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004166 case 0x10ec0286:
4167 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004168 alc_process_coef_fw(codec, coef0288);
4169 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004170 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004171 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004172 alc_process_coef_fw(codec, coef0288);
4173 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004174 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004175 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004176 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004177 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004178 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004179 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004180 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004181 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004182 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004183 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004184 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004185 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004186 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004187 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004188 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004189 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004190 alc_process_coef_fw(codec, coef0225);
4191 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004192 case 0x10ec0867:
4193 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4194 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004195 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004196 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004197}
4198
4199
4200static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4201 hda_nid_t mic_pin)
4202{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004203 static struct coef_fw coef0255[] = {
4204 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4205 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4206 {}
4207 };
4208 static struct coef_fw coef0233[] = {
4209 UPDATE_COEF(0x35, 0, 1<<14),
4210 WRITE_COEF(0x06, 0x2100),
4211 WRITE_COEF(0x1a, 0x0021),
4212 WRITE_COEF(0x26, 0x008c),
4213 {}
4214 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004215 static struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004216 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004217 UPDATE_COEF(0x50, 0x2000, 0),
4218 UPDATE_COEF(0x56, 0x0006, 0),
4219 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4220 UPDATE_COEF(0x66, 0x0008, 0x0008),
4221 UPDATE_COEF(0x67, 0x2000, 0x2000),
4222 {}
4223 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004224 static struct coef_fw coef0292[] = {
4225 WRITE_COEF(0x19, 0xa208),
4226 WRITE_COEF(0x2e, 0xacf0),
4227 {}
4228 };
4229 static struct coef_fw coef0293[] = {
4230 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4231 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4232 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4233 {}
4234 };
4235 static struct coef_fw coef0688[] = {
4236 WRITE_COEF(0xb7, 0x802b),
4237 WRITE_COEF(0xb5, 0x1040),
4238 UPDATE_COEF(0xc3, 0, 1<<12),
4239 {}
4240 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004241 static struct coef_fw coef0225[] = {
4242 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4243 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4244 UPDATE_COEF(0x63, 3<<14, 0),
4245 {}
4246 };
Kailang Yang71683c32017-06-20 16:33:50 +08004247 static struct coef_fw coef0274[] = {
4248 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4249 UPDATE_COEF(0x4a, 0x0010, 0),
4250 UPDATE_COEF(0x6b, 0xf000, 0),
4251 {}
4252 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004253
Takashi Iwai7639a062015-03-03 10:07:24 +01004254 switch (codec->core.vendor_id) {
Kailang Yang736f20a2017-10-20 15:06:34 +08004255 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004256 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004257 case 0x10ec0256:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004258 alc_write_coef_idx(codec, 0x45, 0xc489);
4259 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004260 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004261 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4262 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004263 case 0x10ec0234:
4264 case 0x10ec0274:
4265 case 0x10ec0294:
4266 alc_write_coef_idx(codec, 0x45, 0x4689);
4267 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4268 alc_process_coef_fw(codec, coef0274);
4269 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4270 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004271 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004272 case 0x10ec0283:
4273 alc_write_coef_idx(codec, 0x45, 0xc429);
4274 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004275 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004276 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4277 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004278 case 0x10ec0286:
4279 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004280 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004281 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4282 alc_process_coef_fw(codec, coef0288);
4283 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4284 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004285 case 0x10ec0292:
4286 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004287 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004288 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004289 case 0x10ec0293:
4290 /* Set to TRS mode */
4291 alc_write_coef_idx(codec, 0x45, 0xc429);
4292 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004293 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004294 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4295 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004296 case 0x10ec0867:
4297 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4298 /* fallthru */
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004299 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004300 case 0x10ec0662:
4301 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4302 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4303 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004304 case 0x10ec0668:
4305 alc_write_coef_idx(codec, 0x11, 0x0001);
4306 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004307 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004308 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4309 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004310 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004311 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004312 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004313 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004314 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004315 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004316 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004317 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4318 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4319 alc_process_coef_fw(codec, coef0225);
4320 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4321 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004322 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004323 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004324}
4325
4326static void alc_headset_mode_default(struct hda_codec *codec)
4327{
David Henningsson2ae95572016-02-25 09:37:05 +01004328 static struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004329 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4330 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4331 UPDATE_COEF(0x49, 3<<8, 0<<8),
4332 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4333 UPDATE_COEF(0x63, 3<<14, 0),
4334 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01004335 {}
4336 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004337 static struct coef_fw coef0255[] = {
4338 WRITE_COEF(0x45, 0xc089),
4339 WRITE_COEF(0x45, 0xc489),
4340 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4341 WRITE_COEF(0x49, 0x0049),
4342 {}
4343 };
4344 static struct coef_fw coef0233[] = {
4345 WRITE_COEF(0x06, 0x2100),
4346 WRITE_COEF(0x32, 0x4ea3),
4347 {}
4348 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004349 static struct coef_fw coef0288[] = {
4350 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4351 UPDATE_COEF(0x50, 0x2000, 0x2000),
4352 UPDATE_COEF(0x56, 0x0006, 0x0006),
4353 UPDATE_COEF(0x66, 0x0008, 0),
4354 UPDATE_COEF(0x67, 0x2000, 0),
4355 {}
4356 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004357 static struct coef_fw coef0292[] = {
4358 WRITE_COEF(0x76, 0x000e),
4359 WRITE_COEF(0x6c, 0x2400),
4360 WRITE_COEF(0x6b, 0xc429),
4361 WRITE_COEF(0x18, 0x7308),
4362 {}
4363 };
4364 static struct coef_fw coef0293[] = {
4365 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4366 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4367 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4368 {}
4369 };
4370 static struct coef_fw coef0688[] = {
4371 WRITE_COEF(0x11, 0x0041),
4372 WRITE_COEF(0x15, 0x0d40),
4373 WRITE_COEF(0xb7, 0x802b),
4374 {}
4375 };
Kailang Yang71683c32017-06-20 16:33:50 +08004376 static struct coef_fw coef0274[] = {
4377 WRITE_COEF(0x45, 0x4289),
4378 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4379 UPDATE_COEF(0x6b, 0x0f00, 0),
4380 UPDATE_COEF(0x49, 0x0300, 0x0300),
4381 {}
4382 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004383
Takashi Iwai7639a062015-03-03 10:07:24 +01004384 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08004385 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01004386 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004387 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004388 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004389 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004390 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004391 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01004392 alc_process_coef_fw(codec, coef0225);
4393 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004394 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004395 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004396 case 0x10ec0256:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004397 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004398 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004399 case 0x10ec0234:
4400 case 0x10ec0274:
4401 case 0x10ec0294:
4402 alc_process_coef_fw(codec, coef0274);
4403 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004404 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004405 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004406 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004407 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004408 case 0x10ec0286:
4409 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004410 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004411 alc_process_coef_fw(codec, coef0288);
4412 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004413 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004414 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004415 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004416 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004417 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004418 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004419 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004420 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004421 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004422 case 0x10ec0867:
4423 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4424 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004425 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004426 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004427}
4428
4429/* Iphone type */
4430static void alc_headset_mode_ctia(struct hda_codec *codec)
4431{
Kailang Yang89542932017-07-17 15:03:43 +08004432 int val;
4433
Takashi Iwai54db6c32014-08-18 15:11:19 +02004434 static struct coef_fw coef0255[] = {
4435 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4436 WRITE_COEF(0x1b, 0x0c2b),
4437 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4438 {}
4439 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004440 static struct coef_fw coef0256[] = {
4441 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4442 WRITE_COEF(0x1b, 0x0c6b),
4443 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4444 {}
4445 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004446 static struct coef_fw coef0233[] = {
4447 WRITE_COEF(0x45, 0xd429),
4448 WRITE_COEF(0x1b, 0x0c2b),
4449 WRITE_COEF(0x32, 0x4ea3),
4450 {}
4451 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004452 static struct coef_fw coef0288[] = {
4453 UPDATE_COEF(0x50, 0x2000, 0x2000),
4454 UPDATE_COEF(0x56, 0x0006, 0x0006),
4455 UPDATE_COEF(0x66, 0x0008, 0),
4456 UPDATE_COEF(0x67, 0x2000, 0),
4457 {}
4458 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004459 static struct coef_fw coef0292[] = {
4460 WRITE_COEF(0x6b, 0xd429),
4461 WRITE_COEF(0x76, 0x0008),
4462 WRITE_COEF(0x18, 0x7388),
4463 {}
4464 };
4465 static struct coef_fw coef0293[] = {
4466 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4467 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4468 {}
4469 };
4470 static struct coef_fw coef0688[] = {
4471 WRITE_COEF(0x11, 0x0001),
4472 WRITE_COEF(0x15, 0x0d60),
4473 WRITE_COEF(0xc3, 0x0000),
4474 {}
4475 };
Kailang Yang5a367672017-07-21 15:23:53 +08004476 static struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004477 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004478 UPDATE_COEF(0x63, 3<<14, 2<<14),
4479 {}
4480 };
4481 static struct coef_fw coef0225_2[] = {
4482 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4483 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004484 {}
4485 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004486
Takashi Iwai7639a062015-03-03 10:07:24 +01004487 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004488 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004489 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004490 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004491 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004492 case 0x10ec0256:
4493 alc_process_coef_fw(codec, coef0256);
4494 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004495 case 0x10ec0234:
4496 case 0x10ec0274:
4497 case 0x10ec0294:
4498 alc_write_coef_idx(codec, 0x45, 0xd689);
4499 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004500 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004501 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004502 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004503 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004504 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004505 val = alc_read_coef_idx(codec, 0x50);
4506 if (val & (1 << 12)) {
4507 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4508 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4509 msleep(300);
4510 } else {
4511 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4512 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4513 msleep(300);
4514 }
4515 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004516 case 0x10ec0286:
4517 case 0x10ec0288:
4518 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4519 msleep(300);
4520 alc_process_coef_fw(codec, coef0288);
4521 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004522 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004523 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004524 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004525 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004526 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004527 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004528 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004529 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004530 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004531 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004532 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004533 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004534 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004535 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004536 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004537 val = alc_read_coef_idx(codec, 0x45);
4538 if (val & (1 << 9))
4539 alc_process_coef_fw(codec, coef0225_2);
4540 else
4541 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004542 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004543 case 0x10ec0867:
4544 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4545 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004546 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004547 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004548}
4549
4550/* Nokia type */
4551static void alc_headset_mode_omtp(struct hda_codec *codec)
4552{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004553 static struct coef_fw coef0255[] = {
4554 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4555 WRITE_COEF(0x1b, 0x0c2b),
4556 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4557 {}
4558 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004559 static struct coef_fw coef0256[] = {
4560 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4561 WRITE_COEF(0x1b, 0x0c6b),
4562 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4563 {}
4564 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004565 static struct coef_fw coef0233[] = {
4566 WRITE_COEF(0x45, 0xe429),
4567 WRITE_COEF(0x1b, 0x0c2b),
4568 WRITE_COEF(0x32, 0x4ea3),
4569 {}
4570 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004571 static struct coef_fw coef0288[] = {
4572 UPDATE_COEF(0x50, 0x2000, 0x2000),
4573 UPDATE_COEF(0x56, 0x0006, 0x0006),
4574 UPDATE_COEF(0x66, 0x0008, 0),
4575 UPDATE_COEF(0x67, 0x2000, 0),
4576 {}
4577 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004578 static struct coef_fw coef0292[] = {
4579 WRITE_COEF(0x6b, 0xe429),
4580 WRITE_COEF(0x76, 0x0008),
4581 WRITE_COEF(0x18, 0x7388),
4582 {}
4583 };
4584 static struct coef_fw coef0293[] = {
4585 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4586 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4587 {}
4588 };
4589 static struct coef_fw coef0688[] = {
4590 WRITE_COEF(0x11, 0x0001),
4591 WRITE_COEF(0x15, 0x0d50),
4592 WRITE_COEF(0xc3, 0x0000),
4593 {}
4594 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004595 static struct coef_fw coef0225[] = {
4596 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004597 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004598 {}
4599 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004600
Takashi Iwai7639a062015-03-03 10:07:24 +01004601 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004602 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004603 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004604 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004605 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004606 case 0x10ec0256:
4607 alc_process_coef_fw(codec, coef0256);
4608 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004609 case 0x10ec0234:
4610 case 0x10ec0274:
4611 case 0x10ec0294:
4612 alc_write_coef_idx(codec, 0x45, 0xe689);
4613 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004614 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004615 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004616 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004617 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004618 case 0x10ec0298:
4619 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08004620 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4621 msleep(300);
4622 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004623 case 0x10ec0286:
4624 case 0x10ec0288:
4625 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4626 msleep(300);
4627 alc_process_coef_fw(codec, coef0288);
4628 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004629 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004630 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004631 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004632 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004633 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004634 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004635 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004636 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004637 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004638 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004639 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004640 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004641 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004642 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004643 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004644 alc_process_coef_fw(codec, coef0225);
4645 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004646 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004647 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004648}
4649
4650static void alc_determine_headset_type(struct hda_codec *codec)
4651{
4652 int val;
4653 bool is_ctia = false;
4654 struct alc_spec *spec = codec->spec;
Takashi Iwai54db6c32014-08-18 15:11:19 +02004655 static struct coef_fw coef0255[] = {
4656 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4657 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4658 conteol) */
4659 {}
4660 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004661 static struct coef_fw coef0288[] = {
4662 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4663 {}
4664 };
Kailang Yang89542932017-07-17 15:03:43 +08004665 static struct coef_fw coef0298[] = {
4666 UPDATE_COEF(0x50, 0x2000, 0x2000),
4667 UPDATE_COEF(0x56, 0x0006, 0x0006),
4668 UPDATE_COEF(0x66, 0x0008, 0),
4669 UPDATE_COEF(0x67, 0x2000, 0),
4670 UPDATE_COEF(0x19, 0x1300, 0x1300),
4671 {}
4672 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004673 static struct coef_fw coef0293[] = {
4674 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4675 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4676 {}
4677 };
4678 static struct coef_fw coef0688[] = {
4679 WRITE_COEF(0x11, 0x0001),
4680 WRITE_COEF(0xb7, 0x802b),
4681 WRITE_COEF(0x15, 0x0d60),
4682 WRITE_COEF(0xc3, 0x0c00),
4683 {}
4684 };
Kailang Yang71683c32017-06-20 16:33:50 +08004685 static struct coef_fw coef0274[] = {
4686 UPDATE_COEF(0x4a, 0x0010, 0),
4687 UPDATE_COEF(0x4a, 0x8000, 0),
4688 WRITE_COEF(0x45, 0xd289),
4689 UPDATE_COEF(0x49, 0x0300, 0x0300),
4690 {}
4691 };
David Henningsson73bdd592013-04-15 15:44:14 +02004692
Takashi Iwai7639a062015-03-03 10:07:24 +01004693 switch (codec->core.vendor_id) {
Kailang Yang736f20a2017-10-20 15:06:34 +08004694 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004695 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004696 case 0x10ec0256:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004697 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004698 msleep(300);
4699 val = alc_read_coef_idx(codec, 0x46);
4700 is_ctia = (val & 0x0070) == 0x0070;
4701 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004702 case 0x10ec0234:
4703 case 0x10ec0274:
4704 case 0x10ec0294:
4705 alc_process_coef_fw(codec, coef0274);
4706 msleep(80);
4707 val = alc_read_coef_idx(codec, 0x46);
4708 is_ctia = (val & 0x00f0) == 0x00f0;
4709 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004710 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004711 case 0x10ec0283:
4712 alc_write_coef_idx(codec, 0x45, 0xd029);
4713 msleep(300);
4714 val = alc_read_coef_idx(codec, 0x46);
4715 is_ctia = (val & 0x0070) == 0x0070;
4716 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004717 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004718 snd_hda_codec_write(codec, 0x21, 0,
4719 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4720 msleep(100);
4721 snd_hda_codec_write(codec, 0x21, 0,
4722 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4723 msleep(200);
4724
4725 val = alc_read_coef_idx(codec, 0x50);
4726 if (val & (1 << 12)) {
4727 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4728 alc_process_coef_fw(codec, coef0288);
4729 msleep(350);
4730 val = alc_read_coef_idx(codec, 0x50);
4731 is_ctia = (val & 0x0070) == 0x0070;
4732 } else {
4733 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4734 alc_process_coef_fw(codec, coef0288);
4735 msleep(350);
4736 val = alc_read_coef_idx(codec, 0x50);
4737 is_ctia = (val & 0x0070) == 0x0070;
4738 }
4739 alc_process_coef_fw(codec, coef0298);
4740 snd_hda_codec_write(codec, 0x21, 0,
4741 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4742 msleep(75);
4743 snd_hda_codec_write(codec, 0x21, 0,
4744 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4745 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004746 case 0x10ec0286:
4747 case 0x10ec0288:
4748 alc_process_coef_fw(codec, coef0288);
4749 msleep(350);
4750 val = alc_read_coef_idx(codec, 0x50);
4751 is_ctia = (val & 0x0070) == 0x0070;
4752 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004753 case 0x10ec0292:
4754 alc_write_coef_idx(codec, 0x6b, 0xd429);
4755 msleep(300);
4756 val = alc_read_coef_idx(codec, 0x6c);
4757 is_ctia = (val & 0x001c) == 0x001c;
4758 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004759 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004760 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004761 msleep(300);
4762 val = alc_read_coef_idx(codec, 0x46);
4763 is_ctia = (val & 0x0070) == 0x0070;
4764 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004765 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004766 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004767 msleep(300);
4768 val = alc_read_coef_idx(codec, 0xbe);
4769 is_ctia = (val & 0x1c02) == 0x1c02;
4770 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004771 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004772 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004773 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004774 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004775 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004776 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08004777 snd_hda_codec_write(codec, 0x21, 0,
4778 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4779 msleep(80);
4780 snd_hda_codec_write(codec, 0x21, 0,
4781 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4782
Kailang Yang5a367672017-07-21 15:23:53 +08004783 alc_process_coef_fw(codec, alc225_pre_hsmode);
4784 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4785 val = alc_read_coef_idx(codec, 0x45);
4786 if (val & (1 << 9)) {
4787 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4788 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4789 msleep(800);
4790 val = alc_read_coef_idx(codec, 0x46);
4791 is_ctia = (val & 0x00f0) == 0x00f0;
4792 } else {
4793 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4794 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4795 msleep(800);
4796 val = alc_read_coef_idx(codec, 0x46);
4797 is_ctia = (val & 0x00f0) == 0x00f0;
4798 }
4799 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4800 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4801 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08004802
4803 snd_hda_codec_write(codec, 0x21, 0,
4804 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4805 msleep(80);
4806 snd_hda_codec_write(codec, 0x21, 0,
4807 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004808 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004809 case 0x10ec0867:
4810 is_ctia = true;
4811 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004812 }
4813
Takashi Iwai4e76a882014-02-25 12:21:03 +01004814 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02004815 is_ctia ? "yes" : "no");
4816 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4817}
4818
4819static void alc_update_headset_mode(struct hda_codec *codec)
4820{
4821 struct alc_spec *spec = codec->spec;
4822
4823 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
Takashi Iwai35a39f92019-02-01 11:19:50 +01004824 hda_nid_t hp_pin = alc_get_hp_pin(spec);
David Henningsson73bdd592013-04-15 15:44:14 +02004825
4826 int new_headset_mode;
4827
4828 if (!snd_hda_jack_detect(codec, hp_pin))
4829 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4830 else if (mux_pin == spec->headset_mic_pin)
4831 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4832 else if (mux_pin == spec->headphone_mic_pin)
4833 new_headset_mode = ALC_HEADSET_MODE_MIC;
4834 else
4835 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4836
David Henningsson5959a6b2013-11-12 11:10:57 +01004837 if (new_headset_mode == spec->current_headset_mode) {
4838 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02004839 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01004840 }
David Henningsson73bdd592013-04-15 15:44:14 +02004841
4842 switch (new_headset_mode) {
4843 case ALC_HEADSET_MODE_UNPLUGGED:
4844 alc_headset_mode_unplugged(codec);
4845 spec->gen.hp_jack_present = false;
4846 break;
4847 case ALC_HEADSET_MODE_HEADSET:
4848 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4849 alc_determine_headset_type(codec);
4850 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4851 alc_headset_mode_ctia(codec);
4852 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4853 alc_headset_mode_omtp(codec);
4854 spec->gen.hp_jack_present = true;
4855 break;
4856 case ALC_HEADSET_MODE_MIC:
4857 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4858 spec->gen.hp_jack_present = false;
4859 break;
4860 case ALC_HEADSET_MODE_HEADPHONE:
4861 alc_headset_mode_default(codec);
4862 spec->gen.hp_jack_present = true;
4863 break;
4864 }
4865 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4866 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4867 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02004868 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02004869 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4870 PIN_VREFHIZ);
4871 }
4872 spec->current_headset_mode = new_headset_mode;
4873
4874 snd_hda_gen_update_outputs(codec);
4875}
4876
4877static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01004878 struct snd_kcontrol *kcontrol,
4879 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02004880{
4881 alc_update_headset_mode(codec);
4882}
4883
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02004884static void alc_update_headset_jack_cb(struct hda_codec *codec,
4885 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02004886{
4887 struct alc_spec *spec = codec->spec;
David Henningsson5db4d342013-11-22 12:17:06 +01004888 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02004889 snd_hda_gen_hp_automute(codec, jack);
4890}
4891
4892static void alc_probe_headset_mode(struct hda_codec *codec)
4893{
4894 int i;
4895 struct alc_spec *spec = codec->spec;
4896 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4897
4898 /* Find mic pins */
4899 for (i = 0; i < cfg->num_inputs; i++) {
4900 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4901 spec->headset_mic_pin = cfg->inputs[i].pin;
4902 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4903 spec->headphone_mic_pin = cfg->inputs[i].pin;
4904 }
4905
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02004906 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02004907 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4908 spec->gen.automute_hook = alc_update_headset_mode;
4909 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4910}
4911
4912static void alc_fixup_headset_mode(struct hda_codec *codec,
4913 const struct hda_fixup *fix, int action)
4914{
4915 struct alc_spec *spec = codec->spec;
4916
4917 switch (action) {
4918 case HDA_FIXUP_ACT_PRE_PROBE:
4919 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4920 break;
4921 case HDA_FIXUP_ACT_PROBE:
4922 alc_probe_headset_mode(codec);
4923 break;
4924 case HDA_FIXUP_ACT_INIT:
4925 spec->current_headset_mode = 0;
4926 alc_update_headset_mode(codec);
4927 break;
4928 }
4929}
4930
4931static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4932 const struct hda_fixup *fix, int action)
4933{
4934 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4935 struct alc_spec *spec = codec->spec;
4936 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4937 }
4938 else
4939 alc_fixup_headset_mode(codec, fix, action);
4940}
4941
Kailang Yang31278992014-03-03 15:27:22 +08004942static void alc255_set_default_jack_type(struct hda_codec *codec)
4943{
4944 /* Set to iphone type */
Kailang Yange69e7e02016-05-30 15:58:28 +08004945 static struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004946 WRITE_COEF(0x1b, 0x880b),
4947 WRITE_COEF(0x45, 0xd089),
4948 WRITE_COEF(0x1b, 0x080b),
4949 WRITE_COEF(0x46, 0x0004),
4950 WRITE_COEF(0x1b, 0x0c0b),
4951 {}
4952 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004953 static struct coef_fw alc256fw[] = {
4954 WRITE_COEF(0x1b, 0x884b),
4955 WRITE_COEF(0x45, 0xd089),
4956 WRITE_COEF(0x1b, 0x084b),
4957 WRITE_COEF(0x46, 0x0004),
4958 WRITE_COEF(0x1b, 0x0c4b),
4959 {}
4960 };
4961 switch (codec->core.vendor_id) {
4962 case 0x10ec0255:
4963 alc_process_coef_fw(codec, alc255fw);
4964 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004965 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004966 case 0x10ec0256:
4967 alc_process_coef_fw(codec, alc256fw);
4968 break;
4969 }
Kailang Yang31278992014-03-03 15:27:22 +08004970 msleep(30);
4971}
4972
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004973static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4974 const struct hda_fixup *fix, int action)
4975{
4976 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08004977 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004978 }
4979 alc_fixup_headset_mode(codec, fix, action);
4980}
4981
Kailang Yang31278992014-03-03 15:27:22 +08004982static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
4983 const struct hda_fixup *fix, int action)
4984{
4985 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4986 struct alc_spec *spec = codec->spec;
4987 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4988 alc255_set_default_jack_type(codec);
4989 }
4990 else
4991 alc_fixup_headset_mode(codec, fix, action);
4992}
4993
Kailang Yange1e62b92015-04-08 16:01:22 +08004994static void alc288_update_headset_jack_cb(struct hda_codec *codec,
4995 struct hda_jack_callback *jack)
4996{
4997 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08004998
4999 alc_update_headset_jack_cb(codec, jack);
5000 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02005001 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08005002}
5003
5004static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5005 const struct hda_fixup *fix, int action)
5006{
5007 alc_fixup_headset_mode(codec, fix, action);
5008 if (action == HDA_FIXUP_ACT_PROBE) {
5009 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02005010 /* toggled via hp_automute_hook */
5011 spec->gpio_mask |= 0x40;
5012 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08005013 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5014 }
5015}
5016
Hui Wang493a52a2014-01-14 14:07:36 +08005017static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5018 const struct hda_fixup *fix, int action)
5019{
5020 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5021 struct alc_spec *spec = codec->spec;
5022 spec->gen.auto_mute_via_amp = 1;
5023 }
5024}
5025
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005026static void alc_fixup_no_shutup(struct hda_codec *codec,
5027 const struct hda_fixup *fix, int action)
5028{
Takashi Iwaiefe55732018-06-15 11:55:02 +02005029 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005030 struct alc_spec *spec = codec->spec;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01005031 spec->no_shutup_pins = 1;
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005032 }
5033}
5034
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005035static void alc_fixup_disable_aamix(struct hda_codec *codec,
5036 const struct hda_fixup *fix, int action)
5037{
5038 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5039 struct alc_spec *spec = codec->spec;
5040 /* Disable AA-loopback as it causes white noise */
5041 spec->gen.mixer_nid = 0;
5042 }
5043}
5044
Takashi Iwai7f57d802015-09-24 17:36:51 +02005045/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5046static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5047 const struct hda_fixup *fix, int action)
5048{
5049 static const struct hda_pintbl pincfgs[] = {
5050 { 0x16, 0x21211010 }, /* dock headphone */
5051 { 0x19, 0x21a11010 }, /* dock mic */
5052 { }
5053 };
5054 struct alc_spec *spec = codec->spec;
5055
5056 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai70a09762015-12-15 14:59:58 +01005057 spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */
Takashi Iwai7f57d802015-09-24 17:36:51 +02005058 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5059 codec->power_save_node = 0; /* avoid click noises */
5060 snd_hda_apply_pincfgs(codec, pincfgs);
5061 }
5062}
5063
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005064static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5065 const struct hda_fixup *fix, int action)
5066{
5067 static const struct hda_pintbl pincfgs[] = {
5068 { 0x17, 0x21211010 }, /* dock headphone */
5069 { 0x19, 0x21a11010 }, /* dock mic */
5070 { }
5071 };
Takashi Iwai54947cd2018-12-03 10:44:15 +01005072 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5073 * the speaker output becomes too low by some reason on Thinkpads with
5074 * ALC298 codec
5075 */
5076 static hda_nid_t preferred_pairs[] = {
5077 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5078 0
5079 };
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005080 struct alc_spec *spec = codec->spec;
5081
5082 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai54947cd2018-12-03 10:44:15 +01005083 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005084 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005085 snd_hda_apply_pincfgs(codec, pincfgs);
5086 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005087 /* Enable DOCK device */
5088 snd_hda_codec_write(codec, 0x17, 0,
5089 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5090 /* Enable DOCK device */
5091 snd_hda_codec_write(codec, 0x19, 0,
5092 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005093 }
5094}
5095
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005096static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005097{
5098 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01005099 int hp_pin = alc_get_hp_pin(spec);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005100
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005101 /* Prevent pop noises when headphones are plugged in */
5102 snd_hda_codec_write(codec, hp_pin, 0,
5103 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5104 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005105}
5106
5107static void alc_fixup_dell_xps13(struct hda_codec *codec,
5108 const struct hda_fixup *fix, int action)
5109{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005110 struct alc_spec *spec = codec->spec;
5111 struct hda_input_mux *imux = &spec->gen.input_mux;
5112 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005113
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005114 switch (action) {
5115 case HDA_FIXUP_ACT_PRE_PROBE:
5116 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5117 * it causes a click noise at start up
5118 */
5119 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005120 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005121 break;
5122 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005123 /* Make the internal mic the default input source. */
5124 for (i = 0; i < imux->num_items; i++) {
5125 if (spec->gen.imux_pins[i] == 0x12) {
5126 spec->gen.cur_mux[0] = i;
5127 break;
5128 }
5129 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005130 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005131 }
5132}
5133
David Henningsson1f8b46c2015-05-12 14:38:15 +02005134static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5135 const struct hda_fixup *fix, int action)
5136{
5137 struct alc_spec *spec = codec->spec;
5138
5139 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5140 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5141 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005142
5143 /* Disable boost for mic-in permanently. (This code is only called
5144 from quirks that guarantee that the headphone is at NID 0x1b.) */
5145 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5146 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005147 } else
5148 alc_fixup_headset_mode(codec, fix, action);
5149}
5150
David Henningsson73bdd592013-04-15 15:44:14 +02005151static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5152 const struct hda_fixup *fix, int action)
5153{
5154 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005155 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005156 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005157 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5158 }
5159 alc_fixup_headset_mode(codec, fix, action);
5160}
5161
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005162/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5163static int find_ext_mic_pin(struct hda_codec *codec)
5164{
5165 struct alc_spec *spec = codec->spec;
5166 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5167 hda_nid_t nid;
5168 unsigned int defcfg;
5169 int i;
5170
5171 for (i = 0; i < cfg->num_inputs; i++) {
5172 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5173 continue;
5174 nid = cfg->inputs[i].pin;
5175 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5176 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5177 continue;
5178 return nid;
5179 }
5180
5181 return 0;
5182}
5183
Dylan Reid08a978d2012-11-18 22:56:40 -08005184static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005185 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005186 int action)
5187{
5188 struct alc_spec *spec = codec->spec;
5189
Takashi Iwai0db75792013-01-23 13:57:20 +01005190 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005191 int mic_pin = find_ext_mic_pin(codec);
Takashi Iwai35a39f92019-02-01 11:19:50 +01005192 int hp_pin = alc_get_hp_pin(spec);
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005193
5194 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005195 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005196 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005197 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005198}
David Henningsson693b6132012-06-22 19:12:10 +02005199
David Henningsson3e0d6112013-04-22 14:30:14 +02005200static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5201 const struct hda_fixup *fix,
5202 int action)
5203{
5204 struct alc_spec *spec = codec->spec;
5205 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5206 int i;
5207
5208 /* The mic boosts on level 2 and 3 are too noisy
5209 on the internal mic input.
5210 Therefore limit the boost to 0 or 1. */
5211
5212 if (action != HDA_FIXUP_ACT_PROBE)
5213 return;
5214
5215 for (i = 0; i < cfg->num_inputs; i++) {
5216 hda_nid_t nid = cfg->inputs[i].pin;
5217 unsigned int defcfg;
5218 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5219 continue;
5220 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5221 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5222 continue;
5223
5224 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5225 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5226 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5227 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5228 (0 << AC_AMPCAP_MUTE_SHIFT));
5229 }
5230}
5231
Kailang Yangcd217a62013-08-22 10:15:24 +02005232static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005233 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005234{
5235 struct alc_spec *spec = codec->spec;
5236 int vref;
5237
5238 msleep(200);
5239 snd_hda_gen_hp_automute(codec, jack);
5240
5241 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5242
5243 msleep(600);
5244 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5245 vref);
5246}
5247
Kailang Yangcd217a62013-08-22 10:15:24 +02005248static void alc283_fixup_chromebook(struct hda_codec *codec,
5249 const struct hda_fixup *fix, int action)
5250{
5251 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005252
5253 switch (action) {
5254 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005255 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005256 /* Disable AA-loopback as it causes white noise */
5257 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08005258 break;
5259 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08005260 /* MIC2-VREF control */
5261 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005262 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08005263 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02005264 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08005265 break;
5266 }
5267}
5268
5269static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5270 const struct hda_fixup *fix, int action)
5271{
5272 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08005273
5274 switch (action) {
5275 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02005276 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5277 break;
5278 case HDA_FIXUP_ACT_INIT:
5279 /* MIC2-VREF control */
5280 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005281 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02005282 break;
5283 }
5284}
5285
Takashi Iwai7bba2152013-09-06 15:45:38 +02005286/* mute tablet speaker pin (0x14) via dock plugging in addition */
5287static void asus_tx300_automute(struct hda_codec *codec)
5288{
5289 struct alc_spec *spec = codec->spec;
5290 snd_hda_gen_update_outputs(codec);
5291 if (snd_hda_jack_detect(codec, 0x1b))
5292 spec->gen.mute_bits |= (1ULL << 0x14);
5293}
5294
5295static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5296 const struct hda_fixup *fix, int action)
5297{
5298 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005299 static const struct hda_pintbl dock_pins[] = {
5300 { 0x1b, 0x21114000 }, /* dock speaker pin */
5301 {}
5302 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02005303
5304 switch (action) {
5305 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02005306 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02005307 /* TX300 needs to set up GPIO2 for the speaker amp */
5308 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02005309 snd_hda_apply_pincfgs(codec, dock_pins);
5310 spec->gen.auto_mute_via_amp = 1;
5311 spec->gen.automute_hook = asus_tx300_automute;
5312 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005313 snd_hda_gen_hp_automute);
5314 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02005315 case HDA_FIXUP_ACT_PROBE:
5316 spec->init_amp = ALC_INIT_DEFAULT;
5317 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005318 case HDA_FIXUP_ACT_BUILD:
5319 /* this is a bit tricky; give more sane names for the main
5320 * (tablet) speaker and the dock speaker, respectively
5321 */
Takashi Iwai56798e62017-04-11 08:10:52 +02005322 rename_ctl(codec, "Speaker Playback Switch",
5323 "Dock Speaker Playback Switch");
5324 rename_ctl(codec, "Bass Speaker Playback Switch",
5325 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02005326 break;
5327 }
5328}
5329
David Henningsson338cae52013-10-07 10:39:59 +02005330static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5331 const struct hda_fixup *fix, int action)
5332{
David Henningsson0f4881d2013-12-20 16:08:13 +01005333 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5334 /* DAC node 0x03 is giving mono output. We therefore want to
5335 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5336 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5337 hda_nid_t conn1[2] = { 0x0c };
5338 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
5339 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
5340 }
David Henningsson338cae52013-10-07 10:39:59 +02005341}
5342
Hui Wangdd9aa332016-08-01 10:20:32 +08005343static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5344 const struct hda_fixup *fix, int action)
5345{
5346 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5347 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5348 we can't adjust the speaker's volume since this node does not has
5349 Amp-out capability. we change the speaker's route to:
5350 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5351 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5352 speaker's volume now. */
5353
5354 hda_nid_t conn1[1] = { 0x0c };
5355 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
5356 }
5357}
5358
Takashi Iwaie312a862018-03-06 12:14:17 +01005359/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5360static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5361 const struct hda_fixup *fix, int action)
5362{
5363 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5364 hda_nid_t conn[2] = { 0x02, 0x03 };
5365 snd_hda_override_conn_list(codec, 0x17, 2, conn);
5366 }
5367}
5368
Keith Packard98973f22015-07-15 12:14:39 -07005369/* Hook to update amp GPIO4 for automute */
5370static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5371 struct hda_jack_callback *jack)
5372{
5373 struct alc_spec *spec = codec->spec;
5374
5375 snd_hda_gen_hp_automute(codec, jack);
5376 /* mute_led_polarity is set to 0, so we pass inverted value here */
5377 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
5378}
5379
5380/* Manage GPIOs for HP EliteBook Folio 9480m.
5381 *
5382 * GPIO4 is the headphone amplifier power control
5383 * GPIO3 is the audio output mute indicator LED
5384 */
5385
5386static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5387 const struct hda_fixup *fix,
5388 int action)
5389{
5390 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07005391
Takashi Iwai01e4a272018-06-19 22:47:30 +02005392 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07005393 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02005394 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5395 spec->gpio_mask |= 0x10;
5396 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07005397 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07005398 }
5399}
5400
Takashi Iwaiae065f12018-06-19 23:00:03 +02005401static void alc275_fixup_gpio4_off(struct hda_codec *codec,
5402 const struct hda_fixup *fix,
5403 int action)
5404{
5405 struct alc_spec *spec = codec->spec;
5406
5407 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5408 spec->gpio_mask |= 0x04;
5409 spec->gpio_dir |= 0x04;
5410 /* set data bit low */
5411 }
5412}
5413
Kailang Yangca169cc2017-04-25 16:17:40 +08005414static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5415 const struct hda_fixup *fix,
5416 int action)
5417{
5418 alc_fixup_dual_codecs(codec, fix, action);
5419 switch (action) {
5420 case HDA_FIXUP_ACT_PRE_PROBE:
5421 /* override card longname to provide a unique UCM profile */
5422 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5423 break;
5424 case HDA_FIXUP_ACT_BUILD:
5425 /* rename Capture controls depending on the codec */
5426 rename_ctl(codec, "Capture Volume",
5427 codec->addr == 0 ?
5428 "Rear-Panel Capture Volume" :
5429 "Front-Panel Capture Volume");
5430 rename_ctl(codec, "Capture Switch",
5431 codec->addr == 0 ?
5432 "Rear-Panel Capture Switch" :
5433 "Front-Panel Capture Switch");
5434 break;
5435 }
5436}
5437
Kailang Yang92266652017-12-14 15:28:58 +08005438/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5439static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5440 const struct hda_fixup *fix, int action)
5441{
5442 struct alc_spec *spec = codec->spec;
5443 static hda_nid_t preferred_pairs[] = {
5444 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5445 0
5446 };
5447
5448 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5449 return;
5450
5451 spec->gen.preferred_dacs = preferred_pairs;
5452}
5453
Hui Wangc4cfcf62018-11-26 14:17:16 +08005454/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
5455static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
5456 const struct hda_fixup *fix, int action)
5457{
5458 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5459 return;
5460
5461 snd_hda_override_wcaps(codec, 0x03, 0);
5462}
5463
Kailang Yange8547472018-11-28 15:32:45 +08005464static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
5465 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
5466 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
5467 { SND_JACK_BTN_2, KEY_VOLUMEUP },
5468 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
5469 {}
5470};
5471
5472static void alc_headset_btn_callback(struct hda_codec *codec,
5473 struct hda_jack_callback *jack)
5474{
5475 int report = 0;
5476
5477 if (jack->unsol_res & (7 << 13))
5478 report |= SND_JACK_BTN_0;
5479
5480 if (jack->unsol_res & (1 << 16 | 3 << 8))
5481 report |= SND_JACK_BTN_1;
5482
5483 /* Volume up key */
5484 if (jack->unsol_res & (7 << 23))
5485 report |= SND_JACK_BTN_2;
5486
5487 /* Volume down key */
5488 if (jack->unsol_res & (7 << 10))
5489 report |= SND_JACK_BTN_3;
5490
5491 jack->jack->button_state = report;
5492}
5493
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01005494static void alc295_fixup_chromebook(struct hda_codec *codec,
Kailang Yange8547472018-11-28 15:32:45 +08005495 const struct hda_fixup *fix, int action)
5496{
5497
5498 switch (action) {
5499 case HDA_FIXUP_ACT_PRE_PROBE:
5500 snd_hda_jack_detect_enable_callback(codec, 0x55,
5501 alc_headset_btn_callback);
5502 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
5503 SND_JACK_HEADSET, alc_headset_btn_keymap);
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01005504 switch (codec->core.vendor_id) {
5505 case 0x10ec0295:
5506 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
5507 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
5508 break;
5509 case 0x10ec0236:
5510 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
5511 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
5512 break;
5513 }
Kailang Yange8547472018-11-28 15:32:45 +08005514 break;
5515 case HDA_FIXUP_ACT_INIT:
5516 switch (codec->core.vendor_id) {
5517 case 0x10ec0225:
5518 case 0x10ec0295:
5519 case 0x10ec0299:
5520 alc_write_coef_idx(codec, 0x48, 0xd011);
5521 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
5522 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
5523 break;
5524 case 0x10ec0236:
5525 case 0x10ec0256:
5526 alc_write_coef_idx(codec, 0x48, 0xd011);
5527 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
5528 break;
5529 }
5530 break;
5531 }
5532}
5533
Kailang Yangd1dd4212019-01-09 17:05:24 +08005534static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
5535 const struct hda_fixup *fix, int action)
5536{
5537 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5538 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5539}
5540
Takashi Iwaib317b032014-01-08 11:44:21 +01005541/* for hda_fixup_thinkpad_acpi() */
5542#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01005543
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02005544static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5545 const struct hda_fixup *fix, int action)
5546{
5547 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5548 hda_fixup_thinkpad_acpi(codec, fix, action);
5549}
5550
Tom Bridenbbf8ff62018-05-29 17:34:20 +01005551/* for alc295_fixup_hp_top_speakers */
5552#include "hp_x360_helper.c"
5553
Takashi Iwai1d045db2011-07-07 18:23:21 +02005554enum {
5555 ALC269_FIXUP_SONY_VAIO,
5556 ALC275_FIXUP_SONY_VAIO_GPIO2,
5557 ALC269_FIXUP_DELL_M101Z,
5558 ALC269_FIXUP_SKU_IGNORE,
5559 ALC269_FIXUP_ASUS_G73JW,
5560 ALC269_FIXUP_LENOVO_EAPD,
5561 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02005562 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005563 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02005564 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005565 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02005566 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02005567 ALC269_FIXUP_QUANTA_MUTE,
5568 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02005569 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02005570 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02005571 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01005572 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02005573 ALC269_FIXUP_AMIC,
5574 ALC269_FIXUP_DMIC,
5575 ALC269VB_FIXUP_AMIC,
5576 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005577 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01005578 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005579 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00005580 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01005581 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08005582 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5583 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02005584 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02005585 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005586 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02005587 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02005588 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02005589 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5590 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02005591 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08005592 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02005593 ALC269_FIXUP_HEADSET_MODE,
5594 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02005595 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02005596 ALC269_FIXUP_ASUS_X101_FUNC,
5597 ALC269_FIXUP_ASUS_X101_VERB,
5598 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08005599 ALC271_FIXUP_AMIC_MIC2,
5600 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01005601 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07005602 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02005603 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01005604 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01005605 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01005606 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02005607 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02005608 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08005609 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005610 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02005611 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02005612 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01005613 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5614 ALC290_FIXUP_SUBWOOFER,
5615 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01005616 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01005617 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06005618 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06005619 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005620 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08005621 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005622 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08005623 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08005624 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02005625 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01005626 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02005627 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01005628 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02005629 ALC282_FIXUP_ASPIRE_V5_PINS,
David Henningsson7a5255f2014-10-30 08:26:01 +01005630 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08005631 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01005632 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01005633 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01005634 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07005635 ALC280_FIXUP_HP_9480M,
Kailang Yange1e62b92015-04-08 16:01:22 +08005636 ALC288_FIXUP_DELL_HEADSET_MODE,
5637 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08005638 ALC288_FIXUP_DELL_XPS_13,
5639 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02005640 ALC292_FIXUP_DELL_E7X,
5641 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01005642 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
Kailang Yang977e6272015-05-18 15:31:20 +08005643 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08005644 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08005645 ALC275_FIXUP_DELL_XPS,
Hui Wang8c697292015-11-24 11:08:18 +08005646 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
Hui Wang23adc192015-12-08 12:27:18 +08005647 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08005648 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08005649 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08005650 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01005651 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01005652 ALC295_FIXUP_DISABLE_DAC3,
Takashi Iwaif8839822016-02-25 14:31:59 +01005653 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08005654 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02005655 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08005656 ALC298_FIXUP_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08005657 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01005658 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08005659 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06005660 ALC256_FIXUP_ASUS_HEADSET_MODE,
5661 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06005662 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06005663 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
5664 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08005665 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08005666 ALC233_FIXUP_ACER_HEADSET_MIC,
Hui Wangf33f79f2017-07-07 12:08:29 +08005667 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08005668 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
PeiSen Houb84e8432017-09-01 15:11:56 +08005669 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08005670 ALC274_FIXUP_DELL_BIND_DACS,
5671 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005672 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08005673 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08005674 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05005675 ALC256_FIXUP_HUAWEI_MBXP_PINS,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01005676 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08005677 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08005678 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05005679 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08005680 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08005681 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08005682 ALC294_FIXUP_ASUS_HEADSET_MIC,
5683 ALC294_FIXUP_ASUS_SPK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07005684 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Hui Wangc8c6ee62019-02-14 11:41:33 +08005685 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08005686 ALC255_FIXUP_ACER_HEADSET_MIC,
Kailang Yang10f5b1b2019-02-21 16:10:22 +08005687 ALC295_FIXUP_CHROME_BOOK,
Kailang Yang136824e2019-03-14 16:22:45 +08005688 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
5689 ALC225_FIXUP_WYSE_AUTO_MUTE,
5690 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08005691 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
Jian-Hong Pane1037352019-03-22 11:37:18 +08005692 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01005693 ALC299_FIXUP_PREDATOR_SPK,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005694};
5695
Takashi Iwai1727a772013-01-10 09:52:52 +01005696static const struct hda_fixup alc269_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005697 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01005698 .type = HDA_FIXUP_PINCTLS,
5699 .v.pins = (const struct hda_pintbl[]) {
5700 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02005701 {}
5702 }
5703 },
5704 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02005705 .type = HDA_FIXUP_FUNC,
5706 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005707 .chained = true,
5708 .chain_id = ALC269_FIXUP_SONY_VAIO
5709 },
5710 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005711 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005712 .v.verbs = (const struct hda_verb[]) {
5713 /* Enables internal speaker */
5714 {0x20, AC_VERB_SET_COEF_INDEX, 13},
5715 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
5716 {}
5717 }
5718 },
5719 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005720 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02005721 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005722 },
5723 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005724 .type = HDA_FIXUP_PINS,
5725 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005726 { 0x17, 0x99130111 }, /* subwoofer */
5727 { }
5728 }
5729 },
5730 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005731 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005732 .v.verbs = (const struct hda_verb[]) {
5733 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5734 {}
5735 }
5736 },
5737 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005738 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005739 .v.func = alc269_fixup_hweq,
5740 .chained = true,
5741 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5742 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02005743 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5744 .type = HDA_FIXUP_FUNC,
5745 .v.func = alc_fixup_disable_aamix,
5746 .chained = true,
5747 .chain_id = ALC269_FIXUP_SONY_VAIO
5748 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02005749 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005750 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005751 .v.func = alc271_fixup_dmic,
5752 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02005753 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005754 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02005755 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02005756 .chained = true,
5757 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02005758 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005759 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005760 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005761 .v.func = alc269_fixup_stereo_dmic,
5762 },
David Henningsson7c478f02013-10-11 10:18:46 +02005763 [ALC269_FIXUP_HEADSET_MIC] = {
5764 .type = HDA_FIXUP_FUNC,
5765 .v.func = alc269_fixup_headset_mic,
5766 },
Takashi Iwai24519912011-08-16 15:08:49 +02005767 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005768 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02005769 .v.func = alc269_fixup_quanta_mute,
5770 },
5771 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005772 .type = HDA_FIXUP_PINS,
5773 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02005774 { 0x1a, 0x2101103f }, /* dock line-out */
5775 { 0x1b, 0x23a11040 }, /* dock mic-in */
5776 { }
5777 },
5778 .chained = true,
5779 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5780 },
David Henningsson2041d562014-06-13 11:15:44 +02005781 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5782 .type = HDA_FIXUP_PINS,
5783 .v.pins = (const struct hda_pintbl[]) {
5784 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5785 { }
5786 },
5787 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02005788 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5789 .type = HDA_FIXUP_PINS,
5790 .v.pins = (const struct hda_pintbl[]) {
5791 { 0x21, 0x0221102f }, /* HP out */
5792 { }
5793 },
5794 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02005795 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5796 .type = HDA_FIXUP_FUNC,
5797 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5798 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01005799 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5800 .type = HDA_FIXUP_FUNC,
5801 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5802 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02005803 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005804 .type = HDA_FIXUP_PINS,
5805 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005806 { 0x14, 0x99130110 }, /* speaker */
5807 { 0x15, 0x0121401f }, /* HP out */
5808 { 0x18, 0x01a19c20 }, /* mic */
5809 { 0x19, 0x99a3092f }, /* int-mic */
5810 { }
5811 },
5812 },
5813 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005814 .type = HDA_FIXUP_PINS,
5815 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005816 { 0x12, 0x99a3092f }, /* int-mic */
5817 { 0x14, 0x99130110 }, /* speaker */
5818 { 0x15, 0x0121401f }, /* HP out */
5819 { 0x18, 0x01a19c20 }, /* mic */
5820 { }
5821 },
5822 },
5823 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005824 .type = HDA_FIXUP_PINS,
5825 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005826 { 0x14, 0x99130110 }, /* speaker */
5827 { 0x18, 0x01a19c20 }, /* mic */
5828 { 0x19, 0x99a3092f }, /* int-mic */
5829 { 0x21, 0x0121401f }, /* HP out */
5830 { }
5831 },
5832 },
David Henningsson2267ea92012-01-03 08:45:56 +01005833 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005834 .type = HDA_FIXUP_PINS,
5835 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005836 { 0x12, 0x99a3092f }, /* int-mic */
5837 { 0x14, 0x99130110 }, /* speaker */
5838 { 0x18, 0x01a19c20 }, /* mic */
5839 { 0x21, 0x0121401f }, /* HP out */
5840 { }
5841 },
5842 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005843 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005844 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005845 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01005846 },
David Henningssond06ac142013-02-18 11:41:55 +01005847 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5848 .type = HDA_FIXUP_FUNC,
5849 .v.func = alc269_fixup_hp_mute_led_mic1,
5850 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005851 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005852 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005853 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01005854 },
Tom Briden7f783bd2017-03-25 10:12:01 +00005855 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
5856 .type = HDA_FIXUP_FUNC,
5857 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05005858 .chained = true,
5859 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00005860 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01005861 [ALC269_FIXUP_HP_GPIO_LED] = {
5862 .type = HDA_FIXUP_FUNC,
5863 .v.func = alc269_fixup_hp_gpio_led,
5864 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08005865 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5866 .type = HDA_FIXUP_FUNC,
5867 .v.func = alc269_fixup_hp_gpio_mic1_led,
5868 },
5869 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5870 .type = HDA_FIXUP_FUNC,
5871 .v.func = alc269_fixup_hp_line1_mic1_led,
5872 },
David Henningsson693b6132012-06-22 19:12:10 +02005873 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005874 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02005875 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02005876 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005877 [ALC269_FIXUP_NO_SHUTUP] = {
5878 .type = HDA_FIXUP_FUNC,
5879 .v.func = alc_fixup_no_shutup,
5880 },
David Henningsson108cc102012-07-20 10:37:25 +02005881 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005882 .type = HDA_FIXUP_PINS,
5883 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02005884 { 0x19, 0x23a11040 }, /* dock mic */
5885 { 0x1b, 0x2121103f }, /* dock headphone */
5886 { }
5887 },
5888 .chained = true,
5889 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5890 },
5891 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005892 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02005893 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01005894 .chained = true,
5895 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02005896 },
David Henningsson73bdd592013-04-15 15:44:14 +02005897 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5898 .type = HDA_FIXUP_PINS,
5899 .v.pins = (const struct hda_pintbl[]) {
5900 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5901 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5902 { }
5903 },
5904 .chained = true,
5905 .chain_id = ALC269_FIXUP_HEADSET_MODE
5906 },
5907 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5908 .type = HDA_FIXUP_PINS,
5909 .v.pins = (const struct hda_pintbl[]) {
5910 { 0x16, 0x21014020 }, /* dock line out */
5911 { 0x19, 0x21a19030 }, /* dock mic */
5912 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5913 { }
5914 },
5915 .chained = true,
5916 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5917 },
David Henningsson338cae52013-10-07 10:39:59 +02005918 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5919 .type = HDA_FIXUP_PINS,
5920 .v.pins = (const struct hda_pintbl[]) {
5921 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5922 { }
5923 },
5924 .chained = true,
5925 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5926 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08005927 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
5928 .type = HDA_FIXUP_PINS,
5929 .v.pins = (const struct hda_pintbl[]) {
5930 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5931 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5932 { }
5933 },
5934 .chained = true,
5935 .chain_id = ALC269_FIXUP_HEADSET_MODE
5936 },
David Henningsson73bdd592013-04-15 15:44:14 +02005937 [ALC269_FIXUP_HEADSET_MODE] = {
5938 .type = HDA_FIXUP_FUNC,
5939 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08005940 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01005941 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02005942 },
5943 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5944 .type = HDA_FIXUP_FUNC,
5945 .v.func = alc_fixup_headset_mode_no_hp_mic,
5946 },
Takashi Iwai78197172015-06-27 10:21:13 +02005947 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
5948 .type = HDA_FIXUP_PINS,
5949 .v.pins = (const struct hda_pintbl[]) {
5950 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
5951 { }
5952 },
5953 .chained = true,
5954 .chain_id = ALC269_FIXUP_HEADSET_MODE,
5955 },
David Henningsson88cfcf82013-10-11 10:18:45 +02005956 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
5957 .type = HDA_FIXUP_PINS,
5958 .v.pins = (const struct hda_pintbl[]) {
5959 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5960 { }
5961 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02005962 .chained = true,
5963 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02005964 },
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05005965 [ALC256_FIXUP_HUAWEI_MBXP_PINS] = {
5966 .type = HDA_FIXUP_PINS,
5967 .v.pins = (const struct hda_pintbl[]) {
5968 {0x12, 0x90a60130},
5969 {0x13, 0x40000000},
5970 {0x14, 0x90170110},
5971 {0x18, 0x411111f0},
5972 {0x19, 0x04a11040},
5973 {0x1a, 0x411111f0},
5974 {0x1b, 0x90170112},
5975 {0x1d, 0x40759a05},
5976 {0x1e, 0x411111f0},
5977 {0x21, 0x04211020},
5978 { }
5979 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05005980 .chained = true,
5981 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05005982 },
David Henningssond240d1d2013-04-15 12:50:02 +02005983 [ALC269_FIXUP_ASUS_X101_FUNC] = {
5984 .type = HDA_FIXUP_FUNC,
5985 .v.func = alc269_fixup_x101_headset_mic,
5986 },
5987 [ALC269_FIXUP_ASUS_X101_VERB] = {
5988 .type = HDA_FIXUP_VERBS,
5989 .v.verbs = (const struct hda_verb[]) {
5990 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5991 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
5992 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
5993 { }
5994 },
5995 .chained = true,
5996 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
5997 },
5998 [ALC269_FIXUP_ASUS_X101] = {
5999 .type = HDA_FIXUP_PINS,
6000 .v.pins = (const struct hda_pintbl[]) {
6001 { 0x18, 0x04a1182c }, /* Headset mic */
6002 { }
6003 },
6004 .chained = true,
6005 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
6006 },
Dylan Reid08a978d2012-11-18 22:56:40 -08006007 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006008 .type = HDA_FIXUP_PINS,
6009 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08006010 { 0x14, 0x99130110 }, /* speaker */
6011 { 0x19, 0x01a19c20 }, /* mic */
6012 { 0x1b, 0x99a7012f }, /* int-mic */
6013 { 0x21, 0x0121401f }, /* HP out */
6014 { }
6015 },
6016 },
6017 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01006018 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08006019 .v.func = alc271_hp_gate_mic_jack,
6020 .chained = true,
6021 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6022 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006023 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
6024 .type = HDA_FIXUP_FUNC,
6025 .v.func = alc269_fixup_limit_int_mic_boost,
6026 .chained = true,
6027 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
6028 },
Dylan Reid42397002013-04-05 14:58:22 -07006029 [ALC269_FIXUP_ACER_AC700] = {
6030 .type = HDA_FIXUP_PINS,
6031 .v.pins = (const struct hda_pintbl[]) {
6032 { 0x12, 0x99a3092f }, /* int-mic */
6033 { 0x14, 0x99130110 }, /* speaker */
6034 { 0x18, 0x03a11c20 }, /* mic */
6035 { 0x1e, 0x0346101e }, /* SPDIF1 */
6036 { 0x21, 0x0321101f }, /* HP out */
6037 { }
6038 },
6039 .chained = true,
6040 .chain_id = ALC271_FIXUP_DMIC,
6041 },
David Henningsson3e0d6112013-04-22 14:30:14 +02006042 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
6043 .type = HDA_FIXUP_FUNC,
6044 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01006045 .chained = true,
6046 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02006047 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01006048 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
6049 .type = HDA_FIXUP_FUNC,
6050 .v.func = alc269_fixup_limit_int_mic_boost,
6051 .chained = true,
6052 .chain_id = ALC269VB_FIXUP_DMIC,
6053 },
Takashi Iwai23870832013-11-29 14:13:12 +01006054 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
6055 .type = HDA_FIXUP_VERBS,
6056 .v.verbs = (const struct hda_verb[]) {
6057 /* class-D output amp +5dB */
6058 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
6059 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
6060 {}
6061 },
6062 .chained = true,
6063 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
6064 },
David Henningsson8e35cd42013-11-06 11:20:01 +01006065 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
6066 .type = HDA_FIXUP_FUNC,
6067 .v.func = alc269_fixup_limit_int_mic_boost,
6068 .chained = true,
6069 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
6070 },
Anisse Astier02b504d2013-06-03 11:53:10 +02006071 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
6072 .type = HDA_FIXUP_PINS,
6073 .v.pins = (const struct hda_pintbl[]) {
6074 { 0x12, 0x99a3092f }, /* int-mic */
6075 { 0x18, 0x03a11d20 }, /* mic */
6076 { 0x19, 0x411111f0 }, /* Unused bogus pin */
6077 { }
6078 },
6079 },
Kailang Yangcd217a62013-08-22 10:15:24 +02006080 [ALC283_FIXUP_CHROME_BOOK] = {
6081 .type = HDA_FIXUP_FUNC,
6082 .v.func = alc283_fixup_chromebook,
6083 },
Kailang Yang0202e992013-12-02 15:20:15 +08006084 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
6085 .type = HDA_FIXUP_FUNC,
6086 .v.func = alc283_fixup_sense_combo_jack,
6087 .chained = true,
6088 .chain_id = ALC283_FIXUP_CHROME_BOOK,
6089 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02006090 [ALC282_FIXUP_ASUS_TX300] = {
6091 .type = HDA_FIXUP_FUNC,
6092 .v.func = alc282_fixup_asus_tx300,
6093 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02006094 [ALC283_FIXUP_INT_MIC] = {
6095 .type = HDA_FIXUP_VERBS,
6096 .v.verbs = (const struct hda_verb[]) {
6097 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
6098 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
6099 { }
6100 },
6101 .chained = true,
6102 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6103 },
David Henningsson0f4881d2013-12-20 16:08:13 +01006104 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
6105 .type = HDA_FIXUP_PINS,
6106 .v.pins = (const struct hda_pintbl[]) {
6107 { 0x17, 0x90170112 }, /* subwoofer */
6108 { }
6109 },
6110 .chained = true,
6111 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6112 },
6113 [ALC290_FIXUP_SUBWOOFER] = {
6114 .type = HDA_FIXUP_PINS,
6115 .v.pins = (const struct hda_pintbl[]) {
6116 { 0x17, 0x90170112 }, /* subwoofer */
6117 { }
6118 },
6119 .chained = true,
6120 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
6121 },
David Henningsson338cae52013-10-07 10:39:59 +02006122 [ALC290_FIXUP_MONO_SPEAKERS] = {
6123 .type = HDA_FIXUP_FUNC,
6124 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01006125 },
6126 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
6127 .type = HDA_FIXUP_FUNC,
6128 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02006129 .chained = true,
6130 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
6131 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01006132 [ALC269_FIXUP_THINKPAD_ACPI] = {
6133 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006134 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02006135 .chained = true,
6136 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006137 },
David Henningsson56f27012016-01-11 09:33:14 +01006138 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
6139 .type = HDA_FIXUP_FUNC,
6140 .v.func = alc_fixup_inv_dmic,
6141 .chained = true,
6142 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
6143 },
Chris Chiu5824ce82017-02-28 14:17:11 -06006144 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
6145 .type = HDA_FIXUP_PINS,
6146 .v.pins = (const struct hda_pintbl[]) {
6147 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6148 { }
6149 },
6150 .chained = true,
6151 .chain_id = ALC255_FIXUP_HEADSET_MODE
6152 },
Chris Chiu615966a2017-02-28 14:17:12 -06006153 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6154 .type = HDA_FIXUP_PINS,
6155 .v.pins = (const struct hda_pintbl[]) {
6156 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6157 { }
6158 },
6159 .chained = true,
6160 .chain_id = ALC255_FIXUP_HEADSET_MODE
6161 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006162 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6163 .type = HDA_FIXUP_PINS,
6164 .v.pins = (const struct hda_pintbl[]) {
6165 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6166 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6167 { }
6168 },
6169 .chained = true,
6170 .chain_id = ALC255_FIXUP_HEADSET_MODE
6171 },
Kailang Yang31278992014-03-03 15:27:22 +08006172 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
6173 .type = HDA_FIXUP_PINS,
6174 .v.pins = (const struct hda_pintbl[]) {
6175 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6176 { }
6177 },
6178 .chained = true,
6179 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6180 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006181 [ALC255_FIXUP_HEADSET_MODE] = {
6182 .type = HDA_FIXUP_FUNC,
6183 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08006184 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006185 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006186 },
Kailang Yang31278992014-03-03 15:27:22 +08006187 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
6188 .type = HDA_FIXUP_FUNC,
6189 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
6190 },
Kailang Yanga22aa262014-04-23 17:34:28 +08006191 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6192 .type = HDA_FIXUP_PINS,
6193 .v.pins = (const struct hda_pintbl[]) {
6194 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6195 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6196 { }
6197 },
6198 .chained = true,
6199 .chain_id = ALC269_FIXUP_HEADSET_MODE
6200 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02006201 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02006202 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02006203 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006204 .chained = true,
6205 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6206 },
Takashi Iwai9a811232015-12-09 15:17:43 +01006207 [ALC292_FIXUP_TPT440] = {
6208 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01006209 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01006210 .chained = true,
6211 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6212 },
Anisse Astierabaa22742016-08-24 09:14:13 +02006213 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01006214 .type = HDA_FIXUP_PINS,
6215 .v.pins = (const struct hda_pintbl[]) {
6216 { 0x19, 0x04a110f0 },
6217 { },
6218 },
6219 },
Takashi Iwaib3802782018-11-26 17:47:46 +01006220 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08006221 .type = HDA_FIXUP_FUNC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006222 .v.func = snd_hda_gen_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08006223 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006224 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6225 .type = HDA_FIXUP_PINS,
6226 .v.pins = (const struct hda_pintbl[]) {
6227 { 0x12, 0x90a60130 },
6228 { 0x14, 0x90170110 },
6229 { 0x17, 0x40000008 },
6230 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02006231 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006232 { 0x1a, 0x411111f0 },
6233 { 0x1b, 0x411111f0 },
6234 { 0x1d, 0x40f89b2d },
6235 { 0x1e, 0x411111f0 },
6236 { 0x21, 0x0321101f },
6237 { },
6238 },
6239 },
David Henningsson7a5255f2014-10-30 08:26:01 +01006240 [ALC280_FIXUP_HP_GPIO4] = {
6241 .type = HDA_FIXUP_FUNC,
6242 .v.func = alc280_fixup_hp_gpio4,
6243 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006244 [ALC286_FIXUP_HP_GPIO_LED] = {
6245 .type = HDA_FIXUP_FUNC,
6246 .v.func = alc286_fixup_hp_gpio_led,
6247 },
David Henningsson33f4acd2015-01-07 15:50:13 +01006248 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6249 .type = HDA_FIXUP_FUNC,
6250 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6251 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01006252 [ALC280_FIXUP_HP_DOCK_PINS] = {
6253 .type = HDA_FIXUP_PINS,
6254 .v.pins = (const struct hda_pintbl[]) {
6255 { 0x1b, 0x21011020 }, /* line-out */
6256 { 0x1a, 0x01a1903c }, /* headset mic */
6257 { 0x18, 0x2181103f }, /* line-in */
6258 { },
6259 },
6260 .chained = true,
6261 .chain_id = ALC280_FIXUP_HP_GPIO4
6262 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006263 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6264 .type = HDA_FIXUP_PINS,
6265 .v.pins = (const struct hda_pintbl[]) {
6266 { 0x1b, 0x21011020 }, /* line-out */
6267 { 0x18, 0x2181103f }, /* line-in */
6268 { },
6269 },
6270 .chained = true,
6271 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6272 },
Keith Packard98973f22015-07-15 12:14:39 -07006273 [ALC280_FIXUP_HP_9480M] = {
6274 .type = HDA_FIXUP_FUNC,
6275 .v.func = alc280_fixup_hp_9480m,
6276 },
Kailang Yange1e62b92015-04-08 16:01:22 +08006277 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6278 .type = HDA_FIXUP_FUNC,
6279 .v.func = alc_fixup_headset_mode_dell_alc288,
6280 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01006281 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08006282 },
6283 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6284 .type = HDA_FIXUP_PINS,
6285 .v.pins = (const struct hda_pintbl[]) {
6286 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6287 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6288 { }
6289 },
6290 .chained = true,
6291 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6292 },
Hui Wang831bfdf92015-06-26 12:35:17 +08006293 [ALC288_FIXUP_DISABLE_AAMIX] = {
6294 .type = HDA_FIXUP_FUNC,
6295 .v.func = alc_fixup_disable_aamix,
6296 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02006297 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08006298 },
6299 [ALC288_FIXUP_DELL_XPS_13] = {
6300 .type = HDA_FIXUP_FUNC,
6301 .v.func = alc_fixup_dell_xps13,
6302 .chained = true,
6303 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6304 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006305 [ALC292_FIXUP_DISABLE_AAMIX] = {
6306 .type = HDA_FIXUP_FUNC,
6307 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08006308 .chained = true,
6309 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006310 },
David Henningssonc04017e2015-12-15 14:44:03 +01006311 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6312 .type = HDA_FIXUP_FUNC,
6313 .v.func = alc_fixup_disable_aamix,
6314 .chained = true,
6315 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6316 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006317 [ALC292_FIXUP_DELL_E7X] = {
6318 .type = HDA_FIXUP_FUNC,
6319 .v.func = alc_fixup_dell_xps13,
6320 .chained = true,
6321 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6322 },
Kailang Yang977e6272015-05-18 15:31:20 +08006323 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6324 .type = HDA_FIXUP_PINS,
6325 .v.pins = (const struct hda_pintbl[]) {
6326 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6327 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6328 { }
6329 },
6330 .chained = true,
6331 .chain_id = ALC269_FIXUP_HEADSET_MODE
6332 },
Hui Wang2f726ae2017-03-31 10:31:40 +08006333 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6334 .type = HDA_FIXUP_PINS,
6335 .v.pins = (const struct hda_pintbl[]) {
6336 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6337 { }
6338 },
6339 .chained = true,
6340 .chain_id = ALC269_FIXUP_HEADSET_MODE
6341 },
Kailang Yang6ed11312015-10-26 15:37:39 +08006342 [ALC275_FIXUP_DELL_XPS] = {
6343 .type = HDA_FIXUP_VERBS,
6344 .v.verbs = (const struct hda_verb[]) {
6345 /* Enables internal speaker */
6346 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6347 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6348 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6349 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6350 {}
6351 }
6352 },
Hui Wang8c697292015-11-24 11:08:18 +08006353 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
6354 .type = HDA_FIXUP_VERBS,
6355 .v.verbs = (const struct hda_verb[]) {
6356 /* Disable pass-through path for FRONT 14h */
6357 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
6358 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
6359 {}
6360 },
6361 .chained = true,
6362 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6363 },
Hui Wang23adc192015-12-08 12:27:18 +08006364 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6365 .type = HDA_FIXUP_FUNC,
6366 .v.func = alc_fixup_disable_aamix,
6367 .chained = true,
6368 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6369 },
Kailang3694cb22015-12-28 11:35:24 +08006370 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6371 .type = HDA_FIXUP_FUNC,
6372 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6373 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006374 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6375 .type = HDA_FIXUP_FUNC,
6376 .v.func = alc_fixup_disable_aamix,
6377 .chained = true,
6378 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6379 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08006380 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
6381 .type = HDA_FIXUP_FUNC,
6382 .v.func = alc_fixup_disable_mic_vref,
6383 .chained = true,
6384 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6385 },
David Henningsson2ae95572016-02-25 09:37:05 +01006386 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6387 .type = HDA_FIXUP_VERBS,
6388 .v.verbs = (const struct hda_verb[]) {
6389 /* Disable pass-through path for FRONT 14h */
6390 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6391 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6392 {}
6393 },
6394 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006395 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01006396 },
Takashi Iwaif8839822016-02-25 14:31:59 +01006397 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6398 .type = HDA_FIXUP_FUNC,
6399 .v.func = alc_fixup_disable_aamix,
6400 .chained = true,
6401 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6402 },
Hui Wange549d192016-04-01 11:00:15 +08006403 [ALC221_FIXUP_HP_FRONT_MIC] = {
6404 .type = HDA_FIXUP_PINS,
6405 .v.pins = (const struct hda_pintbl[]) {
6406 { 0x19, 0x02a19020 }, /* Front Mic */
6407 { }
6408 },
6409 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02006410 [ALC292_FIXUP_TPT460] = {
6411 .type = HDA_FIXUP_FUNC,
6412 .v.func = alc_fixup_tpt440_dock,
6413 .chained = true,
6414 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6415 },
Hui Wangdd9aa332016-08-01 10:20:32 +08006416 [ALC298_FIXUP_SPK_VOLUME] = {
6417 .type = HDA_FIXUP_FUNC,
6418 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08006419 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08006420 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08006421 },
Takashi Iwaie312a862018-03-06 12:14:17 +01006422 [ALC295_FIXUP_DISABLE_DAC3] = {
6423 .type = HDA_FIXUP_FUNC,
6424 .v.func = alc295_fixup_disable_dac3,
6425 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006426 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6427 .type = HDA_FIXUP_PINS,
6428 .v.pins = (const struct hda_pintbl[]) {
6429 { 0x1b, 0x90170151 },
6430 { }
6431 },
6432 .chained = true,
6433 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6434 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006435 [ALC269_FIXUP_ATIV_BOOK_8] = {
6436 .type = HDA_FIXUP_FUNC,
6437 .v.func = alc_fixup_auto_mute_via_amp,
6438 .chained = true,
6439 .chain_id = ALC269_FIXUP_NO_SHUTUP
6440 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006441 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6442 .type = HDA_FIXUP_PINS,
6443 .v.pins = (const struct hda_pintbl[]) {
6444 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6445 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6446 { }
6447 },
6448 .chained = true,
6449 .chain_id = ALC269_FIXUP_HEADSET_MODE
6450 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06006451 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6452 .type = HDA_FIXUP_FUNC,
6453 .v.func = alc_fixup_headset_mode,
6454 },
6455 [ALC256_FIXUP_ASUS_MIC] = {
6456 .type = HDA_FIXUP_PINS,
6457 .v.pins = (const struct hda_pintbl[]) {
6458 { 0x13, 0x90a60160 }, /* use as internal mic */
6459 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6460 { }
6461 },
6462 .chained = true,
6463 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6464 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06006465 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02006466 .type = HDA_FIXUP_FUNC,
6467 /* Set up GPIO2 for the speaker amp */
6468 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006469 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06006470 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6471 .type = HDA_FIXUP_PINS,
6472 .v.pins = (const struct hda_pintbl[]) {
6473 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6474 { }
6475 },
6476 .chained = true,
6477 .chain_id = ALC269_FIXUP_HEADSET_MIC
6478 },
6479 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6480 .type = HDA_FIXUP_VERBS,
6481 .v.verbs = (const struct hda_verb[]) {
6482 /* Enables internal speaker */
6483 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6484 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6485 {}
6486 },
6487 .chained = true,
6488 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6489 },
Kailang Yangca169cc2017-04-25 16:17:40 +08006490 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6491 .type = HDA_FIXUP_FUNC,
6492 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6493 },
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08006494 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
6495 .type = HDA_FIXUP_VERBS,
6496 .v.verbs = (const struct hda_verb[]) {
6497 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
6498 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
6499 { }
6500 },
6501 .chained = true,
6502 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6503 },
Hui Wangf33f79f2017-07-07 12:08:29 +08006504 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6505 .type = HDA_FIXUP_PINS,
6506 .v.pins = (const struct hda_pintbl[]) {
6507 /* Change the mic location from front to right, otherwise there are
6508 two front mics with the same name, pulseaudio can't handle them.
6509 This is just a temporary workaround, after applying this fixup,
6510 there will be one "Front Mic" and one "Mic" in this machine.
6511 */
6512 { 0x1a, 0x04a19040 },
6513 { }
6514 },
6515 },
Kailang Yang5f364132017-07-25 16:28:16 +08006516 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6517 .type = HDA_FIXUP_PINS,
6518 .v.pins = (const struct hda_pintbl[]) {
6519 { 0x16, 0x0101102f }, /* Rear Headset HP */
6520 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6521 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6522 { 0x1b, 0x02011020 },
6523 { }
6524 },
6525 .chained = true,
6526 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6527 },
PeiSen Houb84e8432017-09-01 15:11:56 +08006528 [ALC700_FIXUP_INTEL_REFERENCE] = {
6529 .type = HDA_FIXUP_VERBS,
6530 .v.verbs = (const struct hda_verb[]) {
6531 /* Enables internal speaker */
6532 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6533 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6534 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6535 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6536 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6537 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6538 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6539 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6540 {}
6541 }
6542 },
Kailang Yang92266652017-12-14 15:28:58 +08006543 [ALC274_FIXUP_DELL_BIND_DACS] = {
6544 .type = HDA_FIXUP_FUNC,
6545 .v.func = alc274_fixup_bind_dacs,
6546 .chained = true,
6547 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6548 },
6549 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6550 .type = HDA_FIXUP_PINS,
6551 .v.pins = (const struct hda_pintbl[]) {
6552 { 0x1b, 0x0401102f },
6553 { }
6554 },
6555 .chained = true,
6556 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6557 },
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006558 [ALC298_FIXUP_TPT470_DOCK] = {
6559 .type = HDA_FIXUP_FUNC,
6560 .v.func = alc_fixup_tpt470_dock,
6561 .chained = true,
6562 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6563 },
Kailang Yangae104a22018-02-05 16:07:20 +08006564 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6565 .type = HDA_FIXUP_PINS,
6566 .v.pins = (const struct hda_pintbl[]) {
6567 { 0x14, 0x0201101f },
6568 { }
6569 },
6570 .chained = true,
6571 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6572 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006573 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
6574 .type = HDA_FIXUP_PINS,
6575 .v.pins = (const struct hda_pintbl[]) {
6576 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6577 { }
6578 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08006579 .chained = true,
6580 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006581 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006582 [ALC295_FIXUP_HP_X360] = {
6583 .type = HDA_FIXUP_FUNC,
6584 .v.func = alc295_fixup_hp_top_speakers,
6585 .chained = true,
6586 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08006587 },
6588 [ALC221_FIXUP_HP_HEADSET_MIC] = {
6589 .type = HDA_FIXUP_PINS,
6590 .v.pins = (const struct hda_pintbl[]) {
6591 { 0x19, 0x0181313f},
6592 { }
6593 },
6594 .chained = true,
6595 .chain_id = ALC269_FIXUP_HEADSET_MIC
6596 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08006597 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
6598 .type = HDA_FIXUP_FUNC,
6599 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08006600 .chained = true,
6601 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08006602 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006603 [ALC295_FIXUP_HP_AUTO_MUTE] = {
6604 .type = HDA_FIXUP_FUNC,
6605 .v.func = alc_fixup_auto_mute_via_amp,
6606 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08006607 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
6608 .type = HDA_FIXUP_PINS,
6609 .v.pins = (const struct hda_pintbl[]) {
6610 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6611 { }
6612 },
6613 .chained = true,
6614 .chain_id = ALC269_FIXUP_HEADSET_MIC
6615 },
Chris Chiud8ae4582018-12-07 17:17:11 +08006616 [ALC294_FIXUP_ASUS_MIC] = {
6617 .type = HDA_FIXUP_PINS,
6618 .v.pins = (const struct hda_pintbl[]) {
6619 { 0x13, 0x90a60160 }, /* use as internal mic */
6620 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6621 { }
6622 },
6623 .chained = true,
6624 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6625 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006626 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
6627 .type = HDA_FIXUP_PINS,
6628 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08006629 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006630 { }
6631 },
6632 .chained = true,
6633 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6634 },
6635 [ALC294_FIXUP_ASUS_SPK] = {
6636 .type = HDA_FIXUP_VERBS,
6637 .v.verbs = (const struct hda_verb[]) {
6638 /* Set EAPD high */
6639 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
6640 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
6641 { }
6642 },
6643 .chained = true,
6644 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
6645 },
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01006646 [ALC295_FIXUP_CHROME_BOOK] = {
Kailang Yange8547472018-11-28 15:32:45 +08006647 .type = HDA_FIXUP_FUNC,
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01006648 .v.func = alc295_fixup_chromebook,
Kailang Yange8547472018-11-28 15:32:45 +08006649 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07006650 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
6651 .type = HDA_FIXUP_PINS,
6652 .v.pins = (const struct hda_pintbl[]) {
6653 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6654 { }
6655 },
6656 .chained = true,
6657 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6658 },
Hui Wangc8c6ee62019-02-14 11:41:33 +08006659 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
6660 .type = HDA_FIXUP_VERBS,
6661 .v.verbs = (const struct hda_verb[]) {
6662 /* Disable PCBEEP-IN passthrough */
6663 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6664 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6665 { }
6666 },
6667 .chained = true,
6668 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
6669 },
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08006670 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
6671 .type = HDA_FIXUP_PINS,
6672 .v.pins = (const struct hda_pintbl[]) {
6673 { 0x19, 0x03a11130 },
6674 { 0x1a, 0x90a60140 }, /* use as internal mic */
6675 { }
6676 },
6677 .chained = true,
6678 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
6679 },
Kailang Yang136824e2019-03-14 16:22:45 +08006680 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
6681 .type = HDA_FIXUP_PINS,
6682 .v.pins = (const struct hda_pintbl[]) {
6683 { 0x16, 0x01011020 }, /* Rear Line out */
6684 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
6685 { }
6686 },
6687 .chained = true,
6688 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
6689 },
6690 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
6691 .type = HDA_FIXUP_FUNC,
6692 .v.func = alc_fixup_auto_mute_via_amp,
6693 .chained = true,
6694 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
6695 },
6696 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
6697 .type = HDA_FIXUP_FUNC,
6698 .v.func = alc_fixup_disable_mic_vref,
6699 .chained = true,
6700 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6701 },
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08006702 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
6703 .type = HDA_FIXUP_VERBS,
6704 .v.verbs = (const struct hda_verb[]) {
6705 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
6706 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
6707 { }
6708 },
6709 .chained = true,
6710 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
6711 },
Jian-Hong Pane1037352019-03-22 11:37:18 +08006712 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6713 .type = HDA_FIXUP_PINS,
6714 .v.pins = (const struct hda_pintbl[]) {
6715 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6716 { }
6717 },
6718 .chained = true,
6719 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6720 },
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01006721 [ALC299_FIXUP_PREDATOR_SPK] = {
6722 .type = HDA_FIXUP_PINS,
6723 .v.pins = (const struct hda_pintbl[]) {
6724 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
6725 { }
6726 }
6727 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02006728};
6729
6730static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01006731 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02006732 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6733 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02006734 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02006735 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6736 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02006737 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6738 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05006739 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006740 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02006741 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Chris Chiu705b65f2018-12-05 14:48:54 +08006742 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01006743 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiuc7531e32019-03-21 17:17:31 +08006744 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
6745 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01006746 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08006747 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6748 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
6749 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Pan2733cce2019-03-21 16:39:04 +08006750 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08006751 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08006752 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02006753 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08006754 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01006755 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01006756 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006757 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
6758 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01006759 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02006760 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6761 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6762 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01006763 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6764 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01006765 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02006766 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01006767 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08006768 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6769 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08006770 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02006771 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02006772 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08006773 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08006774 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6775 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01006776 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6777 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6778 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6779 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6780 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Feng423cd782016-05-20 15:47:23 +08006781 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006782 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006783 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01006784 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
Kai-Heng Feng423cd782016-05-20 15:47:23 +08006785 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08006786 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08006787 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwaie312a862018-03-06 12:14:17 +01006788 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Takashi Iwai493de342017-02-28 17:27:57 +01006789 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kailang Yang5f364132017-07-25 16:28:16 +08006790 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Takashi Iwaie4c9fd12018-01-10 08:34:28 +01006791 SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08006792 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6793 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006794 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6795 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08006796 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yang136824e2019-03-14 16:22:45 +08006797 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
Kailang Yangda484d02019-03-14 15:50:59 +08006798 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08006799 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yanga22aa262014-04-23 17:34:28 +08006800 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6801 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006802 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006803 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01006804 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
David Henningsson33f4acd2015-01-07 15:50:13 +01006805 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08006806 /* ALC282 */
Hui Wang7976eb42015-02-13 11:14:41 +08006807 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006808 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006809 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006810 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6811 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6812 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6813 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006814 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006815 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006816 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6817 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006818 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006819 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
TienFu Chenb4b33f92015-01-20 15:06:21 +01006820 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
TienFu Chen3271cb22015-02-10 09:09:41 +01006821 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yangc60666b2014-02-21 16:23:35 +08006822 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006823 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6824 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6825 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006826 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Keith Packard98973f22015-07-15 12:14:39 -07006827 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006828 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6829 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006830 /* ALC290 */
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006831 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006832 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006833 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006834 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6835 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6836 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6837 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6838 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006839 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006840 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006841 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006842 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6843 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6844 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006845 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6846 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006847 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006848 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006849 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006850 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006851 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6852 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006853 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6854 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006855 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006856 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6857 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6858 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6859 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwaif8839822016-02-25 14:31:59 +01006860 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01006861 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6862 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Takashi Iwai563785e2018-11-12 09:43:12 +01006863 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08006864 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006865 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01006866 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6867 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05006868 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006869 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02006870 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02006871 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01006872 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006873 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006874 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02006875 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006876 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6877 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6878 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006879 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
6880 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
6881 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01006882 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01006883 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02006884 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai017f2a12011-07-09 14:42:25 +02006885 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06006886 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
David Henningsson693b6132012-06-22 19:12:10 +02006887 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06006888 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006889 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006890 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Chris Chiueeed4cd2017-02-28 14:17:15 -06006891 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006892 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
6893 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
6894 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6895 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02006896 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwaif88abaa2014-02-07 12:07:59 +01006897 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
David Henningsson88cfcf82013-10-11 10:18:45 +02006898 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006899 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
6900 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6901 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006902 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwai24519912011-08-16 15:08:49 +02006903 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006904 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006905 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Takashi Iwai88776f32015-05-01 09:20:34 +02006906 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006907 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
David Henningsson2041d562014-06-13 11:15:44 +02006908 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08006909 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09006910 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02006911 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006912 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Anisse Astierabaa22742016-08-24 09:14:13 +02006913 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
6914 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01006915 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
Jeremy Soller89e3a562019-01-30 16:12:31 -07006916 SND_PCI_QUIRK(0x1558, 0x1325, "System76 Darter Pro (darp5)", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Kailang Yangca169cc2017-04-25 16:17:40 +08006917 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006918 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
6919 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
6920 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
6921 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
6922 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwai707fba32012-08-02 09:04:39 +02006923 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
Felix Kaechelec8415a42012-08-06 23:02:01 +02006924 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Stefán Freyr84f98fd2012-10-19 22:46:00 +02006925 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02006926 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02006927 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02006928 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01006929 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02006930 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02006931 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05006932 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02006933 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01006934 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02006935 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01006936 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07006937 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02006938 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006939 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6940 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02006941 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02006942 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006943 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
6944 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6945 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01006946 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006947 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6948 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6949 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01006950 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang3694cb22015-12-28 11:35:24 +08006951 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08006952 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08006953 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08006954 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08006955 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08006956 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
David Henningsson56f27012016-01-11 09:33:14 +01006957 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01006958 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006959 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
David Henningssona4a9e082013-08-16 14:09:01 +02006960 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02006961 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02006962 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02006963 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02006964 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01006965 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02006966 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02006967 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08006968 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02006969 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02006970 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02006971 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006972 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6973 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6974 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02006975 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006976 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6977 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningsson012e7eb2012-08-08 08:43:37 +02006978 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006979 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Ayman Bagabase2744fd2018-12-12 18:07:59 -05006980 SND_PCI_QUIRK(0x19e5, 0x3200, "Huawei MBX", ALC255_FIXUP_MIC_MUTE_LED),
6981 SND_PCI_QUIRK(0x19e5, 0x3201, "Huawei MBX", ALC255_FIXUP_MIC_MUTE_LED),
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05006982 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MBXP", ALC256_FIXUP_HUAWEI_MBXP_PINS),
Anisse Astier02b504d2013-06-03 11:53:10 +02006983 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02006984
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01006985#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02006986 /* Below is a quirk table taken from the old code.
6987 * Basically the device should work as is without the fixup table.
6988 * If BIOS doesn't give a proper info, enable the corresponding
6989 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02006990 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02006991 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
6992 ALC269_FIXUP_AMIC),
6993 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02006994 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
6995 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
6996 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
6997 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
6998 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
6999 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
7000 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
7001 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
7002 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
7003 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
7004 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
7005 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
7006 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
7007 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
7008 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
7009 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
7010 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
7011 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
7012 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
7013 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
7014 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
7015 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
7016 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
7017 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
7018 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
7019 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
7020 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
7021 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
7022 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
7023 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
7024 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
7025 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
7026 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
7027 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
7028 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
7029 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
7030 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
7031 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
7032#endif
7033 {}
7034};
7035
David Henningsson214eef72014-07-22 14:09:35 +02007036static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
7037 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
7038 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
7039 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
7040 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
7041 {}
7042};
7043
Takashi Iwai1727a772013-01-10 09:52:52 +01007044static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02007045 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
7046 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02007047 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
7048 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
7049 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02007050 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02007051 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
7052 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02007053 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01007054 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01007055 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02007056 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
7057 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02007058 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
7059 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08007060 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08007061 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02007062 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01007063 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02007064 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02007065 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02007066 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02007067 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02007068 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
7069 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
7070 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
7071 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
7072 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
7073 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
7074 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
7075 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
7076 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
7077 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
7078 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
7079 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
7080 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
7081 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
7082 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
7083 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
7084 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
7085 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
7086 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
7087 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
7088 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
7089 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
7090 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
7091 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
7092 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
7093 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
7094 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
7095 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
7096 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
7097 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
7098 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
7099 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
7100 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
7101 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
7102 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
7103 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
7104 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
7105 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
7106 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
7107 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01007108 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02007109 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
7110 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
7111 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
7112 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
7113 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
7114 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
7115 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
7116 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
7117 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
7118 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
7119 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
7120 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
7121 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
7122 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
7123 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
7124 {.id = ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE, .name = "alc256-dell-xps13"},
7125 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
7126 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
7127 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08007128 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02007129 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
7130 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
7131 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
7132 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
7133 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
7134 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
7135 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
7136 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
7137 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
7138 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
7139 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
7140 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
7141 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
7142 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
7143 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
7144 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
7145 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
7146 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yang10f5b1b2019-02-21 16:10:22 +08007147 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-sense-combo"},
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01007148 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02007149 {}
7150};
Kailang Yangcfc5a842016-02-03 15:20:39 +08007151#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08007152 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02007153
Hui Wange8191a82015-04-24 13:39:59 +08007154#define ALC256_STANDARD_PINS \
7155 {0x12, 0x90a60140}, \
7156 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08007157 {0x21, 0x02211020}
7158
David Henningssonfea185e2014-09-03 10:23:04 +02007159#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08007160 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08007161
David Henningssonfea185e2014-09-03 10:23:04 +02007162#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08007163 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02007164
7165#define ALC292_STANDARD_PINS \
7166 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08007167 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08007168
Hui Wang3f6409702016-09-11 11:26:16 +08007169#define ALC295_STANDARD_PINS \
7170 {0x12, 0xb7a60130}, \
7171 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08007172 {0x21, 0x04211020}
7173
Woodrow Shen703867e2015-08-05 12:34:12 +08007174#define ALC298_STANDARD_PINS \
7175 {0x12, 0x90a60130}, \
7176 {0x21, 0x03211020}
7177
Hui Wange1918932014-05-26 16:22:44 +08007178static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08007179 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
7180 {0x14, 0x01014020},
7181 {0x17, 0x90170110},
7182 {0x18, 0x02a11030},
7183 {0x19, 0x0181303F},
7184 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06007185 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
7186 {0x12, 0x90a601c0},
7187 {0x14, 0x90171120},
7188 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06007189 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7190 {0x14, 0x90170110},
7191 {0x1b, 0x90a70130},
7192 {0x21, 0x03211020}),
7193 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
7194 {0x1a, 0x90a70130},
7195 {0x1b, 0x90170110},
7196 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01007197 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08007198 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08007199 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08007200 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01007201 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08007202 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08007203 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08007204 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08007205 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7206 ALC225_STANDARD_PINS,
7207 {0x12, 0xb7a60150},
7208 {0x14, 0x901701a0}),
7209 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7210 ALC225_STANDARD_PINS,
7211 {0x12, 0xb7a60150},
7212 {0x14, 0x901701b0}),
7213 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
7214 ALC225_STANDARD_PINS,
7215 {0x12, 0xb7a60130},
7216 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05007217 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7218 {0x1b, 0x01111010},
7219 {0x1e, 0x01451130},
7220 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08007221 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
7222 {0x12, 0x90a60140},
7223 {0x14, 0x90170110},
7224 {0x19, 0x02a11030},
7225 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08007226 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7227 {0x14, 0x90170110},
7228 {0x19, 0x02a11030},
7229 {0x1a, 0x02a11040},
7230 {0x1b, 0x01014020},
7231 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08007232 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7233 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08007234 {0x19, 0x02a11030},
7235 {0x1a, 0x02a11040},
7236 {0x1b, 0x01011020},
7237 {0x21, 0x0221101f}),
7238 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
7239 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08007240 {0x19, 0x02a11020},
7241 {0x1a, 0x02a11030},
7242 {0x21, 0x0221101f}),
Hui Wangf2657882017-10-24 16:53:34 +08007243 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7244 {0x12, 0x90a60140},
7245 {0x14, 0x90170110},
7246 {0x21, 0x02211020}),
7247 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7248 {0x12, 0x90a60140},
7249 {0x14, 0x90170150},
7250 {0x21, 0x02211020}),
Hui Wangc77900e2014-09-03 11:31:07 +08007251 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08007252 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08007253 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02007254 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08007255 {0x14, 0x90170130},
7256 {0x21, 0x02211040}),
7257 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02007258 {0x12, 0x90a60140},
7259 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02007260 {0x21, 0x02211020}),
7261 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7262 {0x12, 0x90a60160},
7263 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02007264 {0x21, 0x02211030}),
7265 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08007266 {0x14, 0x90170110},
7267 {0x1b, 0x02011020},
7268 {0x21, 0x0221101f}),
7269 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08007270 {0x14, 0x90170110},
7271 {0x1b, 0x01011020},
7272 {0x21, 0x0221101f}),
7273 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02007274 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02007275 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02007276 {0x21, 0x0221103f}),
7277 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08007278 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08007279 {0x1b, 0x01011020},
7280 {0x21, 0x0221103f}),
7281 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7282 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08007283 {0x1b, 0x02011020},
7284 {0x21, 0x0221103f}),
7285 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08007286 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08007287 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08007288 {0x21, 0x0221105f}),
7289 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08007290 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08007291 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08007292 {0x21, 0x0221101f}),
7293 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02007294 {0x12, 0x90a60160},
7295 {0x14, 0x90170120},
7296 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02007297 {0x21, 0x0321102f}),
7298 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7299 {0x12, 0x90a60160},
7300 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02007301 {0x21, 0x02211040}),
7302 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7303 {0x12, 0x90a60160},
7304 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02007305 {0x21, 0x02211050}),
7306 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7307 {0x12, 0x90a60170},
7308 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02007309 {0x21, 0x02211030}),
7310 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7311 {0x12, 0x90a60170},
7312 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02007313 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08007314 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08007315 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08007316 {0x14, 0x90171130},
7317 {0x21, 0x02211040}),
7318 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7319 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08007320 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08007321 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02007322 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02007323 {0x12, 0x90a60180},
7324 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02007325 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08007326 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7327 {0x12, 0x90a60180},
7328 {0x14, 0x90170120},
7329 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08007330 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7331 {0x1b, 0x01011020},
7332 {0x21, 0x02211010}),
Kailang Yang7081adf2015-03-30 17:05:37 +08007333 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang285d5dd2017-12-22 11:17:45 +08007334 {0x12, 0x90a60130},
7335 {0x14, 0x90170110},
7336 {0x1b, 0x01011020},
7337 {0x21, 0x0221101f}),
7338 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang81a12312015-05-28 16:48:22 +08007339 {0x12, 0x90a60160},
7340 {0x14, 0x90170120},
Kailang Yang81a12312015-05-28 16:48:22 +08007341 {0x21, 0x02211030}),
7342 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shenf83c3292016-06-24 15:58:34 +08007343 {0x12, 0x90a60170},
7344 {0x14, 0x90170120},
7345 {0x21, 0x02211030}),
Shrirang Bagul311042d2016-08-29 15:19:27 +08007346 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
7347 {0x12, 0x90a60180},
7348 {0x14, 0x90170120},
7349 {0x21, 0x02211030}),
Woodrow Shenf83c3292016-06-24 15:58:34 +08007350 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang3f6409702016-09-11 11:26:16 +08007351 {0x12, 0xb7a60130},
7352 {0x14, 0x90170110},
7353 {0x21, 0x02211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01007354 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang3f2f7c52018-01-29 14:23:15 +08007355 {0x12, 0x90a60130},
7356 {0x14, 0x90170110},
7357 {0x14, 0x01011020},
7358 {0x21, 0x0221101f}),
7359 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncf51eb92014-10-30 08:26:02 +01007360 ALC256_STANDARD_PINS),
Chris Chiuc1732ed2017-02-28 14:17:13 -06007361 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7362 {0x14, 0x90170110},
7363 {0x1b, 0x90a70130},
7364 {0x21, 0x04211020}),
7365 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
7366 {0x14, 0x90170110},
7367 {0x1b, 0x90a70130},
7368 {0x21, 0x03211020}),
Jian-Hong Pane1037352019-03-22 11:37:18 +08007369 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiua806ef12019-03-22 11:37:20 +08007370 {0x12, 0x90a60130},
7371 {0x14, 0x90170110},
7372 {0x21, 0x03211020}),
7373 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan6ac371a2019-03-22 11:37:22 +08007374 {0x12, 0x90a60130},
7375 {0x14, 0x90170110},
7376 {0x21, 0x04211020}),
7377 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pane1037352019-03-22 11:37:18 +08007378 {0x1a, 0x90a70130},
7379 {0x1b, 0x90170110},
7380 {0x21, 0x03211020}),
Kailang Yang92266652017-12-14 15:28:58 +08007381 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Hui Wang75ee94b2017-11-09 08:48:08 +08007382 {0x12, 0xb7a60130},
7383 {0x13, 0xb8a61140},
7384 {0x16, 0x90170110},
7385 {0x21, 0x04211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01007386 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
7387 {0x12, 0x90a60130},
7388 {0x14, 0x90170110},
7389 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08007390 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08007391 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
7392 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08007393 {0x14, 0x90170110},
7394 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08007395 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08007396 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08007397 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02007398 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007399 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02007400 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02007401 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02007402 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08007403 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007404 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08007405 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08007406 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08007407 {0x21, 0x03211040}),
7408 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007409 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08007410 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08007411 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08007412 {0x21, 0x03211020}),
7413 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007414 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08007415 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08007416 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08007417 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08007418 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02007419 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08007420 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08007421 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08007422 {0x21, 0x04211020}),
David Henningsson76c21322014-06-24 14:46:54 +02007423 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007424 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02007425 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02007426 {0x21, 0x0321101f}),
7427 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7428 {0x12, 0x90a60160},
7429 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02007430 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08007431 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007432 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08007433 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08007434 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08007435 {0x21, 0x0321101f}),
Hui Wangc8c6ee62019-02-14 11:41:33 +08007436 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Hui Wangc4cfcf62018-11-26 14:17:16 +08007437 {0x12, 0x90a60130},
7438 {0x14, 0x90170110},
7439 {0x19, 0x04a11040},
7440 {0x21, 0x04211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08007441 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
7442 {0x12, 0x90a60130},
7443 {0x17, 0x90170110},
7444 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02007445 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08007446 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08007447 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08007448 {0x21, 0x0321101f}),
Hui Wangd5078192018-03-02 13:05:36 +08007449 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Hui Wang3f2f7c52018-01-29 14:23:15 +08007450 {0x12, 0xb7a60130},
7451 {0x14, 0x90170110},
7452 {0x21, 0x04211020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007453 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007454 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007455 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08007456 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08007457 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007458 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007459 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007460 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08007461 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08007462 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007463 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007464 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007465 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08007466 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007467 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007468 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007469 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08007470 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08007471 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007472 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007473 {0x14, 0x90170110},
7474 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08007475 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08007476 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007477 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007478 {0x14, 0x90170110},
7479 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08007480 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08007481 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02007482 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08007483 {0x14, 0x90170110},
7484 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08007485 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08007486 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007487 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08007488 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08007489 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08007490 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08007491 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007492 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08007493 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08007494 {0x16, 0x01014020},
7495 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08007496 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02007497 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007498 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08007499 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02007500 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007501 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02007502 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02007503 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08007504 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02007505 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007506 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08007507 {0x13, 0x90a60140}),
Chris Chiud8ae4582018-12-07 17:17:11 +08007508 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
7509 {0x14, 0x90170110},
7510 {0x1b, 0x90a70130},
7511 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08007512 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7513 {0x12, 0x90a60130},
7514 {0x17, 0x90170110},
Jian-Hong Pan8bb37a22019-02-21 17:00:18 +08007515 {0x21, 0x03211020}),
7516 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
7517 {0x12, 0x90a60130},
7518 {0x17, 0x90170110},
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08007519 {0x21, 0x04211020}),
Hui Wang3f6409702016-09-11 11:26:16 +08007520 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08007521 ALC295_STANDARD_PINS,
7522 {0x17, 0x21014020},
7523 {0x18, 0x21a19030}),
7524 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7525 ALC295_STANDARD_PINS,
7526 {0x17, 0x21014040},
7527 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08007528 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7529 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08007530 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08007531 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02007532 {0x17, 0x90170110}),
7533 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7534 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08007535 {0x17, 0x90170140}),
7536 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7537 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02007538 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08007539 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
7540 {0x12, 0xb7a60140},
7541 {0x13, 0xb7a60150},
7542 {0x17, 0x90170110},
7543 {0x1a, 0x03011020},
7544 {0x21, 0x03211030}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08007545 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7546 ALC225_STANDARD_PINS,
7547 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08007548 {0x17, 0x90170110}),
Hui Wange1918932014-05-26 16:22:44 +08007549 {}
7550};
Takashi Iwai1d045db2011-07-07 18:23:21 +02007551
Takashi Iwai546bb672012-03-07 08:37:19 +01007552static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02007553{
Kailang Yang526af6e2012-03-07 08:25:20 +01007554 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007555 int val;
7556
Kailang Yang526af6e2012-03-07 08:25:20 +01007557 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01007558 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01007559
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007560 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007561 alc_write_coef_idx(codec, 0xf, 0x960b);
7562 alc_write_coef_idx(codec, 0xe, 0x8817);
7563 }
7564
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007565 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007566 alc_write_coef_idx(codec, 0xf, 0x960b);
7567 alc_write_coef_idx(codec, 0xe, 0x8814);
7568 }
7569
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007570 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007571 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02007572 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007573 }
7574
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007575 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007576 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02007577 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007578 /* Capless ramp up clock control */
7579 alc_write_coef_idx(codec, 0xd, val | (1<<10));
7580 }
7581 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02007582 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007583 /* Class D power on reset */
7584 alc_write_coef_idx(codec, 0x17, val | (1<<7));
7585 }
7586 }
7587
Takashi Iwai98b24882014-08-18 13:47:50 +02007588 /* HP */
7589 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007590}
7591
7592/*
7593 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007594static int patch_alc269(struct hda_codec *codec)
7595{
7596 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02007597 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007598
Takashi Iwai3de95172012-05-07 18:03:15 +02007599 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007600 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02007601 return err;
7602
7603 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01007604 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007605 codec->power_save_node = 1;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007606
Takashi Iwai225068a2015-05-29 10:42:14 +02007607#ifdef CONFIG_PM
7608 codec->patch_ops.suspend = alc269_suspend;
7609 codec->patch_ops.resume = alc269_resume;
7610#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08007611 spec->shutup = alc_default_shutup;
7612 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02007613
Takashi Iwai7639a062015-03-03 10:07:24 +01007614 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01007615 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02007616 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007617 switch (alc_get_coef0(codec) & 0x00f0) {
7618 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01007619 if (codec->bus->pci &&
7620 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007621 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02007622 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02007623 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007624 break;
7625 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01007626 if (codec->bus->pci &&
7627 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007628 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02007629 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02007630 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007631 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02007632 case 0x0030:
7633 spec->codec_variant = ALC269_TYPE_ALC269VD;
7634 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007635 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02007636 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007637 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007638 if (err < 0)
7639 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08007640 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01007641 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007642 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01007643 break;
7644
7645 case 0x10ec0280:
7646 case 0x10ec0290:
7647 spec->codec_variant = ALC269_TYPE_ALC280;
7648 break;
7649 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01007650 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08007651 spec->shutup = alc282_shutup;
7652 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01007653 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02007654 case 0x10ec0233:
7655 case 0x10ec0283:
7656 spec->codec_variant = ALC269_TYPE_ALC283;
7657 spec->shutup = alc283_shutup;
7658 spec->init_hook = alc283_init;
7659 break;
Kailang Yang065380f2013-01-10 10:25:48 +01007660 case 0x10ec0284:
7661 case 0x10ec0292:
7662 spec->codec_variant = ALC269_TYPE_ALC284;
7663 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02007664 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08007665 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02007666 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02007667 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08007668 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02007669 spec->codec_variant = ALC269_TYPE_ALC286;
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08007670 spec->shutup = alc286_shutup;
Kailang Yang7fc7d042013-04-25 11:04:43 +02007671 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08007672 case 0x10ec0298:
7673 spec->codec_variant = ALC269_TYPE_ALC298;
7674 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08007675 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02007676 case 0x10ec0255:
7677 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08007678 spec->shutup = alc256_shutup;
7679 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02007680 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08007681 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08007682 case 0x10ec0256:
7683 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08007684 spec->shutup = alc256_shutup;
7685 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02007686 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yangd32b6662015-04-23 15:10:53 +08007687 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
Kailang Yang4344aec2014-12-17 17:39:05 +08007688 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08007689 case 0x10ec0257:
7690 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08007691 spec->shutup = alc256_shutup;
7692 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08007693 spec->gen.mixer_nid = 0;
7694 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08007695 case 0x10ec0215:
7696 case 0x10ec0285:
7697 case 0x10ec0289:
7698 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08007699 spec->shutup = alc225_shutup;
7700 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08007701 spec->gen.mixer_nid = 0;
7702 break;
Kailang Yang42314302016-02-03 15:03:50 +08007703 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08007704 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08007705 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08007706 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08007707 spec->shutup = alc225_shutup;
7708 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01007709 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08007710 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08007711 case 0x10ec0234:
7712 case 0x10ec0274:
7713 case 0x10ec0294:
7714 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08007715 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08007716 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +08007717 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08007718 break;
Kailang Yang1078bef2018-11-08 16:36:15 +08007719 case 0x10ec0300:
7720 spec->codec_variant = ALC269_TYPE_ALC300;
7721 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007722 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08007723 case 0x10ec0700:
7724 case 0x10ec0701:
7725 case 0x10ec0703:
7726 spec->codec_variant = ALC269_TYPE_ALC700;
7727 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08007728 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +08007729 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +08007730 break;
7731
Takashi Iwai1d045db2011-07-07 18:23:21 +02007732 }
7733
Kailang Yangad60d502013-06-28 12:03:01 +02007734 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05007735 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02007736 spec->init_hook = alc5505_dsp_init;
7737 }
7738
Takashi Iwaiefe55732018-06-15 11:55:02 +02007739 snd_hda_pick_fixup(codec, alc269_fixup_models,
7740 alc269_fixup_tbl, alc269_fixups);
7741 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
7742 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
7743 alc269_fixups);
7744 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
7745
7746 alc_auto_parse_customize_define(codec);
7747
7748 if (has_cdefine_beep(codec))
7749 spec->gen.beep_nid = 0x01;
7750
Takashi Iwaia4297b52011-08-23 18:40:12 +02007751 /* automatic parse from the BIOS config */
7752 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007753 if (err < 0)
7754 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007755
Takashi Iwaifea80fa2018-06-20 12:52:46 +02007756 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
7757 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
7758 if (err < 0)
7759 goto error;
7760 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007761
Takashi Iwai1727a772013-01-10 09:52:52 +01007762 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007763
Takashi Iwai1d045db2011-07-07 18:23:21 +02007764 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007765
7766 error:
7767 alc_free(codec);
7768 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007769}
7770
7771/*
7772 * ALC861
7773 */
7774
Takashi Iwai1d045db2011-07-07 18:23:21 +02007775static int alc861_parse_auto_config(struct hda_codec *codec)
7776{
Takashi Iwai1d045db2011-07-07 18:23:21 +02007777 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007778 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
7779 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007780}
7781
Takashi Iwai1d045db2011-07-07 18:23:21 +02007782/* Pin config fixes */
7783enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007784 ALC861_FIXUP_FSC_AMILO_PI1505,
7785 ALC861_FIXUP_AMP_VREF_0F,
7786 ALC861_FIXUP_NO_JACK_DETECT,
7787 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007788 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007789};
7790
Takashi Iwai31150f22012-01-30 10:54:08 +01007791/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
7792static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007793 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01007794{
7795 struct alc_spec *spec = codec->spec;
7796 unsigned int val;
7797
Takashi Iwai1727a772013-01-10 09:52:52 +01007798 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01007799 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01007800 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01007801 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
7802 val |= AC_PINCTL_IN_EN;
7803 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02007804 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01007805 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01007806}
7807
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007808/* suppress the jack-detection */
7809static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007810 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007811{
Takashi Iwai1727a772013-01-10 09:52:52 +01007812 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007813 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02007814}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007815
Takashi Iwai1727a772013-01-10 09:52:52 +01007816static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007817 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007818 .type = HDA_FIXUP_PINS,
7819 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007820 { 0x0b, 0x0221101f }, /* HP */
7821 { 0x0f, 0x90170310 }, /* speaker */
7822 { }
7823 }
7824 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007825 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007826 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01007827 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01007828 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007829 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007830 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007831 .v.func = alc_fixup_no_jack_detect,
7832 },
7833 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007834 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007835 .v.func = alc861_fixup_asus_amp_vref_0f,
7836 .chained = true,
7837 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007838 },
7839 [ALC660_FIXUP_ASUS_W7J] = {
7840 .type = HDA_FIXUP_VERBS,
7841 .v.verbs = (const struct hda_verb[]) {
7842 /* ASUS W7J needs a magic pin setup on unused NID 0x10
7843 * for enabling outputs
7844 */
7845 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7846 { }
7847 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007848 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007849};
7850
7851static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007852 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01007853 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007854 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
7855 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
7856 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
7857 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
7858 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
7859 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007860 {}
7861};
7862
7863/*
7864 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007865static int patch_alc861(struct hda_codec *codec)
7866{
7867 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007868 int err;
7869
Takashi Iwai3de95172012-05-07 18:03:15 +02007870 err = alc_alloc_spec(codec, 0x15);
7871 if (err < 0)
7872 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007873
Takashi Iwai3de95172012-05-07 18:03:15 +02007874 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007875 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007876
Takashi Iwai225068a2015-05-29 10:42:14 +02007877#ifdef CONFIG_PM
7878 spec->power_hook = alc_power_eapd;
7879#endif
7880
Takashi Iwai1727a772013-01-10 09:52:52 +01007881 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
7882 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007883
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007884 /* automatic parse from the BIOS config */
7885 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007886 if (err < 0)
7887 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007888
Takashi Iwaifea80fa2018-06-20 12:52:46 +02007889 if (!spec->gen.no_analog) {
7890 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
7891 if (err < 0)
7892 goto error;
7893 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007894
Takashi Iwai1727a772013-01-10 09:52:52 +01007895 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007896
Takashi Iwai1d045db2011-07-07 18:23:21 +02007897 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007898
7899 error:
7900 alc_free(codec);
7901 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007902}
7903
7904/*
7905 * ALC861-VD support
7906 *
7907 * Based on ALC882
7908 *
7909 * In addition, an independent DAC
7910 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007911static int alc861vd_parse_auto_config(struct hda_codec *codec)
7912{
Takashi Iwai1d045db2011-07-07 18:23:21 +02007913 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007914 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7915 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007916}
7917
Takashi Iwai1d045db2011-07-07 18:23:21 +02007918enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007919 ALC660VD_FIX_ASUS_GPIO1,
7920 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007921};
7922
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007923/* exclude VREF80 */
7924static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007925 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007926{
Takashi Iwai1727a772013-01-10 09:52:52 +01007927 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01007928 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
7929 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007930 }
7931}
7932
Takashi Iwaidf73d832018-06-19 23:05:47 +02007933/* reset GPIO1 */
7934static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
7935 const struct hda_fixup *fix, int action)
7936{
7937 struct alc_spec *spec = codec->spec;
7938
7939 if (action == HDA_FIXUP_ACT_PRE_PROBE)
7940 spec->gpio_mask |= 0x02;
7941 alc_fixup_gpio(codec, action, 0x01);
7942}
7943
Takashi Iwai1727a772013-01-10 09:52:52 +01007944static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007945 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +02007946 .type = HDA_FIXUP_FUNC,
7947 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007948 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007949 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007950 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007951 .v.func = alc861vd_fixup_dallas,
7952 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02007953};
7954
7955static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007956 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007957 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007958 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007959 {}
7960};
7961
Takashi Iwai1d045db2011-07-07 18:23:21 +02007962/*
7963 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007964static int patch_alc861vd(struct hda_codec *codec)
7965{
7966 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007967 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007968
Takashi Iwai3de95172012-05-07 18:03:15 +02007969 err = alc_alloc_spec(codec, 0x0b);
7970 if (err < 0)
7971 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007972
Takashi Iwai3de95172012-05-07 18:03:15 +02007973 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007974 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007975
Takashi Iwai225068a2015-05-29 10:42:14 +02007976 spec->shutup = alc_eapd_shutup;
7977
Takashi Iwai1727a772013-01-10 09:52:52 +01007978 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
7979 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007980
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007981 /* automatic parse from the BIOS config */
7982 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007983 if (err < 0)
7984 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007985
Takashi Iwaifea80fa2018-06-20 12:52:46 +02007986 if (!spec->gen.no_analog) {
7987 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
7988 if (err < 0)
7989 goto error;
7990 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007991
Takashi Iwai1727a772013-01-10 09:52:52 +01007992 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007993
Takashi Iwai1d045db2011-07-07 18:23:21 +02007994 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007995
7996 error:
7997 alc_free(codec);
7998 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007999}
8000
8001/*
8002 * ALC662 support
8003 *
8004 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
8005 * configuration. Each pin widget can choose any input DACs and a mixer.
8006 * Each ADC is connected from a mixer of all inputs. This makes possible
8007 * 6-channel independent captures.
8008 *
8009 * In addition, an independent DAC for the multi-playback (not used in this
8010 * driver yet).
8011 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02008012
8013/*
8014 * BIOS auto configuration
8015 */
8016
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008017static int alc662_parse_auto_config(struct hda_codec *codec)
8018{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02008019 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02008020 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
8021 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
8022 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02008023
Takashi Iwai7639a062015-03-03 10:07:24 +01008024 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
8025 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
8026 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02008027 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01008028 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02008029 ssids = alc662_ssids;
8030 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008031}
8032
Todd Broch6be79482010-12-07 16:51:05 -08008033static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01008034 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01008035{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01008036 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01008037 return;
Todd Broch6be79482010-12-07 16:51:05 -08008038 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
8039 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
8040 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
8041 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
8042 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01008043 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08008044}
8045
Takashi Iwai8e383952013-10-30 17:41:12 +01008046static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
8047 { .channels = 2,
8048 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
8049 { .channels = 4,
8050 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
8051 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
8052 { }
8053};
8054
8055/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01008056static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01008057 const struct hda_fixup *fix, int action)
8058{
8059 if (action == HDA_FIXUP_ACT_BUILD) {
8060 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +01008061 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +01008062 }
8063}
8064
Takashi Iwaibf686652014-01-13 16:18:25 +01008065/* avoid D3 for keeping GPIO up */
8066static unsigned int gpio_led_power_filter(struct hda_codec *codec,
8067 hda_nid_t nid,
8068 unsigned int power_state)
8069{
8070 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +02008071 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +01008072 return AC_PWRST_D0;
8073 return power_state;
8074}
8075
Takashi Iwai3e887f32014-01-10 17:50:58 +01008076static void alc662_fixup_led_gpio1(struct hda_codec *codec,
8077 const struct hda_fixup *fix, int action)
8078{
8079 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +01008080
Takashi Iwai01e4a272018-06-19 22:47:30 +02008081 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +01008082 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01008083 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +01008084 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01008085 }
8086}
8087
Kailang Yangc6790c82016-11-25 16:15:17 +08008088static void alc662_usi_automute_hook(struct hda_codec *codec,
8089 struct hda_jack_callback *jack)
8090{
8091 struct alc_spec *spec = codec->spec;
8092 int vref;
8093 msleep(200);
8094 snd_hda_gen_hp_automute(codec, jack);
8095
8096 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
8097 msleep(100);
8098 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
8099 vref);
8100}
8101
8102static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
8103 const struct hda_fixup *fix, int action)
8104{
8105 struct alc_spec *spec = codec->spec;
8106 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
8107 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
8108 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
8109 }
8110}
8111
Kailang Yangf3f91852014-10-24 15:43:46 +08008112static struct coef_fw alc668_coefs[] = {
8113 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
8114 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
8115 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
8116 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
8117 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
8118 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
8119 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
8120 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
8121 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
8122 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
8123 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
8124 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
8125 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
8126 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
8127 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
8128 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
8129 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
8130 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
8131 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
8132 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
8133 {}
8134};
8135
8136static void alc668_restore_default_value(struct hda_codec *codec)
8137{
8138 alc_process_coef_fw(codec, alc668_coefs);
8139}
8140
David Henningsson6cb3b702010-09-09 08:51:44 +02008141enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04008142 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01008143 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02008144 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08008145 ALC272_FIXUP_MARIO,
Anisse Astierd2ebd472011-01-20 12:36:21 +01008146 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02008147 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02008148 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02008149 ALC662_FIXUP_ASUS_MODE1,
8150 ALC662_FIXUP_ASUS_MODE2,
8151 ALC662_FIXUP_ASUS_MODE3,
8152 ALC662_FIXUP_ASUS_MODE4,
8153 ALC662_FIXUP_ASUS_MODE5,
8154 ALC662_FIXUP_ASUS_MODE6,
8155 ALC662_FIXUP_ASUS_MODE7,
8156 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01008157 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02008158 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02008159 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +02008160 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02008161 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02008162 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +02008163 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01008164 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01008165 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008166 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01008167 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08008168 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02008169 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02008170 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02008171 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02008172 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008173 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02008174 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +02008175 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008176 ALC891_FIXUP_HEADSET_MODE,
8177 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08008178 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008179 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +08008180 ALC662_FIXUP_USI_FUNC,
8181 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +08008182 ALC662_FIXUP_LENOVO_MULTI_CODECS,
David Henningsson6cb3b702010-09-09 08:51:44 +02008183};
8184
Takashi Iwai1727a772013-01-10 09:52:52 +01008185static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04008186 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008187 .type = HDA_FIXUP_PINS,
8188 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04008189 { 0x15, 0x99130112 }, /* subwoofer */
8190 { }
8191 }
8192 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01008193 [ALC662_FIXUP_LED_GPIO1] = {
8194 .type = HDA_FIXUP_FUNC,
8195 .v.func = alc662_fixup_led_gpio1,
8196 },
David Henningsson6cb3b702010-09-09 08:51:44 +02008197 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008198 .type = HDA_FIXUP_PINS,
8199 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02008200 { 0x17, 0x99130112 }, /* subwoofer */
8201 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01008202 },
8203 .chained = true,
8204 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02008205 },
Todd Broch6be79482010-12-07 16:51:05 -08008206 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008207 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01008208 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01008209 },
8210 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008211 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +01008212 .v.verbs = (const struct hda_verb[]) {
8213 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
8214 {}
8215 }
8216 },
David Henningsson94024cd2011-04-29 14:10:55 +02008217 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008218 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02008219 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +02008220 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02008221 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008222 .type = HDA_FIXUP_PINS,
8223 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02008224 { 0x14, 0x0221201f }, /* HP out */
8225 { }
8226 },
8227 .chained = true,
8228 .chain_id = ALC662_FIXUP_SKU_IGNORE
8229 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02008230 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008231 .type = HDA_FIXUP_PINS,
8232 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008233 { 0x14, 0x99130110 }, /* speaker */
8234 { 0x18, 0x01a19c20 }, /* mic */
8235 { 0x19, 0x99a3092f }, /* int-mic */
8236 { 0x21, 0x0121401f }, /* HP out */
8237 { }
8238 },
8239 .chained = true,
8240 .chain_id = ALC662_FIXUP_SKU_IGNORE
8241 },
8242 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008243 .type = HDA_FIXUP_PINS,
8244 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +02008245 { 0x14, 0x99130110 }, /* speaker */
8246 { 0x18, 0x01a19820 }, /* mic */
8247 { 0x19, 0x99a3092f }, /* int-mic */
8248 { 0x1b, 0x0121401f }, /* HP out */
8249 { }
8250 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02008251 .chained = true,
8252 .chain_id = ALC662_FIXUP_SKU_IGNORE
8253 },
8254 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008255 .type = HDA_FIXUP_PINS,
8256 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008257 { 0x14, 0x99130110 }, /* speaker */
8258 { 0x15, 0x0121441f }, /* HP */
8259 { 0x18, 0x01a19840 }, /* mic */
8260 { 0x19, 0x99a3094f }, /* int-mic */
8261 { 0x21, 0x01211420 }, /* HP2 */
8262 { }
8263 },
8264 .chained = true,
8265 .chain_id = ALC662_FIXUP_SKU_IGNORE
8266 },
8267 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008268 .type = HDA_FIXUP_PINS,
8269 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008270 { 0x14, 0x99130110 }, /* speaker */
8271 { 0x16, 0x99130111 }, /* speaker */
8272 { 0x18, 0x01a19840 }, /* mic */
8273 { 0x19, 0x99a3094f }, /* int-mic */
8274 { 0x21, 0x0121441f }, /* HP */
8275 { }
8276 },
8277 .chained = true,
8278 .chain_id = ALC662_FIXUP_SKU_IGNORE
8279 },
8280 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008281 .type = HDA_FIXUP_PINS,
8282 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008283 { 0x14, 0x99130110 }, /* speaker */
8284 { 0x15, 0x0121441f }, /* HP */
8285 { 0x16, 0x99130111 }, /* speaker */
8286 { 0x18, 0x01a19840 }, /* mic */
8287 { 0x19, 0x99a3094f }, /* int-mic */
8288 { }
8289 },
8290 .chained = true,
8291 .chain_id = ALC662_FIXUP_SKU_IGNORE
8292 },
8293 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008294 .type = HDA_FIXUP_PINS,
8295 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008296 { 0x14, 0x99130110 }, /* speaker */
8297 { 0x15, 0x01211420 }, /* HP2 */
8298 { 0x18, 0x01a19840 }, /* mic */
8299 { 0x19, 0x99a3094f }, /* int-mic */
8300 { 0x1b, 0x0121441f }, /* HP */
8301 { }
8302 },
8303 .chained = true,
8304 .chain_id = ALC662_FIXUP_SKU_IGNORE
8305 },
8306 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008307 .type = HDA_FIXUP_PINS,
8308 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008309 { 0x14, 0x99130110 }, /* speaker */
8310 { 0x17, 0x99130111 }, /* speaker */
8311 { 0x18, 0x01a19840 }, /* mic */
8312 { 0x19, 0x99a3094f }, /* int-mic */
8313 { 0x1b, 0x01214020 }, /* HP */
8314 { 0x21, 0x0121401f }, /* HP */
8315 { }
8316 },
8317 .chained = true,
8318 .chain_id = ALC662_FIXUP_SKU_IGNORE
8319 },
8320 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008321 .type = HDA_FIXUP_PINS,
8322 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008323 { 0x14, 0x99130110 }, /* speaker */
8324 { 0x12, 0x99a30970 }, /* int-mic */
8325 { 0x15, 0x01214020 }, /* HP */
8326 { 0x17, 0x99130111 }, /* speaker */
8327 { 0x18, 0x01a19840 }, /* mic */
8328 { 0x21, 0x0121401f }, /* HP */
8329 { }
8330 },
8331 .chained = true,
8332 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +02008333 },
Takashi Iwai1565cc32012-02-13 12:03:25 +01008334 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008335 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +01008336 .v.func = alc_fixup_no_jack_detect,
8337 },
David Henningssonedfe3bf2012-06-12 13:15:12 +02008338 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008339 .type = HDA_FIXUP_PINS,
8340 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +02008341 { 0x1b, 0x02214020 }, /* Front HP */
8342 { }
8343 }
8344 },
Takashi Iwai125821a2012-06-22 14:30:29 +02008345 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01008346 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02008347 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +02008348 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02008349 [ALC668_FIXUP_DELL_XPS13] = {
8350 .type = HDA_FIXUP_FUNC,
8351 .v.func = alc_fixup_dell_xps13,
8352 .chained = true,
8353 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
8354 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02008355 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
8356 .type = HDA_FIXUP_FUNC,
8357 .v.func = alc_fixup_disable_aamix,
8358 .chained = true,
8359 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8360 },
Hui Wang493a52a2014-01-14 14:07:36 +08008361 [ALC668_FIXUP_AUTO_MUTE] = {
8362 .type = HDA_FIXUP_FUNC,
8363 .v.func = alc_fixup_auto_mute_via_amp,
8364 .chained = true,
8365 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
8366 },
David Henningsson1f8b46c2015-05-12 14:38:15 +02008367 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
8368 .type = HDA_FIXUP_PINS,
8369 .v.pins = (const struct hda_pintbl[]) {
8370 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8371 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
8372 { }
8373 },
8374 .chained = true,
8375 .chain_id = ALC662_FIXUP_HEADSET_MODE
8376 },
8377 [ALC662_FIXUP_HEADSET_MODE] = {
8378 .type = HDA_FIXUP_FUNC,
8379 .v.func = alc_fixup_headset_mode_alc662,
8380 },
David Henningsson73bdd592013-04-15 15:44:14 +02008381 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
8382 .type = HDA_FIXUP_PINS,
8383 .v.pins = (const struct hda_pintbl[]) {
8384 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8385 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8386 { }
8387 },
8388 .chained = true,
8389 .chain_id = ALC668_FIXUP_HEADSET_MODE
8390 },
8391 [ALC668_FIXUP_HEADSET_MODE] = {
8392 .type = HDA_FIXUP_FUNC,
8393 .v.func = alc_fixup_headset_mode_alc668,
8394 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01008395 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +01008396 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01008397 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +01008398 .chained = true,
8399 .chain_id = ALC662_FIXUP_ASUS_MODE4
8400 },
David Henningsson61a75f12014-02-07 09:31:08 +01008401 [ALC662_FIXUP_BASS_16] = {
8402 .type = HDA_FIXUP_PINS,
8403 .v.pins = (const struct hda_pintbl[]) {
8404 {0x16, 0x80106111}, /* bass speaker */
8405 {}
8406 },
8407 .chained = true,
8408 .chain_id = ALC662_FIXUP_BASS_CHMAP,
8409 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008410 [ALC662_FIXUP_BASS_1A] = {
8411 .type = HDA_FIXUP_PINS,
8412 .v.pins = (const struct hda_pintbl[]) {
8413 {0x1a, 0x80106111}, /* bass speaker */
8414 {}
8415 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01008416 .chained = true,
8417 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008418 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01008419 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008420 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01008421 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01008422 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02008423 [ALC662_FIXUP_ASUS_Nx50] = {
8424 .type = HDA_FIXUP_FUNC,
8425 .v.func = alc_fixup_auto_mute_via_amp,
8426 .chained = true,
8427 .chain_id = ALC662_FIXUP_BASS_1A
8428 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02008429 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
8430 .type = HDA_FIXUP_FUNC,
8431 .v.func = alc_fixup_headset_mode_alc668,
8432 .chain_id = ALC662_FIXUP_BASS_CHMAP
8433 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008434 [ALC668_FIXUP_ASUS_Nx51] = {
8435 .type = HDA_FIXUP_PINS,
8436 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02008437 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8438 { 0x1a, 0x90170151 }, /* bass speaker */
8439 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008440 {}
8441 },
8442 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02008443 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008444 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02008445 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +02008446 .type = HDA_FIXUP_VERBS,
8447 .v.verbs = (const struct hda_verb[]) {
8448 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
8449 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
8450 {}
8451 },
8452 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +02008453 [ALC668_FIXUP_ASUS_G751] = {
8454 .type = HDA_FIXUP_PINS,
8455 .v.pins = (const struct hda_pintbl[]) {
8456 { 0x16, 0x0421101f }, /* HP */
8457 {}
8458 },
8459 .chained = true,
8460 .chain_id = ALC668_FIXUP_MIC_COEF
8461 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008462 [ALC891_FIXUP_HEADSET_MODE] = {
8463 .type = HDA_FIXUP_FUNC,
8464 .v.func = alc_fixup_headset_mode,
8465 },
8466 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
8467 .type = HDA_FIXUP_PINS,
8468 .v.pins = (const struct hda_pintbl[]) {
8469 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
8470 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
8471 { }
8472 },
8473 .chained = true,
8474 .chain_id = ALC891_FIXUP_HEADSET_MODE
8475 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08008476 [ALC662_FIXUP_ACER_VERITON] = {
8477 .type = HDA_FIXUP_PINS,
8478 .v.pins = (const struct hda_pintbl[]) {
8479 { 0x15, 0x50170120 }, /* no internal speaker */
8480 { }
8481 }
8482 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008483 [ALC892_FIXUP_ASROCK_MOBO] = {
8484 .type = HDA_FIXUP_PINS,
8485 .v.pins = (const struct hda_pintbl[]) {
8486 { 0x15, 0x40f000f0 }, /* disabled */
8487 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008488 { }
8489 }
8490 },
Kailang Yangc6790c82016-11-25 16:15:17 +08008491 [ALC662_FIXUP_USI_FUNC] = {
8492 .type = HDA_FIXUP_FUNC,
8493 .v.func = alc662_fixup_usi_headset_mic,
8494 },
8495 [ALC662_FIXUP_USI_HEADSET_MODE] = {
8496 .type = HDA_FIXUP_PINS,
8497 .v.pins = (const struct hda_pintbl[]) {
8498 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
8499 { 0x18, 0x01a1903d },
8500 { }
8501 },
8502 .chained = true,
8503 .chain_id = ALC662_FIXUP_USI_FUNC
8504 },
Kailang Yangca169cc2017-04-25 16:17:40 +08008505 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
8506 .type = HDA_FIXUP_FUNC,
8507 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
8508 },
David Henningsson6cb3b702010-09-09 08:51:44 +02008509};
8510
Takashi Iwaia9111322011-05-02 11:30:18 +02008511static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +02008512 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +02008513 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +01008514 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +01008515 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +02008516 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +02008517 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +02008518 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -04008519 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
David Henningsson73bdd592013-04-15 15:44:14 +02008520 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8521 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +02008522 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02008523 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +02008524 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +01008525 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff992013-11-07 09:28:59 +01008526 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +08008527 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
8528 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +08008529 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02008530 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Kaho Ng2da2dc92016-05-09 00:27:49 +08008531 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +02008532 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwaidb8948e2016-01-18 09:17:30 +01008533 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02008534 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +02008535 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
David Henningsson8e54b4a2014-02-07 09:31:07 +01008536 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +01008537 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008538 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
8539 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Takashi Iwaic7efff92017-01-04 21:38:16 +01008540 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +01008541 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +01008542 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +01008543 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +02008544 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -05008545 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +08008546 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +08008547 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +06008548 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +02008549 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008550 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +02008551 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08008552 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Anisse Astierd2ebd472011-01-20 12:36:21 +01008553 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +02008554
8555#if 0
8556 /* Below is a quirk table taken from the old code.
8557 * Basically the device should work as is without the fixup table.
8558 * If BIOS doesn't give a proper info, enable the corresponding
8559 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008560 */
Takashi Iwai53c334a2011-08-23 18:27:14 +02008561 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
8562 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
8563 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
8564 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
8565 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8566 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8567 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8568 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
8569 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
8570 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8571 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
8572 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
8573 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
8574 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
8575 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
8576 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8577 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
8578 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
8579 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8580 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8581 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8582 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8583 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
8584 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
8585 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
8586 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8587 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
8588 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8589 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8590 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
8591 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8592 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8593 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
8594 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
8595 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
8596 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
8597 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
8598 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
8599 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
8600 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8601 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
8602 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
8603 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8604 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
8605 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
8606 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
8607 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
8608 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
8609 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8610 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
8611#endif
David Henningsson6cb3b702010-09-09 08:51:44 +02008612 {}
8613};
8614
Takashi Iwai1727a772013-01-10 09:52:52 +01008615static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008616 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
8617 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -08008618 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008619 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +02008620 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
8621 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
8622 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
8623 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
8624 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
8625 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
8626 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
8627 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008628 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02008629 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008630 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +02008631 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008632 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
8633 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
8634 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
8635 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
8636 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
8637 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
8638 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
8639 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +02008640 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +02008641 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
8642 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
8643 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
8644 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
8645 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02008646 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Todd Broch6be79482010-12-07 16:51:05 -08008647 {}
8648};
David Henningsson6cb3b702010-09-09 08:51:44 +02008649
Hui Wang532895c2014-05-29 15:59:19 +08008650static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008651 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8652 {0x17, 0x02211010},
8653 {0x18, 0x01a19030},
8654 {0x1a, 0x01813040},
8655 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +02008656 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02008657 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +02008658 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +02008659 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +08008660 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +02008661 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8662 {0x12, 0x99a30130},
8663 {0x14, 0x90170110},
8664 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008665 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008666 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8667 {0x12, 0x99a30140},
8668 {0x14, 0x90170110},
8669 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008670 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008671 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8672 {0x12, 0x99a30150},
8673 {0x14, 0x90170110},
8674 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008675 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008676 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +02008677 {0x14, 0x90170110},
8678 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008679 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008680 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
8681 {0x12, 0x90a60130},
8682 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08008683 {0x15, 0x0321101f}),
Hui Wang532895c2014-05-29 15:59:19 +08008684 {}
8685};
8686
Takashi Iwai1d045db2011-07-07 18:23:21 +02008687/*
8688 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008689static int patch_alc662(struct hda_codec *codec)
8690{
8691 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02008692 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008693
Takashi Iwai3de95172012-05-07 18:03:15 +02008694 err = alc_alloc_spec(codec, 0x0b);
8695 if (err < 0)
8696 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008697
Takashi Iwai3de95172012-05-07 18:03:15 +02008698 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008699
Takashi Iwai225068a2015-05-29 10:42:14 +02008700 spec->shutup = alc_eapd_shutup;
8701
Takashi Iwai53c334a2011-08-23 18:27:14 +02008702 /* handle multiple HPs as is */
8703 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
8704
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +02008705 alc_fix_pll_init(codec, 0x20, 0x04, 15);
8706
Takashi Iwai7639a062015-03-03 10:07:24 +01008707 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +08008708 case 0x10ec0668:
8709 spec->init_hook = alc668_restore_default_value;
8710 break;
Kailang Yangf3f91852014-10-24 15:43:46 +08008711 }
Kailang Yang8663ff72012-06-29 09:35:52 +02008712
Takashi Iwai1727a772013-01-10 09:52:52 +01008713 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +02008714 alc662_fixup_tbl, alc662_fixups);
Hui Wang532895c2014-05-29 15:59:19 +08008715 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01008716 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +02008717
8718 alc_auto_parse_customize_define(codec);
8719
Takashi Iwai7504b6c2013-03-18 11:25:51 +01008720 if (has_cdefine_beep(codec))
8721 spec->gen.beep_nid = 0x01;
8722
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008723 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +01008724 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008725 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +08008726 err = alc_codec_rename(codec, "ALC272X");
8727 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008728 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008729 }
Kailang Yang274693f2009-12-03 10:07:50 +01008730
Takashi Iwaib9c51062011-08-24 18:08:07 +02008731 /* automatic parse from the BIOS config */
8732 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008733 if (err < 0)
8734 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008735
Takashi Iwai7504b6c2013-03-18 11:25:51 +01008736 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +01008737 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +01008738 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008739 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +01008740 break;
8741 case 0x10ec0272:
8742 case 0x10ec0663:
8743 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +08008744 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008745 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +01008746 break;
8747 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008748 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +01008749 break;
8750 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +02008751 if (err < 0)
8752 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +01008753 }
Takashi Iwai2134ea42008-01-10 16:53:55 +01008754
Takashi Iwai1727a772013-01-10 09:52:52 +01008755 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01008756
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008757 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008758
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008759 error:
8760 alc_free(codec);
8761 return err;
Kailang Yangb478b992011-05-18 11:51:15 +02008762}
8763
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008764/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008765 * ALC680 support
8766 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008767
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008768static int alc680_parse_auto_config(struct hda_codec *codec)
8769{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02008770 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008771}
8772
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008773/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008774 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008775static int patch_alc680(struct hda_codec *codec)
8776{
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008777 int err;
8778
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008779 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02008780 err = alc_alloc_spec(codec, 0);
8781 if (err < 0)
8782 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008783
Takashi Iwai1ebec5f2011-08-15 13:21:48 +02008784 /* automatic parse from the BIOS config */
8785 err = alc680_parse_auto_config(codec);
8786 if (err < 0) {
8787 alc_free(codec);
8788 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008789 }
8790
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008791 return 0;
8792}
8793
8794/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07008795 * patch entries
8796 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008797static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +08008798 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008799 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +08008800 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008801 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
8802 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008803 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008804 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +08008805 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008806 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
8807 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +08008808 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008809 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
8810 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
8811 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
8812 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
8813 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
8814 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
8815 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008816 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008817 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
8818 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
8819 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
8820 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
8821 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
8822 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +08008823 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008824 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
8825 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +08008826 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008827 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
8828 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
8829 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008830 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +08008831 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008832 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +08008833 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +08008834 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008835 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
8836 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
8837 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
8838 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
8839 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
8840 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
8841 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
8842 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
8843 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
8844 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
8845 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
8846 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
8847 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
8848 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +08008849 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
8850 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
8851 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008852 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008853 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
8854 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
8855 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
8856 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
8857 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
8858 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
8859 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
8860 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
8861 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
8862 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
8863 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
8864 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
8865 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +08008866 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +08008867 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -07008868 {} /* terminator */
8869};
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008870MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +01008871
8872MODULE_LICENSE("GPL");
8873MODULE_DESCRIPTION("Realtek HD-audio codec");
8874
Takashi Iwaid8a766a2015-02-17 15:25:37 +01008875static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008876 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +01008877};
8878
Takashi Iwaid8a766a2015-02-17 15:25:37 +01008879module_hda_codec_driver(realtek_driver);