blob: 7934c5df4d80b12ee728504b170ad800bf2f07fd [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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070035#include "hda_codec.h"
36#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 {
46 ALC_INIT_NONE,
47 ALC_INIT_DEFAULT,
48 ALC_INIT_GPIO1,
49 ALC_INIT_GPIO2,
50 ALC_INIT_GPIO3,
51};
52
David Henningsson73bdd592013-04-15 15:44:14 +020053enum {
54 ALC_HEADSET_MODE_UNKNOWN,
55 ALC_HEADSET_MODE_UNPLUGGED,
56 ALC_HEADSET_MODE_HEADSET,
57 ALC_HEADSET_MODE_MIC,
58 ALC_HEADSET_MODE_HEADPHONE,
59};
60
61enum {
62 ALC_HEADSET_TYPE_UNKNOWN,
63 ALC_HEADSET_TYPE_CTIA,
64 ALC_HEADSET_TYPE_OMTP,
65};
66
Hui Wangc7b60a82015-12-28 11:35:25 +080067enum {
68 ALC_KEY_MICMUTE_INDEX,
69};
70
Kailang Yangda00c242010-03-19 11:23:45 +010071struct alc_customize_define {
72 unsigned int sku_cfg;
73 unsigned char port_connectivity;
74 unsigned char check_sum;
75 unsigned char customization;
76 unsigned char external_amp;
77 unsigned int enable_pcbeep:1;
78 unsigned int platform_type:1;
79 unsigned int swap:1;
80 unsigned int override:1;
David Henningsson90622912010-10-14 14:50:18 +020081 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
Kailang Yangda00c242010-03-19 11:23:45 +010082};
83
Linus Torvalds1da177e2005-04-16 15:20:36 -070084struct alc_spec {
Takashi Iwai08c189f2012-12-19 15:22:24 +010085 struct hda_gen_spec gen; /* must be at head */
Takashi Iwai23d30f22012-05-07 17:17:32 +020086
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 /* codec parameterization */
Takashi Iwaia9111322011-05-02 11:30:18 +020088 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 unsigned int num_mixers;
Takashi Iwai45bdd1c2009-02-06 16:11:25 +010090 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
Linus Torvalds1da177e2005-04-16 15:20:36 -070091
Kailang Yangda00c242010-03-19 11:23:45 +010092 struct alc_customize_define cdefine;
Takashi Iwai08c189f2012-12-19 15:22:24 +010093 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
94
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 Iwai9f5c6fa2013-03-18 14:15:58 +0100100 unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */
Takashi Iwai0f32fd192014-11-19 12:16:14 +0100101 unsigned int gpio_mute_led_mask;
102 unsigned int gpio_mic_led_mask;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +0100103
David Henningsson73bdd592013-04-15 15:44:14 +0200104 hda_nid_t headset_mic_pin;
105 hda_nid_t headphone_mic_pin;
106 int current_headset_mode;
107 int current_headset_type;
108
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100109 /* hooks */
110 void (*init_hook)(struct hda_codec *codec);
Takashi Iwai83012a72012-08-24 18:38:08 +0200111#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500112 void (*power_hook)(struct hda_codec *codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100113#endif
Takashi Iwai1c7161532011-04-07 10:37:16 +0200114 void (*shutup)(struct hda_codec *codec);
Takashi Iwai70a09762015-12-15 14:59:58 +0100115 void (*reboot_notify)(struct hda_codec *codec);
Takashi Iwaid922b512011-04-28 12:18:53 +0200116
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200117 int init_amp;
Takashi Iwaid433a672010-09-20 15:11:54 +0200118 int codec_variant; /* flag for other variants */
Kailang Yang97a26572013-11-29 00:35:26 -0500119 unsigned int has_alc5505_dsp:1;
120 unsigned int no_depop_delay:1;
Takashi Iwaie64f14f2009-01-20 18:32:55 +0100121
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200122 /* for PLL fix */
123 hda_nid_t pll_nid;
124 unsigned int pll_coef_idx, pll_coef_bit;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200125 unsigned int coef0;
David Henningsson33f4acd2015-01-07 15:50:13 +0100126 struct input_dev *kb_dev;
Hui Wangc7b60a82015-12-28 11:35:25 +0800127 u8 alc_mute_keycode_map[1];
Kailang Yangdf694da2005-12-05 19:42:22 +0100128};
129
Takashi Iwai23f0c042009-02-26 13:03:58 +0100130/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200131 * COEF access helper functions
132 */
133
134static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
135 unsigned int coef_idx)
136{
137 unsigned int val;
138
139 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
140 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
141 return val;
142}
143
144#define alc_read_coef_idx(codec, coef_idx) \
145 alc_read_coefex_idx(codec, 0x20, coef_idx)
146
147static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
148 unsigned int coef_idx, unsigned int coef_val)
149{
150 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
151 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
152}
153
154#define alc_write_coef_idx(codec, coef_idx, coef_val) \
155 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
156
Takashi Iwai98b24882014-08-18 13:47:50 +0200157static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
158 unsigned int coef_idx, unsigned int mask,
159 unsigned int bits_set)
160{
161 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
162
163 if (val != -1)
164 alc_write_coefex_idx(codec, nid, coef_idx,
165 (val & ~mask) | bits_set);
166}
167
168#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
169 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
170
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200171/* a special bypass for COEF 0; read the cached value at the second time */
172static unsigned int alc_get_coef0(struct hda_codec *codec)
173{
174 struct alc_spec *spec = codec->spec;
175
176 if (!spec->coef0)
177 spec->coef0 = alc_read_coef_idx(codec, 0);
178 return spec->coef0;
179}
180
Takashi Iwai54db6c32014-08-18 15:11:19 +0200181/* coef writes/updates batch */
182struct coef_fw {
183 unsigned char nid;
184 unsigned char idx;
185 unsigned short mask;
186 unsigned short val;
187};
188
189#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
190 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
191#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
192#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
193#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
194
195static void alc_process_coef_fw(struct hda_codec *codec,
196 const struct coef_fw *fw)
197{
198 for (; fw->nid; fw++) {
199 if (fw->mask == (unsigned short)-1)
200 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
201 else
202 alc_update_coefex_idx(codec, fw->nid, fw->idx,
203 fw->mask, fw->val);
204 }
205}
206
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200207/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200208 * Append the given mixer and verb elements for the later use
209 * The mixer array is referred in build_controls(), and init_verbs are
210 * called in init().
Takashi Iwaid88897e2008-10-31 15:01:37 +0100211 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200212static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
Takashi Iwaid88897e2008-10-31 15:01:37 +0100213{
214 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
215 return;
216 spec->mixers[spec->num_mixers++] = mix;
217}
218
Takashi Iwaid88897e2008-10-31 15:01:37 +0100219/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200220 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100221 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200222/* Enable GPIO mask and set output */
Takashi Iwaia9111322011-05-02 11:30:18 +0200223static const struct hda_verb alc_gpio1_init_verbs[] = {
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200224 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
225 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
226 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
227 { }
228};
229
Takashi Iwaia9111322011-05-02 11:30:18 +0200230static const struct hda_verb alc_gpio2_init_verbs[] = {
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200231 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
232 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
233 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
234 { }
235};
236
Takashi Iwaia9111322011-05-02 11:30:18 +0200237static const struct hda_verb alc_gpio3_init_verbs[] = {
Kailang Yangbdd148a2007-05-08 15:19:08 +0200238 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
239 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
240 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
241 { }
242};
243
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200244/*
245 * Fix hardware PLL issue
246 * On some codecs, the analog PLL gating control must be off while
247 * the default value is 1.
248 */
249static void alc_fix_pll(struct hda_codec *codec)
250{
251 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200252
Takashi Iwai98b24882014-08-18 13:47:50 +0200253 if (spec->pll_nid)
254 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
255 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200256}
257
258static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
259 unsigned int coef_idx, unsigned int coef_bit)
260{
261 struct alc_spec *spec = codec->spec;
262 spec->pll_nid = nid;
263 spec->pll_coef_idx = coef_idx;
264 spec->pll_coef_bit = coef_bit;
265 alc_fix_pll(codec);
266}
267
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100268/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200269static void alc_update_knob_master(struct hda_codec *codec,
270 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100271{
272 unsigned int val;
273 struct snd_kcontrol *kctl;
274 struct snd_ctl_elem_value *uctl;
275
276 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
277 if (!kctl)
278 return;
279 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
280 if (!uctl)
281 return;
Takashi Iwai2ebab402016-02-09 10:23:52 +0100282 val = snd_hda_codec_read(codec, jack->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100283 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
284 val &= HDA_AMP_VOLMASK;
285 uctl->value.integer.value[0] = val;
286 uctl->value.integer.value[1] = val;
287 kctl->put(kctl, uctl);
288 kfree(uctl);
289}
290
David Henningsson29adc4b2012-09-25 11:31:00 +0200291static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100292{
David Henningsson29adc4b2012-09-25 11:31:00 +0200293 /* For some reason, the res given from ALC880 is broken.
294 Here we adjust it properly. */
295 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100296}
297
Kailang Yang394c97f2014-11-12 17:38:08 +0800298/* Change EAPD to verb control */
299static void alc_fill_eapd_coef(struct hda_codec *codec)
300{
301 int coef;
302
303 coef = alc_get_coef0(codec);
304
Takashi Iwai7639a062015-03-03 10:07:24 +0100305 switch (codec->core.vendor_id) {
Kailang Yang394c97f2014-11-12 17:38:08 +0800306 case 0x10ec0262:
307 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
308 break;
309 case 0x10ec0267:
310 case 0x10ec0268:
311 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
312 break;
313 case 0x10ec0269:
314 if ((coef & 0x00f0) == 0x0010)
315 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
316 if ((coef & 0x00f0) == 0x0020)
317 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
318 if ((coef & 0x00f0) == 0x0030)
319 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
320 break;
321 case 0x10ec0280:
322 case 0x10ec0284:
323 case 0x10ec0290:
324 case 0x10ec0292:
325 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
326 break;
Kailang Yang42314302016-02-03 15:03:50 +0800327 case 0x10ec0225:
Takashi Iwai44be77c2017-12-27 08:53:59 +0100328 case 0x10ec0295:
329 case 0x10ec0299:
330 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
331 /* fallthrough */
332 case 0x10ec0215:
Kailang Yang394c97f2014-11-12 17:38:08 +0800333 case 0x10ec0233:
Kailang Yangea04a1d2018-04-25 15:31:52 +0800334 case 0x10ec0235:
Kailang Yang736f20a2017-10-20 15:06:34 +0800335 case 0x10ec0236:
Kailang Yang394c97f2014-11-12 17:38:08 +0800336 case 0x10ec0255:
Kailang Yang4344aec2014-12-17 17:39:05 +0800337 case 0x10ec0256:
Kailang Yangf429e7e2017-12-05 15:38:24 +0800338 case 0x10ec0257:
Kailang Yang394c97f2014-11-12 17:38:08 +0800339 case 0x10ec0282:
340 case 0x10ec0283:
341 case 0x10ec0286:
342 case 0x10ec0288:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800343 case 0x10ec0285:
Kailang Yang506b62c2014-12-18 17:07:44 +0800344 case 0x10ec0298:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800345 case 0x10ec0289:
Kailang Yang394c97f2014-11-12 17:38:08 +0800346 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
347 break;
Kailang Yang3aabf942017-11-08 15:28:33 +0800348 case 0x10ec0275:
349 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
350 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800351 case 0x10ec0293:
352 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
353 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800354 case 0x10ec0234:
355 case 0x10ec0274:
356 case 0x10ec0294:
Kailang Yang6fbae352016-05-30 16:44:20 +0800357 case 0x10ec0700:
358 case 0x10ec0701:
359 case 0x10ec0703:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800360 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
361 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800362 case 0x10ec0662:
363 if ((coef & 0x00f0) == 0x0030)
364 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
365 break;
366 case 0x10ec0272:
367 case 0x10ec0273:
368 case 0x10ec0663:
369 case 0x10ec0665:
370 case 0x10ec0670:
371 case 0x10ec0671:
372 case 0x10ec0672:
373 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
374 break;
375 case 0x10ec0668:
376 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
377 break;
378 case 0x10ec0867:
379 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
380 break;
381 case 0x10ec0888:
382 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
383 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
384 break;
385 case 0x10ec0892:
386 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
387 break;
388 case 0x10ec0899:
389 case 0x10ec0900:
Kailang Yang65553b12017-07-11 15:15:47 +0800390 case 0x10ec1168:
Kailang Yanga535ad52017-01-16 16:59:26 +0800391 case 0x10ec1220:
Kailang Yang394c97f2014-11-12 17:38:08 +0800392 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
393 break;
394 }
395}
396
Kailang Yangf9423e72008-05-27 12:32:25 +0200397/* additional initialization for ALC888 variants */
398static void alc888_coef_init(struct hda_codec *codec)
399{
Kailang Yang1df88742014-10-29 16:10:13 +0800400 switch (alc_get_coef0(codec) & 0x00f0) {
401 /* alc888-VA */
402 case 0x00:
403 /* alc888-VB */
404 case 0x10:
405 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
406 break;
407 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200408}
409
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100410/* turn on/off EAPD control (only if available) */
411static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
412{
413 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
414 return;
415 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
416 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
417 on ? 2 : 0);
418}
419
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200420/* turn on/off EAPD controls of the codec */
421static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
422{
423 /* We currently only handle front, HP */
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200424 static hda_nid_t pins[] = {
Hui Wangaf95b412015-03-26 17:14:55 +0800425 0x0f, 0x10, 0x14, 0x15, 0x17, 0
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200426 };
427 hda_nid_t *p;
428 for (p = pins; *p; p++)
429 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200430}
431
Takashi Iwai1c7161532011-04-07 10:37:16 +0200432/* generic shutup callback;
Lars-Peter Clausen4ce8e6a2016-11-08 15:48:06 +0100433 * just turning off EAPD and a little pause for avoiding pop-noise
Takashi Iwai1c7161532011-04-07 10:37:16 +0200434 */
435static void alc_eapd_shutup(struct hda_codec *codec)
436{
Kailang Yang97a26572013-11-29 00:35:26 -0500437 struct alc_spec *spec = codec->spec;
438
Takashi Iwai1c7161532011-04-07 10:37:16 +0200439 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500440 if (!spec->no_depop_delay)
441 msleep(200);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200442 snd_hda_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200443}
444
Takashi Iwai1d045db2011-07-07 18:23:21 +0200445/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200446static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200447{
Kailang Yang394c97f2014-11-12 17:38:08 +0800448 alc_fill_eapd_coef(codec);
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200449 alc_auto_setup_eapd(codec, true);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200450 switch (type) {
451 case ALC_INIT_GPIO1:
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200452 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
453 break;
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200454 case ALC_INIT_GPIO2:
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200455 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
456 break;
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200457 case ALC_INIT_GPIO3:
Kailang Yangbdd148a2007-05-08 15:19:08 +0200458 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
459 break;
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200460 case ALC_INIT_DEFAULT:
Takashi Iwai7639a062015-03-03 10:07:24 +0100461 switch (codec->core.vendor_id) {
Kailang Yangc9b58002007-10-16 14:30:01 +0200462 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200463 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200464 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200465 case 0x10ec0880:
466 case 0x10ec0882:
467 case 0x10ec0883:
468 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800469 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200470 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200471 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200472 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200473 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200474 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200475 break;
476 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200477}
Kailang Yangea1fb292008-08-26 12:58:38 +0200478
Takashi Iwai1d045db2011-07-07 18:23:21 +0200479
480/*
481 * Realtek SSID verification
482 */
483
David Henningsson90622912010-10-14 14:50:18 +0200484/* Could be any non-zero and even value. When used as fixup, tells
485 * the driver to ignore any present sku defines.
486 */
487#define ALC_FIXUP_SKU_IGNORE (2)
488
Takashi Iwai23d30f22012-05-07 17:17:32 +0200489static void alc_fixup_sku_ignore(struct hda_codec *codec,
490 const struct hda_fixup *fix, int action)
491{
492 struct alc_spec *spec = codec->spec;
493 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
494 spec->cdefine.fixup = 1;
495 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
496 }
497}
498
Mengdong Linb5c66112013-11-29 00:35:35 -0500499static void alc_fixup_no_depop_delay(struct hda_codec *codec,
500 const struct hda_fixup *fix, int action)
501{
502 struct alc_spec *spec = codec->spec;
503
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500504 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500505 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500506 codec->depop_delay = 0;
507 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500508}
509
Kailang Yangda00c242010-03-19 11:23:45 +0100510static int alc_auto_parse_customize_define(struct hda_codec *codec)
511{
512 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100513 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100514 struct alc_spec *spec = codec->spec;
515
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200516 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
517
David Henningsson90622912010-10-14 14:50:18 +0200518 if (spec->cdefine.fixup) {
519 ass = spec->cdefine.sku_cfg;
520 if (ass == ALC_FIXUP_SKU_IGNORE)
521 return -1;
522 goto do_sku;
523 }
524
Takashi Iwai5100cd02014-02-15 10:03:19 +0100525 if (!codec->bus->pci)
526 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100527 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200528 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100529 goto do_sku;
530
531 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100532 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100533 nid = 0x17;
534 ass = snd_hda_codec_get_pincfg(codec, nid);
535
536 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100537 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100538 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100539 return -1;
540 }
541
542 /* check sum */
543 tmp = 0;
544 for (i = 1; i < 16; i++) {
545 if ((ass >> i) & 1)
546 tmp++;
547 }
548 if (((ass >> 16) & 0xf) != tmp)
549 return -1;
550
551 spec->cdefine.port_connectivity = ass >> 30;
552 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
553 spec->cdefine.check_sum = (ass >> 16) & 0xf;
554 spec->cdefine.customization = ass >> 8;
555do_sku:
556 spec->cdefine.sku_cfg = ass;
557 spec->cdefine.external_amp = (ass & 0x38) >> 3;
558 spec->cdefine.platform_type = (ass & 0x4) >> 2;
559 spec->cdefine.swap = (ass & 0x2) >> 1;
560 spec->cdefine.override = ass & 0x1;
561
Takashi Iwai4e76a882014-02-25 12:21:03 +0100562 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100563 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100564 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100565 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100566 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
567 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
568 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
569 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
570 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
571 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
572 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100573
574 return 0;
575}
576
Takashi Iwai08c189f2012-12-19 15:22:24 +0100577/* return the position of NID in the list, or -1 if not found */
578static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
579{
580 int i;
581 for (i = 0; i < nums; i++)
582 if (list[i] == nid)
583 return i;
584 return -1;
585}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200586/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200587static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
588{
Takashi Iwai21268962011-07-07 15:01:13 +0200589 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200590}
591
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200592/* check subsystem ID and set up device-specific initialization;
593 * return 1 if initialized, 0 if invalid SSID
594 */
595/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
596 * 31 ~ 16 : Manufacture ID
597 * 15 ~ 8 : SKU ID
598 * 7 ~ 0 : Assembly ID
599 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
600 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100601static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200602{
603 unsigned int ass, tmp, i;
604 unsigned nid;
605 struct alc_spec *spec = codec->spec;
606
David Henningsson90622912010-10-14 14:50:18 +0200607 if (spec->cdefine.fixup) {
608 ass = spec->cdefine.sku_cfg;
609 if (ass == ALC_FIXUP_SKU_IGNORE)
610 return 0;
611 goto do_sku;
612 }
613
Takashi Iwai7639a062015-03-03 10:07:24 +0100614 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100615 if (codec->bus->pci &&
616 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200617 goto do_sku;
618
619 /* invalid SSID, check the special NID pin defcfg instead */
620 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400621 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200622 * 29~21 : reserve
623 * 20 : PCBEEP input
624 * 19~16 : Check sum (15:1)
625 * 15~1 : Custom
626 * 0 : override
627 */
628 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100629 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200630 nid = 0x17;
631 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100632 codec_dbg(codec,
633 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200634 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100635 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200636 return 0;
637 if ((ass >> 30) != 1) /* no physical connection */
638 return 0;
639
640 /* check sum */
641 tmp = 0;
642 for (i = 1; i < 16; i++) {
643 if ((ass >> i) & 1)
644 tmp++;
645 }
646 if (((ass >> 16) & 0xf) != tmp)
647 return 0;
648do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100649 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100650 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200651 /*
652 * 0 : override
653 * 1 : Swap Jack
654 * 2 : 0 --> Desktop, 1 --> Laptop
655 * 3~5 : External Amplifier control
656 * 7~6 : Reserved
657 */
658 tmp = (ass & 0x38) >> 3; /* external Amp control */
659 switch (tmp) {
660 case 1:
661 spec->init_amp = ALC_INIT_GPIO1;
662 break;
663 case 3:
664 spec->init_amp = ALC_INIT_GPIO2;
665 break;
666 case 7:
667 spec->init_amp = ALC_INIT_GPIO3;
668 break;
669 case 5:
Takashi Iwai5a8cfb42010-11-26 17:11:18 +0100670 default:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200671 spec->init_amp = ALC_INIT_DEFAULT;
672 break;
673 }
674
675 /* is laptop or Desktop and enable the function "Mute internal speaker
676 * when the external headphone out jack is plugged"
677 */
678 if (!(ass & 0x8000))
679 return 1;
680 /*
681 * 10~8 : Jack location
682 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
683 * 14~13: Resvered
684 * 15 : 1 --> enable the function "Mute internal speaker
685 * when the external headphone out jack is plugged"
686 */
Takashi Iwai08c189f2012-12-19 15:22:24 +0100687 if (!spec->gen.autocfg.hp_pins[0] &&
688 !(spec->gen.autocfg.line_out_pins[0] &&
689 spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200690 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200691 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100692 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100693 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
694 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200695 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100696 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200697 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200698 return 1;
699}
Kailang Yangea1fb292008-08-26 12:58:38 +0200700
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200701/* Check the validity of ALC subsystem-id
702 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
703static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200704{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100705 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200706 struct alc_spec *spec = codec->spec;
Takashi Iwai4e76a882014-02-25 12:21:03 +0100707 codec_dbg(codec,
708 "realtek: Enable default setup for auto mode as fallback\n");
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200709 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200710 }
Takashi Iwai21268962011-07-07 15:01:13 +0200711}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200712
Takashi Iwai41e41f12005-06-08 14:48:49 +0200713/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200714 */
715
David Henningsson9d36a7d2014-10-07 10:18:42 +0200716static void alc_fixup_inv_dmic(struct hda_codec *codec,
717 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200718{
719 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100720
David Henningsson9d36a7d2014-10-07 10:18:42 +0200721 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200722}
723
Takashi Iwai603c4012008-07-30 15:01:44 +0200724
Takashi Iwai67d634c2009-11-16 15:35:59 +0100725#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100726/* additional beep mixers; the actual parameters are overwritten at build */
Takashi Iwaia9111322011-05-02 11:30:18 +0200727static const struct snd_kcontrol_new alc_beep_mixer[] = {
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100728 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
Jaroslav Kysela123c07a2009-10-21 14:48:23 +0200729 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100730 { } /* end */
731};
Takashi Iwai67d634c2009-11-16 15:35:59 +0100732#endif
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100733
Takashi Iwai2eab6942012-12-18 15:30:41 +0100734static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700735{
736 struct alc_spec *spec = codec->spec;
Takashi Iwai666a70d2012-12-17 20:29:29 +0100737 int i, err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700738
Takashi Iwai08c189f2012-12-19 15:22:24 +0100739 err = snd_hda_gen_build_controls(codec);
740 if (err < 0)
741 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700742
743 for (i = 0; i < spec->num_mixers; i++) {
744 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
745 if (err < 0)
746 return err;
747 }
Takashi Iwai2134ea42008-01-10 16:53:55 +0100748
Takashi Iwai67d634c2009-11-16 15:35:59 +0100749#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100750 /* create beep controls if needed */
751 if (spec->beep_amp) {
Takashi Iwaia9111322011-05-02 11:30:18 +0200752 const struct snd_kcontrol_new *knew;
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100753 for (knew = alc_beep_mixer; knew->name; knew++) {
754 struct snd_kcontrol *kctl;
755 kctl = snd_ctl_new1(knew, codec);
756 if (!kctl)
757 return -ENOMEM;
758 kctl->private_value = spec->beep_amp;
Jaroslav Kysela5e26dfd2009-12-10 13:57:01 +0100759 err = snd_hda_ctl_add(codec, 0, kctl);
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100760 if (err < 0)
761 return err;
762 }
763 }
Takashi Iwai67d634c2009-11-16 15:35:59 +0100764#endif
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100765
Takashi Iwai1727a772013-01-10 09:52:52 +0100766 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100767 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700768}
769
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200770
Linus Torvalds1da177e2005-04-16 15:20:36 -0700771/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100772 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200773 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200774
Linus Torvalds1da177e2005-04-16 15:20:36 -0700775static int alc_init(struct hda_codec *codec)
776{
777 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200778
Takashi Iwai546bb672012-03-07 08:37:19 +0100779 if (spec->init_hook)
780 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100781
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200782 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200783 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200784
Takashi Iwai08c189f2012-12-19 15:22:24 +0100785 snd_hda_gen_init(codec);
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100786
Takashi Iwai1727a772013-01-10 09:52:52 +0100787 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200788
Linus Torvalds1da177e2005-04-16 15:20:36 -0700789 return 0;
790}
791
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100792static inline void alc_shutup(struct hda_codec *codec)
793{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200794 struct alc_spec *spec = codec->spec;
795
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200796 if (!snd_hda_get_bool_hint(codec, "shutup"))
797 return; /* disabled explicitly by hints */
798
Takashi Iwai1c7161532011-04-07 10:37:16 +0200799 if (spec && spec->shutup)
800 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200801 else
802 snd_hda_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100803}
804
Takashi Iwai70a09762015-12-15 14:59:58 +0100805static void alc_reboot_notify(struct hda_codec *codec)
806{
807 struct alc_spec *spec = codec->spec;
808
809 if (spec && spec->reboot_notify)
810 spec->reboot_notify(codec);
811 else
812 alc_shutup(codec);
813}
814
815/* power down codec to D3 at reboot/shutdown; set as reboot_notify ops */
816static void alc_d3_at_reboot(struct hda_codec *codec)
817{
818 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
819 snd_hda_codec_write(codec, codec->core.afg, 0,
820 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
821 msleep(10);
822}
823
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100824#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700825
Takashi Iwai83012a72012-08-24 18:38:08 +0200826#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500827static void alc_power_eapd(struct hda_codec *codec)
828{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200829 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500830}
831
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200832static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100833{
834 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100835 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100836 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500837 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100838 return 0;
839}
840#endif
841
Takashi Iwai2a439522011-07-26 09:52:50 +0200842#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100843static int alc_resume(struct hda_codec *codec)
844{
Kailang Yang97a26572013-11-29 00:35:26 -0500845 struct alc_spec *spec = codec->spec;
846
847 if (!spec->no_depop_delay)
848 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100849 codec->patch_ops.init(codec);
Takashi Iwaieeecd9d2015-02-25 15:18:50 +0100850 regcache_sync(codec->core.regmap);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200851 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100852 return 0;
853}
Takashi Iwaie044c392008-10-27 16:56:24 +0100854#endif
855
Linus Torvalds1da177e2005-04-16 15:20:36 -0700856/*
857 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200858static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700859 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100860 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700861 .init = alc_init,
862 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200863 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200864#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100865 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100866 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100867 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200868#endif
Takashi Iwai70a09762015-12-15 14:59:58 +0100869 .reboot_notify = alc_reboot_notify,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700870};
871
David Henningsson29adc4b2012-09-25 11:31:00 +0200872
Takashi Iwaided255b2015-10-01 17:59:43 +0200873#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100874
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200875/*
Kailang Yang4b016932013-11-28 11:55:09 +0100876 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200877 */
878struct alc_codec_rename_table {
879 unsigned int vendor_id;
880 unsigned short coef_mask;
881 unsigned short coef_bits;
882 const char *name;
883};
884
Kailang Yang4b016932013-11-28 11:55:09 +0100885struct alc_codec_rename_pci_table {
886 unsigned int codec_vendor_id;
887 unsigned short pci_subvendor;
888 unsigned short pci_subdevice;
889 const char *name;
890};
891
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200892static struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800893 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200894 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
895 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
896 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
897 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
898 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
899 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
900 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200901 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800902 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200903 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
904 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
905 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
906 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
907 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
908 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
909 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
910 { } /* terminator */
911};
912
Kailang Yang4b016932013-11-28 11:55:09 +0100913static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
914 { 0x10ec0280, 0x1028, 0, "ALC3220" },
915 { 0x10ec0282, 0x1028, 0, "ALC3221" },
916 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +0800917 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +0100918 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +0800919 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +0100920 { 0x10ec0255, 0x1028, 0, "ALC3234" },
921 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800922 { 0x10ec0275, 0x1028, 0, "ALC3260" },
923 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +0800924 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +0800925 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +0800926 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +0800927 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +0800928 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +0800929 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800930 { 0x10ec0670, 0x1025, 0, "ALC669X" },
931 { 0x10ec0676, 0x1025, 0, "ALC679X" },
932 { 0x10ec0282, 0x1043, 0, "ALC3229" },
933 { 0x10ec0233, 0x1043, 0, "ALC3236" },
934 { 0x10ec0280, 0x103c, 0, "ALC3228" },
935 { 0x10ec0282, 0x103c, 0, "ALC3227" },
936 { 0x10ec0286, 0x103c, 0, "ALC3242" },
937 { 0x10ec0290, 0x103c, 0, "ALC3241" },
938 { 0x10ec0668, 0x103c, 0, "ALC3662" },
939 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
940 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +0100941 { } /* terminator */
942};
943
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200944static int alc_codec_rename_from_preset(struct hda_codec *codec)
945{
946 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +0100947 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200948
949 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +0100950 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200951 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200952 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200953 return alc_codec_rename(codec, p->name);
954 }
Kailang Yang4b016932013-11-28 11:55:09 +0100955
Takashi Iwai5100cd02014-02-15 10:03:19 +0100956 if (!codec->bus->pci)
957 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +0100958 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +0100959 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +0100960 continue;
961 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
962 continue;
963 if (!q->pci_subdevice ||
964 q->pci_subdevice == codec->bus->pci->subsystem_device)
965 return alc_codec_rename(codec, q->name);
966 }
967
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200968 return 0;
969}
970
Takashi Iwaie4770622011-07-08 11:11:35 +0200971
972/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200973 * Digital-beep handlers
974 */
975#ifdef CONFIG_SND_HDA_INPUT_BEEP
976#define set_beep_amp(spec, nid, idx, dir) \
977 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
978
979static const struct snd_pci_quirk beep_white_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +0200980 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -0700981 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +0200982 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +0100983 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +0200984 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
985 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
986 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +0100987 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +0200988 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
989 {}
990};
991
992static inline int has_cdefine_beep(struct hda_codec *codec)
993{
994 struct alc_spec *spec = codec->spec;
995 const struct snd_pci_quirk *q;
996 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
997 if (q)
998 return q->value;
999 return spec->cdefine.enable_pcbeep;
1000}
1001#else
1002#define set_beep_amp(spec, nid, idx, dir) /* NOP */
1003#define has_cdefine_beep(codec) 0
1004#endif
1005
1006/* parse the BIOS configuration and set up the alc_spec */
1007/* return 1 if successful, 0 if the proper config is not found,
1008 * or a negative error code
1009 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001010static int alc_parse_auto_config(struct hda_codec *codec,
1011 const hda_nid_t *ignore_nids,
1012 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001013{
1014 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001015 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001016 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001017
Takashi Iwai53c334a2011-08-23 18:27:14 +02001018 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1019 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001020 if (err < 0)
1021 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001022
1023 if (ssid_nids)
1024 alc_ssid_check(codec, ssid_nids);
1025
Takashi Iwai08c189f2012-12-19 15:22:24 +01001026 err = snd_hda_gen_parse_auto_config(codec, cfg);
1027 if (err < 0)
1028 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001029
Takashi Iwai1d045db2011-07-07 18:23:21 +02001030 return 1;
1031}
1032
Takashi Iwai3de95172012-05-07 18:03:15 +02001033/* common preparation job for alc_spec */
1034static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1035{
1036 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1037 int err;
1038
1039 if (!spec)
1040 return -ENOMEM;
1041 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001042 snd_hda_gen_spec_init(&spec->gen);
1043 spec->gen.mixer_nid = mixer_nid;
1044 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001045 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001046 /* FIXME: do we need this for all Realtek codec models? */
1047 codec->spdif_status_reset = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001048 codec->patch_ops = alc_patch_ops;
Takashi Iwai3de95172012-05-07 18:03:15 +02001049
1050 err = alc_codec_rename_from_preset(codec);
1051 if (err < 0) {
1052 kfree(spec);
1053 return err;
1054 }
1055 return 0;
1056}
1057
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001058static int alc880_parse_auto_config(struct hda_codec *codec)
1059{
1060 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001061 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001062 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1063}
1064
Takashi Iwai1d045db2011-07-07 18:23:21 +02001065/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001066 * ALC880 fix-ups
1067 */
1068enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001069 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001070 ALC880_FIXUP_GPIO2,
1071 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001072 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001073 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001074 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001075 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001076 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001077 ALC880_FIXUP_VOL_KNOB,
1078 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001079 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001080 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001081 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001082 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001083 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001084 ALC880_FIXUP_3ST_BASE,
1085 ALC880_FIXUP_3ST,
1086 ALC880_FIXUP_3ST_DIG,
1087 ALC880_FIXUP_5ST_BASE,
1088 ALC880_FIXUP_5ST,
1089 ALC880_FIXUP_5ST_DIG,
1090 ALC880_FIXUP_6ST_BASE,
1091 ALC880_FIXUP_6ST,
1092 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001093 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001094};
1095
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001096/* enable the volume-knob widget support on NID 0x21 */
1097static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001098 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001099{
Takashi Iwai1727a772013-01-10 09:52:52 +01001100 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001101 snd_hda_jack_detect_enable_callback(codec, 0x21,
1102 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001103}
1104
Takashi Iwai1727a772013-01-10 09:52:52 +01001105static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001106 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001107 .type = HDA_FIXUP_VERBS,
Takashi Iwai411225a2012-02-20 17:48:19 +01001108 .v.verbs = alc_gpio1_init_verbs,
1109 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001110 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001111 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001112 .v.verbs = alc_gpio2_init_verbs,
1113 },
1114 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001115 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001116 .v.verbs = (const struct hda_verb[]) {
1117 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1118 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1119 { }
1120 },
1121 .chained = true,
1122 .chain_id = ALC880_FIXUP_GPIO2,
1123 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001124 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001125 .type = HDA_FIXUP_PINS,
1126 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001127 /* disable bogus unused pins */
1128 { 0x16, 0x411111f0 },
1129 { 0x18, 0x411111f0 },
1130 { 0x1a, 0x411111f0 },
1131 { }
1132 }
1133 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001134 [ALC880_FIXUP_LG_LW25] = {
1135 .type = HDA_FIXUP_PINS,
1136 .v.pins = (const struct hda_pintbl[]) {
1137 { 0x1a, 0x0181344f }, /* line-in */
1138 { 0x1b, 0x0321403f }, /* headphone */
1139 { }
1140 }
1141 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001142 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001143 .type = HDA_FIXUP_PINS,
1144 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001145 /* disable bogus unused pins */
1146 { 0x17, 0x411111f0 },
1147 { }
1148 },
1149 .chained = true,
1150 .chain_id = ALC880_FIXUP_GPIO2,
1151 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001152 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001153 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001154 .v.verbs = (const struct hda_verb[]) {
1155 /* change to EAPD mode */
1156 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1157 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1158 {}
1159 },
1160 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001161 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001162 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001163 .v.verbs = (const struct hda_verb[]) {
1164 /* change to EAPD mode */
1165 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1166 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1167 {}
1168 },
1169 .chained = true,
1170 .chain_id = ALC880_FIXUP_GPIO2,
1171 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001172 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001173 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001174 .v.func = alc880_fixup_vol_knob,
1175 },
1176 [ALC880_FIXUP_FUJITSU] = {
1177 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001178 .type = HDA_FIXUP_PINS,
1179 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001180 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001181 { 0x15, 0x99030120 }, /* speaker */
1182 { 0x16, 0x99030130 }, /* bass speaker */
1183 { 0x17, 0x411111f0 }, /* N/A */
1184 { 0x18, 0x411111f0 }, /* N/A */
1185 { 0x19, 0x01a19950 }, /* mic-in */
1186 { 0x1a, 0x411111f0 }, /* N/A */
1187 { 0x1b, 0x411111f0 }, /* N/A */
1188 { 0x1c, 0x411111f0 }, /* N/A */
1189 { 0x1d, 0x411111f0 }, /* N/A */
1190 { 0x1e, 0x01454140 }, /* SPDIF out */
1191 { }
1192 },
1193 .chained = true,
1194 .chain_id = ALC880_FIXUP_VOL_KNOB,
1195 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001196 [ALC880_FIXUP_F1734] = {
1197 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001198 .type = HDA_FIXUP_PINS,
1199 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001200 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001201 { 0x15, 0x99030120 }, /* speaker */
1202 { 0x16, 0x411111f0 }, /* N/A */
1203 { 0x17, 0x411111f0 }, /* N/A */
1204 { 0x18, 0x411111f0 }, /* N/A */
1205 { 0x19, 0x01a19950 }, /* mic-in */
1206 { 0x1a, 0x411111f0 }, /* N/A */
1207 { 0x1b, 0x411111f0 }, /* N/A */
1208 { 0x1c, 0x411111f0 }, /* N/A */
1209 { 0x1d, 0x411111f0 }, /* N/A */
1210 { 0x1e, 0x411111f0 }, /* N/A */
1211 { }
1212 },
1213 .chained = true,
1214 .chain_id = ALC880_FIXUP_VOL_KNOB,
1215 },
Takashi Iwai817de922012-02-20 17:20:48 +01001216 [ALC880_FIXUP_UNIWILL] = {
1217 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001218 .type = HDA_FIXUP_PINS,
1219 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001220 { 0x14, 0x0121411f }, /* HP */
1221 { 0x15, 0x99030120 }, /* speaker */
1222 { 0x16, 0x99030130 }, /* bass speaker */
1223 { }
1224 },
1225 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001226 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001227 .type = HDA_FIXUP_PINS,
1228 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001229 /* disable bogus unused pins */
1230 { 0x17, 0x411111f0 },
1231 { 0x19, 0x411111f0 },
1232 { 0x1b, 0x411111f0 },
1233 { 0x1f, 0x411111f0 },
1234 { }
1235 }
1236 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001237 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001238 .type = HDA_FIXUP_PINS,
1239 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001240 /* set up the whole pins as BIOS is utterly broken */
1241 { 0x14, 0x99030120 }, /* speaker */
1242 { 0x15, 0x0121411f }, /* HP */
1243 { 0x16, 0x411111f0 }, /* N/A */
1244 { 0x17, 0x411111f0 }, /* N/A */
1245 { 0x18, 0x01a19950 }, /* mic-in */
1246 { 0x19, 0x411111f0 }, /* N/A */
1247 { 0x1a, 0x01813031 }, /* line-in */
1248 { 0x1b, 0x411111f0 }, /* N/A */
1249 { 0x1c, 0x411111f0 }, /* N/A */
1250 { 0x1d, 0x411111f0 }, /* N/A */
1251 { 0x1e, 0x0144111e }, /* SPDIF */
1252 { }
1253 }
1254 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001255 [ALC880_FIXUP_ASUS_W5A] = {
1256 .type = HDA_FIXUP_PINS,
1257 .v.pins = (const struct hda_pintbl[]) {
1258 /* set up the whole pins as BIOS is utterly broken */
1259 { 0x14, 0x0121411f }, /* HP */
1260 { 0x15, 0x411111f0 }, /* N/A */
1261 { 0x16, 0x411111f0 }, /* N/A */
1262 { 0x17, 0x411111f0 }, /* N/A */
1263 { 0x18, 0x90a60160 }, /* mic */
1264 { 0x19, 0x411111f0 }, /* N/A */
1265 { 0x1a, 0x411111f0 }, /* N/A */
1266 { 0x1b, 0x411111f0 }, /* N/A */
1267 { 0x1c, 0x411111f0 }, /* N/A */
1268 { 0x1d, 0x411111f0 }, /* N/A */
1269 { 0x1e, 0xb743111e }, /* SPDIF out */
1270 { }
1271 },
1272 .chained = true,
1273 .chain_id = ALC880_FIXUP_GPIO1,
1274 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001275 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001276 .type = HDA_FIXUP_PINS,
1277 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001278 { 0x14, 0x01014010 }, /* line-out */
1279 { 0x15, 0x411111f0 }, /* N/A */
1280 { 0x16, 0x411111f0 }, /* N/A */
1281 { 0x17, 0x411111f0 }, /* N/A */
1282 { 0x18, 0x01a19c30 }, /* mic-in */
1283 { 0x19, 0x0121411f }, /* HP */
1284 { 0x1a, 0x01813031 }, /* line-in */
1285 { 0x1b, 0x02a19c40 }, /* front-mic */
1286 { 0x1c, 0x411111f0 }, /* N/A */
1287 { 0x1d, 0x411111f0 }, /* N/A */
1288 /* 0x1e is filled in below */
1289 { 0x1f, 0x411111f0 }, /* N/A */
1290 { }
1291 }
1292 },
1293 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001294 .type = HDA_FIXUP_PINS,
1295 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001296 { 0x1e, 0x411111f0 }, /* N/A */
1297 { }
1298 },
1299 .chained = true,
1300 .chain_id = ALC880_FIXUP_3ST_BASE,
1301 },
1302 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001303 .type = HDA_FIXUP_PINS,
1304 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001305 { 0x1e, 0x0144111e }, /* SPDIF */
1306 { }
1307 },
1308 .chained = true,
1309 .chain_id = ALC880_FIXUP_3ST_BASE,
1310 },
1311 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001312 .type = HDA_FIXUP_PINS,
1313 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001314 { 0x14, 0x01014010 }, /* front */
1315 { 0x15, 0x411111f0 }, /* N/A */
1316 { 0x16, 0x01011411 }, /* CLFE */
1317 { 0x17, 0x01016412 }, /* surr */
1318 { 0x18, 0x01a19c30 }, /* mic-in */
1319 { 0x19, 0x0121411f }, /* HP */
1320 { 0x1a, 0x01813031 }, /* line-in */
1321 { 0x1b, 0x02a19c40 }, /* front-mic */
1322 { 0x1c, 0x411111f0 }, /* N/A */
1323 { 0x1d, 0x411111f0 }, /* N/A */
1324 /* 0x1e is filled in below */
1325 { 0x1f, 0x411111f0 }, /* N/A */
1326 { }
1327 }
1328 },
1329 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001330 .type = HDA_FIXUP_PINS,
1331 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001332 { 0x1e, 0x411111f0 }, /* N/A */
1333 { }
1334 },
1335 .chained = true,
1336 .chain_id = ALC880_FIXUP_5ST_BASE,
1337 },
1338 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001339 .type = HDA_FIXUP_PINS,
1340 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001341 { 0x1e, 0x0144111e }, /* SPDIF */
1342 { }
1343 },
1344 .chained = true,
1345 .chain_id = ALC880_FIXUP_5ST_BASE,
1346 },
1347 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001348 .type = HDA_FIXUP_PINS,
1349 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001350 { 0x14, 0x01014010 }, /* front */
1351 { 0x15, 0x01016412 }, /* surr */
1352 { 0x16, 0x01011411 }, /* CLFE */
1353 { 0x17, 0x01012414 }, /* side */
1354 { 0x18, 0x01a19c30 }, /* mic-in */
1355 { 0x19, 0x02a19c40 }, /* front-mic */
1356 { 0x1a, 0x01813031 }, /* line-in */
1357 { 0x1b, 0x0121411f }, /* HP */
1358 { 0x1c, 0x411111f0 }, /* N/A */
1359 { 0x1d, 0x411111f0 }, /* N/A */
1360 /* 0x1e is filled in below */
1361 { 0x1f, 0x411111f0 }, /* N/A */
1362 { }
1363 }
1364 },
1365 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001366 .type = HDA_FIXUP_PINS,
1367 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001368 { 0x1e, 0x411111f0 }, /* N/A */
1369 { }
1370 },
1371 .chained = true,
1372 .chain_id = ALC880_FIXUP_6ST_BASE,
1373 },
1374 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001375 .type = HDA_FIXUP_PINS,
1376 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001377 { 0x1e, 0x0144111e }, /* SPDIF */
1378 { }
1379 },
1380 .chained = true,
1381 .chain_id = ALC880_FIXUP_6ST_BASE,
1382 },
Takashi Iwai53971452013-01-23 18:21:37 +01001383 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1384 .type = HDA_FIXUP_PINS,
1385 .v.pins = (const struct hda_pintbl[]) {
1386 { 0x1b, 0x0121401f }, /* HP with jack detect */
1387 { }
1388 },
1389 .chained_before = true,
1390 .chain_id = ALC880_FIXUP_6ST_BASE,
1391 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001392};
1393
1394static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001395 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001396 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001397 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001398 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001399 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001400 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001401 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001402 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001403 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001404 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001405 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001406 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001407 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001408 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001409 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001410 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001411 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001412 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001413 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1414 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1415 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001416 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001417 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001418
1419 /* Below is the copied entries from alc880_quirks.c.
1420 * It's not quite sure whether BIOS sets the correct pin-config table
1421 * on these machines, thus they are kept to be compatible with
1422 * the old static quirks. Once when it's confirmed to work without
1423 * these overrides, it'd be better to remove.
1424 */
1425 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1426 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1427 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1428 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1429 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1430 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1431 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1432 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1433 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1434 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1435 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1436 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1437 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1438 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1439 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1440 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1441 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1442 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1443 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1444 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1445 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1446 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1447 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1448 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1449 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1450 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1451 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1452 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1453 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1454 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1455 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1456 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1457 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1458 /* default Intel */
1459 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1460 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1461 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1462 {}
1463};
1464
Takashi Iwai1727a772013-01-10 09:52:52 +01001465static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001466 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1467 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1468 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1469 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1470 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1471 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001472 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001473 {}
1474};
1475
1476
1477/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001478 * OK, here we have finally the patch for ALC880
1479 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001480static int patch_alc880(struct hda_codec *codec)
1481{
1482 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001483 int err;
1484
Takashi Iwai3de95172012-05-07 18:03:15 +02001485 err = alc_alloc_spec(codec, 0x0b);
1486 if (err < 0)
1487 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001488
Takashi Iwai3de95172012-05-07 18:03:15 +02001489 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001490 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001491 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001492
Takashi Iwai225068a2015-05-29 10:42:14 +02001493 codec->patch_ops.unsol_event = alc880_unsol_event;
1494
Takashi Iwai1727a772013-01-10 09:52:52 +01001495 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001496 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001497 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001498
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001499 /* automatic parse from the BIOS config */
1500 err = alc880_parse_auto_config(codec);
1501 if (err < 0)
1502 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001503
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001504 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001505 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001506
Takashi Iwai1727a772013-01-10 09:52:52 +01001507 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001508
Takashi Iwai1d045db2011-07-07 18:23:21 +02001509 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001510
1511 error:
1512 alc_free(codec);
1513 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001514}
1515
1516
1517/*
1518 * ALC260 support
1519 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001520static int alc260_parse_auto_config(struct hda_codec *codec)
1521{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001522 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001523 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1524 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001525}
1526
Takashi Iwai1d045db2011-07-07 18:23:21 +02001527/*
1528 * Pin config fixes
1529 */
1530enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001531 ALC260_FIXUP_HP_DC5750,
1532 ALC260_FIXUP_HP_PIN_0F,
1533 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001534 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001535 ALC260_FIXUP_GPIO1_TOGGLE,
1536 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001537 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001538 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001539 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001540 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001541 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001542};
1543
Takashi Iwai20f7d922012-02-16 12:35:16 +01001544static void alc260_gpio1_automute(struct hda_codec *codec)
1545{
1546 struct alc_spec *spec = codec->spec;
1547 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001548 spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001549}
1550
1551static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001552 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001553{
1554 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001555 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001556 /* although the machine has only one output pin, we need to
1557 * toggle GPIO1 according to the jack state
1558 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001559 spec->gen.automute_hook = alc260_gpio1_automute;
1560 spec->gen.detect_hp = 1;
1561 spec->gen.automute_speaker = 1;
1562 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001563 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001564 snd_hda_gen_hp_automute);
Takashi Iwaic9ce6b22012-12-18 18:12:44 +01001565 snd_hda_add_verbs(codec, alc_gpio1_init_verbs);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001566 }
1567}
1568
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001569static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001570 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001571{
1572 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001573 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001574 { 0x0f, 0x02214000 }, /* HP/speaker */
1575 { 0x12, 0x90a60160 }, /* int mic */
1576 { 0x13, 0x02a19000 }, /* ext mic */
1577 { 0x18, 0x01446000 }, /* SPDIF out */
1578 /* disable bogus I/O pins */
1579 { 0x10, 0x411111f0 },
1580 { 0x11, 0x411111f0 },
1581 { 0x14, 0x411111f0 },
1582 { 0x15, 0x411111f0 },
1583 { 0x16, 0x411111f0 },
1584 { 0x17, 0x411111f0 },
1585 { 0x19, 0x411111f0 },
1586 { }
1587 };
1588
1589 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001590 case HDA_FIXUP_ACT_PRE_PROBE:
1591 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001592 break;
Takashi Iwai1727a772013-01-10 09:52:52 +01001593 case HDA_FIXUP_ACT_PROBE:
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001594 spec->init_amp = ALC_INIT_NONE;
1595 break;
1596 }
1597}
1598
Takashi Iwai39aedee2013-01-10 17:10:40 +01001599static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1600 const struct hda_fixup *fix, int action)
1601{
1602 struct alc_spec *spec = codec->spec;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001603 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001604 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001605}
1606
1607static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1608 const struct hda_fixup *fix, int action)
1609{
1610 struct alc_spec *spec = codec->spec;
1611 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001612 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001613 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001614 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001615}
1616
Takashi Iwai1727a772013-01-10 09:52:52 +01001617static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001618 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001619 .type = HDA_FIXUP_PINS,
1620 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001621 { 0x11, 0x90130110 }, /* speaker */
1622 { }
1623 }
1624 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001625 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001626 .type = HDA_FIXUP_PINS,
1627 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001628 { 0x0f, 0x01214000 }, /* HP */
1629 { }
1630 }
1631 },
1632 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001633 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001634 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001635 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1636 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001637 { }
1638 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001639 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001640 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001641 .type = HDA_FIXUP_VERBS,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001642 .v.verbs = alc_gpio1_init_verbs,
1643 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001644 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001645 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001646 .v.func = alc260_fixup_gpio1_toggle,
1647 .chained = true,
1648 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1649 },
1650 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001651 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001652 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001653 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1654 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001655 { }
1656 },
1657 .chained = true,
1658 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1659 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001660 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001661 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001662 .v.func = alc260_fixup_gpio1_toggle,
1663 .chained = true,
1664 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001665 },
1666 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001667 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001668 .v.func = alc260_fixup_kn1,
1669 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001670 [ALC260_FIXUP_FSC_S7020] = {
1671 .type = HDA_FIXUP_FUNC,
1672 .v.func = alc260_fixup_fsc_s7020,
1673 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001674 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1675 .type = HDA_FIXUP_FUNC,
1676 .v.func = alc260_fixup_fsc_s7020_jwse,
1677 .chained = true,
1678 .chain_id = ALC260_FIXUP_FSC_S7020,
1679 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001680 [ALC260_FIXUP_VAIO_PINS] = {
1681 .type = HDA_FIXUP_PINS,
1682 .v.pins = (const struct hda_pintbl[]) {
1683 /* Pin configs are missing completely on some VAIOs */
1684 { 0x0f, 0x01211020 },
1685 { 0x10, 0x0001003f },
1686 { 0x11, 0x411111f0 },
1687 { 0x12, 0x01a15930 },
1688 { 0x13, 0x411111f0 },
1689 { 0x14, 0x411111f0 },
1690 { 0x15, 0x411111f0 },
1691 { 0x16, 0x411111f0 },
1692 { 0x17, 0x411111f0 },
1693 { 0x18, 0x411111f0 },
1694 { 0x19, 0x411111f0 },
1695 { }
1696 }
1697 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001698};
1699
1700static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001701 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001702 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001703 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001704 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001705 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001706 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001707 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001708 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001709 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001710 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001711 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001712 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001713 {}
1714};
1715
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001716static const struct hda_model_fixup alc260_fixup_models[] = {
1717 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1718 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1719 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1720 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1721 {}
1722};
1723
Takashi Iwai1d045db2011-07-07 18:23:21 +02001724/*
1725 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001726static int patch_alc260(struct hda_codec *codec)
1727{
1728 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001729 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001730
Takashi Iwai3de95172012-05-07 18:03:15 +02001731 err = alc_alloc_spec(codec, 0x07);
1732 if (err < 0)
1733 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001734
Takashi Iwai3de95172012-05-07 18:03:15 +02001735 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001736 /* as quite a few machines require HP amp for speaker outputs,
1737 * it's easier to enable it unconditionally; even if it's unneeded,
1738 * it's almost harmless.
1739 */
1740 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001741 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001742
Takashi Iwai225068a2015-05-29 10:42:14 +02001743 spec->shutup = alc_eapd_shutup;
1744
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001745 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1746 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001747 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001748
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001749 /* automatic parse from the BIOS config */
1750 err = alc260_parse_auto_config(codec);
1751 if (err < 0)
1752 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001753
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001754 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001755 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001756
Takashi Iwai1727a772013-01-10 09:52:52 +01001757 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001758
Takashi Iwai1d045db2011-07-07 18:23:21 +02001759 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001760
1761 error:
1762 alc_free(codec);
1763 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001764}
1765
1766
1767/*
1768 * ALC882/883/885/888/889 support
1769 *
1770 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1771 * configuration. Each pin widget can choose any input DACs and a mixer.
1772 * Each ADC is connected from a mixer of all inputs. This makes possible
1773 * 6-channel independent captures.
1774 *
1775 * In addition, an independent DAC for the multi-playback (not used in this
1776 * driver yet).
1777 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001778
1779/*
1780 * Pin config fixes
1781 */
1782enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001783 ALC882_FIXUP_ABIT_AW9D_MAX,
1784 ALC882_FIXUP_LENOVO_Y530,
1785 ALC882_FIXUP_PB_M5210,
1786 ALC882_FIXUP_ACER_ASPIRE_7736,
1787 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001788 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001789 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001790 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001791 ALC888_FIXUP_EEE1601,
Takashi Iwai177943a32011-11-09 12:55:18 +01001792 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001793 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001794 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001795 ALC882_FIXUP_GPIO1,
1796 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001797 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001798 ALC889_FIXUP_COEF,
1799 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001800 ALC882_FIXUP_ACER_ASPIRE_4930G,
1801 ALC882_FIXUP_ACER_ASPIRE_8930G,
1802 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001803 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001804 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001805 ALC889_FIXUP_MBP_VREF,
1806 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001807 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001808 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001809 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001810 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001811 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001812 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001813 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001814 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001815 ALC1220_FIXUP_GB_DUAL_CODECS,
Peisen0202f5c2017-10-26 10:35:36 +08001816 ALC1220_FIXUP_CLEVO_P950,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001817};
1818
Takashi Iwai68ef0562011-11-09 18:24:44 +01001819static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001820 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001821{
Takashi Iwai1727a772013-01-10 09:52:52 +01001822 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001823 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001824 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001825}
1826
Takashi Iwai56710872011-11-14 17:42:11 +01001827/* toggle speaker-output according to the hp-jack state */
1828static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1829{
1830 unsigned int gpiostate, gpiomask, gpiodir;
1831
Takashi Iwai7639a062015-03-03 10:07:24 +01001832 gpiostate = snd_hda_codec_read(codec, codec->core.afg, 0,
Takashi Iwai56710872011-11-14 17:42:11 +01001833 AC_VERB_GET_GPIO_DATA, 0);
1834
1835 if (!muted)
1836 gpiostate |= (1 << pin);
1837 else
1838 gpiostate &= ~(1 << pin);
1839
Takashi Iwai7639a062015-03-03 10:07:24 +01001840 gpiomask = snd_hda_codec_read(codec, codec->core.afg, 0,
Takashi Iwai56710872011-11-14 17:42:11 +01001841 AC_VERB_GET_GPIO_MASK, 0);
1842 gpiomask |= (1 << pin);
1843
Takashi Iwai7639a062015-03-03 10:07:24 +01001844 gpiodir = snd_hda_codec_read(codec, codec->core.afg, 0,
Takashi Iwai56710872011-11-14 17:42:11 +01001845 AC_VERB_GET_GPIO_DIRECTION, 0);
1846 gpiodir |= (1 << pin);
1847
1848
Takashi Iwai7639a062015-03-03 10:07:24 +01001849 snd_hda_codec_write(codec, codec->core.afg, 0,
Takashi Iwai56710872011-11-14 17:42:11 +01001850 AC_VERB_SET_GPIO_MASK, gpiomask);
Takashi Iwai7639a062015-03-03 10:07:24 +01001851 snd_hda_codec_write(codec, codec->core.afg, 0,
Takashi Iwai56710872011-11-14 17:42:11 +01001852 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1853
1854 msleep(1);
1855
Takashi Iwai7639a062015-03-03 10:07:24 +01001856 snd_hda_codec_write(codec, codec->core.afg, 0,
Takashi Iwai56710872011-11-14 17:42:11 +01001857 AC_VERB_SET_GPIO_DATA, gpiostate);
1858}
1859
1860/* set up GPIO at initialization */
1861static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001862 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001863{
Takashi Iwai1727a772013-01-10 09:52:52 +01001864 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai56710872011-11-14 17:42:11 +01001865 return;
1866 alc882_gpio_mute(codec, 0, 0);
1867 alc882_gpio_mute(codec, 1, 0);
1868}
1869
Takashi Iwai02a237b2012-02-13 15:25:07 +01001870/* Fix the connection of some pins for ALC889:
1871 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1872 * work correctly (bko#42740)
1873 */
1874static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001875 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001876{
Takashi Iwai1727a772013-01-10 09:52:52 +01001877 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001878 /* fake the connections during parsing the tree */
Takashi Iwai02a237b2012-02-13 15:25:07 +01001879 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1880 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1881 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1882 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1883 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1884 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001885 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001886 /* restore the connections */
1887 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1888 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1889 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1890 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1891 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001892 }
1893}
1894
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001895/* Set VREF on HP pin */
1896static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001897 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001898{
1899 struct alc_spec *spec = codec->spec;
Mario Kleiner9f660a12015-12-22 00:45:43 +01001900 static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001901 int i;
1902
Takashi Iwai1727a772013-01-10 09:52:52 +01001903 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001904 return;
1905 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1906 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1907 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1908 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001909 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001910 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001911 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01001912 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001913 break;
1914 }
1915}
1916
Takashi Iwai0756f092013-12-04 13:59:45 +01001917static void alc889_fixup_mac_pins(struct hda_codec *codec,
1918 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001919{
1920 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001921 int i;
1922
Takashi Iwai0756f092013-12-04 13:59:45 +01001923 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001924 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001925 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001926 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001927 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001928 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01001929 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001930}
1931
Takashi Iwai0756f092013-12-04 13:59:45 +01001932/* Set VREF on speaker pins on imac91 */
1933static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1934 const struct hda_fixup *fix, int action)
1935{
1936 static hda_nid_t nids[2] = { 0x18, 0x1a };
1937
1938 if (action == HDA_FIXUP_ACT_INIT)
1939 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1940}
1941
Adrien Vergée7729a42014-01-24 14:56:14 -05001942/* Set VREF on speaker pins on mba11 */
1943static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1944 const struct hda_fixup *fix, int action)
1945{
1946 static hda_nid_t nids[1] = { 0x18 };
1947
1948 if (action == HDA_FIXUP_ACT_INIT)
1949 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1950}
1951
Takashi Iwai0756f092013-12-04 13:59:45 +01001952/* Set VREF on speaker pins on mba21 */
1953static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1954 const struct hda_fixup *fix, int action)
1955{
1956 static hda_nid_t nids[2] = { 0x18, 0x19 };
1957
1958 if (action == HDA_FIXUP_ACT_INIT)
1959 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1960}
1961
Takashi Iwaie427c232012-07-29 10:04:08 +02001962/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09001963 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1964 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02001965 */
1966static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001967 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02001968{
1969 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02001970 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01001971 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02001972 spec->gen.no_multi_io = 1;
1973 }
Takashi Iwaie427c232012-07-29 10:04:08 +02001974}
1975
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001976static void alc_fixup_bass_chmap(struct hda_codec *codec,
1977 const struct hda_fixup *fix, int action);
1978
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001979/* For dual-codec configuration, we need to disable some features to avoid
1980 * conflicts of kctls and PCM streams
1981 */
1982static void alc_fixup_dual_codecs(struct hda_codec *codec,
1983 const struct hda_fixup *fix, int action)
1984{
1985 struct alc_spec *spec = codec->spec;
1986
1987 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1988 return;
1989 /* disable vmaster */
1990 spec->gen.suppress_vmaster = 1;
1991 /* auto-mute and auto-mic switch don't work with multiple codecs */
1992 spec->gen.suppress_auto_mute = 1;
1993 spec->gen.suppress_auto_mic = 1;
1994 /* disable aamix as well */
1995 spec->gen.mixer_nid = 0;
1996 /* add location prefix to avoid conflicts */
1997 codec->force_pin_prefix = 1;
1998}
1999
2000static void rename_ctl(struct hda_codec *codec, const char *oldname,
2001 const char *newname)
2002{
2003 struct snd_kcontrol *kctl;
2004
2005 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2006 if (kctl)
2007 strcpy(kctl->id.name, newname);
2008}
2009
2010static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2011 const struct hda_fixup *fix,
2012 int action)
2013{
2014 alc_fixup_dual_codecs(codec, fix, action);
2015 switch (action) {
2016 case HDA_FIXUP_ACT_PRE_PROBE:
2017 /* override card longname to provide a unique UCM profile */
2018 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2019 break;
2020 case HDA_FIXUP_ACT_BUILD:
2021 /* rename Capture controls depending on the codec */
2022 rename_ctl(codec, "Capture Volume",
2023 codec->addr == 0 ?
2024 "Rear-Panel Capture Volume" :
2025 "Front-Panel Capture Volume");
2026 rename_ctl(codec, "Capture Switch",
2027 codec->addr == 0 ?
2028 "Rear-Panel Capture Switch" :
2029 "Front-Panel Capture Switch");
2030 break;
2031 }
2032}
2033
Peisen0202f5c2017-10-26 10:35:36 +08002034static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2035 const struct hda_fixup *fix,
2036 int action)
2037{
2038 hda_nid_t conn1[1] = { 0x0c };
2039
2040 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2041 return;
2042
2043 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2044 /* We therefore want to make sure 0x14 (front headphone) and
2045 * 0x1b (speakers) use the stereo DAC 0x02
2046 */
2047 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
2048 snd_hda_override_conn_list(codec, 0x1b, 1, conn1);
2049}
2050
Takashi Iwai1727a772013-01-10 09:52:52 +01002051static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002052 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002053 .type = HDA_FIXUP_PINS,
2054 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002055 { 0x15, 0x01080104 }, /* side */
2056 { 0x16, 0x01011012 }, /* rear */
2057 { 0x17, 0x01016011 }, /* clfe */
2058 { }
2059 }
2060 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002061 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002062 .type = HDA_FIXUP_PINS,
2063 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002064 { 0x15, 0x99130112 }, /* rear int speakers */
2065 { 0x16, 0x99130111 }, /* subwoofer */
2066 { }
2067 }
2068 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002069 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002070 .type = HDA_FIXUP_PINCTLS,
2071 .v.pins = (const struct hda_pintbl[]) {
2072 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002073 {}
2074 }
2075 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002076 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002077 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002078 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002079 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002080 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002081 .type = HDA_FIXUP_PINS,
2082 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002083 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2084 { }
2085 }
2086 },
Marton Balint8f239212012-03-05 21:33:23 +01002087 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002088 .type = HDA_FIXUP_PINS,
2089 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002090 { 0x1c, 0x993301f0 }, /* CD */
2091 { }
2092 }
2093 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002094 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2095 .type = HDA_FIXUP_PINS,
2096 .v.pins = (const struct hda_pintbl[]) {
2097 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2098 { }
2099 },
2100 .chained = true,
2101 .chain_id = ALC889_FIXUP_CD,
2102 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002103 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002104 .type = HDA_FIXUP_PINS,
2105 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002106 { 0x17, 0x90170111 }, /* hidden surround speaker */
2107 { }
2108 }
2109 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002110 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002111 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002112 .v.verbs = (const struct hda_verb[]) {
2113 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2114 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2115 { }
2116 }
Takashi Iwai177943a32011-11-09 12:55:18 +01002117 },
2118 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002119 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a32011-11-09 12:55:18 +01002120 .v.verbs = (const struct hda_verb[]) {
2121 /* change to EAPD mode */
2122 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2123 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2124 { }
2125 }
2126 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002127 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002128 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002129 .v.verbs = (const struct hda_verb[]) {
2130 /* change to EAPD mode */
2131 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2132 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2133 { }
2134 }
2135 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002136 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002137 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002138 .v.verbs = (const struct hda_verb[]) {
2139 /* eanable EAPD on Acer laptops */
2140 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2141 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2142 { }
2143 }
2144 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002145 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002146 .type = HDA_FIXUP_VERBS,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002147 .v.verbs = alc_gpio1_init_verbs,
2148 },
2149 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002150 .type = HDA_FIXUP_VERBS,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002151 .v.verbs = alc_gpio2_init_verbs,
2152 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002153 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002154 .type = HDA_FIXUP_VERBS,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002155 .v.verbs = alc_gpio3_init_verbs,
2156 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002157 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002158 .type = HDA_FIXUP_VERBS,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002159 .v.verbs = alc_gpio1_init_verbs,
2160 .chained = true,
2161 .chain_id = ALC882_FIXUP_EAPD,
2162 },
2163 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002164 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002165 .v.func = alc889_fixup_coef,
2166 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002167 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002168 .type = HDA_FIXUP_PINS,
2169 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002170 { 0x16, 0x99130111 }, /* CLFE speaker */
2171 { 0x17, 0x99130112 }, /* surround speaker */
2172 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002173 },
2174 .chained = true,
2175 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002176 },
2177 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002178 .type = HDA_FIXUP_PINS,
2179 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002180 { 0x16, 0x99130111 }, /* CLFE speaker */
2181 { 0x1b, 0x99130112 }, /* surround speaker */
2182 { }
2183 },
2184 .chained = true,
2185 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2186 },
2187 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2188 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002189 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002190 .v.verbs = (const struct hda_verb[]) {
2191 /* Enable all DACs */
2192 /* DAC DISABLE/MUTE 1? */
2193 /* setting bits 1-5 disables DAC nids 0x02-0x06
2194 * apparently. Init=0x38 */
2195 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2196 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2197 /* DAC DISABLE/MUTE 2? */
2198 /* some bit here disables the other DACs.
2199 * Init=0x4900 */
2200 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2201 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2202 /* DMIC fix
2203 * This laptop has a stereo digital microphone.
2204 * The mics are only 1cm apart which makes the stereo
2205 * useless. However, either the mic or the ALC889
2206 * makes the signal become a difference/sum signal
2207 * instead of standard stereo, which is annoying.
2208 * So instead we flip this bit which makes the
2209 * codec replicate the sum signal to both channels,
2210 * turning it into a normal mono mic.
2211 */
2212 /* DMIC_CONTROL? Init value = 0x0001 */
2213 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2214 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2215 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2216 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2217 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002218 },
2219 .chained = true,
2220 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002221 },
Takashi Iwai56710872011-11-14 17:42:11 +01002222 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002223 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002224 .v.func = alc885_fixup_macpro_gpio,
2225 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002226 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002227 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002228 .v.func = alc889_fixup_dac_route,
2229 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002230 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002231 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002232 .v.func = alc889_fixup_mbp_vref,
2233 .chained = true,
2234 .chain_id = ALC882_FIXUP_GPIO1,
2235 },
2236 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002237 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002238 .v.func = alc889_fixup_imac91_vref,
2239 .chained = true,
2240 .chain_id = ALC882_FIXUP_GPIO1,
2241 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002242 [ALC889_FIXUP_MBA11_VREF] = {
2243 .type = HDA_FIXUP_FUNC,
2244 .v.func = alc889_fixup_mba11_vref,
2245 .chained = true,
2246 .chain_id = ALC889_FIXUP_MBP_VREF,
2247 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002248 [ALC889_FIXUP_MBA21_VREF] = {
2249 .type = HDA_FIXUP_FUNC,
2250 .v.func = alc889_fixup_mba21_vref,
2251 .chained = true,
2252 .chain_id = ALC889_FIXUP_MBP_VREF,
2253 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002254 [ALC889_FIXUP_MP11_VREF] = {
2255 .type = HDA_FIXUP_FUNC,
2256 .v.func = alc889_fixup_mba11_vref,
2257 .chained = true,
2258 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2259 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002260 [ALC889_FIXUP_MP41_VREF] = {
2261 .type = HDA_FIXUP_FUNC,
2262 .v.func = alc889_fixup_mbp_vref,
2263 .chained = true,
2264 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2265 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002266 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002267 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002268 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002269 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002270 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002271 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002272 .v.func = alc882_fixup_no_primary_hp,
2273 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002274 [ALC887_FIXUP_ASUS_BASS] = {
2275 .type = HDA_FIXUP_PINS,
2276 .v.pins = (const struct hda_pintbl[]) {
2277 {0x16, 0x99130130}, /* bass speaker */
2278 {}
2279 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002280 .chained = true,
2281 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2282 },
2283 [ALC887_FIXUP_BASS_CHMAP] = {
2284 .type = HDA_FIXUP_FUNC,
2285 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002286 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002287 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2288 .type = HDA_FIXUP_FUNC,
2289 .v.func = alc1220_fixup_gb_dual_codecs,
2290 },
Peisen0202f5c2017-10-26 10:35:36 +08002291 [ALC1220_FIXUP_CLEVO_P950] = {
2292 .type = HDA_FIXUP_FUNC,
2293 .v.func = alc1220_fixup_clevo_p950,
2294 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002295};
2296
2297static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002298 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2299 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002300 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002301 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2302 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2303 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2304 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002305 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2306 ALC882_FIXUP_ACER_ASPIRE_4930G),
2307 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2308 ALC882_FIXUP_ACER_ASPIRE_4930G),
2309 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2310 ALC882_FIXUP_ACER_ASPIRE_8930G),
2311 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2312 ALC882_FIXUP_ACER_ASPIRE_8930G),
2313 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2314 ALC882_FIXUP_ACER_ASPIRE_4930G),
2315 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2316 ALC882_FIXUP_ACER_ASPIRE_4930G),
2317 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2318 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002319 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002320 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2321 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002322 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002323 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002324 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a32011-11-09 12:55:18 +01002325 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002326 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002327 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002328 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002329 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002330 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002331 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002332 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002333 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Fernando Luis Vázquez Cao12e31a72013-02-12 16:47:44 +09002334 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaic44d9b12016-02-07 09:38:26 +01002335 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002336
2337 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002338 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2339 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2340 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002341 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002342 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2343 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002344 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2345 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002346 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002347 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002348 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002349 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2350 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002351 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002352 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2353 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2354 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002355 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002356 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002357 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2358 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002359 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002360
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002361 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002362 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002363 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002364 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai63691582017-05-22 16:32:46 +02002365 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002366 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002367 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
Peisen0202f5c2017-10-26 10:35:36 +08002368 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
Jeremy Soller2f0d5202018-05-07 09:28:45 -06002369 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002370 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2371 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002372 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002373 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002374 {}
2375};
2376
Takashi Iwai1727a772013-01-10 09:52:52 +01002377static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai912093b2012-04-11 14:03:41 +02002378 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2379 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2380 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002381 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002382 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002383 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002384 {}
2385};
2386
Takashi Iwai1d045db2011-07-07 18:23:21 +02002387/*
2388 * BIOS auto configuration
2389 */
2390/* almost identical with ALC880 parser... */
2391static int alc882_parse_auto_config(struct hda_codec *codec)
2392{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002393 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002394 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2395 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002396}
2397
Takashi Iwai1d045db2011-07-07 18:23:21 +02002398/*
2399 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002400static int patch_alc882(struct hda_codec *codec)
2401{
2402 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002403 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002404
Takashi Iwai3de95172012-05-07 18:03:15 +02002405 err = alc_alloc_spec(codec, 0x0b);
2406 if (err < 0)
2407 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002408
Takashi Iwai3de95172012-05-07 18:03:15 +02002409 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002410
Takashi Iwai7639a062015-03-03 10:07:24 +01002411 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002412 case 0x10ec0882:
2413 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002414 case 0x10ec0900:
Kailang Yanga535ad52017-01-16 16:59:26 +08002415 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002416 break;
2417 default:
2418 /* ALC883 and variants */
2419 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2420 break;
2421 }
2422
Takashi Iwai1727a772013-01-10 09:52:52 +01002423 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002424 alc882_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002425 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002426
2427 alc_auto_parse_customize_define(codec);
2428
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002429 if (has_cdefine_beep(codec))
2430 spec->gen.beep_nid = 0x01;
2431
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002432 /* automatic parse from the BIOS config */
2433 err = alc882_parse_auto_config(codec);
2434 if (err < 0)
2435 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002436
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002437 if (!spec->gen.no_analog && spec->gen.beep_nid)
Takashi Iwai1d045db2011-07-07 18:23:21 +02002438 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2439
Takashi Iwai1727a772013-01-10 09:52:52 +01002440 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002441
Takashi Iwai1d045db2011-07-07 18:23:21 +02002442 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002443
2444 error:
2445 alc_free(codec);
2446 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002447}
2448
2449
2450/*
2451 * ALC262 support
2452 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002453static int alc262_parse_auto_config(struct hda_codec *codec)
2454{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002455 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002456 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2457 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002458}
2459
2460/*
2461 * Pin config fixes
2462 */
2463enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002464 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002465 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002466 ALC262_FIXUP_HP_Z200,
2467 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002468 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002469 ALC262_FIXUP_BENQ,
2470 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002471 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002472 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002473};
2474
Takashi Iwai1727a772013-01-10 09:52:52 +01002475static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002476 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002477 .type = HDA_FIXUP_PINS,
2478 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002479 { 0x14, 0x99130110 }, /* speaker */
2480 { 0x15, 0x0221142f }, /* front HP */
2481 { 0x1b, 0x0121141f }, /* rear HP */
2482 { }
2483 }
2484 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002485 [ALC262_FIXUP_FSC_S7110] = {
2486 .type = HDA_FIXUP_PINS,
2487 .v.pins = (const struct hda_pintbl[]) {
2488 { 0x15, 0x90170110 }, /* speaker */
2489 { }
2490 },
2491 .chained = true,
2492 .chain_id = ALC262_FIXUP_BENQ,
2493 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002494 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002495 .type = HDA_FIXUP_PINS,
2496 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002497 { 0x16, 0x99130120 }, /* internal speaker */
2498 { }
2499 }
2500 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002501 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002502 .type = HDA_FIXUP_PINS,
2503 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002504 { 0x14, 0x1993e1f0 }, /* int AUX */
2505 { }
2506 }
2507 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002508 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002509 .type = HDA_FIXUP_PINCTLS,
2510 .v.pins = (const struct hda_pintbl[]) {
2511 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002512 {}
2513 },
2514 .chained = true,
2515 .chain_id = ALC262_FIXUP_BENQ,
2516 },
2517 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002518 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002519 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002520 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2521 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2522 {}
2523 }
2524 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002525 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002526 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002527 .v.verbs = (const struct hda_verb[]) {
2528 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2529 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2530 {}
2531 }
2532 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002533 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002534 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002535 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002536 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002537 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2538 .type = HDA_FIXUP_FUNC,
2539 .v.func = alc_fixup_no_depop_delay,
2540 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002541};
2542
2543static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002544 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002545 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002546 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002547 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2548 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002549 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002550 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2551 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002552 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002553 {}
2554};
2555
Takashi Iwai1727a772013-01-10 09:52:52 +01002556static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002557 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2558 {}
2559};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002560
Takashi Iwai1d045db2011-07-07 18:23:21 +02002561/*
2562 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002563static int patch_alc262(struct hda_codec *codec)
2564{
2565 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002566 int err;
2567
Takashi Iwai3de95172012-05-07 18:03:15 +02002568 err = alc_alloc_spec(codec, 0x0b);
2569 if (err < 0)
2570 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002571
Takashi Iwai3de95172012-05-07 18:03:15 +02002572 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002573 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002574
Takashi Iwai225068a2015-05-29 10:42:14 +02002575 spec->shutup = alc_eapd_shutup;
2576
Takashi Iwai1d045db2011-07-07 18:23:21 +02002577#if 0
2578 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2579 * under-run
2580 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002581 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002582#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002583 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2584
Takashi Iwai1727a772013-01-10 09:52:52 +01002585 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002586 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002587 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002588
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002589 alc_auto_parse_customize_define(codec);
2590
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002591 if (has_cdefine_beep(codec))
2592 spec->gen.beep_nid = 0x01;
2593
Takashi Iwai42399f72011-11-07 17:18:44 +01002594 /* automatic parse from the BIOS config */
2595 err = alc262_parse_auto_config(codec);
2596 if (err < 0)
2597 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002598
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002599 if (!spec->gen.no_analog && spec->gen.beep_nid)
Takashi Iwai1d045db2011-07-07 18:23:21 +02002600 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2601
Takashi Iwai1727a772013-01-10 09:52:52 +01002602 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002603
Takashi Iwai1d045db2011-07-07 18:23:21 +02002604 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002605
2606 error:
2607 alc_free(codec);
2608 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002609}
2610
2611/*
2612 * ALC268
2613 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002614/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002615static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2616 struct snd_ctl_elem_value *ucontrol)
2617{
2618 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2619 unsigned long pval;
2620 int err;
2621
2622 mutex_lock(&codec->control_mutex);
2623 pval = kcontrol->private_value;
2624 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2625 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2626 if (err >= 0) {
2627 kcontrol->private_value = (pval & ~0xff) | 0x10;
2628 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2629 }
2630 kcontrol->private_value = pval;
2631 mutex_unlock(&codec->control_mutex);
2632 return err;
2633}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002634
2635static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2636 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002637 {
2638 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2639 .name = "Beep Playback Switch",
2640 .subdevice = HDA_SUBDEV_AMP_FLAG,
2641 .info = snd_hda_mixer_amp_switch_info,
2642 .get = snd_hda_mixer_amp_switch_get,
2643 .put = alc268_beep_switch_put,
2644 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2645 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002646 { }
2647};
2648
2649/* set PCBEEP vol = 0, mute connections */
2650static const struct hda_verb alc268_beep_init_verbs[] = {
2651 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2652 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2653 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2654 { }
2655};
2656
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002657enum {
2658 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002659 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002660 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002661};
2662
Takashi Iwai1727a772013-01-10 09:52:52 +01002663static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002664 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002665 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002666 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002667 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002668 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002669 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002670 .v.verbs = (const struct hda_verb[]) {
2671 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2672 {}
2673 }
2674 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002675 [ALC268_FIXUP_SPDIF] = {
2676 .type = HDA_FIXUP_PINS,
2677 .v.pins = (const struct hda_pintbl[]) {
2678 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2679 {}
2680 }
2681 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002682};
2683
Takashi Iwai1727a772013-01-10 09:52:52 +01002684static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002685 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002686 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2687 {}
2688};
2689
2690static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002691 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002692 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002693 /* below is codec SSID since multiple Toshiba laptops have the
2694 * same PCI SSID 1179:ff00
2695 */
2696 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002697 {}
2698};
2699
Takashi Iwai1d045db2011-07-07 18:23:21 +02002700/*
2701 * BIOS auto configuration
2702 */
2703static int alc268_parse_auto_config(struct hda_codec *codec)
2704{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002705 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002706 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002707}
2708
Takashi Iwai1d045db2011-07-07 18:23:21 +02002709/*
2710 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002711static int patch_alc268(struct hda_codec *codec)
2712{
2713 struct alc_spec *spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002714 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002715
Takashi Iwai1d045db2011-07-07 18:23:21 +02002716 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002717 err = alc_alloc_spec(codec, 0);
2718 if (err < 0)
2719 return err;
2720
2721 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002722 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002723
Takashi Iwai225068a2015-05-29 10:42:14 +02002724 spec->shutup = alc_eapd_shutup;
2725
Takashi Iwai1727a772013-01-10 09:52:52 +01002726 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2727 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002728
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002729 /* automatic parse from the BIOS config */
2730 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002731 if (err < 0)
2732 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002733
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002734 if (err > 0 && !spec->gen.no_analog &&
2735 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2736 add_mixer(spec, alc268_beep_mixer);
2737 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002738 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2739 /* override the amp caps for beep generator */
2740 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2741 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2742 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2743 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2744 (0 << AC_AMPCAP_MUTE_SHIFT));
2745 }
2746
Takashi Iwai1727a772013-01-10 09:52:52 +01002747 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002748
Takashi Iwai1d045db2011-07-07 18:23:21 +02002749 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002750
2751 error:
2752 alc_free(codec);
2753 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002754}
2755
2756/*
2757 * ALC269
2758 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01002759
Takashi Iwai1d045db2011-07-07 18:23:21 +02002760static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002761 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002762};
2763
2764static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002765 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002766};
2767
Takashi Iwai1d045db2011-07-07 18:23:21 +02002768/* different alc269-variants */
2769enum {
2770 ALC269_TYPE_ALC269VA,
2771 ALC269_TYPE_ALC269VB,
2772 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02002773 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01002774 ALC269_TYPE_ALC280,
2775 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02002776 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01002777 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08002778 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02002779 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08002780 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02002781 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08002782 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08002783 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08002784 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08002785 ALC269_TYPE_ALC225,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08002786 ALC269_TYPE_ALC294,
Kailang Yang6fbae352016-05-30 16:44:20 +08002787 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002788};
2789
2790/*
2791 * BIOS auto configuration
2792 */
2793static int alc269_parse_auto_config(struct hda_codec *codec)
2794{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002795 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002796 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2797 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2798 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02002799 const hda_nid_t *ssids;
2800
2801 switch (spec->codec_variant) {
2802 case ALC269_TYPE_ALC269VA:
2803 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01002804 case ALC269_TYPE_ALC280:
2805 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08002806 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02002807 ssids = alc269va_ssids;
2808 break;
2809 case ALC269_TYPE_ALC269VB:
2810 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01002811 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02002812 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02002813 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08002814 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02002815 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08002816 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08002817 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08002818 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08002819 case ALC269_TYPE_ALC225:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08002820 case ALC269_TYPE_ALC294:
Kailang Yang6fbae352016-05-30 16:44:20 +08002821 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02002822 ssids = alc269_ssids;
2823 break;
2824 default:
2825 ssids = alc269_ssids;
2826 break;
2827 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002828
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002829 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002830}
2831
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002832static int find_ext_mic_pin(struct hda_codec *codec);
2833
2834static void alc286_shutup(struct hda_codec *codec)
2835{
Takashi Iwaia9c2dfc2018-04-23 17:24:56 +02002836 const struct hda_pincfg *pin;
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002837 int i;
2838 int mic_pin = find_ext_mic_pin(codec);
2839 /* don't shut up pins when unloading the driver; otherwise it breaks
2840 * the default pin setup at the next load of the driver
2841 */
2842 if (codec->bus->shutdown)
2843 return;
Takashi Iwaia9c2dfc2018-04-23 17:24:56 +02002844 snd_array_for_each(&codec->init_pins, i, pin) {
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002845 /* use read here for syncing after issuing each verb */
2846 if (pin->nid != mic_pin)
2847 snd_hda_codec_read(codec, pin->nid, 0,
2848 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2849 }
2850 codec->pins_shutup = 1;
2851}
2852
Kailang Yang1387e2d2012-11-08 10:23:18 +01002853static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02002854{
Takashi Iwai98b24882014-08-18 13:47:50 +02002855 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002856}
2857
2858static void alc269_shutup(struct hda_codec *codec)
2859{
Kailang Yangadcc70b2012-05-25 08:08:38 +02002860 struct alc_spec *spec = codec->spec;
2861
Kailang Yang1387e2d2012-11-08 10:23:18 +01002862 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2863 alc269vb_toggle_power_output(codec, 0);
2864 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2865 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002866 msleep(150);
2867 }
Takashi Iwai9bfb2842013-07-24 14:31:50 +02002868 snd_hda_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002869}
2870
Takashi Iwai54db6c32014-08-18 15:11:19 +02002871static struct coef_fw alc282_coefs[] = {
2872 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08002873 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02002874 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2875 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2876 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2877 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2878 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2879 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2880 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2881 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2882 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2883 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2884 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2885 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2886 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2887 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2888 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2889 WRITE_COEF(0x63, 0x2902), /* PLL */
2890 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2891 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2892 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2893 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2894 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2895 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2896 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2897 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2898 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2899 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2900 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2901 {}
2902};
2903
Kailang Yangcb149cb2014-03-18 16:45:32 +08002904static void alc282_restore_default_value(struct hda_codec *codec)
2905{
Takashi Iwai54db6c32014-08-18 15:11:19 +02002906 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08002907}
2908
Kailang Yang7b5c7a02014-03-18 16:15:54 +08002909static void alc282_init(struct hda_codec *codec)
2910{
2911 struct alc_spec *spec = codec->spec;
2912 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2913 bool hp_pin_sense;
2914 int coef78;
2915
Kailang Yangcb149cb2014-03-18 16:45:32 +08002916 alc282_restore_default_value(codec);
2917
Kailang Yang7b5c7a02014-03-18 16:15:54 +08002918 if (!hp_pin)
2919 return;
2920 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2921 coef78 = alc_read_coef_idx(codec, 0x78);
2922
2923 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2924 /* Headphone capless set to high power mode */
2925 alc_write_coef_idx(codec, 0x78, 0x9004);
2926
2927 if (hp_pin_sense)
2928 msleep(2);
2929
2930 snd_hda_codec_write(codec, hp_pin, 0,
2931 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2932
2933 if (hp_pin_sense)
2934 msleep(85);
2935
2936 snd_hda_codec_write(codec, hp_pin, 0,
2937 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2938
2939 if (hp_pin_sense)
2940 msleep(100);
2941
2942 /* Headphone capless set to normal mode */
2943 alc_write_coef_idx(codec, 0x78, coef78);
2944}
2945
2946static void alc282_shutup(struct hda_codec *codec)
2947{
2948 struct alc_spec *spec = codec->spec;
2949 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2950 bool hp_pin_sense;
2951 int coef78;
2952
2953 if (!hp_pin) {
2954 alc269_shutup(codec);
2955 return;
2956 }
2957
2958 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2959 coef78 = alc_read_coef_idx(codec, 0x78);
2960 alc_write_coef_idx(codec, 0x78, 0x9004);
2961
2962 if (hp_pin_sense)
2963 msleep(2);
2964
2965 snd_hda_codec_write(codec, hp_pin, 0,
2966 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2967
2968 if (hp_pin_sense)
2969 msleep(85);
2970
2971 snd_hda_codec_write(codec, hp_pin, 0,
2972 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2973
2974 if (hp_pin_sense)
2975 msleep(100);
2976
2977 alc_auto_setup_eapd(codec, false);
2978 snd_hda_shutup_pins(codec);
2979 alc_write_coef_idx(codec, 0x78, coef78);
2980}
2981
Takashi Iwai54db6c32014-08-18 15:11:19 +02002982static struct coef_fw alc283_coefs[] = {
2983 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08002984 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02002985 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2986 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2987 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2988 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2989 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2990 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
2991 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2992 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2993 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
2994 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
2995 WRITE_COEF(0x22, 0xa0c0), /* ANC */
2996 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
2997 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2998 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2999 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3000 WRITE_COEF(0x2e, 0x2902), /* PLL */
3001 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3002 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3003 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3004 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3005 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3006 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3007 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3008 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3009 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3010 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3011 WRITE_COEF(0x49, 0x0), /* test mode */
3012 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3013 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3014 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003015 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003016 {}
3017};
3018
Kailang Yang6bd55b02014-03-17 13:51:27 +08003019static void alc283_restore_default_value(struct hda_codec *codec)
3020{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003021 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003022}
3023
Kailang Yang2af02be2013-08-22 10:03:50 +02003024static void alc283_init(struct hda_codec *codec)
3025{
3026 struct alc_spec *spec = codec->spec;
3027 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3028 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003029
Kailang Yang8314f222014-04-03 17:28:39 +08003030 if (!spec->gen.autocfg.hp_outs) {
3031 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3032 hp_pin = spec->gen.autocfg.line_out_pins[0];
3033 }
3034
Kailang Yang6bd55b02014-03-17 13:51:27 +08003035 alc283_restore_default_value(codec);
3036
Kailang Yang2af02be2013-08-22 10:03:50 +02003037 if (!hp_pin)
3038 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003039
3040 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003041 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3042
3043 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3044 /* Headphone capless set to high power mode */
3045 alc_write_coef_idx(codec, 0x43, 0x9004);
3046
3047 snd_hda_codec_write(codec, hp_pin, 0,
3048 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3049
3050 if (hp_pin_sense)
3051 msleep(85);
3052
3053 snd_hda_codec_write(codec, hp_pin, 0,
3054 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3055
3056 if (hp_pin_sense)
3057 msleep(85);
3058 /* Index 0x46 Combo jack auto switch control 2 */
3059 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003060 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003061 /* Headphone capless set to normal mode */
3062 alc_write_coef_idx(codec, 0x43, 0x9614);
3063}
3064
3065static void alc283_shutup(struct hda_codec *codec)
3066{
3067 struct alc_spec *spec = codec->spec;
3068 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3069 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003070
Kailang Yang8314f222014-04-03 17:28:39 +08003071 if (!spec->gen.autocfg.hp_outs) {
3072 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3073 hp_pin = spec->gen.autocfg.line_out_pins[0];
3074 }
3075
Kailang Yang2af02be2013-08-22 10:03:50 +02003076 if (!hp_pin) {
3077 alc269_shutup(codec);
3078 return;
3079 }
3080
3081 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3082
3083 alc_write_coef_idx(codec, 0x43, 0x9004);
3084
Harsha Priyab450b172014-10-09 11:04:56 +00003085 /*depop hp during suspend*/
3086 alc_write_coef_idx(codec, 0x06, 0x2100);
3087
Kailang Yang2af02be2013-08-22 10:03:50 +02003088 snd_hda_codec_write(codec, hp_pin, 0,
3089 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3090
3091 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003092 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003093
3094 snd_hda_codec_write(codec, hp_pin, 0,
3095 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3096
Takashi Iwai98b24882014-08-18 13:47:50 +02003097 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003098
3099 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003100 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003101 alc_auto_setup_eapd(codec, false);
Kailang Yang2af02be2013-08-22 10:03:50 +02003102 snd_hda_shutup_pins(codec);
3103 alc_write_coef_idx(codec, 0x43, 0x9614);
3104}
3105
Kailang Yang4a219ef2017-06-16 16:54:35 +08003106static void alc256_init(struct hda_codec *codec)
3107{
3108 struct alc_spec *spec = codec->spec;
3109 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3110 bool hp_pin_sense;
3111
3112 if (!hp_pin)
3113 return;
3114
3115 msleep(30);
3116
3117 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3118
3119 if (hp_pin_sense)
3120 msleep(2);
3121
3122 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3123
3124 snd_hda_codec_write(codec, hp_pin, 0,
3125 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3126
3127 if (hp_pin_sense)
3128 msleep(85);
3129
3130 snd_hda_codec_write(codec, hp_pin, 0,
3131 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3132
3133 if (hp_pin_sense)
3134 msleep(100);
3135
3136 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3137 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003138 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3139 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003140}
3141
3142static void alc256_shutup(struct hda_codec *codec)
3143{
3144 struct alc_spec *spec = codec->spec;
3145 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3146 bool hp_pin_sense;
3147
3148 if (!hp_pin) {
3149 alc269_shutup(codec);
3150 return;
3151 }
3152
3153 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3154
3155 if (hp_pin_sense)
3156 msleep(2);
3157
3158 snd_hda_codec_write(codec, hp_pin, 0,
3159 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3160
3161 if (hp_pin_sense)
3162 msleep(85);
3163
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003164 /* 3k pull low control for Headset jack. */
3165 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3166 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3167
Kailang Yang4a219ef2017-06-16 16:54:35 +08003168 snd_hda_codec_write(codec, hp_pin, 0,
3169 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3170
Kailang Yang4a219ef2017-06-16 16:54:35 +08003171 if (hp_pin_sense)
3172 msleep(100);
3173
3174 alc_auto_setup_eapd(codec, false);
3175 snd_hda_shutup_pins(codec);
3176}
3177
Kailang Yangda911b12018-01-05 16:50:08 +08003178static void alc225_init(struct hda_codec *codec)
3179{
3180 struct alc_spec *spec = codec->spec;
3181 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3182 bool hp1_pin_sense, hp2_pin_sense;
3183
3184 if (!hp_pin)
3185 return;
3186
3187 msleep(30);
3188
3189 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3190 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3191
3192 if (hp1_pin_sense || hp2_pin_sense)
3193 msleep(2);
3194
3195 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3196
3197 if (hp1_pin_sense)
3198 snd_hda_codec_write(codec, hp_pin, 0,
3199 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3200 if (hp2_pin_sense)
3201 snd_hda_codec_write(codec, 0x16, 0,
3202 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3203
3204 if (hp1_pin_sense || hp2_pin_sense)
3205 msleep(85);
3206
3207 if (hp1_pin_sense)
3208 snd_hda_codec_write(codec, hp_pin, 0,
3209 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3210 if (hp2_pin_sense)
3211 snd_hda_codec_write(codec, 0x16, 0,
3212 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3213
3214 if (hp1_pin_sense || hp2_pin_sense)
3215 msleep(100);
3216
3217 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3218 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3219}
3220
3221static void alc225_shutup(struct hda_codec *codec)
3222{
3223 struct alc_spec *spec = codec->spec;
3224 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3225 bool hp1_pin_sense, hp2_pin_sense;
3226
3227 if (!hp_pin) {
3228 alc269_shutup(codec);
3229 return;
3230 }
3231
3232 /* 3k pull low control for Headset jack. */
3233 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3234
3235 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3236 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3237
3238 if (hp1_pin_sense || hp2_pin_sense)
3239 msleep(2);
3240
3241 if (hp1_pin_sense)
3242 snd_hda_codec_write(codec, hp_pin, 0,
3243 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3244 if (hp2_pin_sense)
3245 snd_hda_codec_write(codec, 0x16, 0,
3246 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3247
3248 if (hp1_pin_sense || hp2_pin_sense)
3249 msleep(85);
3250
3251 if (hp1_pin_sense)
3252 snd_hda_codec_write(codec, hp_pin, 0,
3253 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3254 if (hp2_pin_sense)
3255 snd_hda_codec_write(codec, 0x16, 0,
3256 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3257
3258 if (hp1_pin_sense || hp2_pin_sense)
3259 msleep(100);
3260
3261 alc_auto_setup_eapd(codec, false);
3262 snd_hda_shutup_pins(codec);
3263}
3264
Kailang Yangc2d6af52017-06-21 14:50:54 +08003265static void alc_default_init(struct hda_codec *codec)
3266{
3267 struct alc_spec *spec = codec->spec;
3268 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3269 bool hp_pin_sense;
3270
3271 if (!hp_pin)
3272 return;
3273
3274 msleep(30);
3275
3276 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3277
3278 if (hp_pin_sense)
3279 msleep(2);
3280
3281 snd_hda_codec_write(codec, hp_pin, 0,
3282 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3283
3284 if (hp_pin_sense)
3285 msleep(85);
3286
3287 snd_hda_codec_write(codec, hp_pin, 0,
3288 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3289
3290 if (hp_pin_sense)
3291 msleep(100);
3292}
3293
3294static void alc_default_shutup(struct hda_codec *codec)
3295{
3296 struct alc_spec *spec = codec->spec;
3297 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3298 bool hp_pin_sense;
3299
3300 if (!hp_pin) {
3301 alc269_shutup(codec);
3302 return;
3303 }
3304
3305 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3306
3307 if (hp_pin_sense)
3308 msleep(2);
3309
3310 snd_hda_codec_write(codec, hp_pin, 0,
3311 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3312
3313 if (hp_pin_sense)
3314 msleep(85);
3315
3316 snd_hda_codec_write(codec, hp_pin, 0,
3317 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3318
3319 if (hp_pin_sense)
3320 msleep(100);
3321
3322 alc_auto_setup_eapd(codec, false);
3323 snd_hda_shutup_pins(codec);
3324}
3325
Kailang Yangad60d502013-06-28 12:03:01 +02003326static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3327 unsigned int val)
3328{
3329 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3330 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3331 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3332}
3333
3334static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3335{
3336 unsigned int val;
3337
3338 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3339 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3340 & 0xffff;
3341 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3342 << 16;
3343 return val;
3344}
3345
3346static void alc5505_dsp_halt(struct hda_codec *codec)
3347{
3348 unsigned int val;
3349
3350 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3351 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3352 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3353 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3354 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3355 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3356 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3357 val = alc5505_coef_get(codec, 0x6220);
3358 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3359}
3360
3361static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3362{
3363 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3364 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3365 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3366 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3367 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3368 alc5505_coef_set(codec, 0x880c, 0x00000004);
3369}
3370
3371static void alc5505_dsp_init(struct hda_codec *codec)
3372{
3373 unsigned int val;
3374
3375 alc5505_dsp_halt(codec);
3376 alc5505_dsp_back_from_halt(codec);
3377 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3378 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3379 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3380 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3381 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3382 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3383 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3384 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3385 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3386 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3387 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3388 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3389 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3390
3391 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3392 if (val <= 3)
3393 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3394 else
3395 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3396
3397 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3398 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3399 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3400 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3401 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3402 alc5505_coef_set(codec, 0x880c, 0x00000003);
3403 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003404
3405#ifdef HALT_REALTEK_ALC5505
3406 alc5505_dsp_halt(codec);
3407#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003408}
3409
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003410#ifdef HALT_REALTEK_ALC5505
3411#define alc5505_dsp_suspend(codec) /* NOP */
3412#define alc5505_dsp_resume(codec) /* NOP */
3413#else
3414#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3415#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3416#endif
3417
Takashi Iwai2a439522011-07-26 09:52:50 +02003418#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003419static int alc269_suspend(struct hda_codec *codec)
3420{
3421 struct alc_spec *spec = codec->spec;
3422
3423 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003424 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003425 return alc_suspend(codec);
3426}
3427
Takashi Iwai1d045db2011-07-07 18:23:21 +02003428static int alc269_resume(struct hda_codec *codec)
3429{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003430 struct alc_spec *spec = codec->spec;
3431
Kailang Yang1387e2d2012-11-08 10:23:18 +01003432 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3433 alc269vb_toggle_power_output(codec, 0);
3434 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003435 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003436 msleep(150);
3437 }
3438
3439 codec->patch_ops.init(codec);
3440
Kailang Yang1387e2d2012-11-08 10:23:18 +01003441 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3442 alc269vb_toggle_power_output(codec, 1);
3443 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003444 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003445 msleep(200);
3446 }
3447
Takashi Iwaieeecd9d2015-02-25 15:18:50 +01003448 regcache_sync(codec->core.regmap);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003449 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003450
3451 /* on some machine, the BIOS will clear the codec gpio data when enter
3452 * suspend, and won't restore the data after resume, so we restore it
3453 * in the driver.
3454 */
3455 if (spec->gpio_led)
Takashi Iwai7639a062015-03-03 10:07:24 +01003456 snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_SET_GPIO_DATA,
Hui Wangf4753712014-08-19 12:07:03 +08003457 spec->gpio_led);
3458
Kailang Yangad60d502013-06-28 12:03:01 +02003459 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003460 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003461
Takashi Iwai1d045db2011-07-07 18:23:21 +02003462 return 0;
3463}
Takashi Iwai2a439522011-07-26 09:52:50 +02003464#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003465
David Henningsson108cc102012-07-20 10:37:25 +02003466static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003467 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003468{
3469 struct alc_spec *spec = codec->spec;
3470
Takashi Iwai1727a772013-01-10 09:52:52 +01003471 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003472 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3473}
3474
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01003475static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3476 const struct hda_fixup *fix,
3477 int action)
3478{
3479 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3480 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3481
3482 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3483 snd_hda_codec_set_pincfg(codec, 0x19,
3484 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3485 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3486}
3487
Takashi Iwai1d045db2011-07-07 18:23:21 +02003488static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003489 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003490{
Takashi Iwai98b24882014-08-18 13:47:50 +02003491 if (action == HDA_FIXUP_ACT_INIT)
3492 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003493}
3494
David Henningsson7c478f02013-10-11 10:18:46 +02003495static void alc269_fixup_headset_mic(struct hda_codec *codec,
3496 const struct hda_fixup *fix, int action)
3497{
3498 struct alc_spec *spec = codec->spec;
3499
3500 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3501 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3502}
3503
Takashi Iwai1d045db2011-07-07 18:23:21 +02003504static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003505 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003506{
3507 static const struct hda_verb verbs[] = {
3508 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3509 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3510 {}
3511 };
3512 unsigned int cfg;
3513
Takashi Iwai7639a062015-03-03 10:07:24 +01003514 if (strcmp(codec->core.chip_name, "ALC271X") &&
3515 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02003516 return;
3517 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3518 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3519 snd_hda_sequence_write(codec, verbs);
3520}
3521
Takashi Iwai017f2a12011-07-09 14:42:25 +02003522static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003523 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003524{
3525 struct alc_spec *spec = codec->spec;
3526
Takashi Iwai1727a772013-01-10 09:52:52 +01003527 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003528 return;
3529
3530 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3531 * fix the sample rate of analog I/O to 44.1kHz
3532 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003533 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3534 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02003535}
3536
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003537static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003538 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003539{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003540 /* The digital-mic unit sends PDM (differential signal) instead of
3541 * the standard PCM, thus you can't record a valid mono stream as is.
3542 * Below is a workaround specific to ALC269 to control the dmic
3543 * signal source as mono.
3544 */
Takashi Iwai98b24882014-08-18 13:47:50 +02003545 if (action == HDA_FIXUP_ACT_INIT)
3546 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003547}
3548
Takashi Iwai24519912011-08-16 15:08:49 +02003549static void alc269_quanta_automute(struct hda_codec *codec)
3550{
Takashi Iwai08c189f2012-12-19 15:22:24 +01003551 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02003552
Takashi Iwai1687ccc2014-08-18 13:49:35 +02003553 alc_write_coef_idx(codec, 0x0c, 0x680);
3554 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02003555}
3556
3557static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003558 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02003559{
3560 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01003561 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02003562 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01003563 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02003564}
3565
David Henningssond240d1d2013-04-15 12:50:02 +02003566static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02003567 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02003568{
3569 struct alc_spec *spec = codec->spec;
3570 int vref;
3571 msleep(200);
3572 snd_hda_gen_hp_automute(codec, jack);
3573
3574 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3575 msleep(100);
3576 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3577 vref);
3578 msleep(500);
3579 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3580 vref);
3581}
3582
3583static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3584 const struct hda_fixup *fix, int action)
3585{
3586 struct alc_spec *spec = codec->spec;
3587 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3588 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3589 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3590 }
3591}
3592
3593
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003594/* update mute-LED according to the speaker mute state via mic VREF pin */
3595static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003596{
3597 struct hda_codec *codec = private_data;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003598 struct alc_spec *spec = codec->spec;
3599 unsigned int pinval;
3600
3601 if (spec->mute_led_polarity)
3602 enabled = !enabled;
Takashi Iwai415d5552014-04-03 11:51:21 +02003603 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3604 pinval &= ~AC_PINCTL_VREFEN;
3605 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
Takashi Iwaie40bdb02018-03-17 22:40:18 +01003606 if (spec->mute_led_nid) {
3607 /* temporarily power up/down for setting VREF */
3608 snd_hda_power_up_pm(codec);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003609 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
Takashi Iwaie40bdb02018-03-17 22:40:18 +01003610 snd_hda_power_down_pm(codec);
3611 }
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003612}
3613
David Henningssond5b6b652013-11-06 10:50:44 +01003614/* Make sure the led works even in runtime suspend */
3615static unsigned int led_power_filter(struct hda_codec *codec,
3616 hda_nid_t nid,
3617 unsigned int power_state)
3618{
3619 struct alc_spec *spec = codec->spec;
3620
Hui Wang50dd9052014-07-08 17:56:15 +08003621 if (power_state != AC_PWRST_D3 || nid == 0 ||
3622 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01003623 return power_state;
3624
3625 /* Set pin ctl again, it might have just been set to 0 */
3626 snd_hda_set_pin_ctl(codec, nid,
3627 snd_hda_codec_get_pin_target(codec, nid));
3628
Takashi Iwaicffd3962015-04-09 10:30:25 +02003629 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01003630}
3631
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003632static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3633 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003634{
3635 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003636 const struct dmi_device *dev = NULL;
3637
3638 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3639 return;
3640
3641 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3642 int pol, pin;
3643 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3644 continue;
3645 if (pin < 0x0a || pin >= 0x10)
3646 break;
3647 spec->mute_led_polarity = pol;
3648 spec->mute_led_nid = pin - 0x0a + 0x18;
3649 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
Takashi Iwaifd25a972012-12-20 14:57:18 +01003650 spec->gen.vmaster_mute_enum = 1;
David Henningssond5b6b652013-11-06 10:50:44 +01003651 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01003652 codec_dbg(codec,
3653 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003654 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003655 break;
3656 }
3657}
3658
Takashi Iwai85c467d2018-05-29 11:38:38 +02003659static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
3660 const struct hda_fixup *fix,
3661 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01003662{
3663 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02003664
David Henningssond06ac142013-02-18 11:41:55 +01003665 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3666 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02003667 spec->mute_led_nid = pin;
David Henningssond06ac142013-02-18 11:41:55 +01003668 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3669 spec->gen.vmaster_mute_enum = 1;
David Henningssond5b6b652013-11-06 10:50:44 +01003670 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01003671 }
3672}
3673
Takashi Iwai85c467d2018-05-29 11:38:38 +02003674static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3675 const struct hda_fixup *fix, int action)
3676{
3677 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
3678}
3679
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003680static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3681 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01003682{
Takashi Iwai85c467d2018-05-29 11:38:38 +02003683 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01003684}
3685
Tom Briden7f783bd2017-03-25 10:12:01 +00003686static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
3687 const struct hda_fixup *fix, int action)
3688{
Takashi Iwai85c467d2018-05-29 11:38:38 +02003689 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00003690}
3691
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003692/* update LED status via GPIO */
3693static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3694 bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003695{
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003696 struct alc_spec *spec = codec->spec;
3697 unsigned int oldval = spec->gpio_led;
3698
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003699 if (spec->mute_led_polarity)
3700 enabled = !enabled;
3701
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003702 if (enabled)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003703 spec->gpio_led &= ~mask;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003704 else
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003705 spec->gpio_led |= mask;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003706 if (spec->gpio_led != oldval)
3707 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3708 spec->gpio_led);
3709}
3710
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003711/* turn on/off mute LED via GPIO per vmaster hook */
3712static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3713{
3714 struct hda_codec *codec = private_data;
3715 struct alc_spec *spec = codec->spec;
3716
3717 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3718}
3719
3720/* turn on/off mic-mute LED via GPIO per capture hook */
Takashi Iwaid03abec2018-06-19 12:29:13 +02003721static void alc_gpio_micmute_update(struct hda_codec *codec)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003722{
3723 struct alc_spec *spec = codec->spec;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003724
Takashi Iwaid03abec2018-06-19 12:29:13 +02003725 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3726 spec->gen.micmute_led.led_value);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003727}
3728
3729static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3730 const struct hda_fixup *fix, int action)
3731{
3732 struct alc_spec *spec = codec->spec;
3733 static const struct hda_verb gpio_init[] = {
3734 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3735 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3736 {}
3737 };
3738
3739 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003740 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003741 spec->gpio_led = 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003742 spec->mute_led_polarity = 0;
3743 spec->gpio_mute_led_mask = 0x08;
3744 spec->gpio_mic_led_mask = 0x10;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003745 snd_hda_add_verbs(codec, gpio_init);
Takashi Iwaid03abec2018-06-19 12:29:13 +02003746 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003747 }
3748}
3749
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08003750static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3751 const struct hda_fixup *fix, int action)
3752{
3753 struct alc_spec *spec = codec->spec;
3754 static const struct hda_verb gpio_init[] = {
3755 { 0x01, AC_VERB_SET_GPIO_MASK, 0x22 },
3756 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x22 },
3757 {}
3758 };
3759
3760 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3761 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08003762 spec->gpio_led = 0;
3763 spec->mute_led_polarity = 0;
3764 spec->gpio_mute_led_mask = 0x02;
3765 spec->gpio_mic_led_mask = 0x20;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003766 snd_hda_add_verbs(codec, gpio_init);
Takashi Iwaid03abec2018-06-19 12:29:13 +02003767 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003768 }
3769}
3770
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003771/* turn on/off mic-mute LED per capture hook */
Takashi Iwaid03abec2018-06-19 12:29:13 +02003772static void alc_cap_micmute_update(struct hda_codec *codec)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003773{
3774 struct alc_spec *spec = codec->spec;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003775 unsigned int pinval;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003776
Takashi Iwaid03abec2018-06-19 12:29:13 +02003777 if (!spec->cap_mute_led_nid)
3778 return;
Hui Wangfc1fad92014-07-08 17:56:14 +08003779 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003780 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003781 if (spec->gen.micmute_led.led_value)
3782 pinval |= AC_PINCTL_VREF_80;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003783 else
Takashi Iwaid03abec2018-06-19 12:29:13 +02003784 pinval |= AC_PINCTL_VREF_HIZ;
3785 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003786}
3787
3788static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3789 const struct hda_fixup *fix, int action)
3790{
3791 struct alc_spec *spec = codec->spec;
3792 static const struct hda_verb gpio_init[] = {
3793 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3794 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3795 {}
3796 };
3797
3798 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003799 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003800 spec->gpio_led = 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003801 spec->mute_led_polarity = 0;
3802 spec->gpio_mute_led_mask = 0x08;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003803 spec->cap_mute_led_nid = 0x18;
3804 snd_hda_add_verbs(codec, gpio_init);
Takashi Iwaid03abec2018-06-19 12:29:13 +02003805 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
Hui Wang50dd9052014-07-08 17:56:15 +08003806 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003807 }
3808}
3809
David Henningsson7a5255f2014-10-30 08:26:01 +01003810static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3811 const struct hda_fixup *fix, int action)
3812{
3813 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3814 struct alc_spec *spec = codec->spec;
3815 static const struct hda_verb gpio_init[] = {
3816 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3817 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3818 {}
3819 };
3820
3821 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003822 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
David Henningsson7a5255f2014-10-30 08:26:01 +01003823 spec->gpio_led = 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003824 spec->mute_led_polarity = 0;
3825 spec->gpio_mute_led_mask = 0x08;
David Henningsson7a5255f2014-10-30 08:26:01 +01003826 spec->cap_mute_led_nid = 0x18;
3827 snd_hda_add_verbs(codec, gpio_init);
Takashi Iwaid03abec2018-06-19 12:29:13 +02003828 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
David Henningsson7a5255f2014-10-30 08:26:01 +01003829 codec->power_filter = led_power_filter;
3830 }
3831}
3832
Takashi Iwai6a30aba2018-04-27 17:17:35 +02003833#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01003834static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3835 struct hda_jack_callback *event)
3836{
3837 struct alc_spec *spec = codec->spec;
3838
3839 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3840 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08003841 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01003842 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08003843 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01003844 input_sync(spec->kb_dev);
3845}
David Henningsson33f4acd2015-01-07 15:50:13 +01003846
Kailang3694cb22015-12-28 11:35:24 +08003847static int alc_register_micmute_input_device(struct hda_codec *codec)
3848{
3849 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08003850 int i;
Kailang3694cb22015-12-28 11:35:24 +08003851
3852 spec->kb_dev = input_allocate_device();
3853 if (!spec->kb_dev) {
3854 codec_err(codec, "Out of memory (input_allocate_device)\n");
3855 return -ENOMEM;
3856 }
Hui Wangc7b60a82015-12-28 11:35:25 +08003857
3858 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
3859
Kailang3694cb22015-12-28 11:35:24 +08003860 spec->kb_dev->name = "Microphone Mute Button";
3861 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08003862 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
3863 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
3864 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
3865 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
3866 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08003867
3868 if (input_register_device(spec->kb_dev)) {
3869 codec_err(codec, "input_register_device failed\n");
3870 input_free_device(spec->kb_dev);
3871 spec->kb_dev = NULL;
3872 return -ENOMEM;
3873 }
3874
3875 return 0;
3876}
3877
David Henningsson33f4acd2015-01-07 15:50:13 +01003878static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3879 const struct hda_fixup *fix, int action)
3880{
David Henningsson33f4acd2015-01-07 15:50:13 +01003881 /* GPIO1 = set according to SKU external amp
3882 GPIO2 = mic mute hotkey
3883 GPIO3 = mute LED
3884 GPIO4 = mic mute LED */
3885 static const struct hda_verb gpio_init[] = {
3886 { 0x01, AC_VERB_SET_GPIO_MASK, 0x1e },
3887 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x1a },
3888 { 0x01, AC_VERB_SET_GPIO_DATA, 0x02 },
3889 {}
3890 };
3891
3892 struct alc_spec *spec = codec->spec;
3893
3894 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang3694cb22015-12-28 11:35:24 +08003895 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01003896 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01003897
3898 snd_hda_add_verbs(codec, gpio_init);
Takashi Iwai7639a062015-03-03 10:07:24 +01003899 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01003900 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01003901 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01003902 gpio2_mic_hotkey_event);
3903
3904 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
David Henningsson33f4acd2015-01-07 15:50:13 +01003905 spec->gpio_led = 0;
3906 spec->mute_led_polarity = 0;
3907 spec->gpio_mute_led_mask = 0x08;
3908 spec->gpio_mic_led_mask = 0x10;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003909 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
David Henningsson33f4acd2015-01-07 15:50:13 +01003910 return;
3911 }
3912
3913 if (!spec->kb_dev)
3914 return;
3915
3916 switch (action) {
3917 case HDA_FIXUP_ACT_PROBE:
3918 spec->init_amp = ALC_INIT_DEFAULT;
3919 break;
3920 case HDA_FIXUP_ACT_FREE:
3921 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01003922 spec->kb_dev = NULL;
3923 }
David Henningsson33f4acd2015-01-07 15:50:13 +01003924}
3925
Kailang3694cb22015-12-28 11:35:24 +08003926static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
3927 const struct hda_fixup *fix, int action)
3928{
3929 /* Line2 = mic mute hotkey
3930 GPIO2 = mic mute LED */
3931 static const struct hda_verb gpio_init[] = {
3932 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
3933 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
3934 {}
3935 };
3936
3937 struct alc_spec *spec = codec->spec;
3938
3939 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3940 if (alc_register_micmute_input_device(codec) != 0)
3941 return;
3942
3943 snd_hda_add_verbs(codec, gpio_init);
3944 snd_hda_jack_detect_enable_callback(codec, 0x1b,
3945 gpio2_mic_hotkey_event);
3946
Kailang3694cb22015-12-28 11:35:24 +08003947 spec->gpio_led = 0;
3948 spec->mute_led_polarity = 0;
3949 spec->gpio_mic_led_mask = 0x04;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003950 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
Kailang3694cb22015-12-28 11:35:24 +08003951 return;
3952 }
3953
3954 if (!spec->kb_dev)
3955 return;
3956
3957 switch (action) {
3958 case HDA_FIXUP_ACT_PROBE:
3959 spec->init_amp = ALC_INIT_DEFAULT;
3960 break;
3961 case HDA_FIXUP_ACT_FREE:
3962 input_unregister_device(spec->kb_dev);
3963 spec->kb_dev = NULL;
3964 }
3965}
Takashi Iwaic4696522018-01-15 10:44:35 +01003966#else /* INPUT */
3967#define alc280_fixup_hp_gpio2_mic_hotkey NULL
3968#define alc233_fixup_lenovo_line2_mic_hotkey NULL
3969#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08003970
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003971static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3972 const struct hda_fixup *fix, int action)
3973{
3974 struct alc_spec *spec = codec->spec;
3975
Takashi Iwai1bce62a2018-06-19 23:15:59 +02003976 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003977 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003978 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003979 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003980 }
3981}
3982
Kailang Yang5a367672017-07-21 15:23:53 +08003983static struct coef_fw alc225_pre_hsmode[] = {
3984 UPDATE_COEF(0x4a, 1<<8, 0),
3985 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
3986 UPDATE_COEF(0x63, 3<<14, 3<<14),
3987 UPDATE_COEF(0x4a, 3<<4, 2<<4),
3988 UPDATE_COEF(0x4a, 3<<10, 3<<10),
3989 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
3990 UPDATE_COEF(0x4a, 3<<10, 0),
3991 {}
3992};
3993
David Henningsson73bdd592013-04-15 15:44:14 +02003994static void alc_headset_mode_unplugged(struct hda_codec *codec)
3995{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003996 static struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003997 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
3998 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
3999 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4000 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4001 {}
4002 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004003 static struct coef_fw coef0255_1[] = {
4004 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4005 {}
4006 };
4007 static struct coef_fw coef0256[] = {
4008 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4009 {}
4010 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004011 static struct coef_fw coef0233[] = {
4012 WRITE_COEF(0x1b, 0x0c0b),
4013 WRITE_COEF(0x45, 0xc429),
4014 UPDATE_COEF(0x35, 0x4000, 0),
4015 WRITE_COEF(0x06, 0x2104),
4016 WRITE_COEF(0x1a, 0x0001),
4017 WRITE_COEF(0x26, 0x0004),
4018 WRITE_COEF(0x32, 0x42a3),
4019 {}
4020 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004021 static struct coef_fw coef0288[] = {
4022 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4023 UPDATE_COEF(0x50, 0x2000, 0x2000),
4024 UPDATE_COEF(0x56, 0x0006, 0x0006),
4025 UPDATE_COEF(0x66, 0x0008, 0),
4026 UPDATE_COEF(0x67, 0x2000, 0),
4027 {}
4028 };
Kailang Yang89542932017-07-17 15:03:43 +08004029 static struct coef_fw coef0298[] = {
4030 UPDATE_COEF(0x19, 0x1300, 0x0300),
4031 {}
4032 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004033 static struct coef_fw coef0292[] = {
4034 WRITE_COEF(0x76, 0x000e),
4035 WRITE_COEF(0x6c, 0x2400),
4036 WRITE_COEF(0x18, 0x7308),
4037 WRITE_COEF(0x6b, 0xc429),
4038 {}
4039 };
4040 static struct coef_fw coef0293[] = {
4041 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4042 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4043 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4044 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4045 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4046 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4047 {}
4048 };
4049 static struct coef_fw coef0668[] = {
4050 WRITE_COEF(0x15, 0x0d40),
4051 WRITE_COEF(0xb7, 0x802b),
4052 {}
4053 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004054 static struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004055 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004056 {}
4057 };
Kailang Yang71683c32017-06-20 16:33:50 +08004058 static struct coef_fw coef0274[] = {
4059 UPDATE_COEF(0x4a, 0x0100, 0),
4060 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4061 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4062 UPDATE_COEF(0x4a, 0x0010, 0),
4063 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4064 WRITE_COEF(0x45, 0x5289),
4065 UPDATE_COEF(0x4a, 0x0c00, 0),
4066 {}
4067 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004068
Takashi Iwai7639a062015-03-03 10:07:24 +01004069 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004070 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004071 alc_process_coef_fw(codec, coef0255_1);
4072 alc_process_coef_fw(codec, coef0255);
4073 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004074 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004075 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004076 alc_process_coef_fw(codec, coef0256);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004077 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004078 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004079 case 0x10ec0234:
4080 case 0x10ec0274:
4081 case 0x10ec0294:
4082 alc_process_coef_fw(codec, coef0274);
4083 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004084 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004085 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004086 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004087 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004088 case 0x10ec0286:
4089 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004090 alc_process_coef_fw(codec, coef0288);
4091 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004092 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004093 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004094 alc_process_coef_fw(codec, coef0288);
4095 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004096 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004097 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004098 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004099 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004100 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004101 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004102 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004103 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004104 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004105 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004106 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004107 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004108 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004109 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004110 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004111 alc_process_coef_fw(codec, coef0225);
4112 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004113 case 0x10ec0867:
4114 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4115 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004116 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004117 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004118}
4119
4120
4121static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4122 hda_nid_t mic_pin)
4123{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004124 static struct coef_fw coef0255[] = {
4125 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4126 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4127 {}
4128 };
4129 static struct coef_fw coef0233[] = {
4130 UPDATE_COEF(0x35, 0, 1<<14),
4131 WRITE_COEF(0x06, 0x2100),
4132 WRITE_COEF(0x1a, 0x0021),
4133 WRITE_COEF(0x26, 0x008c),
4134 {}
4135 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004136 static struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004137 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004138 UPDATE_COEF(0x50, 0x2000, 0),
4139 UPDATE_COEF(0x56, 0x0006, 0),
4140 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4141 UPDATE_COEF(0x66, 0x0008, 0x0008),
4142 UPDATE_COEF(0x67, 0x2000, 0x2000),
4143 {}
4144 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004145 static struct coef_fw coef0292[] = {
4146 WRITE_COEF(0x19, 0xa208),
4147 WRITE_COEF(0x2e, 0xacf0),
4148 {}
4149 };
4150 static struct coef_fw coef0293[] = {
4151 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4152 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4153 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4154 {}
4155 };
4156 static struct coef_fw coef0688[] = {
4157 WRITE_COEF(0xb7, 0x802b),
4158 WRITE_COEF(0xb5, 0x1040),
4159 UPDATE_COEF(0xc3, 0, 1<<12),
4160 {}
4161 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004162 static struct coef_fw coef0225[] = {
4163 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4164 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4165 UPDATE_COEF(0x63, 3<<14, 0),
4166 {}
4167 };
Kailang Yang71683c32017-06-20 16:33:50 +08004168 static struct coef_fw coef0274[] = {
4169 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4170 UPDATE_COEF(0x4a, 0x0010, 0),
4171 UPDATE_COEF(0x6b, 0xf000, 0),
4172 {}
4173 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004174
Takashi Iwai7639a062015-03-03 10:07:24 +01004175 switch (codec->core.vendor_id) {
Kailang Yang736f20a2017-10-20 15:06:34 +08004176 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004177 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004178 case 0x10ec0256:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004179 alc_write_coef_idx(codec, 0x45, 0xc489);
4180 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004181 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004182 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4183 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004184 case 0x10ec0234:
4185 case 0x10ec0274:
4186 case 0x10ec0294:
4187 alc_write_coef_idx(codec, 0x45, 0x4689);
4188 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4189 alc_process_coef_fw(codec, coef0274);
4190 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4191 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004192 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004193 case 0x10ec0283:
4194 alc_write_coef_idx(codec, 0x45, 0xc429);
4195 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004196 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004197 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4198 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004199 case 0x10ec0286:
4200 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004201 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004202 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4203 alc_process_coef_fw(codec, coef0288);
4204 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4205 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004206 case 0x10ec0292:
4207 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004208 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004209 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004210 case 0x10ec0293:
4211 /* Set to TRS mode */
4212 alc_write_coef_idx(codec, 0x45, 0xc429);
4213 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004214 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004215 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4216 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004217 case 0x10ec0867:
4218 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4219 /* fallthru */
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004220 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004221 case 0x10ec0662:
4222 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4223 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4224 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004225 case 0x10ec0668:
4226 alc_write_coef_idx(codec, 0x11, 0x0001);
4227 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004228 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004229 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4230 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004231 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004232 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004233 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004234 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004235 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004236 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004237 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004238 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4239 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4240 alc_process_coef_fw(codec, coef0225);
4241 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4242 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004243 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004244 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004245}
4246
4247static void alc_headset_mode_default(struct hda_codec *codec)
4248{
David Henningsson2ae95572016-02-25 09:37:05 +01004249 static struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004250 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4251 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4252 UPDATE_COEF(0x49, 3<<8, 0<<8),
4253 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4254 UPDATE_COEF(0x63, 3<<14, 0),
4255 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01004256 {}
4257 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004258 static struct coef_fw coef0255[] = {
4259 WRITE_COEF(0x45, 0xc089),
4260 WRITE_COEF(0x45, 0xc489),
4261 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4262 WRITE_COEF(0x49, 0x0049),
4263 {}
4264 };
4265 static struct coef_fw coef0233[] = {
4266 WRITE_COEF(0x06, 0x2100),
4267 WRITE_COEF(0x32, 0x4ea3),
4268 {}
4269 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004270 static struct coef_fw coef0288[] = {
4271 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4272 UPDATE_COEF(0x50, 0x2000, 0x2000),
4273 UPDATE_COEF(0x56, 0x0006, 0x0006),
4274 UPDATE_COEF(0x66, 0x0008, 0),
4275 UPDATE_COEF(0x67, 0x2000, 0),
4276 {}
4277 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004278 static struct coef_fw coef0292[] = {
4279 WRITE_COEF(0x76, 0x000e),
4280 WRITE_COEF(0x6c, 0x2400),
4281 WRITE_COEF(0x6b, 0xc429),
4282 WRITE_COEF(0x18, 0x7308),
4283 {}
4284 };
4285 static struct coef_fw coef0293[] = {
4286 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4287 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4288 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4289 {}
4290 };
4291 static struct coef_fw coef0688[] = {
4292 WRITE_COEF(0x11, 0x0041),
4293 WRITE_COEF(0x15, 0x0d40),
4294 WRITE_COEF(0xb7, 0x802b),
4295 {}
4296 };
Kailang Yang71683c32017-06-20 16:33:50 +08004297 static struct coef_fw coef0274[] = {
4298 WRITE_COEF(0x45, 0x4289),
4299 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4300 UPDATE_COEF(0x6b, 0x0f00, 0),
4301 UPDATE_COEF(0x49, 0x0300, 0x0300),
4302 {}
4303 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004304
Takashi Iwai7639a062015-03-03 10:07:24 +01004305 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08004306 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01004307 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004308 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004309 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004310 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004311 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004312 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01004313 alc_process_coef_fw(codec, coef0225);
4314 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004315 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004316 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004317 case 0x10ec0256:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004318 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004319 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004320 case 0x10ec0234:
4321 case 0x10ec0274:
4322 case 0x10ec0294:
4323 alc_process_coef_fw(codec, coef0274);
4324 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004325 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004326 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004327 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004328 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004329 case 0x10ec0286:
4330 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004331 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004332 alc_process_coef_fw(codec, coef0288);
4333 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004334 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004335 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004336 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004337 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004338 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004339 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004340 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004341 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004342 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004343 case 0x10ec0867:
4344 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4345 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004346 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004347 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004348}
4349
4350/* Iphone type */
4351static void alc_headset_mode_ctia(struct hda_codec *codec)
4352{
Kailang Yang89542932017-07-17 15:03:43 +08004353 int val;
4354
Takashi Iwai54db6c32014-08-18 15:11:19 +02004355 static struct coef_fw coef0255[] = {
4356 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4357 WRITE_COEF(0x1b, 0x0c2b),
4358 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4359 {}
4360 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004361 static struct coef_fw coef0256[] = {
4362 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4363 WRITE_COEF(0x1b, 0x0c6b),
4364 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4365 {}
4366 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004367 static struct coef_fw coef0233[] = {
4368 WRITE_COEF(0x45, 0xd429),
4369 WRITE_COEF(0x1b, 0x0c2b),
4370 WRITE_COEF(0x32, 0x4ea3),
4371 {}
4372 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004373 static struct coef_fw coef0288[] = {
4374 UPDATE_COEF(0x50, 0x2000, 0x2000),
4375 UPDATE_COEF(0x56, 0x0006, 0x0006),
4376 UPDATE_COEF(0x66, 0x0008, 0),
4377 UPDATE_COEF(0x67, 0x2000, 0),
4378 {}
4379 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004380 static struct coef_fw coef0292[] = {
4381 WRITE_COEF(0x6b, 0xd429),
4382 WRITE_COEF(0x76, 0x0008),
4383 WRITE_COEF(0x18, 0x7388),
4384 {}
4385 };
4386 static struct coef_fw coef0293[] = {
4387 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4388 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4389 {}
4390 };
4391 static struct coef_fw coef0688[] = {
4392 WRITE_COEF(0x11, 0x0001),
4393 WRITE_COEF(0x15, 0x0d60),
4394 WRITE_COEF(0xc3, 0x0000),
4395 {}
4396 };
Kailang Yang5a367672017-07-21 15:23:53 +08004397 static struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004398 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004399 UPDATE_COEF(0x63, 3<<14, 2<<14),
4400 {}
4401 };
4402 static struct coef_fw coef0225_2[] = {
4403 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4404 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004405 {}
4406 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004407
Takashi Iwai7639a062015-03-03 10:07:24 +01004408 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004409 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004410 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004411 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004412 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004413 case 0x10ec0256:
4414 alc_process_coef_fw(codec, coef0256);
4415 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004416 case 0x10ec0234:
4417 case 0x10ec0274:
4418 case 0x10ec0294:
4419 alc_write_coef_idx(codec, 0x45, 0xd689);
4420 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004421 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004422 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004423 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004424 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004425 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004426 val = alc_read_coef_idx(codec, 0x50);
4427 if (val & (1 << 12)) {
4428 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4429 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4430 msleep(300);
4431 } else {
4432 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4433 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4434 msleep(300);
4435 }
4436 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004437 case 0x10ec0286:
4438 case 0x10ec0288:
4439 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4440 msleep(300);
4441 alc_process_coef_fw(codec, coef0288);
4442 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004443 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004444 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004445 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004446 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004447 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004448 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004449 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004450 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004451 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004452 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004453 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004454 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004455 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004456 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004457 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004458 val = alc_read_coef_idx(codec, 0x45);
4459 if (val & (1 << 9))
4460 alc_process_coef_fw(codec, coef0225_2);
4461 else
4462 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004463 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004464 case 0x10ec0867:
4465 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4466 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004467 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004468 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004469}
4470
4471/* Nokia type */
4472static void alc_headset_mode_omtp(struct hda_codec *codec)
4473{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004474 static struct coef_fw coef0255[] = {
4475 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4476 WRITE_COEF(0x1b, 0x0c2b),
4477 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4478 {}
4479 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004480 static struct coef_fw coef0256[] = {
4481 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4482 WRITE_COEF(0x1b, 0x0c6b),
4483 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4484 {}
4485 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004486 static struct coef_fw coef0233[] = {
4487 WRITE_COEF(0x45, 0xe429),
4488 WRITE_COEF(0x1b, 0x0c2b),
4489 WRITE_COEF(0x32, 0x4ea3),
4490 {}
4491 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004492 static struct coef_fw coef0288[] = {
4493 UPDATE_COEF(0x50, 0x2000, 0x2000),
4494 UPDATE_COEF(0x56, 0x0006, 0x0006),
4495 UPDATE_COEF(0x66, 0x0008, 0),
4496 UPDATE_COEF(0x67, 0x2000, 0),
4497 {}
4498 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004499 static struct coef_fw coef0292[] = {
4500 WRITE_COEF(0x6b, 0xe429),
4501 WRITE_COEF(0x76, 0x0008),
4502 WRITE_COEF(0x18, 0x7388),
4503 {}
4504 };
4505 static struct coef_fw coef0293[] = {
4506 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4507 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4508 {}
4509 };
4510 static struct coef_fw coef0688[] = {
4511 WRITE_COEF(0x11, 0x0001),
4512 WRITE_COEF(0x15, 0x0d50),
4513 WRITE_COEF(0xc3, 0x0000),
4514 {}
4515 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004516 static struct coef_fw coef0225[] = {
4517 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004518 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004519 {}
4520 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004521
Takashi Iwai7639a062015-03-03 10:07:24 +01004522 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004523 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004524 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004525 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004526 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004527 case 0x10ec0256:
4528 alc_process_coef_fw(codec, coef0256);
4529 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004530 case 0x10ec0234:
4531 case 0x10ec0274:
4532 case 0x10ec0294:
4533 alc_write_coef_idx(codec, 0x45, 0xe689);
4534 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004535 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004536 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004537 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004538 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004539 case 0x10ec0298:
4540 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08004541 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4542 msleep(300);
4543 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004544 case 0x10ec0286:
4545 case 0x10ec0288:
4546 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4547 msleep(300);
4548 alc_process_coef_fw(codec, coef0288);
4549 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004550 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004551 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004552 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004553 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004554 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004555 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004556 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004557 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004558 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004559 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004560 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004561 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004562 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004563 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004564 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004565 alc_process_coef_fw(codec, coef0225);
4566 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004567 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004568 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004569}
4570
4571static void alc_determine_headset_type(struct hda_codec *codec)
4572{
4573 int val;
4574 bool is_ctia = false;
4575 struct alc_spec *spec = codec->spec;
Takashi Iwai54db6c32014-08-18 15:11:19 +02004576 static struct coef_fw coef0255[] = {
4577 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4578 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4579 conteol) */
4580 {}
4581 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004582 static struct coef_fw coef0288[] = {
4583 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4584 {}
4585 };
Kailang Yang89542932017-07-17 15:03:43 +08004586 static struct coef_fw coef0298[] = {
4587 UPDATE_COEF(0x50, 0x2000, 0x2000),
4588 UPDATE_COEF(0x56, 0x0006, 0x0006),
4589 UPDATE_COEF(0x66, 0x0008, 0),
4590 UPDATE_COEF(0x67, 0x2000, 0),
4591 UPDATE_COEF(0x19, 0x1300, 0x1300),
4592 {}
4593 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004594 static struct coef_fw coef0293[] = {
4595 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4596 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4597 {}
4598 };
4599 static struct coef_fw coef0688[] = {
4600 WRITE_COEF(0x11, 0x0001),
4601 WRITE_COEF(0xb7, 0x802b),
4602 WRITE_COEF(0x15, 0x0d60),
4603 WRITE_COEF(0xc3, 0x0c00),
4604 {}
4605 };
Kailang Yang71683c32017-06-20 16:33:50 +08004606 static struct coef_fw coef0274[] = {
4607 UPDATE_COEF(0x4a, 0x0010, 0),
4608 UPDATE_COEF(0x4a, 0x8000, 0),
4609 WRITE_COEF(0x45, 0xd289),
4610 UPDATE_COEF(0x49, 0x0300, 0x0300),
4611 {}
4612 };
David Henningsson73bdd592013-04-15 15:44:14 +02004613
Takashi Iwai7639a062015-03-03 10:07:24 +01004614 switch (codec->core.vendor_id) {
Kailang Yang736f20a2017-10-20 15:06:34 +08004615 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004616 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004617 case 0x10ec0256:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004618 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004619 msleep(300);
4620 val = alc_read_coef_idx(codec, 0x46);
4621 is_ctia = (val & 0x0070) == 0x0070;
4622 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004623 case 0x10ec0234:
4624 case 0x10ec0274:
4625 case 0x10ec0294:
4626 alc_process_coef_fw(codec, coef0274);
4627 msleep(80);
4628 val = alc_read_coef_idx(codec, 0x46);
4629 is_ctia = (val & 0x00f0) == 0x00f0;
4630 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004631 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004632 case 0x10ec0283:
4633 alc_write_coef_idx(codec, 0x45, 0xd029);
4634 msleep(300);
4635 val = alc_read_coef_idx(codec, 0x46);
4636 is_ctia = (val & 0x0070) == 0x0070;
4637 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004638 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004639 snd_hda_codec_write(codec, 0x21, 0,
4640 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4641 msleep(100);
4642 snd_hda_codec_write(codec, 0x21, 0,
4643 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4644 msleep(200);
4645
4646 val = alc_read_coef_idx(codec, 0x50);
4647 if (val & (1 << 12)) {
4648 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4649 alc_process_coef_fw(codec, coef0288);
4650 msleep(350);
4651 val = alc_read_coef_idx(codec, 0x50);
4652 is_ctia = (val & 0x0070) == 0x0070;
4653 } else {
4654 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4655 alc_process_coef_fw(codec, coef0288);
4656 msleep(350);
4657 val = alc_read_coef_idx(codec, 0x50);
4658 is_ctia = (val & 0x0070) == 0x0070;
4659 }
4660 alc_process_coef_fw(codec, coef0298);
4661 snd_hda_codec_write(codec, 0x21, 0,
4662 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4663 msleep(75);
4664 snd_hda_codec_write(codec, 0x21, 0,
4665 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4666 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004667 case 0x10ec0286:
4668 case 0x10ec0288:
4669 alc_process_coef_fw(codec, coef0288);
4670 msleep(350);
4671 val = alc_read_coef_idx(codec, 0x50);
4672 is_ctia = (val & 0x0070) == 0x0070;
4673 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004674 case 0x10ec0292:
4675 alc_write_coef_idx(codec, 0x6b, 0xd429);
4676 msleep(300);
4677 val = alc_read_coef_idx(codec, 0x6c);
4678 is_ctia = (val & 0x001c) == 0x001c;
4679 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004680 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004681 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004682 msleep(300);
4683 val = alc_read_coef_idx(codec, 0x46);
4684 is_ctia = (val & 0x0070) == 0x0070;
4685 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004686 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004687 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004688 msleep(300);
4689 val = alc_read_coef_idx(codec, 0xbe);
4690 is_ctia = (val & 0x1c02) == 0x1c02;
4691 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004692 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004693 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004694 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004695 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004696 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004697 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08004698 snd_hda_codec_write(codec, 0x21, 0,
4699 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4700 msleep(80);
4701 snd_hda_codec_write(codec, 0x21, 0,
4702 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4703
Kailang Yang5a367672017-07-21 15:23:53 +08004704 alc_process_coef_fw(codec, alc225_pre_hsmode);
4705 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4706 val = alc_read_coef_idx(codec, 0x45);
4707 if (val & (1 << 9)) {
4708 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4709 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4710 msleep(800);
4711 val = alc_read_coef_idx(codec, 0x46);
4712 is_ctia = (val & 0x00f0) == 0x00f0;
4713 } else {
4714 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4715 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4716 msleep(800);
4717 val = alc_read_coef_idx(codec, 0x46);
4718 is_ctia = (val & 0x00f0) == 0x00f0;
4719 }
4720 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4721 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4722 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08004723
4724 snd_hda_codec_write(codec, 0x21, 0,
4725 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4726 msleep(80);
4727 snd_hda_codec_write(codec, 0x21, 0,
4728 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004729 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004730 case 0x10ec0867:
4731 is_ctia = true;
4732 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004733 }
4734
Takashi Iwai4e76a882014-02-25 12:21:03 +01004735 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02004736 is_ctia ? "yes" : "no");
4737 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4738}
4739
4740static void alc_update_headset_mode(struct hda_codec *codec)
4741{
4742 struct alc_spec *spec = codec->spec;
4743
4744 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
4745 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
4746
4747 int new_headset_mode;
4748
4749 if (!snd_hda_jack_detect(codec, hp_pin))
4750 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4751 else if (mux_pin == spec->headset_mic_pin)
4752 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4753 else if (mux_pin == spec->headphone_mic_pin)
4754 new_headset_mode = ALC_HEADSET_MODE_MIC;
4755 else
4756 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4757
David Henningsson5959a6b2013-11-12 11:10:57 +01004758 if (new_headset_mode == spec->current_headset_mode) {
4759 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02004760 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01004761 }
David Henningsson73bdd592013-04-15 15:44:14 +02004762
4763 switch (new_headset_mode) {
4764 case ALC_HEADSET_MODE_UNPLUGGED:
4765 alc_headset_mode_unplugged(codec);
4766 spec->gen.hp_jack_present = false;
4767 break;
4768 case ALC_HEADSET_MODE_HEADSET:
4769 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4770 alc_determine_headset_type(codec);
4771 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4772 alc_headset_mode_ctia(codec);
4773 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4774 alc_headset_mode_omtp(codec);
4775 spec->gen.hp_jack_present = true;
4776 break;
4777 case ALC_HEADSET_MODE_MIC:
4778 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4779 spec->gen.hp_jack_present = false;
4780 break;
4781 case ALC_HEADSET_MODE_HEADPHONE:
4782 alc_headset_mode_default(codec);
4783 spec->gen.hp_jack_present = true;
4784 break;
4785 }
4786 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4787 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4788 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02004789 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02004790 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4791 PIN_VREFHIZ);
4792 }
4793 spec->current_headset_mode = new_headset_mode;
4794
4795 snd_hda_gen_update_outputs(codec);
4796}
4797
4798static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01004799 struct snd_kcontrol *kcontrol,
4800 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02004801{
4802 alc_update_headset_mode(codec);
4803}
4804
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02004805static void alc_update_headset_jack_cb(struct hda_codec *codec,
4806 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02004807{
4808 struct alc_spec *spec = codec->spec;
David Henningsson5db4d342013-11-22 12:17:06 +01004809 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02004810 snd_hda_gen_hp_automute(codec, jack);
4811}
4812
4813static void alc_probe_headset_mode(struct hda_codec *codec)
4814{
4815 int i;
4816 struct alc_spec *spec = codec->spec;
4817 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4818
4819 /* Find mic pins */
4820 for (i = 0; i < cfg->num_inputs; i++) {
4821 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4822 spec->headset_mic_pin = cfg->inputs[i].pin;
4823 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4824 spec->headphone_mic_pin = cfg->inputs[i].pin;
4825 }
4826
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02004827 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02004828 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4829 spec->gen.automute_hook = alc_update_headset_mode;
4830 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4831}
4832
4833static void alc_fixup_headset_mode(struct hda_codec *codec,
4834 const struct hda_fixup *fix, int action)
4835{
4836 struct alc_spec *spec = codec->spec;
4837
4838 switch (action) {
4839 case HDA_FIXUP_ACT_PRE_PROBE:
4840 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4841 break;
4842 case HDA_FIXUP_ACT_PROBE:
4843 alc_probe_headset_mode(codec);
4844 break;
4845 case HDA_FIXUP_ACT_INIT:
4846 spec->current_headset_mode = 0;
4847 alc_update_headset_mode(codec);
4848 break;
4849 }
4850}
4851
4852static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4853 const struct hda_fixup *fix, int action)
4854{
4855 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4856 struct alc_spec *spec = codec->spec;
4857 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4858 }
4859 else
4860 alc_fixup_headset_mode(codec, fix, action);
4861}
4862
Kailang Yang31278992014-03-03 15:27:22 +08004863static void alc255_set_default_jack_type(struct hda_codec *codec)
4864{
4865 /* Set to iphone type */
Kailang Yange69e7e02016-05-30 15:58:28 +08004866 static struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004867 WRITE_COEF(0x1b, 0x880b),
4868 WRITE_COEF(0x45, 0xd089),
4869 WRITE_COEF(0x1b, 0x080b),
4870 WRITE_COEF(0x46, 0x0004),
4871 WRITE_COEF(0x1b, 0x0c0b),
4872 {}
4873 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004874 static struct coef_fw alc256fw[] = {
4875 WRITE_COEF(0x1b, 0x884b),
4876 WRITE_COEF(0x45, 0xd089),
4877 WRITE_COEF(0x1b, 0x084b),
4878 WRITE_COEF(0x46, 0x0004),
4879 WRITE_COEF(0x1b, 0x0c4b),
4880 {}
4881 };
4882 switch (codec->core.vendor_id) {
4883 case 0x10ec0255:
4884 alc_process_coef_fw(codec, alc255fw);
4885 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004886 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004887 case 0x10ec0256:
4888 alc_process_coef_fw(codec, alc256fw);
4889 break;
4890 }
Kailang Yang31278992014-03-03 15:27:22 +08004891 msleep(30);
4892}
4893
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004894static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4895 const struct hda_fixup *fix, int action)
4896{
4897 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08004898 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004899 }
4900 alc_fixup_headset_mode(codec, fix, action);
4901}
4902
Kailang Yang31278992014-03-03 15:27:22 +08004903static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
4904 const struct hda_fixup *fix, int action)
4905{
4906 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4907 struct alc_spec *spec = codec->spec;
4908 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4909 alc255_set_default_jack_type(codec);
4910 }
4911 else
4912 alc_fixup_headset_mode(codec, fix, action);
4913}
4914
Kailang Yange1e62b92015-04-08 16:01:22 +08004915static void alc288_update_headset_jack_cb(struct hda_codec *codec,
4916 struct hda_jack_callback *jack)
4917{
4918 struct alc_spec *spec = codec->spec;
4919 int present;
4920
4921 alc_update_headset_jack_cb(codec, jack);
4922 /* Headset Mic enable or disable, only for Dell Dino */
4923 present = spec->gen.hp_jack_present ? 0x40 : 0;
4924 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
4925 present);
4926}
4927
4928static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
4929 const struct hda_fixup *fix, int action)
4930{
4931 alc_fixup_headset_mode(codec, fix, action);
4932 if (action == HDA_FIXUP_ACT_PROBE) {
4933 struct alc_spec *spec = codec->spec;
4934 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
4935 }
4936}
4937
Hui Wang493a52a2014-01-14 14:07:36 +08004938static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
4939 const struct hda_fixup *fix, int action)
4940{
4941 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4942 struct alc_spec *spec = codec->spec;
4943 spec->gen.auto_mute_via_amp = 1;
4944 }
4945}
4946
Takashi Iwai9b745ab2014-03-07 08:37:19 +01004947static void alc_no_shutup(struct hda_codec *codec)
4948{
4949}
4950
4951static void alc_fixup_no_shutup(struct hda_codec *codec,
4952 const struct hda_fixup *fix, int action)
4953{
Gabriele Mazzotta972aa2c2016-12-24 19:50:00 +01004954 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01004955 struct alc_spec *spec = codec->spec;
4956 spec->shutup = alc_no_shutup;
4957 }
4958}
4959
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02004960static void alc_fixup_disable_aamix(struct hda_codec *codec,
4961 const struct hda_fixup *fix, int action)
4962{
4963 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4964 struct alc_spec *spec = codec->spec;
4965 /* Disable AA-loopback as it causes white noise */
4966 spec->gen.mixer_nid = 0;
4967 }
4968}
4969
Takashi Iwai7f57d802015-09-24 17:36:51 +02004970/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
4971static void alc_fixup_tpt440_dock(struct hda_codec *codec,
4972 const struct hda_fixup *fix, int action)
4973{
4974 static const struct hda_pintbl pincfgs[] = {
4975 { 0x16, 0x21211010 }, /* dock headphone */
4976 { 0x19, 0x21a11010 }, /* dock mic */
4977 { }
4978 };
4979 struct alc_spec *spec = codec->spec;
4980
4981 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai70a09762015-12-15 14:59:58 +01004982 spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */
Takashi Iwai7f57d802015-09-24 17:36:51 +02004983 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4984 codec->power_save_node = 0; /* avoid click noises */
4985 snd_hda_apply_pincfgs(codec, pincfgs);
4986 }
4987}
4988
Kailang Yang61fcf8e2018-02-02 15:26:46 +08004989static void alc_fixup_tpt470_dock(struct hda_codec *codec,
4990 const struct hda_fixup *fix, int action)
4991{
4992 static const struct hda_pintbl pincfgs[] = {
4993 { 0x17, 0x21211010 }, /* dock headphone */
4994 { 0x19, 0x21a11010 }, /* dock mic */
4995 { }
4996 };
4997 struct alc_spec *spec = codec->spec;
4998
4999 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5000 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005001 snd_hda_apply_pincfgs(codec, pincfgs);
5002 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005003 /* Enable DOCK device */
5004 snd_hda_codec_write(codec, 0x17, 0,
5005 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5006 /* Enable DOCK device */
5007 snd_hda_codec_write(codec, 0x19, 0,
5008 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005009 }
5010}
5011
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005012static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005013{
5014 struct alc_spec *spec = codec->spec;
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005015 int hp_pin = spec->gen.autocfg.hp_pins[0];
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005016
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005017 /* Prevent pop noises when headphones are plugged in */
5018 snd_hda_codec_write(codec, hp_pin, 0,
5019 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5020 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005021}
5022
5023static void alc_fixup_dell_xps13(struct hda_codec *codec,
5024 const struct hda_fixup *fix, int action)
5025{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005026 struct alc_spec *spec = codec->spec;
5027 struct hda_input_mux *imux = &spec->gen.input_mux;
5028 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005029
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005030 switch (action) {
5031 case HDA_FIXUP_ACT_PRE_PROBE:
5032 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5033 * it causes a click noise at start up
5034 */
5035 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5036 break;
5037 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005038 spec->shutup = alc_shutup_dell_xps13;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005039
5040 /* Make the internal mic the default input source. */
5041 for (i = 0; i < imux->num_items; i++) {
5042 if (spec->gen.imux_pins[i] == 0x12) {
5043 spec->gen.cur_mux[0] = i;
5044 break;
5045 }
5046 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005047 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005048 }
5049}
5050
David Henningsson1f8b46c2015-05-12 14:38:15 +02005051static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5052 const struct hda_fixup *fix, int action)
5053{
5054 struct alc_spec *spec = codec->spec;
5055
5056 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5057 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5058 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005059
5060 /* Disable boost for mic-in permanently. (This code is only called
5061 from quirks that guarantee that the headphone is at NID 0x1b.) */
5062 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5063 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005064 } else
5065 alc_fixup_headset_mode(codec, fix, action);
5066}
5067
David Henningsson73bdd592013-04-15 15:44:14 +02005068static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5069 const struct hda_fixup *fix, int action)
5070{
5071 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005072 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005073 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005074 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5075 }
5076 alc_fixup_headset_mode(codec, fix, action);
5077}
5078
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005079/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5080static int find_ext_mic_pin(struct hda_codec *codec)
5081{
5082 struct alc_spec *spec = codec->spec;
5083 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5084 hda_nid_t nid;
5085 unsigned int defcfg;
5086 int i;
5087
5088 for (i = 0; i < cfg->num_inputs; i++) {
5089 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5090 continue;
5091 nid = cfg->inputs[i].pin;
5092 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5093 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5094 continue;
5095 return nid;
5096 }
5097
5098 return 0;
5099}
5100
Dylan Reid08a978d2012-11-18 22:56:40 -08005101static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005102 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005103 int action)
5104{
5105 struct alc_spec *spec = codec->spec;
5106
Takashi Iwai0db75792013-01-23 13:57:20 +01005107 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005108 int mic_pin = find_ext_mic_pin(codec);
5109 int hp_pin = spec->gen.autocfg.hp_pins[0];
5110
5111 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005112 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005113 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005114 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005115}
David Henningsson693b6132012-06-22 19:12:10 +02005116
David Henningsson3e0d6112013-04-22 14:30:14 +02005117static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5118 const struct hda_fixup *fix,
5119 int action)
5120{
5121 struct alc_spec *spec = codec->spec;
5122 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5123 int i;
5124
5125 /* The mic boosts on level 2 and 3 are too noisy
5126 on the internal mic input.
5127 Therefore limit the boost to 0 or 1. */
5128
5129 if (action != HDA_FIXUP_ACT_PROBE)
5130 return;
5131
5132 for (i = 0; i < cfg->num_inputs; i++) {
5133 hda_nid_t nid = cfg->inputs[i].pin;
5134 unsigned int defcfg;
5135 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5136 continue;
5137 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5138 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5139 continue;
5140
5141 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5142 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5143 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5144 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5145 (0 << AC_AMPCAP_MUTE_SHIFT));
5146 }
5147}
5148
Kailang Yangcd217a62013-08-22 10:15:24 +02005149static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005150 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005151{
5152 struct alc_spec *spec = codec->spec;
5153 int vref;
5154
5155 msleep(200);
5156 snd_hda_gen_hp_automute(codec, jack);
5157
5158 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5159
5160 msleep(600);
5161 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5162 vref);
5163}
5164
Kailang Yangcd217a62013-08-22 10:15:24 +02005165static void alc283_fixup_chromebook(struct hda_codec *codec,
5166 const struct hda_fixup *fix, int action)
5167{
5168 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005169
5170 switch (action) {
5171 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005172 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005173 /* Disable AA-loopback as it causes white noise */
5174 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08005175 break;
5176 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08005177 /* MIC2-VREF control */
5178 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005179 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08005180 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02005181 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08005182 break;
5183 }
5184}
5185
5186static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5187 const struct hda_fixup *fix, int action)
5188{
5189 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08005190
5191 switch (action) {
5192 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02005193 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5194 break;
5195 case HDA_FIXUP_ACT_INIT:
5196 /* MIC2-VREF control */
5197 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005198 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02005199 break;
5200 }
5201}
5202
Takashi Iwai7bba2152013-09-06 15:45:38 +02005203/* mute tablet speaker pin (0x14) via dock plugging in addition */
5204static void asus_tx300_automute(struct hda_codec *codec)
5205{
5206 struct alc_spec *spec = codec->spec;
5207 snd_hda_gen_update_outputs(codec);
5208 if (snd_hda_jack_detect(codec, 0x1b))
5209 spec->gen.mute_bits |= (1ULL << 0x14);
5210}
5211
5212static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5213 const struct hda_fixup *fix, int action)
5214{
5215 struct alc_spec *spec = codec->spec;
5216 /* TX300 needs to set up GPIO2 for the speaker amp */
5217 static const struct hda_verb gpio2_verbs[] = {
5218 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
5219 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
5220 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
5221 {}
5222 };
5223 static const struct hda_pintbl dock_pins[] = {
5224 { 0x1b, 0x21114000 }, /* dock speaker pin */
5225 {}
5226 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02005227
5228 switch (action) {
5229 case HDA_FIXUP_ACT_PRE_PROBE:
5230 snd_hda_add_verbs(codec, gpio2_verbs);
5231 snd_hda_apply_pincfgs(codec, dock_pins);
5232 spec->gen.auto_mute_via_amp = 1;
5233 spec->gen.automute_hook = asus_tx300_automute;
5234 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005235 snd_hda_gen_hp_automute);
5236 break;
5237 case HDA_FIXUP_ACT_BUILD:
5238 /* this is a bit tricky; give more sane names for the main
5239 * (tablet) speaker and the dock speaker, respectively
5240 */
Takashi Iwai56798e62017-04-11 08:10:52 +02005241 rename_ctl(codec, "Speaker Playback Switch",
5242 "Dock Speaker Playback Switch");
5243 rename_ctl(codec, "Bass Speaker Playback Switch",
5244 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02005245 break;
5246 }
5247}
5248
David Henningsson338cae52013-10-07 10:39:59 +02005249static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5250 const struct hda_fixup *fix, int action)
5251{
David Henningsson0f4881d2013-12-20 16:08:13 +01005252 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5253 /* DAC node 0x03 is giving mono output. We therefore want to
5254 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5255 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5256 hda_nid_t conn1[2] = { 0x0c };
5257 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
5258 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
5259 }
David Henningsson338cae52013-10-07 10:39:59 +02005260}
5261
Hui Wangdd9aa332016-08-01 10:20:32 +08005262static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5263 const struct hda_fixup *fix, int action)
5264{
5265 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5266 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5267 we can't adjust the speaker's volume since this node does not has
5268 Amp-out capability. we change the speaker's route to:
5269 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5270 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5271 speaker's volume now. */
5272
5273 hda_nid_t conn1[1] = { 0x0c };
5274 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
5275 }
5276}
5277
Takashi Iwaie312a862018-03-06 12:14:17 +01005278/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5279static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5280 const struct hda_fixup *fix, int action)
5281{
5282 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5283 hda_nid_t conn[2] = { 0x02, 0x03 };
5284 snd_hda_override_conn_list(codec, 0x17, 2, conn);
5285 }
5286}
5287
Keith Packard98973f22015-07-15 12:14:39 -07005288/* Hook to update amp GPIO4 for automute */
5289static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5290 struct hda_jack_callback *jack)
5291{
5292 struct alc_spec *spec = codec->spec;
5293
5294 snd_hda_gen_hp_automute(codec, jack);
5295 /* mute_led_polarity is set to 0, so we pass inverted value here */
5296 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
5297}
5298
5299/* Manage GPIOs for HP EliteBook Folio 9480m.
5300 *
5301 * GPIO4 is the headphone amplifier power control
5302 * GPIO3 is the audio output mute indicator LED
5303 */
5304
5305static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5306 const struct hda_fixup *fix,
5307 int action)
5308{
5309 struct alc_spec *spec = codec->spec;
5310 static const struct hda_verb gpio_init[] = {
5311 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
5312 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
5313 {}
5314 };
5315
5316 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5317 /* Set the hooks to turn the headphone amp on/off
5318 * as needed
5319 */
5320 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
5321 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
5322
5323 /* The GPIOs are currently off */
5324 spec->gpio_led = 0;
5325
5326 /* GPIO3 is connected to the output mute LED,
5327 * high is on, low is off
5328 */
5329 spec->mute_led_polarity = 0;
5330 spec->gpio_mute_led_mask = 0x08;
5331
5332 /* Initialize GPIO configuration */
5333 snd_hda_add_verbs(codec, gpio_init);
5334 }
5335}
5336
Kailang Yangca169cc2017-04-25 16:17:40 +08005337static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5338 const struct hda_fixup *fix,
5339 int action)
5340{
5341 alc_fixup_dual_codecs(codec, fix, action);
5342 switch (action) {
5343 case HDA_FIXUP_ACT_PRE_PROBE:
5344 /* override card longname to provide a unique UCM profile */
5345 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5346 break;
5347 case HDA_FIXUP_ACT_BUILD:
5348 /* rename Capture controls depending on the codec */
5349 rename_ctl(codec, "Capture Volume",
5350 codec->addr == 0 ?
5351 "Rear-Panel Capture Volume" :
5352 "Front-Panel Capture Volume");
5353 rename_ctl(codec, "Capture Switch",
5354 codec->addr == 0 ?
5355 "Rear-Panel Capture Switch" :
5356 "Front-Panel Capture Switch");
5357 break;
5358 }
5359}
5360
Kailang Yang92266652017-12-14 15:28:58 +08005361/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5362static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5363 const struct hda_fixup *fix, int action)
5364{
5365 struct alc_spec *spec = codec->spec;
5366 static hda_nid_t preferred_pairs[] = {
5367 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5368 0
5369 };
5370
5371 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5372 return;
5373
5374 spec->gen.preferred_dacs = preferred_pairs;
5375}
5376
Takashi Iwaib317b032014-01-08 11:44:21 +01005377/* for hda_fixup_thinkpad_acpi() */
5378#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01005379
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02005380static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5381 const struct hda_fixup *fix, int action)
5382{
5383 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5384 hda_fixup_thinkpad_acpi(codec, fix, action);
5385}
5386
Hui Wang00ef9942014-07-31 11:52:38 +08005387/* for dell wmi mic mute led */
5388#include "dell_wmi_helper.c"
5389
Tom Bridenbbf8ff62018-05-29 17:34:20 +01005390/* for alc295_fixup_hp_top_speakers */
5391#include "hp_x360_helper.c"
5392
Takashi Iwai1d045db2011-07-07 18:23:21 +02005393enum {
5394 ALC269_FIXUP_SONY_VAIO,
5395 ALC275_FIXUP_SONY_VAIO_GPIO2,
5396 ALC269_FIXUP_DELL_M101Z,
5397 ALC269_FIXUP_SKU_IGNORE,
5398 ALC269_FIXUP_ASUS_G73JW,
5399 ALC269_FIXUP_LENOVO_EAPD,
5400 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02005401 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005402 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02005403 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005404 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02005405 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02005406 ALC269_FIXUP_QUANTA_MUTE,
5407 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02005408 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02005409 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02005410 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01005411 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02005412 ALC269_FIXUP_AMIC,
5413 ALC269_FIXUP_DMIC,
5414 ALC269VB_FIXUP_AMIC,
5415 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005416 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01005417 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005418 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00005419 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01005420 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08005421 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5422 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02005423 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02005424 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005425 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02005426 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02005427 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02005428 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5429 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02005430 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08005431 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02005432 ALC269_FIXUP_HEADSET_MODE,
5433 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02005434 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02005435 ALC269_FIXUP_ASUS_X101_FUNC,
5436 ALC269_FIXUP_ASUS_X101_VERB,
5437 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08005438 ALC271_FIXUP_AMIC_MIC2,
5439 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01005440 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07005441 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02005442 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01005443 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01005444 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01005445 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02005446 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02005447 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08005448 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005449 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02005450 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02005451 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01005452 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5453 ALC290_FIXUP_SUBWOOFER,
5454 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01005455 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01005456 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06005457 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06005458 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005459 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08005460 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005461 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08005462 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08005463 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02005464 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01005465 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02005466 ALC283_FIXUP_HEADSET_MIC,
Hui Wang00ef9942014-07-31 11:52:38 +08005467 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02005468 ALC282_FIXUP_ASPIRE_V5_PINS,
David Henningsson7a5255f2014-10-30 08:26:01 +01005469 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08005470 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01005471 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01005472 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01005473 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07005474 ALC280_FIXUP_HP_9480M,
Kailang Yange1e62b92015-04-08 16:01:22 +08005475 ALC288_FIXUP_DELL_HEADSET_MODE,
5476 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
5477 ALC288_FIXUP_DELL_XPS_13_GPIO6,
Hui Wang831bfdf92015-06-26 12:35:17 +08005478 ALC288_FIXUP_DELL_XPS_13,
5479 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02005480 ALC292_FIXUP_DELL_E7X,
5481 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01005482 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
Kailang Yang977e6272015-05-18 15:31:20 +08005483 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08005484 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08005485 ALC275_FIXUP_DELL_XPS,
Hui Wang8c697292015-11-24 11:08:18 +08005486 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
Hui Wang23adc192015-12-08 12:27:18 +08005487 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08005488 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08005489 ALC255_FIXUP_DELL_SPK_NOISE,
David Henningsson2ae95572016-02-25 09:37:05 +01005490 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01005491 ALC295_FIXUP_DISABLE_DAC3,
Takashi Iwaif8839822016-02-25 14:31:59 +01005492 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08005493 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02005494 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08005495 ALC298_FIXUP_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08005496 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01005497 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08005498 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06005499 ALC256_FIXUP_ASUS_HEADSET_MODE,
5500 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06005501 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06005502 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
5503 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08005504 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Hui Wangf33f79f2017-07-07 12:08:29 +08005505 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08005506 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
PeiSen Houb84e8432017-09-01 15:11:56 +08005507 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08005508 ALC274_FIXUP_DELL_BIND_DACS,
5509 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005510 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08005511 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08005512 ALC255_FIXUP_DELL_HEADSET_MIC,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01005513 ALC295_FIXUP_HP_X360,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005514};
5515
Takashi Iwai1727a772013-01-10 09:52:52 +01005516static const struct hda_fixup alc269_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005517 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01005518 .type = HDA_FIXUP_PINCTLS,
5519 .v.pins = (const struct hda_pintbl[]) {
5520 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02005521 {}
5522 }
5523 },
5524 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005525 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005526 .v.verbs = (const struct hda_verb[]) {
5527 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
5528 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
5529 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5530 { }
5531 },
5532 .chained = true,
5533 .chain_id = ALC269_FIXUP_SONY_VAIO
5534 },
5535 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005536 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005537 .v.verbs = (const struct hda_verb[]) {
5538 /* Enables internal speaker */
5539 {0x20, AC_VERB_SET_COEF_INDEX, 13},
5540 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
5541 {}
5542 }
5543 },
5544 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005545 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02005546 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005547 },
5548 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005549 .type = HDA_FIXUP_PINS,
5550 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005551 { 0x17, 0x99130111 }, /* subwoofer */
5552 { }
5553 }
5554 },
5555 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005556 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005557 .v.verbs = (const struct hda_verb[]) {
5558 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5559 {}
5560 }
5561 },
5562 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005563 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005564 .v.func = alc269_fixup_hweq,
5565 .chained = true,
5566 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5567 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02005568 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5569 .type = HDA_FIXUP_FUNC,
5570 .v.func = alc_fixup_disable_aamix,
5571 .chained = true,
5572 .chain_id = ALC269_FIXUP_SONY_VAIO
5573 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02005574 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005575 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005576 .v.func = alc271_fixup_dmic,
5577 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02005578 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005579 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02005580 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02005581 .chained = true,
5582 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02005583 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005584 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005585 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005586 .v.func = alc269_fixup_stereo_dmic,
5587 },
David Henningsson7c478f02013-10-11 10:18:46 +02005588 [ALC269_FIXUP_HEADSET_MIC] = {
5589 .type = HDA_FIXUP_FUNC,
5590 .v.func = alc269_fixup_headset_mic,
5591 },
Takashi Iwai24519912011-08-16 15:08:49 +02005592 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005593 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02005594 .v.func = alc269_fixup_quanta_mute,
5595 },
5596 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005597 .type = HDA_FIXUP_PINS,
5598 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02005599 { 0x1a, 0x2101103f }, /* dock line-out */
5600 { 0x1b, 0x23a11040 }, /* dock mic-in */
5601 { }
5602 },
5603 .chained = true,
5604 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5605 },
David Henningsson2041d562014-06-13 11:15:44 +02005606 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5607 .type = HDA_FIXUP_PINS,
5608 .v.pins = (const struct hda_pintbl[]) {
5609 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5610 { }
5611 },
5612 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02005613 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5614 .type = HDA_FIXUP_PINS,
5615 .v.pins = (const struct hda_pintbl[]) {
5616 { 0x21, 0x0221102f }, /* HP out */
5617 { }
5618 },
5619 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02005620 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5621 .type = HDA_FIXUP_FUNC,
5622 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5623 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01005624 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5625 .type = HDA_FIXUP_FUNC,
5626 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5627 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02005628 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005629 .type = HDA_FIXUP_PINS,
5630 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005631 { 0x14, 0x99130110 }, /* speaker */
5632 { 0x15, 0x0121401f }, /* HP out */
5633 { 0x18, 0x01a19c20 }, /* mic */
5634 { 0x19, 0x99a3092f }, /* int-mic */
5635 { }
5636 },
5637 },
5638 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005639 .type = HDA_FIXUP_PINS,
5640 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005641 { 0x12, 0x99a3092f }, /* int-mic */
5642 { 0x14, 0x99130110 }, /* speaker */
5643 { 0x15, 0x0121401f }, /* HP out */
5644 { 0x18, 0x01a19c20 }, /* mic */
5645 { }
5646 },
5647 },
5648 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005649 .type = HDA_FIXUP_PINS,
5650 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005651 { 0x14, 0x99130110 }, /* speaker */
5652 { 0x18, 0x01a19c20 }, /* mic */
5653 { 0x19, 0x99a3092f }, /* int-mic */
5654 { 0x21, 0x0121401f }, /* HP out */
5655 { }
5656 },
5657 },
David Henningsson2267ea92012-01-03 08:45:56 +01005658 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005659 .type = HDA_FIXUP_PINS,
5660 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005661 { 0x12, 0x99a3092f }, /* int-mic */
5662 { 0x14, 0x99130110 }, /* speaker */
5663 { 0x18, 0x01a19c20 }, /* mic */
5664 { 0x21, 0x0121401f }, /* HP out */
5665 { }
5666 },
5667 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005668 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005669 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005670 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01005671 },
David Henningssond06ac142013-02-18 11:41:55 +01005672 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5673 .type = HDA_FIXUP_FUNC,
5674 .v.func = alc269_fixup_hp_mute_led_mic1,
5675 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005676 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005677 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005678 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01005679 },
Tom Briden7f783bd2017-03-25 10:12:01 +00005680 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
5681 .type = HDA_FIXUP_FUNC,
5682 .v.func = alc269_fixup_hp_mute_led_mic3,
5683 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01005684 [ALC269_FIXUP_HP_GPIO_LED] = {
5685 .type = HDA_FIXUP_FUNC,
5686 .v.func = alc269_fixup_hp_gpio_led,
5687 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08005688 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5689 .type = HDA_FIXUP_FUNC,
5690 .v.func = alc269_fixup_hp_gpio_mic1_led,
5691 },
5692 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5693 .type = HDA_FIXUP_FUNC,
5694 .v.func = alc269_fixup_hp_line1_mic1_led,
5695 },
David Henningsson693b6132012-06-22 19:12:10 +02005696 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005697 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02005698 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02005699 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005700 [ALC269_FIXUP_NO_SHUTUP] = {
5701 .type = HDA_FIXUP_FUNC,
5702 .v.func = alc_fixup_no_shutup,
5703 },
David Henningsson108cc102012-07-20 10:37:25 +02005704 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005705 .type = HDA_FIXUP_PINS,
5706 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02005707 { 0x19, 0x23a11040 }, /* dock mic */
5708 { 0x1b, 0x2121103f }, /* dock headphone */
5709 { }
5710 },
5711 .chained = true,
5712 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5713 },
5714 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005715 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02005716 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01005717 .chained = true,
5718 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02005719 },
David Henningsson73bdd592013-04-15 15:44:14 +02005720 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5721 .type = HDA_FIXUP_PINS,
5722 .v.pins = (const struct hda_pintbl[]) {
5723 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5724 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5725 { }
5726 },
5727 .chained = true,
5728 .chain_id = ALC269_FIXUP_HEADSET_MODE
5729 },
5730 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5731 .type = HDA_FIXUP_PINS,
5732 .v.pins = (const struct hda_pintbl[]) {
5733 { 0x16, 0x21014020 }, /* dock line out */
5734 { 0x19, 0x21a19030 }, /* dock mic */
5735 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5736 { }
5737 },
5738 .chained = true,
5739 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5740 },
David Henningsson338cae52013-10-07 10:39:59 +02005741 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5742 .type = HDA_FIXUP_PINS,
5743 .v.pins = (const struct hda_pintbl[]) {
5744 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5745 { }
5746 },
5747 .chained = true,
5748 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5749 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08005750 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
5751 .type = HDA_FIXUP_PINS,
5752 .v.pins = (const struct hda_pintbl[]) {
5753 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5754 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5755 { }
5756 },
5757 .chained = true,
5758 .chain_id = ALC269_FIXUP_HEADSET_MODE
5759 },
David Henningsson73bdd592013-04-15 15:44:14 +02005760 [ALC269_FIXUP_HEADSET_MODE] = {
5761 .type = HDA_FIXUP_FUNC,
5762 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08005763 .chained = true,
5764 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02005765 },
5766 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5767 .type = HDA_FIXUP_FUNC,
5768 .v.func = alc_fixup_headset_mode_no_hp_mic,
5769 },
Takashi Iwai78197172015-06-27 10:21:13 +02005770 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
5771 .type = HDA_FIXUP_PINS,
5772 .v.pins = (const struct hda_pintbl[]) {
5773 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
5774 { }
5775 },
5776 .chained = true,
5777 .chain_id = ALC269_FIXUP_HEADSET_MODE,
5778 },
David Henningsson88cfcf82013-10-11 10:18:45 +02005779 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
5780 .type = HDA_FIXUP_PINS,
5781 .v.pins = (const struct hda_pintbl[]) {
5782 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5783 { }
5784 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02005785 .chained = true,
5786 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02005787 },
David Henningssond240d1d2013-04-15 12:50:02 +02005788 [ALC269_FIXUP_ASUS_X101_FUNC] = {
5789 .type = HDA_FIXUP_FUNC,
5790 .v.func = alc269_fixup_x101_headset_mic,
5791 },
5792 [ALC269_FIXUP_ASUS_X101_VERB] = {
5793 .type = HDA_FIXUP_VERBS,
5794 .v.verbs = (const struct hda_verb[]) {
5795 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5796 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
5797 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
5798 { }
5799 },
5800 .chained = true,
5801 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
5802 },
5803 [ALC269_FIXUP_ASUS_X101] = {
5804 .type = HDA_FIXUP_PINS,
5805 .v.pins = (const struct hda_pintbl[]) {
5806 { 0x18, 0x04a1182c }, /* Headset mic */
5807 { }
5808 },
5809 .chained = true,
5810 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
5811 },
Dylan Reid08a978d2012-11-18 22:56:40 -08005812 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005813 .type = HDA_FIXUP_PINS,
5814 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08005815 { 0x14, 0x99130110 }, /* speaker */
5816 { 0x19, 0x01a19c20 }, /* mic */
5817 { 0x1b, 0x99a7012f }, /* int-mic */
5818 { 0x21, 0x0121401f }, /* HP out */
5819 { }
5820 },
5821 },
5822 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005823 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08005824 .v.func = alc271_hp_gate_mic_jack,
5825 .chained = true,
5826 .chain_id = ALC271_FIXUP_AMIC_MIC2,
5827 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01005828 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
5829 .type = HDA_FIXUP_FUNC,
5830 .v.func = alc269_fixup_limit_int_mic_boost,
5831 .chained = true,
5832 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
5833 },
Dylan Reid42397002013-04-05 14:58:22 -07005834 [ALC269_FIXUP_ACER_AC700] = {
5835 .type = HDA_FIXUP_PINS,
5836 .v.pins = (const struct hda_pintbl[]) {
5837 { 0x12, 0x99a3092f }, /* int-mic */
5838 { 0x14, 0x99130110 }, /* speaker */
5839 { 0x18, 0x03a11c20 }, /* mic */
5840 { 0x1e, 0x0346101e }, /* SPDIF1 */
5841 { 0x21, 0x0321101f }, /* HP out */
5842 { }
5843 },
5844 .chained = true,
5845 .chain_id = ALC271_FIXUP_DMIC,
5846 },
David Henningsson3e0d6112013-04-22 14:30:14 +02005847 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
5848 .type = HDA_FIXUP_FUNC,
5849 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01005850 .chained = true,
5851 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02005852 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01005853 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
5854 .type = HDA_FIXUP_FUNC,
5855 .v.func = alc269_fixup_limit_int_mic_boost,
5856 .chained = true,
5857 .chain_id = ALC269VB_FIXUP_DMIC,
5858 },
Takashi Iwai23870832013-11-29 14:13:12 +01005859 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
5860 .type = HDA_FIXUP_VERBS,
5861 .v.verbs = (const struct hda_verb[]) {
5862 /* class-D output amp +5dB */
5863 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
5864 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
5865 {}
5866 },
5867 .chained = true,
5868 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
5869 },
David Henningsson8e35cd42013-11-06 11:20:01 +01005870 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
5871 .type = HDA_FIXUP_FUNC,
5872 .v.func = alc269_fixup_limit_int_mic_boost,
5873 .chained = true,
5874 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
5875 },
Anisse Astier02b504d2013-06-03 11:53:10 +02005876 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
5877 .type = HDA_FIXUP_PINS,
5878 .v.pins = (const struct hda_pintbl[]) {
5879 { 0x12, 0x99a3092f }, /* int-mic */
5880 { 0x18, 0x03a11d20 }, /* mic */
5881 { 0x19, 0x411111f0 }, /* Unused bogus pin */
5882 { }
5883 },
5884 },
Kailang Yangcd217a62013-08-22 10:15:24 +02005885 [ALC283_FIXUP_CHROME_BOOK] = {
5886 .type = HDA_FIXUP_FUNC,
5887 .v.func = alc283_fixup_chromebook,
5888 },
Kailang Yang0202e992013-12-02 15:20:15 +08005889 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
5890 .type = HDA_FIXUP_FUNC,
5891 .v.func = alc283_fixup_sense_combo_jack,
5892 .chained = true,
5893 .chain_id = ALC283_FIXUP_CHROME_BOOK,
5894 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02005895 [ALC282_FIXUP_ASUS_TX300] = {
5896 .type = HDA_FIXUP_FUNC,
5897 .v.func = alc282_fixup_asus_tx300,
5898 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02005899 [ALC283_FIXUP_INT_MIC] = {
5900 .type = HDA_FIXUP_VERBS,
5901 .v.verbs = (const struct hda_verb[]) {
5902 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
5903 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
5904 { }
5905 },
5906 .chained = true,
5907 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
5908 },
David Henningsson0f4881d2013-12-20 16:08:13 +01005909 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
5910 .type = HDA_FIXUP_PINS,
5911 .v.pins = (const struct hda_pintbl[]) {
5912 { 0x17, 0x90170112 }, /* subwoofer */
5913 { }
5914 },
5915 .chained = true,
5916 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5917 },
5918 [ALC290_FIXUP_SUBWOOFER] = {
5919 .type = HDA_FIXUP_PINS,
5920 .v.pins = (const struct hda_pintbl[]) {
5921 { 0x17, 0x90170112 }, /* subwoofer */
5922 { }
5923 },
5924 .chained = true,
5925 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
5926 },
David Henningsson338cae52013-10-07 10:39:59 +02005927 [ALC290_FIXUP_MONO_SPEAKERS] = {
5928 .type = HDA_FIXUP_FUNC,
5929 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01005930 },
5931 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
5932 .type = HDA_FIXUP_FUNC,
5933 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02005934 .chained = true,
5935 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5936 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01005937 [ALC269_FIXUP_THINKPAD_ACPI] = {
5938 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02005939 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02005940 .chained = true,
5941 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01005942 },
David Henningsson56f27012016-01-11 09:33:14 +01005943 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
5944 .type = HDA_FIXUP_FUNC,
5945 .v.func = alc_fixup_inv_dmic,
5946 .chained = true,
5947 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5948 },
Chris Chiu5824ce82017-02-28 14:17:11 -06005949 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
5950 .type = HDA_FIXUP_PINS,
5951 .v.pins = (const struct hda_pintbl[]) {
5952 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5953 { }
5954 },
5955 .chained = true,
5956 .chain_id = ALC255_FIXUP_HEADSET_MODE
5957 },
Chris Chiu615966a2017-02-28 14:17:12 -06005958 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
5959 .type = HDA_FIXUP_PINS,
5960 .v.pins = (const struct hda_pintbl[]) {
5961 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5962 { }
5963 },
5964 .chained = true,
5965 .chain_id = ALC255_FIXUP_HEADSET_MODE
5966 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005967 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5968 .type = HDA_FIXUP_PINS,
5969 .v.pins = (const struct hda_pintbl[]) {
5970 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5971 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5972 { }
5973 },
5974 .chained = true,
5975 .chain_id = ALC255_FIXUP_HEADSET_MODE
5976 },
Kailang Yang31278992014-03-03 15:27:22 +08005977 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5978 .type = HDA_FIXUP_PINS,
5979 .v.pins = (const struct hda_pintbl[]) {
5980 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5981 { }
5982 },
5983 .chained = true,
5984 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
5985 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005986 [ALC255_FIXUP_HEADSET_MODE] = {
5987 .type = HDA_FIXUP_FUNC,
5988 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08005989 .chained = true,
5990 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005991 },
Kailang Yang31278992014-03-03 15:27:22 +08005992 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5993 .type = HDA_FIXUP_FUNC,
5994 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
5995 },
Kailang Yanga22aa262014-04-23 17:34:28 +08005996 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5997 .type = HDA_FIXUP_PINS,
5998 .v.pins = (const struct hda_pintbl[]) {
5999 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6000 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6001 { }
6002 },
6003 .chained = true,
6004 .chain_id = ALC269_FIXUP_HEADSET_MODE
6005 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02006006 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02006007 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02006008 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006009 .chained = true,
6010 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6011 },
Takashi Iwai9a811232015-12-09 15:17:43 +01006012 [ALC292_FIXUP_TPT440] = {
6013 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01006014 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01006015 .chained = true,
6016 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6017 },
Anisse Astierabaa22742016-08-24 09:14:13 +02006018 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01006019 .type = HDA_FIXUP_PINS,
6020 .v.pins = (const struct hda_pintbl[]) {
6021 { 0x19, 0x04a110f0 },
6022 { },
6023 },
6024 },
Hui Wang00ef9942014-07-31 11:52:38 +08006025 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
6026 .type = HDA_FIXUP_FUNC,
6027 .v.func = alc_fixup_dell_wmi,
Hui Wang00ef9942014-07-31 11:52:38 +08006028 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006029 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6030 .type = HDA_FIXUP_PINS,
6031 .v.pins = (const struct hda_pintbl[]) {
6032 { 0x12, 0x90a60130 },
6033 { 0x14, 0x90170110 },
6034 { 0x17, 0x40000008 },
6035 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02006036 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006037 { 0x1a, 0x411111f0 },
6038 { 0x1b, 0x411111f0 },
6039 { 0x1d, 0x40f89b2d },
6040 { 0x1e, 0x411111f0 },
6041 { 0x21, 0x0321101f },
6042 { },
6043 },
6044 },
David Henningsson7a5255f2014-10-30 08:26:01 +01006045 [ALC280_FIXUP_HP_GPIO4] = {
6046 .type = HDA_FIXUP_FUNC,
6047 .v.func = alc280_fixup_hp_gpio4,
6048 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006049 [ALC286_FIXUP_HP_GPIO_LED] = {
6050 .type = HDA_FIXUP_FUNC,
6051 .v.func = alc286_fixup_hp_gpio_led,
6052 },
David Henningsson33f4acd2015-01-07 15:50:13 +01006053 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6054 .type = HDA_FIXUP_FUNC,
6055 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6056 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01006057 [ALC280_FIXUP_HP_DOCK_PINS] = {
6058 .type = HDA_FIXUP_PINS,
6059 .v.pins = (const struct hda_pintbl[]) {
6060 { 0x1b, 0x21011020 }, /* line-out */
6061 { 0x1a, 0x01a1903c }, /* headset mic */
6062 { 0x18, 0x2181103f }, /* line-in */
6063 { },
6064 },
6065 .chained = true,
6066 .chain_id = ALC280_FIXUP_HP_GPIO4
6067 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006068 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6069 .type = HDA_FIXUP_PINS,
6070 .v.pins = (const struct hda_pintbl[]) {
6071 { 0x1b, 0x21011020 }, /* line-out */
6072 { 0x18, 0x2181103f }, /* line-in */
6073 { },
6074 },
6075 .chained = true,
6076 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6077 },
Keith Packard98973f22015-07-15 12:14:39 -07006078 [ALC280_FIXUP_HP_9480M] = {
6079 .type = HDA_FIXUP_FUNC,
6080 .v.func = alc280_fixup_hp_9480m,
6081 },
Kailang Yange1e62b92015-04-08 16:01:22 +08006082 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6083 .type = HDA_FIXUP_FUNC,
6084 .v.func = alc_fixup_headset_mode_dell_alc288,
6085 .chained = true,
6086 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6087 },
6088 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6089 .type = HDA_FIXUP_PINS,
6090 .v.pins = (const struct hda_pintbl[]) {
6091 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6092 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6093 { }
6094 },
6095 .chained = true,
6096 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6097 },
6098 [ALC288_FIXUP_DELL_XPS_13_GPIO6] = {
6099 .type = HDA_FIXUP_VERBS,
6100 .v.verbs = (const struct hda_verb[]) {
6101 {0x01, AC_VERB_SET_GPIO_MASK, 0x40},
6102 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x40},
6103 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6104 { }
6105 },
6106 .chained = true,
6107 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
6108 },
Hui Wang831bfdf92015-06-26 12:35:17 +08006109 [ALC288_FIXUP_DISABLE_AAMIX] = {
6110 .type = HDA_FIXUP_FUNC,
6111 .v.func = alc_fixup_disable_aamix,
6112 .chained = true,
6113 .chain_id = ALC288_FIXUP_DELL_XPS_13_GPIO6
6114 },
6115 [ALC288_FIXUP_DELL_XPS_13] = {
6116 .type = HDA_FIXUP_FUNC,
6117 .v.func = alc_fixup_dell_xps13,
6118 .chained = true,
6119 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6120 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006121 [ALC292_FIXUP_DISABLE_AAMIX] = {
6122 .type = HDA_FIXUP_FUNC,
6123 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08006124 .chained = true,
6125 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006126 },
David Henningssonc04017e2015-12-15 14:44:03 +01006127 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6128 .type = HDA_FIXUP_FUNC,
6129 .v.func = alc_fixup_disable_aamix,
6130 .chained = true,
6131 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6132 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006133 [ALC292_FIXUP_DELL_E7X] = {
6134 .type = HDA_FIXUP_FUNC,
6135 .v.func = alc_fixup_dell_xps13,
6136 .chained = true,
6137 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6138 },
Kailang Yang977e6272015-05-18 15:31:20 +08006139 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6140 .type = HDA_FIXUP_PINS,
6141 .v.pins = (const struct hda_pintbl[]) {
6142 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6143 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6144 { }
6145 },
6146 .chained = true,
6147 .chain_id = ALC269_FIXUP_HEADSET_MODE
6148 },
Hui Wang2f726ae2017-03-31 10:31:40 +08006149 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6150 .type = HDA_FIXUP_PINS,
6151 .v.pins = (const struct hda_pintbl[]) {
6152 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6153 { }
6154 },
6155 .chained = true,
6156 .chain_id = ALC269_FIXUP_HEADSET_MODE
6157 },
Kailang Yang6ed11312015-10-26 15:37:39 +08006158 [ALC275_FIXUP_DELL_XPS] = {
6159 .type = HDA_FIXUP_VERBS,
6160 .v.verbs = (const struct hda_verb[]) {
6161 /* Enables internal speaker */
6162 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6163 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6164 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6165 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6166 {}
6167 }
6168 },
Hui Wang8c697292015-11-24 11:08:18 +08006169 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
6170 .type = HDA_FIXUP_VERBS,
6171 .v.verbs = (const struct hda_verb[]) {
6172 /* Disable pass-through path for FRONT 14h */
6173 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
6174 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
6175 {}
6176 },
6177 .chained = true,
6178 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6179 },
Hui Wang23adc192015-12-08 12:27:18 +08006180 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6181 .type = HDA_FIXUP_FUNC,
6182 .v.func = alc_fixup_disable_aamix,
6183 .chained = true,
6184 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6185 },
Kailang3694cb22015-12-28 11:35:24 +08006186 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6187 .type = HDA_FIXUP_FUNC,
6188 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6189 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006190 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6191 .type = HDA_FIXUP_FUNC,
6192 .v.func = alc_fixup_disable_aamix,
6193 .chained = true,
6194 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6195 },
David Henningsson2ae95572016-02-25 09:37:05 +01006196 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6197 .type = HDA_FIXUP_VERBS,
6198 .v.verbs = (const struct hda_verb[]) {
6199 /* Disable pass-through path for FRONT 14h */
6200 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6201 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6202 {}
6203 },
6204 .chained = true,
6205 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6206 },
Takashi Iwaif8839822016-02-25 14:31:59 +01006207 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6208 .type = HDA_FIXUP_FUNC,
6209 .v.func = alc_fixup_disable_aamix,
6210 .chained = true,
6211 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6212 },
Hui Wange549d192016-04-01 11:00:15 +08006213 [ALC221_FIXUP_HP_FRONT_MIC] = {
6214 .type = HDA_FIXUP_PINS,
6215 .v.pins = (const struct hda_pintbl[]) {
6216 { 0x19, 0x02a19020 }, /* Front Mic */
6217 { }
6218 },
6219 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02006220 [ALC292_FIXUP_TPT460] = {
6221 .type = HDA_FIXUP_FUNC,
6222 .v.func = alc_fixup_tpt440_dock,
6223 .chained = true,
6224 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6225 },
Hui Wangdd9aa332016-08-01 10:20:32 +08006226 [ALC298_FIXUP_SPK_VOLUME] = {
6227 .type = HDA_FIXUP_FUNC,
6228 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08006229 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08006230 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08006231 },
Takashi Iwaie312a862018-03-06 12:14:17 +01006232 [ALC295_FIXUP_DISABLE_DAC3] = {
6233 .type = HDA_FIXUP_FUNC,
6234 .v.func = alc295_fixup_disable_dac3,
6235 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006236 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6237 .type = HDA_FIXUP_PINS,
6238 .v.pins = (const struct hda_pintbl[]) {
6239 { 0x1b, 0x90170151 },
6240 { }
6241 },
6242 .chained = true,
6243 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6244 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006245 [ALC269_FIXUP_ATIV_BOOK_8] = {
6246 .type = HDA_FIXUP_FUNC,
6247 .v.func = alc_fixup_auto_mute_via_amp,
6248 .chained = true,
6249 .chain_id = ALC269_FIXUP_NO_SHUTUP
6250 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006251 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6252 .type = HDA_FIXUP_PINS,
6253 .v.pins = (const struct hda_pintbl[]) {
6254 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6255 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6256 { }
6257 },
6258 .chained = true,
6259 .chain_id = ALC269_FIXUP_HEADSET_MODE
6260 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06006261 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6262 .type = HDA_FIXUP_FUNC,
6263 .v.func = alc_fixup_headset_mode,
6264 },
6265 [ALC256_FIXUP_ASUS_MIC] = {
6266 .type = HDA_FIXUP_PINS,
6267 .v.pins = (const struct hda_pintbl[]) {
6268 { 0x13, 0x90a60160 }, /* use as internal mic */
6269 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6270 { }
6271 },
6272 .chained = true,
6273 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6274 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06006275 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
6276 .type = HDA_FIXUP_VERBS,
6277 .v.verbs = (const struct hda_verb[]) {
6278 /* Set up GPIO2 for the speaker amp */
6279 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
6280 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
6281 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
6282 {}
6283 },
6284 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06006285 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6286 .type = HDA_FIXUP_PINS,
6287 .v.pins = (const struct hda_pintbl[]) {
6288 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6289 { }
6290 },
6291 .chained = true,
6292 .chain_id = ALC269_FIXUP_HEADSET_MIC
6293 },
6294 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6295 .type = HDA_FIXUP_VERBS,
6296 .v.verbs = (const struct hda_verb[]) {
6297 /* Enables internal speaker */
6298 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6299 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6300 {}
6301 },
6302 .chained = true,
6303 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6304 },
Kailang Yangca169cc2017-04-25 16:17:40 +08006305 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6306 .type = HDA_FIXUP_FUNC,
6307 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6308 },
Hui Wangf33f79f2017-07-07 12:08:29 +08006309 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6310 .type = HDA_FIXUP_PINS,
6311 .v.pins = (const struct hda_pintbl[]) {
6312 /* Change the mic location from front to right, otherwise there are
6313 two front mics with the same name, pulseaudio can't handle them.
6314 This is just a temporary workaround, after applying this fixup,
6315 there will be one "Front Mic" and one "Mic" in this machine.
6316 */
6317 { 0x1a, 0x04a19040 },
6318 { }
6319 },
6320 },
Kailang Yang5f364132017-07-25 16:28:16 +08006321 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6322 .type = HDA_FIXUP_PINS,
6323 .v.pins = (const struct hda_pintbl[]) {
6324 { 0x16, 0x0101102f }, /* Rear Headset HP */
6325 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6326 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6327 { 0x1b, 0x02011020 },
6328 { }
6329 },
6330 .chained = true,
6331 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6332 },
PeiSen Houb84e8432017-09-01 15:11:56 +08006333 [ALC700_FIXUP_INTEL_REFERENCE] = {
6334 .type = HDA_FIXUP_VERBS,
6335 .v.verbs = (const struct hda_verb[]) {
6336 /* Enables internal speaker */
6337 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6338 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6339 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6340 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6341 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6342 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6343 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6344 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6345 {}
6346 }
6347 },
Kailang Yang92266652017-12-14 15:28:58 +08006348 [ALC274_FIXUP_DELL_BIND_DACS] = {
6349 .type = HDA_FIXUP_FUNC,
6350 .v.func = alc274_fixup_bind_dacs,
6351 .chained = true,
6352 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6353 },
6354 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6355 .type = HDA_FIXUP_PINS,
6356 .v.pins = (const struct hda_pintbl[]) {
6357 { 0x1b, 0x0401102f },
6358 { }
6359 },
6360 .chained = true,
6361 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6362 },
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006363 [ALC298_FIXUP_TPT470_DOCK] = {
6364 .type = HDA_FIXUP_FUNC,
6365 .v.func = alc_fixup_tpt470_dock,
6366 .chained = true,
6367 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6368 },
Kailang Yangae104a22018-02-05 16:07:20 +08006369 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6370 .type = HDA_FIXUP_PINS,
6371 .v.pins = (const struct hda_pintbl[]) {
6372 { 0x14, 0x0201101f },
6373 { }
6374 },
6375 .chained = true,
6376 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6377 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006378 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
6379 .type = HDA_FIXUP_PINS,
6380 .v.pins = (const struct hda_pintbl[]) {
6381 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6382 { }
6383 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08006384 .chained = true,
6385 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006386 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006387 [ALC295_FIXUP_HP_X360] = {
6388 .type = HDA_FIXUP_FUNC,
6389 .v.func = alc295_fixup_hp_top_speakers,
6390 .chained = true,
6391 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
6392 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02006393};
6394
6395static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01006396 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02006397 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6398 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02006399 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02006400 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6401 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02006402 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6403 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05006404 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006405 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02006406 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01006407 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
David Henningssonaaedfb42013-08-16 14:09:02 +02006408 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08006409 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01006410 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01006411 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006412 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
6413 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01006414 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02006415 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6416 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6417 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01006418 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6419 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01006420 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02006421 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01006422 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08006423 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6424 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08006425 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02006426 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02006427 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08006428 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08006429 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6430 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01006431 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6432 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6433 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6434 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6435 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Feng423cd782016-05-20 15:47:23 +08006436 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006437 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006438 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Kai-Heng Feng423cd782016-05-20 15:47:23 +08006439 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Hui Wangdd9aa332016-08-01 10:20:32 +08006440 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwaie312a862018-03-06 12:14:17 +01006441 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Takashi Iwai493de342017-02-28 17:27:57 +01006442 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kailang Yang5f364132017-07-25 16:28:16 +08006443 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Takashi Iwaie4c9fd12018-01-10 08:34:28 +01006444 SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08006445 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6446 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006447 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6448 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08006449 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yanga22aa262014-04-23 17:34:28 +08006450 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6451 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006452 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006453 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01006454 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
David Henningsson33f4acd2015-01-07 15:50:13 +01006455 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08006456 /* ALC282 */
Hui Wang7976eb42015-02-13 11:14:41 +08006457 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006458 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006459 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006460 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6461 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6462 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6463 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006464 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006465 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006466 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6467 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006468 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006469 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
TienFu Chenb4b33f92015-01-20 15:06:21 +01006470 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
TienFu Chen3271cb22015-02-10 09:09:41 +01006471 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yangc60666b2014-02-21 16:23:35 +08006472 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006473 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6474 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6475 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006476 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Keith Packard98973f22015-07-15 12:14:39 -07006477 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006478 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6479 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006480 /* ALC290 */
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006481 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006482 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006483 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006484 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6485 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6486 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6487 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6488 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006489 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006490 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006491 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006492 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6493 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6494 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006495 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6496 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006497 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006498 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006499 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006500 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006501 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6502 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006503 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6504 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006505 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006506 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6507 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6508 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6509 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwaif8839822016-02-25 14:31:59 +01006510 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
Hui Wange549d192016-04-01 11:00:15 +08006511 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006512 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006513 SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6514 SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006515 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02006516 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02006517 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006518 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006519 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02006520 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006521 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6522 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6523 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006524 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
6525 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
6526 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01006527 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01006528 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02006529 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai017f2a12011-07-09 14:42:25 +02006530 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06006531 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
David Henningsson693b6132012-06-22 19:12:10 +02006532 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06006533 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006534 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006535 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Chris Chiueeed4cd2017-02-28 14:17:15 -06006536 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006537 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
6538 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
6539 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6540 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02006541 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwaif88abaa2014-02-07 12:07:59 +01006542 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
David Henningsson88cfcf82013-10-11 10:18:45 +02006543 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006544 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
6545 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6546 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006547 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwai24519912011-08-16 15:08:49 +02006548 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006549 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006550 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Takashi Iwai88776f32015-05-01 09:20:34 +02006551 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006552 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
David Henningsson2041d562014-06-13 11:15:44 +02006553 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08006554 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
David Henningssona33cc482014-10-07 10:18:41 +02006555 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006556 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Anisse Astierabaa22742016-08-24 09:14:13 +02006557 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
6558 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Kailang Yangca169cc2017-04-25 16:17:40 +08006559 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006560 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
6561 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
6562 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
6563 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
6564 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwai707fba32012-08-02 09:04:39 +02006565 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
Felix Kaechelec8415a42012-08-06 23:02:01 +02006566 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Stefán Freyr84f98fd2012-10-19 22:46:00 +02006567 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02006568 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02006569 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02006570 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01006571 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02006572 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02006573 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05006574 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02006575 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01006576 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02006577 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01006578 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07006579 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02006580 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006581 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6582 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02006583 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02006584 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006585 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
6586 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6587 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01006588 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006589 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6590 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6591 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01006592 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang3694cb22015-12-28 11:35:24 +08006593 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08006594 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08006595 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08006596 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wanga3dafb22018-04-19 13:29:05 +08006597 SND_PCI_QUIRK(0x17aa, 0x3138, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08006598 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
David Henningsson56f27012016-01-11 09:33:14 +01006599 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01006600 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006601 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
David Henningssona4a9e082013-08-16 14:09:01 +02006602 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02006603 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02006604 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02006605 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02006606 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01006607 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02006608 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02006609 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08006610 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02006611 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02006612 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02006613 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006614 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6615 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6616 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02006617 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006618 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6619 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningsson012e7eb2012-08-08 08:43:37 +02006620 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006621 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Anisse Astier02b504d2013-06-03 11:53:10 +02006622 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02006623
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01006624#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02006625 /* Below is a quirk table taken from the old code.
6626 * Basically the device should work as is without the fixup table.
6627 * If BIOS doesn't give a proper info, enable the corresponding
6628 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02006629 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02006630 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
6631 ALC269_FIXUP_AMIC),
6632 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02006633 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
6634 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
6635 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
6636 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
6637 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
6638 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
6639 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
6640 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
6641 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
6642 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
6643 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
6644 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
6645 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
6646 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
6647 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
6648 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
6649 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
6650 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
6651 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
6652 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
6653 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
6654 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
6655 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
6656 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
6657 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
6658 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
6659 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
6660 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
6661 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
6662 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
6663 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
6664 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
6665 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
6666 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
6667 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
6668 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
6669 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
6670 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
6671#endif
6672 {}
6673};
6674
David Henningsson214eef72014-07-22 14:09:35 +02006675static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
6676 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
6677 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
6678 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
6679 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
6680 {}
6681};
6682
Takashi Iwai1727a772013-01-10 09:52:52 +01006683static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006684 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
6685 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02006686 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
6687 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
6688 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02006689 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02006690 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
6691 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02006692 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006693 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006694 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02006695 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
6696 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08006697 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08006698 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02006699 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01006700 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02006701 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02006702 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02006703 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02006704 {}
6705};
Kailang Yangcfc5a842016-02-03 15:20:39 +08006706#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08006707 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02006708
Hui Wange8191a82015-04-24 13:39:59 +08006709#define ALC256_STANDARD_PINS \
6710 {0x12, 0x90a60140}, \
6711 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08006712 {0x21, 0x02211020}
6713
David Henningssonfea185e2014-09-03 10:23:04 +02006714#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08006715 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08006716
David Henningssonfea185e2014-09-03 10:23:04 +02006717#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08006718 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02006719
6720#define ALC292_STANDARD_PINS \
6721 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08006722 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08006723
Hui Wang3f6409702016-09-11 11:26:16 +08006724#define ALC295_STANDARD_PINS \
6725 {0x12, 0xb7a60130}, \
6726 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08006727 {0x21, 0x04211020}
6728
Woodrow Shen703867e2015-08-05 12:34:12 +08006729#define ALC298_STANDARD_PINS \
6730 {0x12, 0x90a60130}, \
6731 {0x21, 0x03211020}
6732
Hui Wange1918932014-05-26 16:22:44 +08006733static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Chris Chiu5824ce82017-02-28 14:17:11 -06006734 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
6735 {0x12, 0x90a601c0},
6736 {0x14, 0x90171120},
6737 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06006738 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6739 {0x14, 0x90170110},
6740 {0x1b, 0x90a70130},
6741 {0x21, 0x03211020}),
6742 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6743 {0x1a, 0x90a70130},
6744 {0x1b, 0x90170110},
6745 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01006746 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08006747 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08006748 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08006749 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01006750 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08006751 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08006752 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08006753 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08006754 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6755 ALC225_STANDARD_PINS,
6756 {0x12, 0xb7a60150},
6757 {0x14, 0x901701a0}),
6758 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6759 ALC225_STANDARD_PINS,
6760 {0x12, 0xb7a60150},
6761 {0x14, 0x901701b0}),
6762 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6763 ALC225_STANDARD_PINS,
6764 {0x12, 0xb7a60130},
6765 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05006766 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6767 {0x1b, 0x01111010},
6768 {0x1e, 0x01451130},
6769 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08006770 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
6771 {0x12, 0x90a60140},
6772 {0x14, 0x90170110},
6773 {0x19, 0x02a11030},
6774 {0x21, 0x02211020}),
Hui Wangf2657882017-10-24 16:53:34 +08006775 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6776 {0x12, 0x90a60140},
6777 {0x14, 0x90170110},
6778 {0x21, 0x02211020}),
6779 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6780 {0x12, 0x90a60140},
6781 {0x14, 0x90170150},
6782 {0x21, 0x02211020}),
Hui Wangc77900e2014-09-03 11:31:07 +08006783 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08006784 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08006785 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02006786 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08006787 {0x14, 0x90170130},
6788 {0x21, 0x02211040}),
6789 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02006790 {0x12, 0x90a60140},
6791 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02006792 {0x21, 0x02211020}),
6793 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6794 {0x12, 0x90a60160},
6795 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02006796 {0x21, 0x02211030}),
6797 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08006798 {0x14, 0x90170110},
6799 {0x1b, 0x02011020},
6800 {0x21, 0x0221101f}),
6801 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08006802 {0x14, 0x90170110},
6803 {0x1b, 0x01011020},
6804 {0x21, 0x0221101f}),
6805 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02006806 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02006807 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02006808 {0x21, 0x0221103f}),
6809 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08006810 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08006811 {0x1b, 0x01011020},
6812 {0x21, 0x0221103f}),
6813 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6814 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08006815 {0x1b, 0x02011020},
6816 {0x21, 0x0221103f}),
6817 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08006818 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08006819 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08006820 {0x21, 0x0221105f}),
6821 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08006822 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08006823 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08006824 {0x21, 0x0221101f}),
6825 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02006826 {0x12, 0x90a60160},
6827 {0x14, 0x90170120},
6828 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02006829 {0x21, 0x0321102f}),
6830 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6831 {0x12, 0x90a60160},
6832 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02006833 {0x21, 0x02211040}),
6834 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6835 {0x12, 0x90a60160},
6836 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02006837 {0x21, 0x02211050}),
6838 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6839 {0x12, 0x90a60170},
6840 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02006841 {0x21, 0x02211030}),
6842 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6843 {0x12, 0x90a60170},
6844 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02006845 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08006846 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08006847 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08006848 {0x14, 0x90171130},
6849 {0x21, 0x02211040}),
6850 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6851 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08006852 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08006853 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02006854 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02006855 {0x12, 0x90a60180},
6856 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02006857 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08006858 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6859 {0x12, 0x90a60180},
6860 {0x14, 0x90170120},
6861 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08006862 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6863 {0x1b, 0x01011020},
6864 {0x21, 0x02211010}),
Kailang Yang7081adf2015-03-30 17:05:37 +08006865 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang285d5dd2017-12-22 11:17:45 +08006866 {0x12, 0x90a60130},
6867 {0x14, 0x90170110},
6868 {0x1b, 0x01011020},
6869 {0x21, 0x0221101f}),
6870 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang81a12312015-05-28 16:48:22 +08006871 {0x12, 0x90a60160},
6872 {0x14, 0x90170120},
Kailang Yang81a12312015-05-28 16:48:22 +08006873 {0x21, 0x02211030}),
6874 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shenf83c3292016-06-24 15:58:34 +08006875 {0x12, 0x90a60170},
6876 {0x14, 0x90170120},
6877 {0x21, 0x02211030}),
Shrirang Bagul311042d2016-08-29 15:19:27 +08006878 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6879 {0x12, 0x90a60180},
6880 {0x14, 0x90170120},
6881 {0x21, 0x02211030}),
Woodrow Shenf83c3292016-06-24 15:58:34 +08006882 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang3f6409702016-09-11 11:26:16 +08006883 {0x12, 0xb7a60130},
6884 {0x14, 0x90170110},
6885 {0x21, 0x02211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01006886 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang3f2f7c52018-01-29 14:23:15 +08006887 {0x12, 0x90a60130},
6888 {0x14, 0x90170110},
6889 {0x14, 0x01011020},
6890 {0x21, 0x0221101f}),
6891 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncf51eb92014-10-30 08:26:02 +01006892 ALC256_STANDARD_PINS),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006893 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
6894 {0x14, 0x90170110},
6895 {0x1b, 0x90a70130},
6896 {0x21, 0x04211020}),
6897 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
6898 {0x14, 0x90170110},
6899 {0x1b, 0x90a70130},
6900 {0x21, 0x03211020}),
Kailang Yang92266652017-12-14 15:28:58 +08006901 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Hui Wang75ee94b2017-11-09 08:48:08 +08006902 {0x12, 0xb7a60130},
6903 {0x13, 0xb8a61140},
6904 {0x16, 0x90170110},
6905 {0x21, 0x04211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01006906 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
6907 {0x12, 0x90a60130},
6908 {0x14, 0x90170110},
6909 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08006910 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08006911 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
6912 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08006913 {0x14, 0x90170110},
6914 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08006915 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08006916 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08006917 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02006918 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006919 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02006920 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02006921 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02006922 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08006923 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006924 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08006925 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08006926 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08006927 {0x21, 0x03211040}),
6928 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006929 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08006930 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08006931 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08006932 {0x21, 0x03211020}),
6933 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006934 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08006935 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08006936 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08006937 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08006938 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02006939 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08006940 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08006941 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08006942 {0x21, 0x04211020}),
David Henningsson76c21322014-06-24 14:46:54 +02006943 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006944 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02006945 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02006946 {0x21, 0x0321101f}),
6947 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6948 {0x12, 0x90a60160},
6949 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02006950 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08006951 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006952 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08006953 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08006954 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08006955 {0x21, 0x0321101f}),
Kailang Yange1e62b92015-04-08 16:01:22 +08006956 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL_XPS_13_GPIO6,
Kailang Yange1e62b92015-04-08 16:01:22 +08006957 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08006958 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08006959 {0x21, 0x0321101f}),
Hui Wangd5078192018-03-02 13:05:36 +08006960 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Hui Wang3f2f7c52018-01-29 14:23:15 +08006961 {0x12, 0xb7a60130},
6962 {0x14, 0x90170110},
6963 {0x21, 0x04211020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006964 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006965 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006966 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08006967 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08006968 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006969 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006970 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006971 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08006972 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08006973 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006974 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006975 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006976 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08006977 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006978 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006979 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006980 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08006981 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08006982 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006983 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006984 {0x14, 0x90170110},
6985 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08006986 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08006987 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006988 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006989 {0x14, 0x90170110},
6990 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08006991 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006992 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006993 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006994 {0x14, 0x90170110},
6995 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08006996 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08006997 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006998 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08006999 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08007000 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08007001 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08007002 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007003 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08007004 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08007005 {0x16, 0x01014020},
7006 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08007007 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02007008 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007009 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08007010 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02007011 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007012 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02007013 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02007014 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08007015 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02007016 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007017 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08007018 {0x13, 0x90a60140}),
Hui Wang3f6409702016-09-11 11:26:16 +08007019 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08007020 ALC295_STANDARD_PINS,
7021 {0x17, 0x21014020},
7022 {0x18, 0x21a19030}),
7023 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7024 ALC295_STANDARD_PINS,
7025 {0x17, 0x21014040},
7026 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08007027 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7028 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08007029 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08007030 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02007031 {0x17, 0x90170110}),
7032 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7033 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08007034 {0x17, 0x90170140}),
7035 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7036 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02007037 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08007038 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
7039 {0x12, 0xb7a60140},
7040 {0x13, 0xb7a60150},
7041 {0x17, 0x90170110},
7042 {0x1a, 0x03011020},
7043 {0x21, 0x03211030}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08007044 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7045 ALC225_STANDARD_PINS,
7046 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08007047 {0x17, 0x90170110}),
Hui Wange1918932014-05-26 16:22:44 +08007048 {}
7049};
Takashi Iwai1d045db2011-07-07 18:23:21 +02007050
Takashi Iwai546bb672012-03-07 08:37:19 +01007051static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02007052{
Kailang Yang526af6e2012-03-07 08:25:20 +01007053 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007054 int val;
7055
Kailang Yang526af6e2012-03-07 08:25:20 +01007056 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01007057 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01007058
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007059 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007060 alc_write_coef_idx(codec, 0xf, 0x960b);
7061 alc_write_coef_idx(codec, 0xe, 0x8817);
7062 }
7063
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007064 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007065 alc_write_coef_idx(codec, 0xf, 0x960b);
7066 alc_write_coef_idx(codec, 0xe, 0x8814);
7067 }
7068
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007069 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007070 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02007071 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007072 }
7073
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007074 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007075 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02007076 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007077 /* Capless ramp up clock control */
7078 alc_write_coef_idx(codec, 0xd, val | (1<<10));
7079 }
7080 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02007081 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007082 /* Class D power on reset */
7083 alc_write_coef_idx(codec, 0x17, val | (1<<7));
7084 }
7085 }
7086
Takashi Iwai98b24882014-08-18 13:47:50 +02007087 /* HP */
7088 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007089}
7090
7091/*
7092 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007093static int patch_alc269(struct hda_codec *codec)
7094{
7095 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02007096 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007097
Takashi Iwai3de95172012-05-07 18:03:15 +02007098 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007099 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02007100 return err;
7101
7102 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01007103 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007104 codec->power_save_node = 1;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007105
Takashi Iwai225068a2015-05-29 10:42:14 +02007106#ifdef CONFIG_PM
7107 codec->patch_ops.suspend = alc269_suspend;
7108 codec->patch_ops.resume = alc269_resume;
7109#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08007110 spec->shutup = alc_default_shutup;
7111 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02007112
Takashi Iwai1727a772013-01-10 09:52:52 +01007113 snd_hda_pick_fixup(codec, alc269_fixup_models,
Herton Ronaldo Krzesinski9f720bb92012-09-27 10:38:14 -03007114 alc269_fixup_tbl, alc269_fixups);
Hui Wange1918932014-05-26 16:22:44 +08007115 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
David Henningsson214eef72014-07-22 14:09:35 +02007116 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
7117 alc269_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01007118 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Herton Ronaldo Krzesinski9f720bb92012-09-27 10:38:14 -03007119
7120 alc_auto_parse_customize_define(codec);
7121
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007122 if (has_cdefine_beep(codec))
7123 spec->gen.beep_nid = 0x01;
7124
Takashi Iwai7639a062015-03-03 10:07:24 +01007125 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01007126 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02007127 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007128 switch (alc_get_coef0(codec) & 0x00f0) {
7129 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01007130 if (codec->bus->pci &&
7131 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007132 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02007133 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02007134 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007135 break;
7136 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01007137 if (codec->bus->pci &&
7138 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007139 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02007140 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02007141 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007142 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02007143 case 0x0030:
7144 spec->codec_variant = ALC269_TYPE_ALC269VD;
7145 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007146 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02007147 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007148 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007149 if (err < 0)
7150 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08007151 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01007152 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007153 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01007154 break;
7155
7156 case 0x10ec0280:
7157 case 0x10ec0290:
7158 spec->codec_variant = ALC269_TYPE_ALC280;
7159 break;
7160 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01007161 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08007162 spec->shutup = alc282_shutup;
7163 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01007164 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02007165 case 0x10ec0233:
7166 case 0x10ec0283:
7167 spec->codec_variant = ALC269_TYPE_ALC283;
7168 spec->shutup = alc283_shutup;
7169 spec->init_hook = alc283_init;
7170 break;
Kailang Yang065380f2013-01-10 10:25:48 +01007171 case 0x10ec0284:
7172 case 0x10ec0292:
7173 spec->codec_variant = ALC269_TYPE_ALC284;
7174 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02007175 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08007176 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02007177 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02007178 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08007179 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02007180 spec->codec_variant = ALC269_TYPE_ALC286;
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08007181 spec->shutup = alc286_shutup;
Kailang Yang7fc7d042013-04-25 11:04:43 +02007182 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08007183 case 0x10ec0298:
7184 spec->codec_variant = ALC269_TYPE_ALC298;
7185 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08007186 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02007187 case 0x10ec0255:
7188 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08007189 spec->shutup = alc256_shutup;
7190 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02007191 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08007192 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08007193 case 0x10ec0256:
7194 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08007195 spec->shutup = alc256_shutup;
7196 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02007197 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yangd32b6662015-04-23 15:10:53 +08007198 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
Kailang Yang4344aec2014-12-17 17:39:05 +08007199 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08007200 case 0x10ec0257:
7201 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08007202 spec->shutup = alc256_shutup;
7203 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08007204 spec->gen.mixer_nid = 0;
7205 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08007206 case 0x10ec0215:
7207 case 0x10ec0285:
7208 case 0x10ec0289:
7209 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08007210 spec->shutup = alc225_shutup;
7211 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08007212 spec->gen.mixer_nid = 0;
7213 break;
Kailang Yang42314302016-02-03 15:03:50 +08007214 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08007215 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08007216 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08007217 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08007218 spec->shutup = alc225_shutup;
7219 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01007220 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08007221 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08007222 case 0x10ec0234:
7223 case 0x10ec0274:
7224 case 0x10ec0294:
7225 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08007226 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08007227 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08007228 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08007229 case 0x10ec0700:
7230 case 0x10ec0701:
7231 case 0x10ec0703:
7232 spec->codec_variant = ALC269_TYPE_ALC700;
7233 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08007234 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang6fbae352016-05-30 16:44:20 +08007235 break;
7236
Takashi Iwai1d045db2011-07-07 18:23:21 +02007237 }
7238
Kailang Yangad60d502013-06-28 12:03:01 +02007239 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05007240 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02007241 spec->init_hook = alc5505_dsp_init;
7242 }
7243
Takashi Iwaia4297b52011-08-23 18:40:12 +02007244 /* automatic parse from the BIOS config */
7245 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007246 if (err < 0)
7247 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007248
David Henningsson7d1b6e22015-04-21 10:48:46 +02007249 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid)
7250 set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007251
Takashi Iwai1727a772013-01-10 09:52:52 +01007252 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007253
Takashi Iwai1d045db2011-07-07 18:23:21 +02007254 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007255
7256 error:
7257 alc_free(codec);
7258 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007259}
7260
7261/*
7262 * ALC861
7263 */
7264
Takashi Iwai1d045db2011-07-07 18:23:21 +02007265static int alc861_parse_auto_config(struct hda_codec *codec)
7266{
Takashi Iwai1d045db2011-07-07 18:23:21 +02007267 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007268 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
7269 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007270}
7271
Takashi Iwai1d045db2011-07-07 18:23:21 +02007272/* Pin config fixes */
7273enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007274 ALC861_FIXUP_FSC_AMILO_PI1505,
7275 ALC861_FIXUP_AMP_VREF_0F,
7276 ALC861_FIXUP_NO_JACK_DETECT,
7277 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007278 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007279};
7280
Takashi Iwai31150f22012-01-30 10:54:08 +01007281/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
7282static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007283 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01007284{
7285 struct alc_spec *spec = codec->spec;
7286 unsigned int val;
7287
Takashi Iwai1727a772013-01-10 09:52:52 +01007288 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01007289 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01007290 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01007291 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
7292 val |= AC_PINCTL_IN_EN;
7293 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02007294 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01007295 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01007296}
7297
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007298/* suppress the jack-detection */
7299static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007300 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007301{
Takashi Iwai1727a772013-01-10 09:52:52 +01007302 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007303 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02007304}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007305
Takashi Iwai1727a772013-01-10 09:52:52 +01007306static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007307 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007308 .type = HDA_FIXUP_PINS,
7309 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007310 { 0x0b, 0x0221101f }, /* HP */
7311 { 0x0f, 0x90170310 }, /* speaker */
7312 { }
7313 }
7314 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007315 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007316 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01007317 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01007318 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007319 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007320 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007321 .v.func = alc_fixup_no_jack_detect,
7322 },
7323 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007324 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007325 .v.func = alc861_fixup_asus_amp_vref_0f,
7326 .chained = true,
7327 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007328 },
7329 [ALC660_FIXUP_ASUS_W7J] = {
7330 .type = HDA_FIXUP_VERBS,
7331 .v.verbs = (const struct hda_verb[]) {
7332 /* ASUS W7J needs a magic pin setup on unused NID 0x10
7333 * for enabling outputs
7334 */
7335 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7336 { }
7337 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007338 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007339};
7340
7341static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007342 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01007343 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007344 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
7345 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
7346 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
7347 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
7348 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
7349 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007350 {}
7351};
7352
7353/*
7354 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007355static int patch_alc861(struct hda_codec *codec)
7356{
7357 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007358 int err;
7359
Takashi Iwai3de95172012-05-07 18:03:15 +02007360 err = alc_alloc_spec(codec, 0x15);
7361 if (err < 0)
7362 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007363
Takashi Iwai3de95172012-05-07 18:03:15 +02007364 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007365 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007366
Takashi Iwai225068a2015-05-29 10:42:14 +02007367#ifdef CONFIG_PM
7368 spec->power_hook = alc_power_eapd;
7369#endif
7370
Takashi Iwai1727a772013-01-10 09:52:52 +01007371 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
7372 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007373
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007374 /* automatic parse from the BIOS config */
7375 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007376 if (err < 0)
7377 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007378
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007379 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007380 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007381
Takashi Iwai1727a772013-01-10 09:52:52 +01007382 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007383
Takashi Iwai1d045db2011-07-07 18:23:21 +02007384 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007385
7386 error:
7387 alc_free(codec);
7388 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007389}
7390
7391/*
7392 * ALC861-VD support
7393 *
7394 * Based on ALC882
7395 *
7396 * In addition, an independent DAC
7397 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007398static int alc861vd_parse_auto_config(struct hda_codec *codec)
7399{
Takashi Iwai1d045db2011-07-07 18:23:21 +02007400 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007401 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7402 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007403}
7404
Takashi Iwai1d045db2011-07-07 18:23:21 +02007405enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007406 ALC660VD_FIX_ASUS_GPIO1,
7407 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007408};
7409
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007410/* exclude VREF80 */
7411static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007412 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007413{
Takashi Iwai1727a772013-01-10 09:52:52 +01007414 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01007415 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
7416 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007417 }
7418}
7419
Takashi Iwai1727a772013-01-10 09:52:52 +01007420static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007421 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007422 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007423 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007424 /* reset GPIO1 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007425 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7426 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
7427 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
7428 { }
7429 }
7430 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007431 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007432 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007433 .v.func = alc861vd_fixup_dallas,
7434 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02007435};
7436
7437static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007438 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007439 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007440 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007441 {}
7442};
7443
Takashi Iwai1d045db2011-07-07 18:23:21 +02007444/*
7445 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007446static int patch_alc861vd(struct hda_codec *codec)
7447{
7448 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007449 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007450
Takashi Iwai3de95172012-05-07 18:03:15 +02007451 err = alc_alloc_spec(codec, 0x0b);
7452 if (err < 0)
7453 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007454
Takashi Iwai3de95172012-05-07 18:03:15 +02007455 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007456 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007457
Takashi Iwai225068a2015-05-29 10:42:14 +02007458 spec->shutup = alc_eapd_shutup;
7459
Takashi Iwai1727a772013-01-10 09:52:52 +01007460 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
7461 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007462
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007463 /* automatic parse from the BIOS config */
7464 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007465 if (err < 0)
7466 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007467
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007468 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007469 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007470
Takashi Iwai1727a772013-01-10 09:52:52 +01007471 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007472
Takashi Iwai1d045db2011-07-07 18:23:21 +02007473 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007474
7475 error:
7476 alc_free(codec);
7477 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007478}
7479
7480/*
7481 * ALC662 support
7482 *
7483 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
7484 * configuration. Each pin widget can choose any input DACs and a mixer.
7485 * Each ADC is connected from a mixer of all inputs. This makes possible
7486 * 6-channel independent captures.
7487 *
7488 * In addition, an independent DAC for the multi-playback (not used in this
7489 * driver yet).
7490 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007491
7492/*
7493 * BIOS auto configuration
7494 */
7495
Kailang Yangbc9f98a2007-04-12 13:06:07 +02007496static int alc662_parse_auto_config(struct hda_codec *codec)
7497{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02007498 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007499 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
7500 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7501 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02007502
Takashi Iwai7639a062015-03-03 10:07:24 +01007503 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
7504 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
7505 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007506 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01007507 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007508 ssids = alc662_ssids;
7509 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02007510}
7511
Todd Broch6be79482010-12-07 16:51:05 -08007512static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007513 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01007514{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01007515 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01007516 return;
Todd Broch6be79482010-12-07 16:51:05 -08007517 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
7518 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
7519 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
7520 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
7521 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01007522 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08007523}
7524
Takashi Iwai8e383952013-10-30 17:41:12 +01007525static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
7526 { .channels = 2,
7527 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
7528 { .channels = 4,
7529 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
7530 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
7531 { }
7532};
7533
7534/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01007535static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01007536 const struct hda_fixup *fix, int action)
7537{
7538 if (action == HDA_FIXUP_ACT_BUILD) {
7539 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +01007540 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +01007541 }
7542}
7543
Takashi Iwaibf686652014-01-13 16:18:25 +01007544/* avoid D3 for keeping GPIO up */
7545static unsigned int gpio_led_power_filter(struct hda_codec *codec,
7546 hda_nid_t nid,
7547 unsigned int power_state)
7548{
7549 struct alc_spec *spec = codec->spec;
Takashi Iwai7639a062015-03-03 10:07:24 +01007550 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_led)
Takashi Iwaibf686652014-01-13 16:18:25 +01007551 return AC_PWRST_D0;
7552 return power_state;
7553}
7554
Takashi Iwai3e887f32014-01-10 17:50:58 +01007555static void alc662_fixup_led_gpio1(struct hda_codec *codec,
7556 const struct hda_fixup *fix, int action)
7557{
7558 struct alc_spec *spec = codec->spec;
7559 static const struct hda_verb gpio_init[] = {
7560 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
7561 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
7562 {}
7563 };
7564
7565 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01007566 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
Takashi Iwai3e887f32014-01-10 17:50:58 +01007567 spec->gpio_led = 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01007568 spec->mute_led_polarity = 1;
7569 spec->gpio_mute_led_mask = 0x01;
Takashi Iwai3e887f32014-01-10 17:50:58 +01007570 snd_hda_add_verbs(codec, gpio_init);
Takashi Iwaibf686652014-01-13 16:18:25 +01007571 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01007572 }
7573}
7574
Kailang Yangc6790c82016-11-25 16:15:17 +08007575static void alc662_usi_automute_hook(struct hda_codec *codec,
7576 struct hda_jack_callback *jack)
7577{
7578 struct alc_spec *spec = codec->spec;
7579 int vref;
7580 msleep(200);
7581 snd_hda_gen_hp_automute(codec, jack);
7582
7583 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
7584 msleep(100);
7585 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7586 vref);
7587}
7588
7589static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
7590 const struct hda_fixup *fix, int action)
7591{
7592 struct alc_spec *spec = codec->spec;
7593 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7594 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7595 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
7596 }
7597}
7598
Kailang Yangf3f91852014-10-24 15:43:46 +08007599static struct coef_fw alc668_coefs[] = {
7600 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
7601 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
7602 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
7603 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
7604 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
7605 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
7606 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
7607 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
7608 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
7609 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
7610 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
7611 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
7612 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
7613 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
7614 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
7615 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
7616 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
7617 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
7618 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
7619 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
7620 {}
7621};
7622
7623static void alc668_restore_default_value(struct hda_codec *codec)
7624{
7625 alc_process_coef_fw(codec, alc668_coefs);
7626}
7627
David Henningsson6cb3b702010-09-09 08:51:44 +02007628enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04007629 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01007630 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02007631 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08007632 ALC272_FIXUP_MARIO,
Anisse Astierd2ebd472011-01-20 12:36:21 +01007633 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02007634 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02007635 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02007636 ALC662_FIXUP_ASUS_MODE1,
7637 ALC662_FIXUP_ASUS_MODE2,
7638 ALC662_FIXUP_ASUS_MODE3,
7639 ALC662_FIXUP_ASUS_MODE4,
7640 ALC662_FIXUP_ASUS_MODE5,
7641 ALC662_FIXUP_ASUS_MODE6,
7642 ALC662_FIXUP_ASUS_MODE7,
7643 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01007644 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02007645 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02007646 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +02007647 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02007648 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02007649 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +02007650 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01007651 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01007652 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007653 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01007654 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08007655 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02007656 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02007657 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02007658 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02007659 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07007660 ALC668_FIXUP_ASUS_Nx51,
Kailang Yang78f4f7c2016-06-07 11:31:34 +08007661 ALC891_FIXUP_HEADSET_MODE,
7662 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08007663 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +02007664 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +08007665 ALC662_FIXUP_USI_FUNC,
7666 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +08007667 ALC662_FIXUP_LENOVO_MULTI_CODECS,
David Henningsson6cb3b702010-09-09 08:51:44 +02007668};
7669
Takashi Iwai1727a772013-01-10 09:52:52 +01007670static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04007671 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007672 .type = HDA_FIXUP_PINS,
7673 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04007674 { 0x15, 0x99130112 }, /* subwoofer */
7675 { }
7676 }
7677 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01007678 [ALC662_FIXUP_LED_GPIO1] = {
7679 .type = HDA_FIXUP_FUNC,
7680 .v.func = alc662_fixup_led_gpio1,
7681 },
David Henningsson6cb3b702010-09-09 08:51:44 +02007682 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007683 .type = HDA_FIXUP_PINS,
7684 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02007685 { 0x17, 0x99130112 }, /* subwoofer */
7686 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01007687 },
7688 .chained = true,
7689 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02007690 },
Todd Broch6be79482010-12-07 16:51:05 -08007691 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007692 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01007693 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01007694 },
7695 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007696 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +01007697 .v.verbs = (const struct hda_verb[]) {
7698 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7699 {}
7700 }
7701 },
David Henningsson94024cd2011-04-29 14:10:55 +02007702 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007703 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02007704 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +02007705 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02007706 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007707 .type = HDA_FIXUP_PINS,
7708 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02007709 { 0x14, 0x0221201f }, /* HP out */
7710 { }
7711 },
7712 .chained = true,
7713 .chain_id = ALC662_FIXUP_SKU_IGNORE
7714 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02007715 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007716 .type = HDA_FIXUP_PINS,
7717 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007718 { 0x14, 0x99130110 }, /* speaker */
7719 { 0x18, 0x01a19c20 }, /* mic */
7720 { 0x19, 0x99a3092f }, /* int-mic */
7721 { 0x21, 0x0121401f }, /* HP out */
7722 { }
7723 },
7724 .chained = true,
7725 .chain_id = ALC662_FIXUP_SKU_IGNORE
7726 },
7727 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007728 .type = HDA_FIXUP_PINS,
7729 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +02007730 { 0x14, 0x99130110 }, /* speaker */
7731 { 0x18, 0x01a19820 }, /* mic */
7732 { 0x19, 0x99a3092f }, /* int-mic */
7733 { 0x1b, 0x0121401f }, /* HP out */
7734 { }
7735 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02007736 .chained = true,
7737 .chain_id = ALC662_FIXUP_SKU_IGNORE
7738 },
7739 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007740 .type = HDA_FIXUP_PINS,
7741 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007742 { 0x14, 0x99130110 }, /* speaker */
7743 { 0x15, 0x0121441f }, /* HP */
7744 { 0x18, 0x01a19840 }, /* mic */
7745 { 0x19, 0x99a3094f }, /* int-mic */
7746 { 0x21, 0x01211420 }, /* HP2 */
7747 { }
7748 },
7749 .chained = true,
7750 .chain_id = ALC662_FIXUP_SKU_IGNORE
7751 },
7752 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007753 .type = HDA_FIXUP_PINS,
7754 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007755 { 0x14, 0x99130110 }, /* speaker */
7756 { 0x16, 0x99130111 }, /* speaker */
7757 { 0x18, 0x01a19840 }, /* mic */
7758 { 0x19, 0x99a3094f }, /* int-mic */
7759 { 0x21, 0x0121441f }, /* HP */
7760 { }
7761 },
7762 .chained = true,
7763 .chain_id = ALC662_FIXUP_SKU_IGNORE
7764 },
7765 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007766 .type = HDA_FIXUP_PINS,
7767 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007768 { 0x14, 0x99130110 }, /* speaker */
7769 { 0x15, 0x0121441f }, /* HP */
7770 { 0x16, 0x99130111 }, /* speaker */
7771 { 0x18, 0x01a19840 }, /* mic */
7772 { 0x19, 0x99a3094f }, /* int-mic */
7773 { }
7774 },
7775 .chained = true,
7776 .chain_id = ALC662_FIXUP_SKU_IGNORE
7777 },
7778 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007779 .type = HDA_FIXUP_PINS,
7780 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007781 { 0x14, 0x99130110 }, /* speaker */
7782 { 0x15, 0x01211420 }, /* HP2 */
7783 { 0x18, 0x01a19840 }, /* mic */
7784 { 0x19, 0x99a3094f }, /* int-mic */
7785 { 0x1b, 0x0121441f }, /* HP */
7786 { }
7787 },
7788 .chained = true,
7789 .chain_id = ALC662_FIXUP_SKU_IGNORE
7790 },
7791 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007792 .type = HDA_FIXUP_PINS,
7793 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007794 { 0x14, 0x99130110 }, /* speaker */
7795 { 0x17, 0x99130111 }, /* speaker */
7796 { 0x18, 0x01a19840 }, /* mic */
7797 { 0x19, 0x99a3094f }, /* int-mic */
7798 { 0x1b, 0x01214020 }, /* HP */
7799 { 0x21, 0x0121401f }, /* HP */
7800 { }
7801 },
7802 .chained = true,
7803 .chain_id = ALC662_FIXUP_SKU_IGNORE
7804 },
7805 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007806 .type = HDA_FIXUP_PINS,
7807 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007808 { 0x14, 0x99130110 }, /* speaker */
7809 { 0x12, 0x99a30970 }, /* int-mic */
7810 { 0x15, 0x01214020 }, /* HP */
7811 { 0x17, 0x99130111 }, /* speaker */
7812 { 0x18, 0x01a19840 }, /* mic */
7813 { 0x21, 0x0121401f }, /* HP */
7814 { }
7815 },
7816 .chained = true,
7817 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +02007818 },
Takashi Iwai1565cc32012-02-13 12:03:25 +01007819 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007820 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +01007821 .v.func = alc_fixup_no_jack_detect,
7822 },
David Henningssonedfe3bf2012-06-12 13:15:12 +02007823 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007824 .type = HDA_FIXUP_PINS,
7825 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +02007826 { 0x1b, 0x02214020 }, /* Front HP */
7827 { }
7828 }
7829 },
Takashi Iwai125821a2012-06-22 14:30:29 +02007830 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007831 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02007832 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +02007833 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02007834 [ALC668_FIXUP_DELL_XPS13] = {
7835 .type = HDA_FIXUP_FUNC,
7836 .v.func = alc_fixup_dell_xps13,
7837 .chained = true,
7838 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
7839 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02007840 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
7841 .type = HDA_FIXUP_FUNC,
7842 .v.func = alc_fixup_disable_aamix,
7843 .chained = true,
7844 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
7845 },
Hui Wang493a52a2014-01-14 14:07:36 +08007846 [ALC668_FIXUP_AUTO_MUTE] = {
7847 .type = HDA_FIXUP_FUNC,
7848 .v.func = alc_fixup_auto_mute_via_amp,
7849 .chained = true,
7850 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
7851 },
David Henningsson1f8b46c2015-05-12 14:38:15 +02007852 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
7853 .type = HDA_FIXUP_PINS,
7854 .v.pins = (const struct hda_pintbl[]) {
7855 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7856 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
7857 { }
7858 },
7859 .chained = true,
7860 .chain_id = ALC662_FIXUP_HEADSET_MODE
7861 },
7862 [ALC662_FIXUP_HEADSET_MODE] = {
7863 .type = HDA_FIXUP_FUNC,
7864 .v.func = alc_fixup_headset_mode_alc662,
7865 },
David Henningsson73bdd592013-04-15 15:44:14 +02007866 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
7867 .type = HDA_FIXUP_PINS,
7868 .v.pins = (const struct hda_pintbl[]) {
7869 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7870 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7871 { }
7872 },
7873 .chained = true,
7874 .chain_id = ALC668_FIXUP_HEADSET_MODE
7875 },
7876 [ALC668_FIXUP_HEADSET_MODE] = {
7877 .type = HDA_FIXUP_FUNC,
7878 .v.func = alc_fixup_headset_mode_alc668,
7879 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01007880 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +01007881 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01007882 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +01007883 .chained = true,
7884 .chain_id = ALC662_FIXUP_ASUS_MODE4
7885 },
David Henningsson61a75f12014-02-07 09:31:08 +01007886 [ALC662_FIXUP_BASS_16] = {
7887 .type = HDA_FIXUP_PINS,
7888 .v.pins = (const struct hda_pintbl[]) {
7889 {0x16, 0x80106111}, /* bass speaker */
7890 {}
7891 },
7892 .chained = true,
7893 .chain_id = ALC662_FIXUP_BASS_CHMAP,
7894 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007895 [ALC662_FIXUP_BASS_1A] = {
7896 .type = HDA_FIXUP_PINS,
7897 .v.pins = (const struct hda_pintbl[]) {
7898 {0x1a, 0x80106111}, /* bass speaker */
7899 {}
7900 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01007901 .chained = true,
7902 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007903 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01007904 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007905 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01007906 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007907 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02007908 [ALC662_FIXUP_ASUS_Nx50] = {
7909 .type = HDA_FIXUP_FUNC,
7910 .v.func = alc_fixup_auto_mute_via_amp,
7911 .chained = true,
7912 .chain_id = ALC662_FIXUP_BASS_1A
7913 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02007914 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
7915 .type = HDA_FIXUP_FUNC,
7916 .v.func = alc_fixup_headset_mode_alc668,
7917 .chain_id = ALC662_FIXUP_BASS_CHMAP
7918 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07007919 [ALC668_FIXUP_ASUS_Nx51] = {
7920 .type = HDA_FIXUP_PINS,
7921 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02007922 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7923 { 0x1a, 0x90170151 }, /* bass speaker */
7924 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07007925 {}
7926 },
7927 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02007928 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07007929 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +08007930 [ALC891_FIXUP_HEADSET_MODE] = {
7931 .type = HDA_FIXUP_FUNC,
7932 .v.func = alc_fixup_headset_mode,
7933 },
7934 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
7935 .type = HDA_FIXUP_PINS,
7936 .v.pins = (const struct hda_pintbl[]) {
7937 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7938 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7939 { }
7940 },
7941 .chained = true,
7942 .chain_id = ALC891_FIXUP_HEADSET_MODE
7943 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08007944 [ALC662_FIXUP_ACER_VERITON] = {
7945 .type = HDA_FIXUP_PINS,
7946 .v.pins = (const struct hda_pintbl[]) {
7947 { 0x15, 0x50170120 }, /* no internal speaker */
7948 { }
7949 }
7950 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +02007951 [ALC892_FIXUP_ASROCK_MOBO] = {
7952 .type = HDA_FIXUP_PINS,
7953 .v.pins = (const struct hda_pintbl[]) {
7954 { 0x15, 0x40f000f0 }, /* disabled */
7955 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +02007956 { }
7957 }
7958 },
Kailang Yangc6790c82016-11-25 16:15:17 +08007959 [ALC662_FIXUP_USI_FUNC] = {
7960 .type = HDA_FIXUP_FUNC,
7961 .v.func = alc662_fixup_usi_headset_mic,
7962 },
7963 [ALC662_FIXUP_USI_HEADSET_MODE] = {
7964 .type = HDA_FIXUP_PINS,
7965 .v.pins = (const struct hda_pintbl[]) {
7966 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
7967 { 0x18, 0x01a1903d },
7968 { }
7969 },
7970 .chained = true,
7971 .chain_id = ALC662_FIXUP_USI_FUNC
7972 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007973 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
7974 .type = HDA_FIXUP_FUNC,
7975 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
7976 },
David Henningsson6cb3b702010-09-09 08:51:44 +02007977};
7978
Takashi Iwaia9111322011-05-02 11:30:18 +02007979static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007980 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +02007981 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +01007982 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +01007983 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +02007984 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +02007985 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +02007986 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -04007987 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
David Henningsson73bdd592013-04-15 15:44:14 +02007988 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7989 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +02007990 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02007991 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +02007992 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +01007993 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +01007994 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +08007995 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7996 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +08007997 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02007998 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Kaho Ng2da2dc92016-05-09 00:27:49 +08007999 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +02008000 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwaidb8948e2016-01-18 09:17:30 +01008001 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02008002 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
David Henningsson8e54b4a2014-02-07 09:31:07 +01008003 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +01008004 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008005 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
8006 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Takashi Iwaic7efff92017-01-04 21:38:16 +01008007 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +01008008 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +01008009 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +01008010 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +02008011 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -05008012 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +08008013 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +08008014 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +06008015 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +02008016 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008017 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +02008018 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08008019 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Anisse Astierd2ebd472011-01-20 12:36:21 +01008020 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +02008021
8022#if 0
8023 /* Below is a quirk table taken from the old code.
8024 * Basically the device should work as is without the fixup table.
8025 * If BIOS doesn't give a proper info, enable the corresponding
8026 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008027 */
Takashi Iwai53c334a2011-08-23 18:27:14 +02008028 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
8029 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
8030 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
8031 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
8032 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8033 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8034 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8035 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
8036 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
8037 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8038 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
8039 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
8040 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
8041 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
8042 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
8043 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8044 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
8045 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
8046 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8047 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8048 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8049 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8050 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
8051 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
8052 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
8053 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8054 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
8055 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8056 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8057 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
8058 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8059 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8060 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
8061 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
8062 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
8063 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
8064 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
8065 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
8066 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
8067 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8068 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
8069 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
8070 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8071 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
8072 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
8073 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
8074 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
8075 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
8076 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8077 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
8078#endif
David Henningsson6cb3b702010-09-09 08:51:44 +02008079 {}
8080};
8081
Takashi Iwai1727a772013-01-10 09:52:52 +01008082static const struct hda_model_fixup alc662_fixup_models[] = {
Todd Broch6be79482010-12-07 16:51:05 -08008083 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwai53c334a2011-08-23 18:27:14 +02008084 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
8085 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
8086 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
8087 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
8088 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
8089 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
8090 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
8091 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02008092 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningssone32aa852013-06-17 11:04:02 +02008093 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02008094 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Todd Broch6be79482010-12-07 16:51:05 -08008095 {}
8096};
David Henningsson6cb3b702010-09-09 08:51:44 +02008097
Hui Wang532895c2014-05-29 15:59:19 +08008098static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008099 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8100 {0x17, 0x02211010},
8101 {0x18, 0x01a19030},
8102 {0x1a, 0x01813040},
8103 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +02008104 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02008105 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +02008106 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +02008107 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +08008108 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +02008109 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8110 {0x12, 0x99a30130},
8111 {0x14, 0x90170110},
8112 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008113 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008114 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8115 {0x12, 0x99a30140},
8116 {0x14, 0x90170110},
8117 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008118 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008119 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8120 {0x12, 0x99a30150},
8121 {0x14, 0x90170110},
8122 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008123 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008124 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +02008125 {0x14, 0x90170110},
8126 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008127 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008128 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
8129 {0x12, 0x90a60130},
8130 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08008131 {0x15, 0x0321101f}),
Hui Wang532895c2014-05-29 15:59:19 +08008132 {}
8133};
8134
Takashi Iwai1d045db2011-07-07 18:23:21 +02008135/*
8136 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008137static int patch_alc662(struct hda_codec *codec)
8138{
8139 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02008140 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008141
Takashi Iwai3de95172012-05-07 18:03:15 +02008142 err = alc_alloc_spec(codec, 0x0b);
8143 if (err < 0)
8144 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008145
Takashi Iwai3de95172012-05-07 18:03:15 +02008146 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008147
Takashi Iwai225068a2015-05-29 10:42:14 +02008148 spec->shutup = alc_eapd_shutup;
8149
Takashi Iwai53c334a2011-08-23 18:27:14 +02008150 /* handle multiple HPs as is */
8151 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
8152
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +02008153 alc_fix_pll_init(codec, 0x20, 0x04, 15);
8154
Takashi Iwai7639a062015-03-03 10:07:24 +01008155 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +08008156 case 0x10ec0668:
8157 spec->init_hook = alc668_restore_default_value;
8158 break;
Kailang Yangf3f91852014-10-24 15:43:46 +08008159 }
Kailang Yang8663ff72012-06-29 09:35:52 +02008160
Takashi Iwai1727a772013-01-10 09:52:52 +01008161 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +02008162 alc662_fixup_tbl, alc662_fixups);
Hui Wang532895c2014-05-29 15:59:19 +08008163 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01008164 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +02008165
8166 alc_auto_parse_customize_define(codec);
8167
Takashi Iwai7504b6c2013-03-18 11:25:51 +01008168 if (has_cdefine_beep(codec))
8169 spec->gen.beep_nid = 0x01;
8170
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008171 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +01008172 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008173 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +08008174 err = alc_codec_rename(codec, "ALC272X");
8175 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008176 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008177 }
Kailang Yang274693f2009-12-03 10:07:50 +01008178
Takashi Iwaib9c51062011-08-24 18:08:07 +02008179 /* automatic parse from the BIOS config */
8180 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008181 if (err < 0)
8182 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008183
Takashi Iwai7504b6c2013-03-18 11:25:51 +01008184 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +01008185 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +01008186 case 0x10ec0662:
8187 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
8188 break;
8189 case 0x10ec0272:
8190 case 0x10ec0663:
8191 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +08008192 case 0x10ec0668:
Kailang Yangda00c242010-03-19 11:23:45 +01008193 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
8194 break;
8195 case 0x10ec0273:
8196 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
8197 break;
8198 }
Kailang Yangcec27c82010-02-04 14:18:18 +01008199 }
Takashi Iwai2134ea42008-01-10 16:53:55 +01008200
Takashi Iwai1727a772013-01-10 09:52:52 +01008201 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01008202
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008203 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008204
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008205 error:
8206 alc_free(codec);
8207 return err;
Kailang Yangb478b992011-05-18 11:51:15 +02008208}
8209
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008210/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008211 * ALC680 support
8212 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008213
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008214static int alc680_parse_auto_config(struct hda_codec *codec)
8215{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02008216 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008217}
8218
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008219/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008220 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008221static int patch_alc680(struct hda_codec *codec)
8222{
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008223 int err;
8224
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008225 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02008226 err = alc_alloc_spec(codec, 0);
8227 if (err < 0)
8228 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008229
Takashi Iwai1ebec5f2011-08-15 13:21:48 +02008230 /* automatic parse from the BIOS config */
8231 err = alc680_parse_auto_config(codec);
8232 if (err < 0) {
8233 alc_free(codec);
8234 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008235 }
8236
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008237 return 0;
8238}
8239
8240/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07008241 * patch entries
8242 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008243static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +08008244 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008245 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +08008246 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008247 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
8248 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008249 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008250 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +08008251 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008252 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
8253 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +08008254 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008255 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
8256 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
8257 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
8258 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
8259 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
8260 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
8261 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008262 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008263 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
8264 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
8265 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
8266 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
8267 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
8268 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +08008269 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008270 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
8271 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +08008272 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008273 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
8274 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
8275 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008276 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +08008277 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008278 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +08008279 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008280 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
8281 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
8282 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
8283 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
8284 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
8285 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
8286 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
8287 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
8288 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
8289 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
8290 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
8291 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
8292 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
8293 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +08008294 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
8295 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
8296 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008297 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008298 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
8299 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
8300 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
8301 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
8302 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
8303 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
8304 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
8305 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
8306 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
8307 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
8308 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
8309 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
8310 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +08008311 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +08008312 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -07008313 {} /* terminator */
8314};
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008315MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +01008316
8317MODULE_LICENSE("GPL");
8318MODULE_DESCRIPTION("Realtek HD-audio codec");
8319
Takashi Iwaid8a766a2015-02-17 15:25:37 +01008320static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008321 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +01008322};
8323
Takashi Iwaid8a766a2015-02-17 15:25:37 +01008324module_hda_codec_driver(realtek_driver);