blob: a0881ffcd9d7ab6457f651a9ca89aee79358e21a [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 {
Takashi Iwai1c76aa52018-06-21 16:37:54 +020046 ALC_INIT_UNDEFINED,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020047 ALC_INIT_NONE,
48 ALC_INIT_DEFAULT,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020049};
50
David Henningsson73bdd592013-04-15 15:44:14 +020051enum {
52 ALC_HEADSET_MODE_UNKNOWN,
53 ALC_HEADSET_MODE_UNPLUGGED,
54 ALC_HEADSET_MODE_HEADSET,
55 ALC_HEADSET_MODE_MIC,
56 ALC_HEADSET_MODE_HEADPHONE,
57};
58
59enum {
60 ALC_HEADSET_TYPE_UNKNOWN,
61 ALC_HEADSET_TYPE_CTIA,
62 ALC_HEADSET_TYPE_OMTP,
63};
64
Hui Wangc7b60a82015-12-28 11:35:25 +080065enum {
66 ALC_KEY_MICMUTE_INDEX,
67};
68
Kailang Yangda00c242010-03-19 11:23:45 +010069struct alc_customize_define {
70 unsigned int sku_cfg;
71 unsigned char port_connectivity;
72 unsigned char check_sum;
73 unsigned char customization;
74 unsigned char external_amp;
75 unsigned int enable_pcbeep:1;
76 unsigned int platform_type:1;
77 unsigned int swap:1;
78 unsigned int override:1;
David Henningsson90622912010-10-14 14:50:18 +020079 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
Kailang Yangda00c242010-03-19 11:23:45 +010080};
81
Linus Torvalds1da177e2005-04-16 15:20:36 -070082struct alc_spec {
Takashi Iwai08c189f2012-12-19 15:22:24 +010083 struct hda_gen_spec gen; /* must be at head */
Takashi Iwai23d30f22012-05-07 17:17:32 +020084
Linus Torvalds1da177e2005-04-16 15:20:36 -070085 /* codec parameterization */
Takashi Iwaia9111322011-05-02 11:30:18 +020086 const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 unsigned int num_mixers;
Takashi Iwai45bdd1c2009-02-06 16:11:25 +010088 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
Linus Torvalds1da177e2005-04-16 15:20:36 -070089
Kailang Yangda00c242010-03-19 11:23:45 +010090 struct alc_customize_define cdefine;
Takashi Iwai08c189f2012-12-19 15:22:24 +010091 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
92
Takashi Iwai5579cd62018-06-19 22:22:41 +020093 /* GPIO bits */
94 unsigned int gpio_mask;
95 unsigned int gpio_dir;
96 unsigned int gpio_data;
Takashi Iwai215c8502018-06-19 22:34:26 +020097 bool gpio_write_delay; /* add a delay before writing gpio_data */
Takashi Iwai5579cd62018-06-19 22:22:41 +020098
Takashi Iwai08fb0d02013-01-10 17:33:58 +010099 /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
100 int mute_led_polarity;
101 hda_nid_t mute_led_nid;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +0800102 hda_nid_t cap_mute_led_nid;
Takashi Iwai08fb0d02013-01-10 17:33:58 +0100103
Takashi Iwai0f32fd192014-11-19 12:16:14 +0100104 unsigned int gpio_mute_led_mask;
105 unsigned int gpio_mic_led_mask;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +0100106
David Henningsson73bdd592013-04-15 15:44:14 +0200107 hda_nid_t headset_mic_pin;
108 hda_nid_t headphone_mic_pin;
109 int current_headset_mode;
110 int current_headset_type;
111
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100112 /* hooks */
113 void (*init_hook)(struct hda_codec *codec);
Takashi Iwai83012a72012-08-24 18:38:08 +0200114#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500115 void (*power_hook)(struct hda_codec *codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100116#endif
Takashi Iwai1c7161532011-04-07 10:37:16 +0200117 void (*shutup)(struct hda_codec *codec);
Takashi Iwai70a09762015-12-15 14:59:58 +0100118 void (*reboot_notify)(struct hda_codec *codec);
Takashi Iwaid922b512011-04-28 12:18:53 +0200119
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200120 int init_amp;
Takashi Iwaid433a672010-09-20 15:11:54 +0200121 int codec_variant; /* flag for other variants */
Kailang Yang97a26572013-11-29 00:35:26 -0500122 unsigned int has_alc5505_dsp:1;
123 unsigned int no_depop_delay:1;
Takashi Iwaie64f14f2009-01-20 18:32:55 +0100124
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200125 /* for PLL fix */
126 hda_nid_t pll_nid;
127 unsigned int pll_coef_idx, pll_coef_bit;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200128 unsigned int coef0;
David Henningsson33f4acd2015-01-07 15:50:13 +0100129 struct input_dev *kb_dev;
Hui Wangc7b60a82015-12-28 11:35:25 +0800130 u8 alc_mute_keycode_map[1];
Kailang Yangdf694da2005-12-05 19:42:22 +0100131};
132
Takashi Iwai23f0c042009-02-26 13:03:58 +0100133/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200134 * COEF access helper functions
135 */
136
137static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
138 unsigned int coef_idx)
139{
140 unsigned int val;
141
142 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
143 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
144 return val;
145}
146
147#define alc_read_coef_idx(codec, coef_idx) \
148 alc_read_coefex_idx(codec, 0x20, coef_idx)
149
150static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
151 unsigned int coef_idx, unsigned int coef_val)
152{
153 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
154 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
155}
156
157#define alc_write_coef_idx(codec, coef_idx, coef_val) \
158 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
159
Takashi Iwai98b24882014-08-18 13:47:50 +0200160static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
161 unsigned int coef_idx, unsigned int mask,
162 unsigned int bits_set)
163{
164 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
165
166 if (val != -1)
167 alc_write_coefex_idx(codec, nid, coef_idx,
168 (val & ~mask) | bits_set);
169}
170
171#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
172 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
173
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200174/* a special bypass for COEF 0; read the cached value at the second time */
175static unsigned int alc_get_coef0(struct hda_codec *codec)
176{
177 struct alc_spec *spec = codec->spec;
178
179 if (!spec->coef0)
180 spec->coef0 = alc_read_coef_idx(codec, 0);
181 return spec->coef0;
182}
183
Takashi Iwai54db6c32014-08-18 15:11:19 +0200184/* coef writes/updates batch */
185struct coef_fw {
186 unsigned char nid;
187 unsigned char idx;
188 unsigned short mask;
189 unsigned short val;
190};
191
192#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
193 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
194#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
195#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
196#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
197
198static void alc_process_coef_fw(struct hda_codec *codec,
199 const struct coef_fw *fw)
200{
201 for (; fw->nid; fw++) {
202 if (fw->mask == (unsigned short)-1)
203 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
204 else
205 alc_update_coefex_idx(codec, fw->nid, fw->idx,
206 fw->mask, fw->val);
207 }
208}
209
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200210/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200211 * Append the given mixer and verb elements for the later use
212 * The mixer array is referred in build_controls(), and init_verbs are
213 * called in init().
Takashi Iwaid88897e2008-10-31 15:01:37 +0100214 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200215static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
Takashi Iwaid88897e2008-10-31 15:01:37 +0100216{
217 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
218 return;
219 spec->mixers[spec->num_mixers++] = mix;
220}
221
Takashi Iwaid88897e2008-10-31 15:01:37 +0100222/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200223 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100224 */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200225
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200226/* Enable GPIO mask and set output */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200227static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
228{
229 struct alc_spec *spec = codec->spec;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200230
Takashi Iwai5579cd62018-06-19 22:22:41 +0200231 spec->gpio_mask |= mask;
232 spec->gpio_dir |= mask;
233 spec->gpio_data |= mask;
234}
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200235
Takashi Iwai5579cd62018-06-19 22:22:41 +0200236static void alc_write_gpio_data(struct hda_codec *codec)
237{
238 struct alc_spec *spec = codec->spec;
239
240 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
241 spec->gpio_data);
242}
243
Takashi Iwaiaaf312d2018-06-19 22:28:22 +0200244static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
245 bool on)
246{
247 struct alc_spec *spec = codec->spec;
248 unsigned int oldval = spec->gpio_data;
249
250 if (on)
251 spec->gpio_data |= mask;
252 else
253 spec->gpio_data &= ~mask;
254 if (oldval != spec->gpio_data)
255 alc_write_gpio_data(codec);
256}
257
Takashi Iwai5579cd62018-06-19 22:22:41 +0200258static void alc_write_gpio(struct hda_codec *codec)
259{
260 struct alc_spec *spec = codec->spec;
261
262 if (!spec->gpio_mask)
263 return;
264
265 snd_hda_codec_write(codec, codec->core.afg, 0,
266 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
267 snd_hda_codec_write(codec, codec->core.afg, 0,
268 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
Takashi Iwai215c8502018-06-19 22:34:26 +0200269 if (spec->gpio_write_delay)
270 msleep(1);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200271 alc_write_gpio_data(codec);
272}
273
274static void alc_fixup_gpio(struct hda_codec *codec, int action,
275 unsigned int mask)
276{
277 if (action == HDA_FIXUP_ACT_PRE_PROBE)
278 alc_setup_gpio(codec, mask);
279}
280
281static void alc_fixup_gpio1(struct hda_codec *codec,
282 const struct hda_fixup *fix, int action)
283{
284 alc_fixup_gpio(codec, action, 0x01);
285}
286
287static void alc_fixup_gpio2(struct hda_codec *codec,
288 const struct hda_fixup *fix, int action)
289{
290 alc_fixup_gpio(codec, action, 0x02);
291}
292
293static void alc_fixup_gpio3(struct hda_codec *codec,
294 const struct hda_fixup *fix, int action)
295{
296 alc_fixup_gpio(codec, action, 0x03);
297}
Kailang Yangbdd148a2007-05-08 15:19:08 +0200298
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200299/*
300 * Fix hardware PLL issue
301 * On some codecs, the analog PLL gating control must be off while
302 * the default value is 1.
303 */
304static void alc_fix_pll(struct hda_codec *codec)
305{
306 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200307
Takashi Iwai98b24882014-08-18 13:47:50 +0200308 if (spec->pll_nid)
309 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
310 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200311}
312
313static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
314 unsigned int coef_idx, unsigned int coef_bit)
315{
316 struct alc_spec *spec = codec->spec;
317 spec->pll_nid = nid;
318 spec->pll_coef_idx = coef_idx;
319 spec->pll_coef_bit = coef_bit;
320 alc_fix_pll(codec);
321}
322
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100323/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200324static void alc_update_knob_master(struct hda_codec *codec,
325 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100326{
327 unsigned int val;
328 struct snd_kcontrol *kctl;
329 struct snd_ctl_elem_value *uctl;
330
331 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
332 if (!kctl)
333 return;
334 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
335 if (!uctl)
336 return;
Takashi Iwai2ebab402016-02-09 10:23:52 +0100337 val = snd_hda_codec_read(codec, jack->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100338 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
339 val &= HDA_AMP_VOLMASK;
340 uctl->value.integer.value[0] = val;
341 uctl->value.integer.value[1] = val;
342 kctl->put(kctl, uctl);
343 kfree(uctl);
344}
345
David Henningsson29adc4b2012-09-25 11:31:00 +0200346static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100347{
David Henningsson29adc4b2012-09-25 11:31:00 +0200348 /* For some reason, the res given from ALC880 is broken.
349 Here we adjust it properly. */
350 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100351}
352
Kailang Yang394c97f2014-11-12 17:38:08 +0800353/* Change EAPD to verb control */
354static void alc_fill_eapd_coef(struct hda_codec *codec)
355{
356 int coef;
357
358 coef = alc_get_coef0(codec);
359
Takashi Iwai7639a062015-03-03 10:07:24 +0100360 switch (codec->core.vendor_id) {
Kailang Yang394c97f2014-11-12 17:38:08 +0800361 case 0x10ec0262:
362 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
363 break;
364 case 0x10ec0267:
365 case 0x10ec0268:
366 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
367 break;
368 case 0x10ec0269:
369 if ((coef & 0x00f0) == 0x0010)
370 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
371 if ((coef & 0x00f0) == 0x0020)
372 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
373 if ((coef & 0x00f0) == 0x0030)
374 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
375 break;
376 case 0x10ec0280:
377 case 0x10ec0284:
378 case 0x10ec0290:
379 case 0x10ec0292:
380 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
381 break;
Kailang Yang42314302016-02-03 15:03:50 +0800382 case 0x10ec0225:
Takashi Iwai44be77c2017-12-27 08:53:59 +0100383 case 0x10ec0295:
384 case 0x10ec0299:
385 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
386 /* fallthrough */
387 case 0x10ec0215:
Kailang Yang394c97f2014-11-12 17:38:08 +0800388 case 0x10ec0233:
Kailang Yangea04a1d2018-04-25 15:31:52 +0800389 case 0x10ec0235:
Kailang Yang736f20a2017-10-20 15:06:34 +0800390 case 0x10ec0236:
Kailang Yang394c97f2014-11-12 17:38:08 +0800391 case 0x10ec0255:
Kailang Yang4344aec2014-12-17 17:39:05 +0800392 case 0x10ec0256:
Kailang Yangf429e7e2017-12-05 15:38:24 +0800393 case 0x10ec0257:
Kailang Yang394c97f2014-11-12 17:38:08 +0800394 case 0x10ec0282:
395 case 0x10ec0283:
396 case 0x10ec0286:
397 case 0x10ec0288:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800398 case 0x10ec0285:
Kailang Yang506b62c2014-12-18 17:07:44 +0800399 case 0x10ec0298:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800400 case 0x10ec0289:
Kailang Yang394c97f2014-11-12 17:38:08 +0800401 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
402 break;
Kailang Yang3aabf942017-11-08 15:28:33 +0800403 case 0x10ec0275:
404 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
405 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800406 case 0x10ec0293:
407 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
408 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800409 case 0x10ec0234:
410 case 0x10ec0274:
411 case 0x10ec0294:
Kailang Yang6fbae352016-05-30 16:44:20 +0800412 case 0x10ec0700:
413 case 0x10ec0701:
414 case 0x10ec0703:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800415 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
416 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800417 case 0x10ec0662:
418 if ((coef & 0x00f0) == 0x0030)
419 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
420 break;
421 case 0x10ec0272:
422 case 0x10ec0273:
423 case 0x10ec0663:
424 case 0x10ec0665:
425 case 0x10ec0670:
426 case 0x10ec0671:
427 case 0x10ec0672:
428 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
429 break;
430 case 0x10ec0668:
431 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
432 break;
433 case 0x10ec0867:
434 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
435 break;
436 case 0x10ec0888:
437 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
438 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
439 break;
440 case 0x10ec0892:
441 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
442 break;
443 case 0x10ec0899:
444 case 0x10ec0900:
Kailang Yang65553b12017-07-11 15:15:47 +0800445 case 0x10ec1168:
Kailang Yanga535ad52017-01-16 16:59:26 +0800446 case 0x10ec1220:
Kailang Yang394c97f2014-11-12 17:38:08 +0800447 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
448 break;
449 }
450}
451
Kailang Yangf9423e72008-05-27 12:32:25 +0200452/* additional initialization for ALC888 variants */
453static void alc888_coef_init(struct hda_codec *codec)
454{
Kailang Yang1df88742014-10-29 16:10:13 +0800455 switch (alc_get_coef0(codec) & 0x00f0) {
456 /* alc888-VA */
457 case 0x00:
458 /* alc888-VB */
459 case 0x10:
460 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
461 break;
462 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200463}
464
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100465/* turn on/off EAPD control (only if available) */
466static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
467{
468 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
469 return;
470 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
471 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
472 on ? 2 : 0);
473}
474
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200475/* turn on/off EAPD controls of the codec */
476static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
477{
478 /* We currently only handle front, HP */
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200479 static hda_nid_t pins[] = {
Hui Wangaf95b412015-03-26 17:14:55 +0800480 0x0f, 0x10, 0x14, 0x15, 0x17, 0
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200481 };
482 hda_nid_t *p;
483 for (p = pins; *p; p++)
484 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200485}
486
Takashi Iwai1c7161532011-04-07 10:37:16 +0200487/* generic shutup callback;
Lars-Peter Clausen4ce8e6a2016-11-08 15:48:06 +0100488 * just turning off EAPD and a little pause for avoiding pop-noise
Takashi Iwai1c7161532011-04-07 10:37:16 +0200489 */
490static void alc_eapd_shutup(struct hda_codec *codec)
491{
Kailang Yang97a26572013-11-29 00:35:26 -0500492 struct alc_spec *spec = codec->spec;
493
Takashi Iwai1c7161532011-04-07 10:37:16 +0200494 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500495 if (!spec->no_depop_delay)
496 msleep(200);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200497 snd_hda_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200498}
499
Takashi Iwai1d045db2011-07-07 18:23:21 +0200500/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200501static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200502{
Kailang Yang394c97f2014-11-12 17:38:08 +0800503 alc_fill_eapd_coef(codec);
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200504 alc_auto_setup_eapd(codec, true);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200505 alc_write_gpio(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200506 switch (type) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200507 case ALC_INIT_DEFAULT:
Takashi Iwai7639a062015-03-03 10:07:24 +0100508 switch (codec->core.vendor_id) {
Kailang Yangc9b58002007-10-16 14:30:01 +0200509 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200510 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200511 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200512 case 0x10ec0880:
513 case 0x10ec0882:
514 case 0x10ec0883:
515 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800516 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200517 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200518 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200519 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200520 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200521 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200522 break;
523 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200524}
Kailang Yangea1fb292008-08-26 12:58:38 +0200525
Takashi Iwai1d045db2011-07-07 18:23:21 +0200526
527/*
528 * Realtek SSID verification
529 */
530
David Henningsson90622912010-10-14 14:50:18 +0200531/* Could be any non-zero and even value. When used as fixup, tells
532 * the driver to ignore any present sku defines.
533 */
534#define ALC_FIXUP_SKU_IGNORE (2)
535
Takashi Iwai23d30f22012-05-07 17:17:32 +0200536static void alc_fixup_sku_ignore(struct hda_codec *codec,
537 const struct hda_fixup *fix, int action)
538{
539 struct alc_spec *spec = codec->spec;
540 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
541 spec->cdefine.fixup = 1;
542 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
543 }
544}
545
Mengdong Linb5c66112013-11-29 00:35:35 -0500546static void alc_fixup_no_depop_delay(struct hda_codec *codec,
547 const struct hda_fixup *fix, int action)
548{
549 struct alc_spec *spec = codec->spec;
550
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500551 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500552 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500553 codec->depop_delay = 0;
554 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500555}
556
Kailang Yangda00c242010-03-19 11:23:45 +0100557static int alc_auto_parse_customize_define(struct hda_codec *codec)
558{
559 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100560 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100561 struct alc_spec *spec = codec->spec;
562
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200563 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
564
David Henningsson90622912010-10-14 14:50:18 +0200565 if (spec->cdefine.fixup) {
566 ass = spec->cdefine.sku_cfg;
567 if (ass == ALC_FIXUP_SKU_IGNORE)
568 return -1;
569 goto do_sku;
570 }
571
Takashi Iwai5100cd02014-02-15 10:03:19 +0100572 if (!codec->bus->pci)
573 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100574 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200575 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100576 goto do_sku;
577
578 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100579 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100580 nid = 0x17;
581 ass = snd_hda_codec_get_pincfg(codec, nid);
582
583 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100584 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100585 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100586 return -1;
587 }
588
589 /* check sum */
590 tmp = 0;
591 for (i = 1; i < 16; i++) {
592 if ((ass >> i) & 1)
593 tmp++;
594 }
595 if (((ass >> 16) & 0xf) != tmp)
596 return -1;
597
598 spec->cdefine.port_connectivity = ass >> 30;
599 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
600 spec->cdefine.check_sum = (ass >> 16) & 0xf;
601 spec->cdefine.customization = ass >> 8;
602do_sku:
603 spec->cdefine.sku_cfg = ass;
604 spec->cdefine.external_amp = (ass & 0x38) >> 3;
605 spec->cdefine.platform_type = (ass & 0x4) >> 2;
606 spec->cdefine.swap = (ass & 0x2) >> 1;
607 spec->cdefine.override = ass & 0x1;
608
Takashi Iwai4e76a882014-02-25 12:21:03 +0100609 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100610 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100611 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100612 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100613 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
614 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
615 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
616 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
617 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
618 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
619 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100620
621 return 0;
622}
623
Takashi Iwai08c189f2012-12-19 15:22:24 +0100624/* return the position of NID in the list, or -1 if not found */
625static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
626{
627 int i;
628 for (i = 0; i < nums; i++)
629 if (list[i] == nid)
630 return i;
631 return -1;
632}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200633/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200634static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
635{
Takashi Iwai21268962011-07-07 15:01:13 +0200636 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200637}
638
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200639/* check subsystem ID and set up device-specific initialization;
640 * return 1 if initialized, 0 if invalid SSID
641 */
642/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
643 * 31 ~ 16 : Manufacture ID
644 * 15 ~ 8 : SKU ID
645 * 7 ~ 0 : Assembly ID
646 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
647 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100648static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200649{
650 unsigned int ass, tmp, i;
651 unsigned nid;
652 struct alc_spec *spec = codec->spec;
653
David Henningsson90622912010-10-14 14:50:18 +0200654 if (spec->cdefine.fixup) {
655 ass = spec->cdefine.sku_cfg;
656 if (ass == ALC_FIXUP_SKU_IGNORE)
657 return 0;
658 goto do_sku;
659 }
660
Takashi Iwai7639a062015-03-03 10:07:24 +0100661 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100662 if (codec->bus->pci &&
663 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200664 goto do_sku;
665
666 /* invalid SSID, check the special NID pin defcfg instead */
667 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400668 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200669 * 29~21 : reserve
670 * 20 : PCBEEP input
671 * 19~16 : Check sum (15:1)
672 * 15~1 : Custom
673 * 0 : override
674 */
675 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100676 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200677 nid = 0x17;
678 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100679 codec_dbg(codec,
680 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200681 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100682 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200683 return 0;
684 if ((ass >> 30) != 1) /* no physical connection */
685 return 0;
686
687 /* check sum */
688 tmp = 0;
689 for (i = 1; i < 16; i++) {
690 if ((ass >> i) & 1)
691 tmp++;
692 }
693 if (((ass >> 16) & 0xf) != tmp)
694 return 0;
695do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100696 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100697 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200698 /*
699 * 0 : override
700 * 1 : Swap Jack
701 * 2 : 0 --> Desktop, 1 --> Laptop
702 * 3~5 : External Amplifier control
703 * 7~6 : Reserved
704 */
705 tmp = (ass & 0x38) >> 3; /* external Amp control */
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200706 if (spec->init_amp == ALC_INIT_UNDEFINED) {
707 switch (tmp) {
708 case 1:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200709 alc_setup_gpio(codec, 0x01);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200710 break;
711 case 3:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200712 alc_setup_gpio(codec, 0x02);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200713 break;
714 case 7:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200715 alc_setup_gpio(codec, 0x03);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200716 break;
717 case 5:
718 default:
719 spec->init_amp = ALC_INIT_DEFAULT;
720 break;
721 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200722 }
723
724 /* is laptop or Desktop and enable the function "Mute internal speaker
725 * when the external headphone out jack is plugged"
726 */
727 if (!(ass & 0x8000))
728 return 1;
729 /*
730 * 10~8 : Jack location
731 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
732 * 14~13: Resvered
733 * 15 : 1 --> enable the function "Mute internal speaker
734 * when the external headphone out jack is plugged"
735 */
Takashi Iwai08c189f2012-12-19 15:22:24 +0100736 if (!spec->gen.autocfg.hp_pins[0] &&
737 !(spec->gen.autocfg.line_out_pins[0] &&
738 spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200739 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200740 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100741 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100742 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
743 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200744 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100745 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200746 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200747 return 1;
748}
Kailang Yangea1fb292008-08-26 12:58:38 +0200749
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200750/* Check the validity of ALC subsystem-id
751 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
752static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200753{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100754 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200755 struct alc_spec *spec = codec->spec;
Takashi Iwai4e76a882014-02-25 12:21:03 +0100756 codec_dbg(codec,
757 "realtek: Enable default setup for auto mode as fallback\n");
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200758 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200759 }
Takashi Iwai21268962011-07-07 15:01:13 +0200760}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200761
Takashi Iwai41e41f12005-06-08 14:48:49 +0200762/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200763 */
764
David Henningsson9d36a7d2014-10-07 10:18:42 +0200765static void alc_fixup_inv_dmic(struct hda_codec *codec,
766 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200767{
768 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100769
David Henningsson9d36a7d2014-10-07 10:18:42 +0200770 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200771}
772
Takashi Iwai603c4012008-07-30 15:01:44 +0200773
Takashi Iwai67d634c2009-11-16 15:35:59 +0100774#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100775/* additional beep mixers; the actual parameters are overwritten at build */
Takashi Iwaia9111322011-05-02 11:30:18 +0200776static const struct snd_kcontrol_new alc_beep_mixer[] = {
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100777 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
Jaroslav Kysela123c07a2009-10-21 14:48:23 +0200778 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100779 { } /* end */
780};
Takashi Iwai67d634c2009-11-16 15:35:59 +0100781#endif
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100782
Takashi Iwai2eab6942012-12-18 15:30:41 +0100783static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700784{
785 struct alc_spec *spec = codec->spec;
Takashi Iwai666a70d2012-12-17 20:29:29 +0100786 int i, err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700787
Takashi Iwai08c189f2012-12-19 15:22:24 +0100788 err = snd_hda_gen_build_controls(codec);
789 if (err < 0)
790 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700791
792 for (i = 0; i < spec->num_mixers; i++) {
793 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
794 if (err < 0)
795 return err;
796 }
Takashi Iwai2134ea42008-01-10 16:53:55 +0100797
Takashi Iwai67d634c2009-11-16 15:35:59 +0100798#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100799 /* create beep controls if needed */
800 if (spec->beep_amp) {
Takashi Iwaia9111322011-05-02 11:30:18 +0200801 const struct snd_kcontrol_new *knew;
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100802 for (knew = alc_beep_mixer; knew->name; knew++) {
803 struct snd_kcontrol *kctl;
804 kctl = snd_ctl_new1(knew, codec);
805 if (!kctl)
806 return -ENOMEM;
807 kctl->private_value = spec->beep_amp;
Jaroslav Kysela5e26dfd2009-12-10 13:57:01 +0100808 err = snd_hda_ctl_add(codec, 0, kctl);
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100809 if (err < 0)
810 return err;
811 }
812 }
Takashi Iwai67d634c2009-11-16 15:35:59 +0100813#endif
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100814
Takashi Iwai1727a772013-01-10 09:52:52 +0100815 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100816 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817}
818
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200819
Linus Torvalds1da177e2005-04-16 15:20:36 -0700820/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100821 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200822 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200823
Linus Torvalds1da177e2005-04-16 15:20:36 -0700824static int alc_init(struct hda_codec *codec)
825{
826 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200827
Takashi Iwai546bb672012-03-07 08:37:19 +0100828 if (spec->init_hook)
829 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100830
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200831 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200832 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200833
Takashi Iwai08c189f2012-12-19 15:22:24 +0100834 snd_hda_gen_init(codec);
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100835
Takashi Iwai1727a772013-01-10 09:52:52 +0100836 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200837
Linus Torvalds1da177e2005-04-16 15:20:36 -0700838 return 0;
839}
840
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100841static inline void alc_shutup(struct hda_codec *codec)
842{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200843 struct alc_spec *spec = codec->spec;
844
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200845 if (!snd_hda_get_bool_hint(codec, "shutup"))
846 return; /* disabled explicitly by hints */
847
Takashi Iwai1c7161532011-04-07 10:37:16 +0200848 if (spec && spec->shutup)
849 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200850 else
851 snd_hda_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100852}
853
Takashi Iwai70a09762015-12-15 14:59:58 +0100854static void alc_reboot_notify(struct hda_codec *codec)
855{
856 struct alc_spec *spec = codec->spec;
857
858 if (spec && spec->reboot_notify)
859 spec->reboot_notify(codec);
860 else
861 alc_shutup(codec);
862}
863
864/* power down codec to D3 at reboot/shutdown; set as reboot_notify ops */
865static void alc_d3_at_reboot(struct hda_codec *codec)
866{
867 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
868 snd_hda_codec_write(codec, codec->core.afg, 0,
869 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
870 msleep(10);
871}
872
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100873#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700874
Takashi Iwai83012a72012-08-24 18:38:08 +0200875#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500876static void alc_power_eapd(struct hda_codec *codec)
877{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200878 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500879}
880
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200881static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100882{
883 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100884 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100885 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500886 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100887 return 0;
888}
889#endif
890
Takashi Iwai2a439522011-07-26 09:52:50 +0200891#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100892static int alc_resume(struct hda_codec *codec)
893{
Kailang Yang97a26572013-11-29 00:35:26 -0500894 struct alc_spec *spec = codec->spec;
895
896 if (!spec->no_depop_delay)
897 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100898 codec->patch_ops.init(codec);
Takashi Iwaieeecd9d2015-02-25 15:18:50 +0100899 regcache_sync(codec->core.regmap);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200900 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100901 return 0;
902}
Takashi Iwaie044c392008-10-27 16:56:24 +0100903#endif
904
Linus Torvalds1da177e2005-04-16 15:20:36 -0700905/*
906 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200907static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700908 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100909 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700910 .init = alc_init,
911 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200912 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200913#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100914 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100915 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100916 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200917#endif
Takashi Iwai70a09762015-12-15 14:59:58 +0100918 .reboot_notify = alc_reboot_notify,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700919};
920
David Henningsson29adc4b2012-09-25 11:31:00 +0200921
Takashi Iwaided255b2015-10-01 17:59:43 +0200922#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100923
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200924/*
Kailang Yang4b016932013-11-28 11:55:09 +0100925 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200926 */
927struct alc_codec_rename_table {
928 unsigned int vendor_id;
929 unsigned short coef_mask;
930 unsigned short coef_bits;
931 const char *name;
932};
933
Kailang Yang4b016932013-11-28 11:55:09 +0100934struct alc_codec_rename_pci_table {
935 unsigned int codec_vendor_id;
936 unsigned short pci_subvendor;
937 unsigned short pci_subdevice;
938 const char *name;
939};
940
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200941static struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800942 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200943 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
944 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
945 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
946 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
947 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
948 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
949 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200950 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800951 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200952 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
953 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
954 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
955 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
956 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
957 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
958 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
959 { } /* terminator */
960};
961
Kailang Yang4b016932013-11-28 11:55:09 +0100962static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
963 { 0x10ec0280, 0x1028, 0, "ALC3220" },
964 { 0x10ec0282, 0x1028, 0, "ALC3221" },
965 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +0800966 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +0100967 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +0800968 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +0100969 { 0x10ec0255, 0x1028, 0, "ALC3234" },
970 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800971 { 0x10ec0275, 0x1028, 0, "ALC3260" },
972 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +0800973 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +0800974 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +0800975 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +0800976 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +0800977 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +0800978 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800979 { 0x10ec0670, 0x1025, 0, "ALC669X" },
980 { 0x10ec0676, 0x1025, 0, "ALC679X" },
981 { 0x10ec0282, 0x1043, 0, "ALC3229" },
982 { 0x10ec0233, 0x1043, 0, "ALC3236" },
983 { 0x10ec0280, 0x103c, 0, "ALC3228" },
984 { 0x10ec0282, 0x103c, 0, "ALC3227" },
985 { 0x10ec0286, 0x103c, 0, "ALC3242" },
986 { 0x10ec0290, 0x103c, 0, "ALC3241" },
987 { 0x10ec0668, 0x103c, 0, "ALC3662" },
988 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
989 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +0100990 { } /* terminator */
991};
992
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200993static int alc_codec_rename_from_preset(struct hda_codec *codec)
994{
995 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +0100996 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200997
998 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +0100999 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001000 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02001001 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001002 return alc_codec_rename(codec, p->name);
1003 }
Kailang Yang4b016932013-11-28 11:55:09 +01001004
Takashi Iwai5100cd02014-02-15 10:03:19 +01001005 if (!codec->bus->pci)
1006 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +01001007 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001008 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +01001009 continue;
1010 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1011 continue;
1012 if (!q->pci_subdevice ||
1013 q->pci_subdevice == codec->bus->pci->subsystem_device)
1014 return alc_codec_rename(codec, q->name);
1015 }
1016
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001017 return 0;
1018}
1019
Takashi Iwaie4770622011-07-08 11:11:35 +02001020
1021/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001022 * Digital-beep handlers
1023 */
1024#ifdef CONFIG_SND_HDA_INPUT_BEEP
1025#define set_beep_amp(spec, nid, idx, dir) \
1026 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
1027
1028static const struct snd_pci_quirk beep_white_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +02001029 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -07001030 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001031 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +01001032 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001033 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1034 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1035 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +01001036 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001037 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1038 {}
1039};
1040
1041static inline int has_cdefine_beep(struct hda_codec *codec)
1042{
1043 struct alc_spec *spec = codec->spec;
1044 const struct snd_pci_quirk *q;
1045 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
1046 if (q)
1047 return q->value;
1048 return spec->cdefine.enable_pcbeep;
1049}
1050#else
1051#define set_beep_amp(spec, nid, idx, dir) /* NOP */
1052#define has_cdefine_beep(codec) 0
1053#endif
1054
1055/* parse the BIOS configuration and set up the alc_spec */
1056/* return 1 if successful, 0 if the proper config is not found,
1057 * or a negative error code
1058 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001059static int alc_parse_auto_config(struct hda_codec *codec,
1060 const hda_nid_t *ignore_nids,
1061 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001062{
1063 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001064 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001065 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001066
Takashi Iwai53c334a2011-08-23 18:27:14 +02001067 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1068 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001069 if (err < 0)
1070 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001071
1072 if (ssid_nids)
1073 alc_ssid_check(codec, ssid_nids);
1074
Takashi Iwai08c189f2012-12-19 15:22:24 +01001075 err = snd_hda_gen_parse_auto_config(codec, cfg);
1076 if (err < 0)
1077 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001078
Takashi Iwai1d045db2011-07-07 18:23:21 +02001079 return 1;
1080}
1081
Takashi Iwai3de95172012-05-07 18:03:15 +02001082/* common preparation job for alc_spec */
1083static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1084{
1085 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1086 int err;
1087
1088 if (!spec)
1089 return -ENOMEM;
1090 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001091 snd_hda_gen_spec_init(&spec->gen);
1092 spec->gen.mixer_nid = mixer_nid;
1093 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001094 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001095 /* FIXME: do we need this for all Realtek codec models? */
1096 codec->spdif_status_reset = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001097 codec->patch_ops = alc_patch_ops;
Takashi Iwai3de95172012-05-07 18:03:15 +02001098
1099 err = alc_codec_rename_from_preset(codec);
1100 if (err < 0) {
1101 kfree(spec);
1102 return err;
1103 }
1104 return 0;
1105}
1106
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001107static int alc880_parse_auto_config(struct hda_codec *codec)
1108{
1109 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001110 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001111 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1112}
1113
Takashi Iwai1d045db2011-07-07 18:23:21 +02001114/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001115 * ALC880 fix-ups
1116 */
1117enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001118 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001119 ALC880_FIXUP_GPIO2,
1120 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001121 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001122 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001123 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001124 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001125 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001126 ALC880_FIXUP_VOL_KNOB,
1127 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001128 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001129 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001130 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001131 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001132 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001133 ALC880_FIXUP_3ST_BASE,
1134 ALC880_FIXUP_3ST,
1135 ALC880_FIXUP_3ST_DIG,
1136 ALC880_FIXUP_5ST_BASE,
1137 ALC880_FIXUP_5ST,
1138 ALC880_FIXUP_5ST_DIG,
1139 ALC880_FIXUP_6ST_BASE,
1140 ALC880_FIXUP_6ST,
1141 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001142 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001143};
1144
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001145/* enable the volume-knob widget support on NID 0x21 */
1146static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001147 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001148{
Takashi Iwai1727a772013-01-10 09:52:52 +01001149 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001150 snd_hda_jack_detect_enable_callback(codec, 0x21,
1151 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001152}
1153
Takashi Iwai1727a772013-01-10 09:52:52 +01001154static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001155 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001156 .type = HDA_FIXUP_FUNC,
1157 .v.func = alc_fixup_gpio1,
Takashi Iwai411225a2012-02-20 17:48:19 +01001158 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001159 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001160 .type = HDA_FIXUP_FUNC,
1161 .v.func = alc_fixup_gpio2,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001162 },
1163 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001164 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001165 .v.verbs = (const struct hda_verb[]) {
1166 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1167 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1168 { }
1169 },
1170 .chained = true,
1171 .chain_id = ALC880_FIXUP_GPIO2,
1172 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001173 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001174 .type = HDA_FIXUP_PINS,
1175 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001176 /* disable bogus unused pins */
1177 { 0x16, 0x411111f0 },
1178 { 0x18, 0x411111f0 },
1179 { 0x1a, 0x411111f0 },
1180 { }
1181 }
1182 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001183 [ALC880_FIXUP_LG_LW25] = {
1184 .type = HDA_FIXUP_PINS,
1185 .v.pins = (const struct hda_pintbl[]) {
1186 { 0x1a, 0x0181344f }, /* line-in */
1187 { 0x1b, 0x0321403f }, /* headphone */
1188 { }
1189 }
1190 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001191 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001192 .type = HDA_FIXUP_PINS,
1193 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001194 /* disable bogus unused pins */
1195 { 0x17, 0x411111f0 },
1196 { }
1197 },
1198 .chained = true,
1199 .chain_id = ALC880_FIXUP_GPIO2,
1200 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001201 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001202 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001203 .v.verbs = (const struct hda_verb[]) {
1204 /* change to EAPD mode */
1205 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1206 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1207 {}
1208 },
1209 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001210 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001211 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001212 .v.verbs = (const struct hda_verb[]) {
1213 /* change to EAPD mode */
1214 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1215 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1216 {}
1217 },
1218 .chained = true,
1219 .chain_id = ALC880_FIXUP_GPIO2,
1220 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001221 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001222 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001223 .v.func = alc880_fixup_vol_knob,
1224 },
1225 [ALC880_FIXUP_FUJITSU] = {
1226 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001227 .type = HDA_FIXUP_PINS,
1228 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001229 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001230 { 0x15, 0x99030120 }, /* speaker */
1231 { 0x16, 0x99030130 }, /* bass speaker */
1232 { 0x17, 0x411111f0 }, /* N/A */
1233 { 0x18, 0x411111f0 }, /* N/A */
1234 { 0x19, 0x01a19950 }, /* mic-in */
1235 { 0x1a, 0x411111f0 }, /* N/A */
1236 { 0x1b, 0x411111f0 }, /* N/A */
1237 { 0x1c, 0x411111f0 }, /* N/A */
1238 { 0x1d, 0x411111f0 }, /* N/A */
1239 { 0x1e, 0x01454140 }, /* SPDIF out */
1240 { }
1241 },
1242 .chained = true,
1243 .chain_id = ALC880_FIXUP_VOL_KNOB,
1244 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001245 [ALC880_FIXUP_F1734] = {
1246 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001247 .type = HDA_FIXUP_PINS,
1248 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001249 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001250 { 0x15, 0x99030120 }, /* speaker */
1251 { 0x16, 0x411111f0 }, /* N/A */
1252 { 0x17, 0x411111f0 }, /* N/A */
1253 { 0x18, 0x411111f0 }, /* N/A */
1254 { 0x19, 0x01a19950 }, /* mic-in */
1255 { 0x1a, 0x411111f0 }, /* N/A */
1256 { 0x1b, 0x411111f0 }, /* N/A */
1257 { 0x1c, 0x411111f0 }, /* N/A */
1258 { 0x1d, 0x411111f0 }, /* N/A */
1259 { 0x1e, 0x411111f0 }, /* N/A */
1260 { }
1261 },
1262 .chained = true,
1263 .chain_id = ALC880_FIXUP_VOL_KNOB,
1264 },
Takashi Iwai817de922012-02-20 17:20:48 +01001265 [ALC880_FIXUP_UNIWILL] = {
1266 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001267 .type = HDA_FIXUP_PINS,
1268 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001269 { 0x14, 0x0121411f }, /* HP */
1270 { 0x15, 0x99030120 }, /* speaker */
1271 { 0x16, 0x99030130 }, /* bass speaker */
1272 { }
1273 },
1274 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001275 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001276 .type = HDA_FIXUP_PINS,
1277 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001278 /* disable bogus unused pins */
1279 { 0x17, 0x411111f0 },
1280 { 0x19, 0x411111f0 },
1281 { 0x1b, 0x411111f0 },
1282 { 0x1f, 0x411111f0 },
1283 { }
1284 }
1285 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001286 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001287 .type = HDA_FIXUP_PINS,
1288 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001289 /* set up the whole pins as BIOS is utterly broken */
1290 { 0x14, 0x99030120 }, /* speaker */
1291 { 0x15, 0x0121411f }, /* HP */
1292 { 0x16, 0x411111f0 }, /* N/A */
1293 { 0x17, 0x411111f0 }, /* N/A */
1294 { 0x18, 0x01a19950 }, /* mic-in */
1295 { 0x19, 0x411111f0 }, /* N/A */
1296 { 0x1a, 0x01813031 }, /* line-in */
1297 { 0x1b, 0x411111f0 }, /* N/A */
1298 { 0x1c, 0x411111f0 }, /* N/A */
1299 { 0x1d, 0x411111f0 }, /* N/A */
1300 { 0x1e, 0x0144111e }, /* SPDIF */
1301 { }
1302 }
1303 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001304 [ALC880_FIXUP_ASUS_W5A] = {
1305 .type = HDA_FIXUP_PINS,
1306 .v.pins = (const struct hda_pintbl[]) {
1307 /* set up the whole pins as BIOS is utterly broken */
1308 { 0x14, 0x0121411f }, /* HP */
1309 { 0x15, 0x411111f0 }, /* N/A */
1310 { 0x16, 0x411111f0 }, /* N/A */
1311 { 0x17, 0x411111f0 }, /* N/A */
1312 { 0x18, 0x90a60160 }, /* mic */
1313 { 0x19, 0x411111f0 }, /* N/A */
1314 { 0x1a, 0x411111f0 }, /* N/A */
1315 { 0x1b, 0x411111f0 }, /* N/A */
1316 { 0x1c, 0x411111f0 }, /* N/A */
1317 { 0x1d, 0x411111f0 }, /* N/A */
1318 { 0x1e, 0xb743111e }, /* SPDIF out */
1319 { }
1320 },
1321 .chained = true,
1322 .chain_id = ALC880_FIXUP_GPIO1,
1323 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001324 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001325 .type = HDA_FIXUP_PINS,
1326 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001327 { 0x14, 0x01014010 }, /* line-out */
1328 { 0x15, 0x411111f0 }, /* N/A */
1329 { 0x16, 0x411111f0 }, /* N/A */
1330 { 0x17, 0x411111f0 }, /* N/A */
1331 { 0x18, 0x01a19c30 }, /* mic-in */
1332 { 0x19, 0x0121411f }, /* HP */
1333 { 0x1a, 0x01813031 }, /* line-in */
1334 { 0x1b, 0x02a19c40 }, /* front-mic */
1335 { 0x1c, 0x411111f0 }, /* N/A */
1336 { 0x1d, 0x411111f0 }, /* N/A */
1337 /* 0x1e is filled in below */
1338 { 0x1f, 0x411111f0 }, /* N/A */
1339 { }
1340 }
1341 },
1342 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001343 .type = HDA_FIXUP_PINS,
1344 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001345 { 0x1e, 0x411111f0 }, /* N/A */
1346 { }
1347 },
1348 .chained = true,
1349 .chain_id = ALC880_FIXUP_3ST_BASE,
1350 },
1351 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001352 .type = HDA_FIXUP_PINS,
1353 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001354 { 0x1e, 0x0144111e }, /* SPDIF */
1355 { }
1356 },
1357 .chained = true,
1358 .chain_id = ALC880_FIXUP_3ST_BASE,
1359 },
1360 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001361 .type = HDA_FIXUP_PINS,
1362 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001363 { 0x14, 0x01014010 }, /* front */
1364 { 0x15, 0x411111f0 }, /* N/A */
1365 { 0x16, 0x01011411 }, /* CLFE */
1366 { 0x17, 0x01016412 }, /* surr */
1367 { 0x18, 0x01a19c30 }, /* mic-in */
1368 { 0x19, 0x0121411f }, /* HP */
1369 { 0x1a, 0x01813031 }, /* line-in */
1370 { 0x1b, 0x02a19c40 }, /* front-mic */
1371 { 0x1c, 0x411111f0 }, /* N/A */
1372 { 0x1d, 0x411111f0 }, /* N/A */
1373 /* 0x1e is filled in below */
1374 { 0x1f, 0x411111f0 }, /* N/A */
1375 { }
1376 }
1377 },
1378 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001379 .type = HDA_FIXUP_PINS,
1380 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001381 { 0x1e, 0x411111f0 }, /* N/A */
1382 { }
1383 },
1384 .chained = true,
1385 .chain_id = ALC880_FIXUP_5ST_BASE,
1386 },
1387 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001388 .type = HDA_FIXUP_PINS,
1389 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001390 { 0x1e, 0x0144111e }, /* SPDIF */
1391 { }
1392 },
1393 .chained = true,
1394 .chain_id = ALC880_FIXUP_5ST_BASE,
1395 },
1396 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001397 .type = HDA_FIXUP_PINS,
1398 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001399 { 0x14, 0x01014010 }, /* front */
1400 { 0x15, 0x01016412 }, /* surr */
1401 { 0x16, 0x01011411 }, /* CLFE */
1402 { 0x17, 0x01012414 }, /* side */
1403 { 0x18, 0x01a19c30 }, /* mic-in */
1404 { 0x19, 0x02a19c40 }, /* front-mic */
1405 { 0x1a, 0x01813031 }, /* line-in */
1406 { 0x1b, 0x0121411f }, /* HP */
1407 { 0x1c, 0x411111f0 }, /* N/A */
1408 { 0x1d, 0x411111f0 }, /* N/A */
1409 /* 0x1e is filled in below */
1410 { 0x1f, 0x411111f0 }, /* N/A */
1411 { }
1412 }
1413 },
1414 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001415 .type = HDA_FIXUP_PINS,
1416 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001417 { 0x1e, 0x411111f0 }, /* N/A */
1418 { }
1419 },
1420 .chained = true,
1421 .chain_id = ALC880_FIXUP_6ST_BASE,
1422 },
1423 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001424 .type = HDA_FIXUP_PINS,
1425 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001426 { 0x1e, 0x0144111e }, /* SPDIF */
1427 { }
1428 },
1429 .chained = true,
1430 .chain_id = ALC880_FIXUP_6ST_BASE,
1431 },
Takashi Iwai53971452013-01-23 18:21:37 +01001432 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1433 .type = HDA_FIXUP_PINS,
1434 .v.pins = (const struct hda_pintbl[]) {
1435 { 0x1b, 0x0121401f }, /* HP with jack detect */
1436 { }
1437 },
1438 .chained_before = true,
1439 .chain_id = ALC880_FIXUP_6ST_BASE,
1440 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001441};
1442
1443static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001444 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001445 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001446 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001447 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001448 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001449 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001450 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001451 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001452 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001453 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001454 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001455 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001456 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001457 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001458 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001459 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001460 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001461 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001462 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1463 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1464 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001465 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001466 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001467
1468 /* Below is the copied entries from alc880_quirks.c.
1469 * It's not quite sure whether BIOS sets the correct pin-config table
1470 * on these machines, thus they are kept to be compatible with
1471 * the old static quirks. Once when it's confirmed to work without
1472 * these overrides, it'd be better to remove.
1473 */
1474 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1475 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1476 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1477 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1478 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1479 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1480 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1481 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1482 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1483 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1484 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1485 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1486 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1487 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1488 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1489 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1490 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1491 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1492 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1493 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1494 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1495 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1496 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1497 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1498 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1499 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1500 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1501 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1502 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1503 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1504 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1505 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1506 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1507 /* default Intel */
1508 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1509 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1510 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1511 {}
1512};
1513
Takashi Iwai1727a772013-01-10 09:52:52 +01001514static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001515 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1516 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1517 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1518 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1519 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1520 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001521 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001522 {}
1523};
1524
1525
1526/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001527 * OK, here we have finally the patch for ALC880
1528 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001529static int patch_alc880(struct hda_codec *codec)
1530{
1531 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001532 int err;
1533
Takashi Iwai3de95172012-05-07 18:03:15 +02001534 err = alc_alloc_spec(codec, 0x0b);
1535 if (err < 0)
1536 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001537
Takashi Iwai3de95172012-05-07 18:03:15 +02001538 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001539 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001540 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001541
Takashi Iwai225068a2015-05-29 10:42:14 +02001542 codec->patch_ops.unsol_event = alc880_unsol_event;
1543
Takashi Iwai1727a772013-01-10 09:52:52 +01001544 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001545 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001546 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001547
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001548 /* automatic parse from the BIOS config */
1549 err = alc880_parse_auto_config(codec);
1550 if (err < 0)
1551 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001552
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001553 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001554 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001555
Takashi Iwai1727a772013-01-10 09:52:52 +01001556 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001557
Takashi Iwai1d045db2011-07-07 18:23:21 +02001558 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001559
1560 error:
1561 alc_free(codec);
1562 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001563}
1564
1565
1566/*
1567 * ALC260 support
1568 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001569static int alc260_parse_auto_config(struct hda_codec *codec)
1570{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001571 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001572 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1573 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001574}
1575
Takashi Iwai1d045db2011-07-07 18:23:21 +02001576/*
1577 * Pin config fixes
1578 */
1579enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001580 ALC260_FIXUP_HP_DC5750,
1581 ALC260_FIXUP_HP_PIN_0F,
1582 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001583 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001584 ALC260_FIXUP_GPIO1_TOGGLE,
1585 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001586 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001587 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001588 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001589 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001590 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001591};
1592
Takashi Iwai20f7d922012-02-16 12:35:16 +01001593static void alc260_gpio1_automute(struct hda_codec *codec)
1594{
1595 struct alc_spec *spec = codec->spec;
Takashi Iwaiaaf312d2018-06-19 22:28:22 +02001596
1597 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001598}
1599
1600static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001601 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001602{
1603 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001604 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001605 /* although the machine has only one output pin, we need to
1606 * toggle GPIO1 according to the jack state
1607 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001608 spec->gen.automute_hook = alc260_gpio1_automute;
1609 spec->gen.detect_hp = 1;
1610 spec->gen.automute_speaker = 1;
1611 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001612 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001613 snd_hda_gen_hp_automute);
Takashi Iwai5579cd62018-06-19 22:22:41 +02001614 alc_setup_gpio(codec, 0x01);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001615 }
1616}
1617
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001618static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001619 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001620{
1621 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001622 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001623 { 0x0f, 0x02214000 }, /* HP/speaker */
1624 { 0x12, 0x90a60160 }, /* int mic */
1625 { 0x13, 0x02a19000 }, /* ext mic */
1626 { 0x18, 0x01446000 }, /* SPDIF out */
1627 /* disable bogus I/O pins */
1628 { 0x10, 0x411111f0 },
1629 { 0x11, 0x411111f0 },
1630 { 0x14, 0x411111f0 },
1631 { 0x15, 0x411111f0 },
1632 { 0x16, 0x411111f0 },
1633 { 0x17, 0x411111f0 },
1634 { 0x19, 0x411111f0 },
1635 { }
1636 };
1637
1638 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001639 case HDA_FIXUP_ACT_PRE_PROBE:
1640 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001641 spec->init_amp = ALC_INIT_NONE;
1642 break;
1643 }
1644}
1645
Takashi Iwai39aedee2013-01-10 17:10:40 +01001646static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1647 const struct hda_fixup *fix, int action)
1648{
1649 struct alc_spec *spec = codec->spec;
Takashi Iwai1c76aa52018-06-21 16:37:54 +02001650 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001651 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001652}
1653
1654static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1655 const struct hda_fixup *fix, int action)
1656{
1657 struct alc_spec *spec = codec->spec;
1658 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001659 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001660 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001661 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001662}
1663
Takashi Iwai1727a772013-01-10 09:52:52 +01001664static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001665 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001666 .type = HDA_FIXUP_PINS,
1667 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001668 { 0x11, 0x90130110 }, /* speaker */
1669 { }
1670 }
1671 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001672 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001673 .type = HDA_FIXUP_PINS,
1674 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001675 { 0x0f, 0x01214000 }, /* HP */
1676 { }
1677 }
1678 },
1679 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001680 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001681 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001682 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1683 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001684 { }
1685 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001686 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001687 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001688 .type = HDA_FIXUP_FUNC,
1689 .v.func = alc_fixup_gpio1,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001690 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001691 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001692 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001693 .v.func = alc260_fixup_gpio1_toggle,
1694 .chained = true,
1695 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1696 },
1697 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001698 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001699 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001700 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1701 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001702 { }
1703 },
1704 .chained = true,
1705 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1706 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001707 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001708 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001709 .v.func = alc260_fixup_gpio1_toggle,
1710 .chained = true,
1711 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001712 },
1713 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001714 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001715 .v.func = alc260_fixup_kn1,
1716 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001717 [ALC260_FIXUP_FSC_S7020] = {
1718 .type = HDA_FIXUP_FUNC,
1719 .v.func = alc260_fixup_fsc_s7020,
1720 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001721 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1722 .type = HDA_FIXUP_FUNC,
1723 .v.func = alc260_fixup_fsc_s7020_jwse,
1724 .chained = true,
1725 .chain_id = ALC260_FIXUP_FSC_S7020,
1726 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001727 [ALC260_FIXUP_VAIO_PINS] = {
1728 .type = HDA_FIXUP_PINS,
1729 .v.pins = (const struct hda_pintbl[]) {
1730 /* Pin configs are missing completely on some VAIOs */
1731 { 0x0f, 0x01211020 },
1732 { 0x10, 0x0001003f },
1733 { 0x11, 0x411111f0 },
1734 { 0x12, 0x01a15930 },
1735 { 0x13, 0x411111f0 },
1736 { 0x14, 0x411111f0 },
1737 { 0x15, 0x411111f0 },
1738 { 0x16, 0x411111f0 },
1739 { 0x17, 0x411111f0 },
1740 { 0x18, 0x411111f0 },
1741 { 0x19, 0x411111f0 },
1742 { }
1743 }
1744 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001745};
1746
1747static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001748 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001749 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001750 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001751 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001752 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001753 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001754 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001755 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001756 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001757 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001758 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001759 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001760 {}
1761};
1762
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001763static const struct hda_model_fixup alc260_fixup_models[] = {
1764 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1765 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1766 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1767 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1768 {}
1769};
1770
Takashi Iwai1d045db2011-07-07 18:23:21 +02001771/*
1772 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001773static int patch_alc260(struct hda_codec *codec)
1774{
1775 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001776 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001777
Takashi Iwai3de95172012-05-07 18:03:15 +02001778 err = alc_alloc_spec(codec, 0x07);
1779 if (err < 0)
1780 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001781
Takashi Iwai3de95172012-05-07 18:03:15 +02001782 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001783 /* as quite a few machines require HP amp for speaker outputs,
1784 * it's easier to enable it unconditionally; even if it's unneeded,
1785 * it's almost harmless.
1786 */
1787 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001788 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001789
Takashi Iwai225068a2015-05-29 10:42:14 +02001790 spec->shutup = alc_eapd_shutup;
1791
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001792 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1793 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001794 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001795
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001796 /* automatic parse from the BIOS config */
1797 err = alc260_parse_auto_config(codec);
1798 if (err < 0)
1799 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001800
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001801 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001802 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001803
Takashi Iwai1727a772013-01-10 09:52:52 +01001804 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001805
Takashi Iwai1d045db2011-07-07 18:23:21 +02001806 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001807
1808 error:
1809 alc_free(codec);
1810 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001811}
1812
1813
1814/*
1815 * ALC882/883/885/888/889 support
1816 *
1817 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1818 * configuration. Each pin widget can choose any input DACs and a mixer.
1819 * Each ADC is connected from a mixer of all inputs. This makes possible
1820 * 6-channel independent captures.
1821 *
1822 * In addition, an independent DAC for the multi-playback (not used in this
1823 * driver yet).
1824 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001825
1826/*
1827 * Pin config fixes
1828 */
1829enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001830 ALC882_FIXUP_ABIT_AW9D_MAX,
1831 ALC882_FIXUP_LENOVO_Y530,
1832 ALC882_FIXUP_PB_M5210,
1833 ALC882_FIXUP_ACER_ASPIRE_7736,
1834 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001835 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001836 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001837 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001838 ALC888_FIXUP_EEE1601,
Takashi Iwai177943a2011-11-09 12:55:18 +01001839 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001840 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001841 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001842 ALC882_FIXUP_GPIO1,
1843 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001844 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001845 ALC889_FIXUP_COEF,
1846 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001847 ALC882_FIXUP_ACER_ASPIRE_4930G,
1848 ALC882_FIXUP_ACER_ASPIRE_8930G,
1849 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001850 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001851 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001852 ALC889_FIXUP_MBP_VREF,
1853 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001854 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001855 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001856 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001857 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001858 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001859 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001860 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001861 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001862 ALC1220_FIXUP_GB_DUAL_CODECS,
Peisen0202f5c2017-10-26 10:35:36 +08001863 ALC1220_FIXUP_CLEVO_P950,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001864};
1865
Takashi Iwai68ef0562011-11-09 18:24:44 +01001866static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001867 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001868{
Takashi Iwai1727a772013-01-10 09:52:52 +01001869 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001870 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001871 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001872}
1873
Takashi Iwai56710872011-11-14 17:42:11 +01001874/* set up GPIO at initialization */
1875static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001876 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001877{
Takashi Iwai215c8502018-06-19 22:34:26 +02001878 struct alc_spec *spec = codec->spec;
1879
1880 spec->gpio_write_delay = true;
1881 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001882}
1883
Takashi Iwai02a237b2012-02-13 15:25:07 +01001884/* Fix the connection of some pins for ALC889:
1885 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1886 * work correctly (bko#42740)
1887 */
1888static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001889 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001890{
Takashi Iwai1727a772013-01-10 09:52:52 +01001891 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001892 /* fake the connections during parsing the tree */
Takashi Iwai02a237b2012-02-13 15:25:07 +01001893 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1894 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1895 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1896 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1897 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1898 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001899 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001900 /* restore the connections */
1901 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1902 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1903 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1904 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1905 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001906 }
1907}
1908
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001909/* Set VREF on HP pin */
1910static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001911 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001912{
1913 struct alc_spec *spec = codec->spec;
Mario Kleiner9f660a12015-12-22 00:45:43 +01001914 static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001915 int i;
1916
Takashi Iwai1727a772013-01-10 09:52:52 +01001917 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001918 return;
1919 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1920 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1921 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1922 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001923 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001924 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001925 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01001926 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001927 break;
1928 }
1929}
1930
Takashi Iwai0756f092013-12-04 13:59:45 +01001931static void alc889_fixup_mac_pins(struct hda_codec *codec,
1932 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001933{
1934 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001935 int i;
1936
Takashi Iwai0756f092013-12-04 13:59:45 +01001937 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001938 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001939 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001940 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001941 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001942 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01001943 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001944}
1945
Takashi Iwai0756f092013-12-04 13:59:45 +01001946/* Set VREF on speaker pins on imac91 */
1947static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1948 const struct hda_fixup *fix, int action)
1949{
1950 static hda_nid_t nids[2] = { 0x18, 0x1a };
1951
1952 if (action == HDA_FIXUP_ACT_INIT)
1953 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1954}
1955
Adrien Vergée7729a42014-01-24 14:56:14 -05001956/* Set VREF on speaker pins on mba11 */
1957static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1958 const struct hda_fixup *fix, int action)
1959{
1960 static hda_nid_t nids[1] = { 0x18 };
1961
1962 if (action == HDA_FIXUP_ACT_INIT)
1963 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1964}
1965
Takashi Iwai0756f092013-12-04 13:59:45 +01001966/* Set VREF on speaker pins on mba21 */
1967static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1968 const struct hda_fixup *fix, int action)
1969{
1970 static hda_nid_t nids[2] = { 0x18, 0x19 };
1971
1972 if (action == HDA_FIXUP_ACT_INIT)
1973 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1974}
1975
Takashi Iwaie427c232012-07-29 10:04:08 +02001976/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09001977 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1978 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02001979 */
1980static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001981 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02001982{
1983 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02001984 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01001985 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02001986 spec->gen.no_multi_io = 1;
1987 }
Takashi Iwaie427c232012-07-29 10:04:08 +02001988}
1989
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001990static void alc_fixup_bass_chmap(struct hda_codec *codec,
1991 const struct hda_fixup *fix, int action);
1992
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001993/* For dual-codec configuration, we need to disable some features to avoid
1994 * conflicts of kctls and PCM streams
1995 */
1996static void alc_fixup_dual_codecs(struct hda_codec *codec,
1997 const struct hda_fixup *fix, int action)
1998{
1999 struct alc_spec *spec = codec->spec;
2000
2001 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2002 return;
2003 /* disable vmaster */
2004 spec->gen.suppress_vmaster = 1;
2005 /* auto-mute and auto-mic switch don't work with multiple codecs */
2006 spec->gen.suppress_auto_mute = 1;
2007 spec->gen.suppress_auto_mic = 1;
2008 /* disable aamix as well */
2009 spec->gen.mixer_nid = 0;
2010 /* add location prefix to avoid conflicts */
2011 codec->force_pin_prefix = 1;
2012}
2013
2014static void rename_ctl(struct hda_codec *codec, const char *oldname,
2015 const char *newname)
2016{
2017 struct snd_kcontrol *kctl;
2018
2019 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2020 if (kctl)
2021 strcpy(kctl->id.name, newname);
2022}
2023
2024static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2025 const struct hda_fixup *fix,
2026 int action)
2027{
2028 alc_fixup_dual_codecs(codec, fix, action);
2029 switch (action) {
2030 case HDA_FIXUP_ACT_PRE_PROBE:
2031 /* override card longname to provide a unique UCM profile */
2032 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2033 break;
2034 case HDA_FIXUP_ACT_BUILD:
2035 /* rename Capture controls depending on the codec */
2036 rename_ctl(codec, "Capture Volume",
2037 codec->addr == 0 ?
2038 "Rear-Panel Capture Volume" :
2039 "Front-Panel Capture Volume");
2040 rename_ctl(codec, "Capture Switch",
2041 codec->addr == 0 ?
2042 "Rear-Panel Capture Switch" :
2043 "Front-Panel Capture Switch");
2044 break;
2045 }
2046}
2047
Peisen0202f5c2017-10-26 10:35:36 +08002048static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2049 const struct hda_fixup *fix,
2050 int action)
2051{
2052 hda_nid_t conn1[1] = { 0x0c };
2053
2054 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2055 return;
2056
2057 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2058 /* We therefore want to make sure 0x14 (front headphone) and
2059 * 0x1b (speakers) use the stereo DAC 0x02
2060 */
2061 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
2062 snd_hda_override_conn_list(codec, 0x1b, 1, conn1);
2063}
2064
Takashi Iwai1727a772013-01-10 09:52:52 +01002065static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002066 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002067 .type = HDA_FIXUP_PINS,
2068 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002069 { 0x15, 0x01080104 }, /* side */
2070 { 0x16, 0x01011012 }, /* rear */
2071 { 0x17, 0x01016011 }, /* clfe */
2072 { }
2073 }
2074 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002075 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002076 .type = HDA_FIXUP_PINS,
2077 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002078 { 0x15, 0x99130112 }, /* rear int speakers */
2079 { 0x16, 0x99130111 }, /* subwoofer */
2080 { }
2081 }
2082 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002083 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002084 .type = HDA_FIXUP_PINCTLS,
2085 .v.pins = (const struct hda_pintbl[]) {
2086 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002087 {}
2088 }
2089 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002090 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002091 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002092 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002093 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002094 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002095 .type = HDA_FIXUP_PINS,
2096 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002097 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2098 { }
2099 }
2100 },
Marton Balint8f239212012-03-05 21:33:23 +01002101 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002102 .type = HDA_FIXUP_PINS,
2103 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002104 { 0x1c, 0x993301f0 }, /* CD */
2105 { }
2106 }
2107 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002108 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2109 .type = HDA_FIXUP_PINS,
2110 .v.pins = (const struct hda_pintbl[]) {
2111 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2112 { }
2113 },
2114 .chained = true,
2115 .chain_id = ALC889_FIXUP_CD,
2116 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002117 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002118 .type = HDA_FIXUP_PINS,
2119 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002120 { 0x17, 0x90170111 }, /* hidden surround speaker */
2121 { }
2122 }
2123 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002124 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002125 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002126 .v.verbs = (const struct hda_verb[]) {
2127 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2128 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2129 { }
2130 }
Takashi Iwai177943a2011-11-09 12:55:18 +01002131 },
2132 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002133 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a2011-11-09 12:55:18 +01002134 .v.verbs = (const struct hda_verb[]) {
2135 /* change to EAPD mode */
2136 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2137 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2138 { }
2139 }
2140 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002141 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002142 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002143 .v.verbs = (const struct hda_verb[]) {
2144 /* change to EAPD mode */
2145 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2146 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2147 { }
2148 }
2149 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002150 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002151 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002152 .v.verbs = (const struct hda_verb[]) {
2153 /* eanable EAPD on Acer laptops */
2154 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2155 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2156 { }
2157 }
2158 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002159 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002160 .type = HDA_FIXUP_FUNC,
2161 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002162 },
2163 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002164 .type = HDA_FIXUP_FUNC,
2165 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002166 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002167 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002168 .type = HDA_FIXUP_FUNC,
2169 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002170 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002171 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002172 .type = HDA_FIXUP_FUNC,
2173 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002174 .chained = true,
2175 .chain_id = ALC882_FIXUP_EAPD,
2176 },
2177 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002178 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002179 .v.func = alc889_fixup_coef,
2180 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002181 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002182 .type = HDA_FIXUP_PINS,
2183 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002184 { 0x16, 0x99130111 }, /* CLFE speaker */
2185 { 0x17, 0x99130112 }, /* surround speaker */
2186 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002187 },
2188 .chained = true,
2189 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002190 },
2191 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002192 .type = HDA_FIXUP_PINS,
2193 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002194 { 0x16, 0x99130111 }, /* CLFE speaker */
2195 { 0x1b, 0x99130112 }, /* surround speaker */
2196 { }
2197 },
2198 .chained = true,
2199 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2200 },
2201 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2202 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002203 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002204 .v.verbs = (const struct hda_verb[]) {
2205 /* Enable all DACs */
2206 /* DAC DISABLE/MUTE 1? */
2207 /* setting bits 1-5 disables DAC nids 0x02-0x06
2208 * apparently. Init=0x38 */
2209 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2210 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2211 /* DAC DISABLE/MUTE 2? */
2212 /* some bit here disables the other DACs.
2213 * Init=0x4900 */
2214 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2215 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2216 /* DMIC fix
2217 * This laptop has a stereo digital microphone.
2218 * The mics are only 1cm apart which makes the stereo
2219 * useless. However, either the mic or the ALC889
2220 * makes the signal become a difference/sum signal
2221 * instead of standard stereo, which is annoying.
2222 * So instead we flip this bit which makes the
2223 * codec replicate the sum signal to both channels,
2224 * turning it into a normal mono mic.
2225 */
2226 /* DMIC_CONTROL? Init value = 0x0001 */
2227 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2228 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2229 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2230 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2231 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002232 },
2233 .chained = true,
2234 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002235 },
Takashi Iwai56710872011-11-14 17:42:11 +01002236 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002237 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002238 .v.func = alc885_fixup_macpro_gpio,
2239 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002240 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002241 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002242 .v.func = alc889_fixup_dac_route,
2243 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002244 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002245 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002246 .v.func = alc889_fixup_mbp_vref,
2247 .chained = true,
2248 .chain_id = ALC882_FIXUP_GPIO1,
2249 },
2250 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002251 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002252 .v.func = alc889_fixup_imac91_vref,
2253 .chained = true,
2254 .chain_id = ALC882_FIXUP_GPIO1,
2255 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002256 [ALC889_FIXUP_MBA11_VREF] = {
2257 .type = HDA_FIXUP_FUNC,
2258 .v.func = alc889_fixup_mba11_vref,
2259 .chained = true,
2260 .chain_id = ALC889_FIXUP_MBP_VREF,
2261 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002262 [ALC889_FIXUP_MBA21_VREF] = {
2263 .type = HDA_FIXUP_FUNC,
2264 .v.func = alc889_fixup_mba21_vref,
2265 .chained = true,
2266 .chain_id = ALC889_FIXUP_MBP_VREF,
2267 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002268 [ALC889_FIXUP_MP11_VREF] = {
2269 .type = HDA_FIXUP_FUNC,
2270 .v.func = alc889_fixup_mba11_vref,
2271 .chained = true,
2272 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2273 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002274 [ALC889_FIXUP_MP41_VREF] = {
2275 .type = HDA_FIXUP_FUNC,
2276 .v.func = alc889_fixup_mbp_vref,
2277 .chained = true,
2278 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2279 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002280 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002281 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002282 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002283 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002284 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002285 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002286 .v.func = alc882_fixup_no_primary_hp,
2287 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002288 [ALC887_FIXUP_ASUS_BASS] = {
2289 .type = HDA_FIXUP_PINS,
2290 .v.pins = (const struct hda_pintbl[]) {
2291 {0x16, 0x99130130}, /* bass speaker */
2292 {}
2293 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002294 .chained = true,
2295 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2296 },
2297 [ALC887_FIXUP_BASS_CHMAP] = {
2298 .type = HDA_FIXUP_FUNC,
2299 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002300 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002301 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2302 .type = HDA_FIXUP_FUNC,
2303 .v.func = alc1220_fixup_gb_dual_codecs,
2304 },
Peisen0202f5c2017-10-26 10:35:36 +08002305 [ALC1220_FIXUP_CLEVO_P950] = {
2306 .type = HDA_FIXUP_FUNC,
2307 .v.func = alc1220_fixup_clevo_p950,
2308 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002309};
2310
2311static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002312 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2313 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002314 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002315 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2316 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2317 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2318 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002319 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2320 ALC882_FIXUP_ACER_ASPIRE_4930G),
2321 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2322 ALC882_FIXUP_ACER_ASPIRE_4930G),
2323 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2324 ALC882_FIXUP_ACER_ASPIRE_8930G),
2325 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2326 ALC882_FIXUP_ACER_ASPIRE_8930G),
2327 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2328 ALC882_FIXUP_ACER_ASPIRE_4930G),
2329 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2330 ALC882_FIXUP_ACER_ASPIRE_4930G),
2331 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2332 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002333 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002334 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2335 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002336 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002337 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002338 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a2011-11-09 12:55:18 +01002339 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002340 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002341 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002342 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002343 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002344 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002345 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002346 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002347 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Fernando Luis Vázquez Cao12e31a72013-02-12 16:47:44 +09002348 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaic44d9b12016-02-07 09:38:26 +01002349 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002350
2351 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002352 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2353 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2354 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002355 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002356 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2357 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002358 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2359 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002360 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002361 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002362 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002363 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2364 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002365 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002366 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2367 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2368 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002369 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002370 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002371 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2372 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002373 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002374
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002375 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002376 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002377 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002378 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai63691582017-05-22 16:32:46 +02002379 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002380 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002381 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
Peisen0202f5c2017-10-26 10:35:36 +08002382 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
Jeremy Soller2f0d5202018-05-07 09:28:45 -06002383 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002384 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2385 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002386 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002387 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002388 {}
2389};
2390
Takashi Iwai1727a772013-01-10 09:52:52 +01002391static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai912093b2012-04-11 14:03:41 +02002392 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2393 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2394 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002395 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002396 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002397 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002398 {}
2399};
2400
Takashi Iwai1d045db2011-07-07 18:23:21 +02002401/*
2402 * BIOS auto configuration
2403 */
2404/* almost identical with ALC880 parser... */
2405static int alc882_parse_auto_config(struct hda_codec *codec)
2406{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002407 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002408 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2409 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002410}
2411
Takashi Iwai1d045db2011-07-07 18:23:21 +02002412/*
2413 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002414static int patch_alc882(struct hda_codec *codec)
2415{
2416 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002417 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002418
Takashi Iwai3de95172012-05-07 18:03:15 +02002419 err = alc_alloc_spec(codec, 0x0b);
2420 if (err < 0)
2421 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002422
Takashi Iwai3de95172012-05-07 18:03:15 +02002423 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002424
Takashi Iwai7639a062015-03-03 10:07:24 +01002425 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002426 case 0x10ec0882:
2427 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002428 case 0x10ec0900:
Kailang Yanga535ad52017-01-16 16:59:26 +08002429 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002430 break;
2431 default:
2432 /* ALC883 and variants */
2433 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2434 break;
2435 }
2436
Takashi Iwai1727a772013-01-10 09:52:52 +01002437 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002438 alc882_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002439 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002440
2441 alc_auto_parse_customize_define(codec);
2442
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002443 if (has_cdefine_beep(codec))
2444 spec->gen.beep_nid = 0x01;
2445
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002446 /* automatic parse from the BIOS config */
2447 err = alc882_parse_auto_config(codec);
2448 if (err < 0)
2449 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002450
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002451 if (!spec->gen.no_analog && spec->gen.beep_nid)
Takashi Iwai1d045db2011-07-07 18:23:21 +02002452 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2453
Takashi Iwai1727a772013-01-10 09:52:52 +01002454 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002455
Takashi Iwai1d045db2011-07-07 18:23:21 +02002456 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002457
2458 error:
2459 alc_free(codec);
2460 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002461}
2462
2463
2464/*
2465 * ALC262 support
2466 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002467static int alc262_parse_auto_config(struct hda_codec *codec)
2468{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002469 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002470 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2471 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002472}
2473
2474/*
2475 * Pin config fixes
2476 */
2477enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002478 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002479 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002480 ALC262_FIXUP_HP_Z200,
2481 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002482 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002483 ALC262_FIXUP_BENQ,
2484 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002485 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002486 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002487};
2488
Takashi Iwai1727a772013-01-10 09:52:52 +01002489static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002490 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002491 .type = HDA_FIXUP_PINS,
2492 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002493 { 0x14, 0x99130110 }, /* speaker */
2494 { 0x15, 0x0221142f }, /* front HP */
2495 { 0x1b, 0x0121141f }, /* rear HP */
2496 { }
2497 }
2498 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002499 [ALC262_FIXUP_FSC_S7110] = {
2500 .type = HDA_FIXUP_PINS,
2501 .v.pins = (const struct hda_pintbl[]) {
2502 { 0x15, 0x90170110 }, /* speaker */
2503 { }
2504 },
2505 .chained = true,
2506 .chain_id = ALC262_FIXUP_BENQ,
2507 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002508 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002509 .type = HDA_FIXUP_PINS,
2510 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002511 { 0x16, 0x99130120 }, /* internal speaker */
2512 { }
2513 }
2514 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002515 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002516 .type = HDA_FIXUP_PINS,
2517 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002518 { 0x14, 0x1993e1f0 }, /* int AUX */
2519 { }
2520 }
2521 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002522 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002523 .type = HDA_FIXUP_PINCTLS,
2524 .v.pins = (const struct hda_pintbl[]) {
2525 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002526 {}
2527 },
2528 .chained = true,
2529 .chain_id = ALC262_FIXUP_BENQ,
2530 },
2531 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002532 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002533 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002534 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2535 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2536 {}
2537 }
2538 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002539 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002540 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002541 .v.verbs = (const struct hda_verb[]) {
2542 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2543 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2544 {}
2545 }
2546 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002547 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002548 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002549 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002550 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002551 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2552 .type = HDA_FIXUP_FUNC,
2553 .v.func = alc_fixup_no_depop_delay,
2554 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002555};
2556
2557static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002558 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002559 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002560 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002561 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2562 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002563 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002564 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2565 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002566 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002567 {}
2568};
2569
Takashi Iwai1727a772013-01-10 09:52:52 +01002570static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002571 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2572 {}
2573};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002574
Takashi Iwai1d045db2011-07-07 18:23:21 +02002575/*
2576 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002577static int patch_alc262(struct hda_codec *codec)
2578{
2579 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002580 int err;
2581
Takashi Iwai3de95172012-05-07 18:03:15 +02002582 err = alc_alloc_spec(codec, 0x0b);
2583 if (err < 0)
2584 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002585
Takashi Iwai3de95172012-05-07 18:03:15 +02002586 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002587 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002588
Takashi Iwai225068a2015-05-29 10:42:14 +02002589 spec->shutup = alc_eapd_shutup;
2590
Takashi Iwai1d045db2011-07-07 18:23:21 +02002591#if 0
2592 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2593 * under-run
2594 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002595 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002596#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002597 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2598
Takashi Iwai1727a772013-01-10 09:52:52 +01002599 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002600 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002601 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002602
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002603 alc_auto_parse_customize_define(codec);
2604
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002605 if (has_cdefine_beep(codec))
2606 spec->gen.beep_nid = 0x01;
2607
Takashi Iwai42399f72011-11-07 17:18:44 +01002608 /* automatic parse from the BIOS config */
2609 err = alc262_parse_auto_config(codec);
2610 if (err < 0)
2611 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002612
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002613 if (!spec->gen.no_analog && spec->gen.beep_nid)
Takashi Iwai1d045db2011-07-07 18:23:21 +02002614 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2615
Takashi Iwai1727a772013-01-10 09:52:52 +01002616 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002617
Takashi Iwai1d045db2011-07-07 18:23:21 +02002618 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002619
2620 error:
2621 alc_free(codec);
2622 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002623}
2624
2625/*
2626 * ALC268
2627 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002628/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002629static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2630 struct snd_ctl_elem_value *ucontrol)
2631{
2632 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2633 unsigned long pval;
2634 int err;
2635
2636 mutex_lock(&codec->control_mutex);
2637 pval = kcontrol->private_value;
2638 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2639 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2640 if (err >= 0) {
2641 kcontrol->private_value = (pval & ~0xff) | 0x10;
2642 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2643 }
2644 kcontrol->private_value = pval;
2645 mutex_unlock(&codec->control_mutex);
2646 return err;
2647}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002648
2649static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2650 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002651 {
2652 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2653 .name = "Beep Playback Switch",
2654 .subdevice = HDA_SUBDEV_AMP_FLAG,
2655 .info = snd_hda_mixer_amp_switch_info,
2656 .get = snd_hda_mixer_amp_switch_get,
2657 .put = alc268_beep_switch_put,
2658 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2659 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002660 { }
2661};
2662
2663/* set PCBEEP vol = 0, mute connections */
2664static const struct hda_verb alc268_beep_init_verbs[] = {
2665 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2666 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2667 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2668 { }
2669};
2670
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002671enum {
2672 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002673 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002674 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002675};
2676
Takashi Iwai1727a772013-01-10 09:52:52 +01002677static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002678 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002679 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002680 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002681 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002682 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002683 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002684 .v.verbs = (const struct hda_verb[]) {
2685 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2686 {}
2687 }
2688 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002689 [ALC268_FIXUP_SPDIF] = {
2690 .type = HDA_FIXUP_PINS,
2691 .v.pins = (const struct hda_pintbl[]) {
2692 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2693 {}
2694 }
2695 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002696};
2697
Takashi Iwai1727a772013-01-10 09:52:52 +01002698static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002699 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002700 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2701 {}
2702};
2703
2704static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002705 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002706 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002707 /* below is codec SSID since multiple Toshiba laptops have the
2708 * same PCI SSID 1179:ff00
2709 */
2710 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002711 {}
2712};
2713
Takashi Iwai1d045db2011-07-07 18:23:21 +02002714/*
2715 * BIOS auto configuration
2716 */
2717static int alc268_parse_auto_config(struct hda_codec *codec)
2718{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002719 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002720 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002721}
2722
Takashi Iwai1d045db2011-07-07 18:23:21 +02002723/*
2724 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002725static int patch_alc268(struct hda_codec *codec)
2726{
2727 struct alc_spec *spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002728 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002729
Takashi Iwai1d045db2011-07-07 18:23:21 +02002730 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002731 err = alc_alloc_spec(codec, 0);
2732 if (err < 0)
2733 return err;
2734
2735 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002736 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002737
Takashi Iwai225068a2015-05-29 10:42:14 +02002738 spec->shutup = alc_eapd_shutup;
2739
Takashi Iwai1727a772013-01-10 09:52:52 +01002740 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2741 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002742
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002743 /* automatic parse from the BIOS config */
2744 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002745 if (err < 0)
2746 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002747
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002748 if (err > 0 && !spec->gen.no_analog &&
2749 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2750 add_mixer(spec, alc268_beep_mixer);
2751 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002752 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2753 /* override the amp caps for beep generator */
2754 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2755 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2756 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2757 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2758 (0 << AC_AMPCAP_MUTE_SHIFT));
2759 }
2760
Takashi Iwai1727a772013-01-10 09:52:52 +01002761 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002762
Takashi Iwai1d045db2011-07-07 18:23:21 +02002763 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002764
2765 error:
2766 alc_free(codec);
2767 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002768}
2769
2770/*
2771 * ALC269
2772 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01002773
Takashi Iwai1d045db2011-07-07 18:23:21 +02002774static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002775 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002776};
2777
2778static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002779 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002780};
2781
Takashi Iwai1d045db2011-07-07 18:23:21 +02002782/* different alc269-variants */
2783enum {
2784 ALC269_TYPE_ALC269VA,
2785 ALC269_TYPE_ALC269VB,
2786 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02002787 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01002788 ALC269_TYPE_ALC280,
2789 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02002790 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01002791 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08002792 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02002793 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08002794 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02002795 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08002796 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08002797 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08002798 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08002799 ALC269_TYPE_ALC225,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08002800 ALC269_TYPE_ALC294,
Kailang Yang6fbae352016-05-30 16:44:20 +08002801 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002802};
2803
2804/*
2805 * BIOS auto configuration
2806 */
2807static int alc269_parse_auto_config(struct hda_codec *codec)
2808{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002809 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002810 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2811 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2812 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02002813 const hda_nid_t *ssids;
2814
2815 switch (spec->codec_variant) {
2816 case ALC269_TYPE_ALC269VA:
2817 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01002818 case ALC269_TYPE_ALC280:
2819 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08002820 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02002821 ssids = alc269va_ssids;
2822 break;
2823 case ALC269_TYPE_ALC269VB:
2824 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01002825 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02002826 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02002827 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08002828 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02002829 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08002830 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08002831 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08002832 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08002833 case ALC269_TYPE_ALC225:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08002834 case ALC269_TYPE_ALC294:
Kailang Yang6fbae352016-05-30 16:44:20 +08002835 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02002836 ssids = alc269_ssids;
2837 break;
2838 default:
2839 ssids = alc269_ssids;
2840 break;
2841 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002842
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002843 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002844}
2845
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002846static int find_ext_mic_pin(struct hda_codec *codec);
2847
2848static void alc286_shutup(struct hda_codec *codec)
2849{
Takashi Iwaia9c2dfc2018-04-23 17:24:56 +02002850 const struct hda_pincfg *pin;
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002851 int i;
2852 int mic_pin = find_ext_mic_pin(codec);
2853 /* don't shut up pins when unloading the driver; otherwise it breaks
2854 * the default pin setup at the next load of the driver
2855 */
2856 if (codec->bus->shutdown)
2857 return;
Takashi Iwaia9c2dfc2018-04-23 17:24:56 +02002858 snd_array_for_each(&codec->init_pins, i, pin) {
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002859 /* use read here for syncing after issuing each verb */
2860 if (pin->nid != mic_pin)
2861 snd_hda_codec_read(codec, pin->nid, 0,
2862 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2863 }
2864 codec->pins_shutup = 1;
2865}
2866
Kailang Yang1387e2d2012-11-08 10:23:18 +01002867static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02002868{
Takashi Iwai98b24882014-08-18 13:47:50 +02002869 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002870}
2871
2872static void alc269_shutup(struct hda_codec *codec)
2873{
Kailang Yangadcc70b2012-05-25 08:08:38 +02002874 struct alc_spec *spec = codec->spec;
2875
Kailang Yang1387e2d2012-11-08 10:23:18 +01002876 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2877 alc269vb_toggle_power_output(codec, 0);
2878 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2879 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002880 msleep(150);
2881 }
Takashi Iwai9bfb2842013-07-24 14:31:50 +02002882 snd_hda_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002883}
2884
Takashi Iwai54db6c32014-08-18 15:11:19 +02002885static struct coef_fw alc282_coefs[] = {
2886 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08002887 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02002888 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2889 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2890 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2891 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2892 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2893 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2894 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2895 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2896 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2897 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2898 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2899 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2900 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2901 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2902 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2903 WRITE_COEF(0x63, 0x2902), /* PLL */
2904 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2905 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2906 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2907 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2908 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2909 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2910 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2911 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2912 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2913 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2914 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2915 {}
2916};
2917
Kailang Yangcb149cb2014-03-18 16:45:32 +08002918static void alc282_restore_default_value(struct hda_codec *codec)
2919{
Takashi Iwai54db6c32014-08-18 15:11:19 +02002920 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08002921}
2922
Kailang Yang7b5c7a02014-03-18 16:15:54 +08002923static void alc282_init(struct hda_codec *codec)
2924{
2925 struct alc_spec *spec = codec->spec;
2926 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2927 bool hp_pin_sense;
2928 int coef78;
2929
Kailang Yangcb149cb2014-03-18 16:45:32 +08002930 alc282_restore_default_value(codec);
2931
Kailang Yang7b5c7a02014-03-18 16:15:54 +08002932 if (!hp_pin)
2933 return;
2934 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2935 coef78 = alc_read_coef_idx(codec, 0x78);
2936
2937 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2938 /* Headphone capless set to high power mode */
2939 alc_write_coef_idx(codec, 0x78, 0x9004);
2940
2941 if (hp_pin_sense)
2942 msleep(2);
2943
2944 snd_hda_codec_write(codec, hp_pin, 0,
2945 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2946
2947 if (hp_pin_sense)
2948 msleep(85);
2949
2950 snd_hda_codec_write(codec, hp_pin, 0,
2951 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2952
2953 if (hp_pin_sense)
2954 msleep(100);
2955
2956 /* Headphone capless set to normal mode */
2957 alc_write_coef_idx(codec, 0x78, coef78);
2958}
2959
2960static void alc282_shutup(struct hda_codec *codec)
2961{
2962 struct alc_spec *spec = codec->spec;
2963 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2964 bool hp_pin_sense;
2965 int coef78;
2966
2967 if (!hp_pin) {
2968 alc269_shutup(codec);
2969 return;
2970 }
2971
2972 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2973 coef78 = alc_read_coef_idx(codec, 0x78);
2974 alc_write_coef_idx(codec, 0x78, 0x9004);
2975
2976 if (hp_pin_sense)
2977 msleep(2);
2978
2979 snd_hda_codec_write(codec, hp_pin, 0,
2980 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2981
2982 if (hp_pin_sense)
2983 msleep(85);
2984
2985 snd_hda_codec_write(codec, hp_pin, 0,
2986 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2987
2988 if (hp_pin_sense)
2989 msleep(100);
2990
2991 alc_auto_setup_eapd(codec, false);
2992 snd_hda_shutup_pins(codec);
2993 alc_write_coef_idx(codec, 0x78, coef78);
2994}
2995
Takashi Iwai54db6c32014-08-18 15:11:19 +02002996static struct coef_fw alc283_coefs[] = {
2997 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08002998 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02002999 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3000 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3001 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3002 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3003 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3004 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3005 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3006 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3007 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3008 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3009 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3010 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3011 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3012 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3013 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3014 WRITE_COEF(0x2e, 0x2902), /* PLL */
3015 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3016 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3017 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3018 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3019 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3020 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3021 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3022 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3023 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3024 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3025 WRITE_COEF(0x49, 0x0), /* test mode */
3026 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3027 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3028 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003029 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003030 {}
3031};
3032
Kailang Yang6bd55b02014-03-17 13:51:27 +08003033static void alc283_restore_default_value(struct hda_codec *codec)
3034{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003035 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003036}
3037
Kailang Yang2af02be2013-08-22 10:03:50 +02003038static void alc283_init(struct hda_codec *codec)
3039{
3040 struct alc_spec *spec = codec->spec;
3041 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3042 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003043
Kailang Yang8314f222014-04-03 17:28:39 +08003044 if (!spec->gen.autocfg.hp_outs) {
3045 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3046 hp_pin = spec->gen.autocfg.line_out_pins[0];
3047 }
3048
Kailang Yang6bd55b02014-03-17 13:51:27 +08003049 alc283_restore_default_value(codec);
3050
Kailang Yang2af02be2013-08-22 10:03:50 +02003051 if (!hp_pin)
3052 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003053
3054 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003055 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3056
3057 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3058 /* Headphone capless set to high power mode */
3059 alc_write_coef_idx(codec, 0x43, 0x9004);
3060
3061 snd_hda_codec_write(codec, hp_pin, 0,
3062 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3063
3064 if (hp_pin_sense)
3065 msleep(85);
3066
3067 snd_hda_codec_write(codec, hp_pin, 0,
3068 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3069
3070 if (hp_pin_sense)
3071 msleep(85);
3072 /* Index 0x46 Combo jack auto switch control 2 */
3073 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003074 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003075 /* Headphone capless set to normal mode */
3076 alc_write_coef_idx(codec, 0x43, 0x9614);
3077}
3078
3079static void alc283_shutup(struct hda_codec *codec)
3080{
3081 struct alc_spec *spec = codec->spec;
3082 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3083 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003084
Kailang Yang8314f222014-04-03 17:28:39 +08003085 if (!spec->gen.autocfg.hp_outs) {
3086 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
3087 hp_pin = spec->gen.autocfg.line_out_pins[0];
3088 }
3089
Kailang Yang2af02be2013-08-22 10:03:50 +02003090 if (!hp_pin) {
3091 alc269_shutup(codec);
3092 return;
3093 }
3094
3095 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3096
3097 alc_write_coef_idx(codec, 0x43, 0x9004);
3098
Harsha Priyab450b172014-10-09 11:04:56 +00003099 /*depop hp during suspend*/
3100 alc_write_coef_idx(codec, 0x06, 0x2100);
3101
Kailang Yang2af02be2013-08-22 10:03:50 +02003102 snd_hda_codec_write(codec, hp_pin, 0,
3103 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3104
3105 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003106 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003107
3108 snd_hda_codec_write(codec, hp_pin, 0,
3109 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3110
Takashi Iwai98b24882014-08-18 13:47:50 +02003111 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003112
3113 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003114 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003115 alc_auto_setup_eapd(codec, false);
Kailang Yang2af02be2013-08-22 10:03:50 +02003116 snd_hda_shutup_pins(codec);
3117 alc_write_coef_idx(codec, 0x43, 0x9614);
3118}
3119
Kailang Yang4a219ef2017-06-16 16:54:35 +08003120static void alc256_init(struct hda_codec *codec)
3121{
3122 struct alc_spec *spec = codec->spec;
3123 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3124 bool hp_pin_sense;
3125
3126 if (!hp_pin)
3127 return;
3128
3129 msleep(30);
3130
3131 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3132
3133 if (hp_pin_sense)
3134 msleep(2);
3135
3136 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3137
3138 snd_hda_codec_write(codec, hp_pin, 0,
3139 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3140
3141 if (hp_pin_sense)
3142 msleep(85);
3143
3144 snd_hda_codec_write(codec, hp_pin, 0,
3145 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3146
3147 if (hp_pin_sense)
3148 msleep(100);
3149
3150 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3151 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003152 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3153 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003154}
3155
3156static void alc256_shutup(struct hda_codec *codec)
3157{
3158 struct alc_spec *spec = codec->spec;
3159 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3160 bool hp_pin_sense;
3161
3162 if (!hp_pin) {
3163 alc269_shutup(codec);
3164 return;
3165 }
3166
3167 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3168
3169 if (hp_pin_sense)
3170 msleep(2);
3171
3172 snd_hda_codec_write(codec, hp_pin, 0,
3173 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3174
3175 if (hp_pin_sense)
3176 msleep(85);
3177
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003178 /* 3k pull low control for Headset jack. */
3179 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3180 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3181
Kailang Yang4a219ef2017-06-16 16:54:35 +08003182 snd_hda_codec_write(codec, hp_pin, 0,
3183 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3184
Kailang Yang4a219ef2017-06-16 16:54:35 +08003185 if (hp_pin_sense)
3186 msleep(100);
3187
3188 alc_auto_setup_eapd(codec, false);
3189 snd_hda_shutup_pins(codec);
3190}
3191
Kailang Yangda911b12018-01-05 16:50:08 +08003192static void alc225_init(struct hda_codec *codec)
3193{
3194 struct alc_spec *spec = codec->spec;
3195 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3196 bool hp1_pin_sense, hp2_pin_sense;
3197
3198 if (!hp_pin)
3199 return;
3200
3201 msleep(30);
3202
3203 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3204 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3205
3206 if (hp1_pin_sense || hp2_pin_sense)
3207 msleep(2);
3208
3209 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3210
3211 if (hp1_pin_sense)
3212 snd_hda_codec_write(codec, hp_pin, 0,
3213 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3214 if (hp2_pin_sense)
3215 snd_hda_codec_write(codec, 0x16, 0,
3216 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3217
3218 if (hp1_pin_sense || hp2_pin_sense)
3219 msleep(85);
3220
3221 if (hp1_pin_sense)
3222 snd_hda_codec_write(codec, hp_pin, 0,
3223 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3224 if (hp2_pin_sense)
3225 snd_hda_codec_write(codec, 0x16, 0,
3226 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3227
3228 if (hp1_pin_sense || hp2_pin_sense)
3229 msleep(100);
3230
3231 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3232 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3233}
3234
3235static void alc225_shutup(struct hda_codec *codec)
3236{
3237 struct alc_spec *spec = codec->spec;
3238 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3239 bool hp1_pin_sense, hp2_pin_sense;
3240
3241 if (!hp_pin) {
3242 alc269_shutup(codec);
3243 return;
3244 }
3245
3246 /* 3k pull low control for Headset jack. */
3247 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3248
3249 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3250 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3251
3252 if (hp1_pin_sense || hp2_pin_sense)
3253 msleep(2);
3254
3255 if (hp1_pin_sense)
3256 snd_hda_codec_write(codec, hp_pin, 0,
3257 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3258 if (hp2_pin_sense)
3259 snd_hda_codec_write(codec, 0x16, 0,
3260 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3261
3262 if (hp1_pin_sense || hp2_pin_sense)
3263 msleep(85);
3264
3265 if (hp1_pin_sense)
3266 snd_hda_codec_write(codec, hp_pin, 0,
3267 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3268 if (hp2_pin_sense)
3269 snd_hda_codec_write(codec, 0x16, 0,
3270 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3271
3272 if (hp1_pin_sense || hp2_pin_sense)
3273 msleep(100);
3274
3275 alc_auto_setup_eapd(codec, false);
3276 snd_hda_shutup_pins(codec);
3277}
3278
Kailang Yangc2d6af52017-06-21 14:50:54 +08003279static void alc_default_init(struct hda_codec *codec)
3280{
3281 struct alc_spec *spec = codec->spec;
3282 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3283 bool hp_pin_sense;
3284
3285 if (!hp_pin)
3286 return;
3287
3288 msleep(30);
3289
3290 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3291
3292 if (hp_pin_sense)
3293 msleep(2);
3294
3295 snd_hda_codec_write(codec, hp_pin, 0,
3296 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3297
3298 if (hp_pin_sense)
3299 msleep(85);
3300
3301 snd_hda_codec_write(codec, hp_pin, 0,
3302 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3303
3304 if (hp_pin_sense)
3305 msleep(100);
3306}
3307
3308static void alc_default_shutup(struct hda_codec *codec)
3309{
3310 struct alc_spec *spec = codec->spec;
3311 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3312 bool hp_pin_sense;
3313
3314 if (!hp_pin) {
3315 alc269_shutup(codec);
3316 return;
3317 }
3318
3319 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3320
3321 if (hp_pin_sense)
3322 msleep(2);
3323
3324 snd_hda_codec_write(codec, hp_pin, 0,
3325 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3326
3327 if (hp_pin_sense)
3328 msleep(85);
3329
3330 snd_hda_codec_write(codec, hp_pin, 0,
3331 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3332
3333 if (hp_pin_sense)
3334 msleep(100);
3335
3336 alc_auto_setup_eapd(codec, false);
3337 snd_hda_shutup_pins(codec);
3338}
3339
Kailang Yangad60d502013-06-28 12:03:01 +02003340static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3341 unsigned int val)
3342{
3343 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3344 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3345 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3346}
3347
3348static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3349{
3350 unsigned int val;
3351
3352 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3353 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3354 & 0xffff;
3355 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3356 << 16;
3357 return val;
3358}
3359
3360static void alc5505_dsp_halt(struct hda_codec *codec)
3361{
3362 unsigned int val;
3363
3364 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3365 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3366 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3367 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3368 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3369 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3370 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3371 val = alc5505_coef_get(codec, 0x6220);
3372 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3373}
3374
3375static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3376{
3377 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3378 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3379 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3380 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3381 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3382 alc5505_coef_set(codec, 0x880c, 0x00000004);
3383}
3384
3385static void alc5505_dsp_init(struct hda_codec *codec)
3386{
3387 unsigned int val;
3388
3389 alc5505_dsp_halt(codec);
3390 alc5505_dsp_back_from_halt(codec);
3391 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3392 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3393 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3394 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3395 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3396 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3397 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3398 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3399 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3400 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3401 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3402 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3403 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3404
3405 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3406 if (val <= 3)
3407 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3408 else
3409 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3410
3411 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3412 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3413 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3414 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3415 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3416 alc5505_coef_set(codec, 0x880c, 0x00000003);
3417 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003418
3419#ifdef HALT_REALTEK_ALC5505
3420 alc5505_dsp_halt(codec);
3421#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003422}
3423
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003424#ifdef HALT_REALTEK_ALC5505
3425#define alc5505_dsp_suspend(codec) /* NOP */
3426#define alc5505_dsp_resume(codec) /* NOP */
3427#else
3428#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3429#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3430#endif
3431
Takashi Iwai2a439522011-07-26 09:52:50 +02003432#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003433static int alc269_suspend(struct hda_codec *codec)
3434{
3435 struct alc_spec *spec = codec->spec;
3436
3437 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003438 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003439 return alc_suspend(codec);
3440}
3441
Takashi Iwai1d045db2011-07-07 18:23:21 +02003442static int alc269_resume(struct hda_codec *codec)
3443{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003444 struct alc_spec *spec = codec->spec;
3445
Kailang Yang1387e2d2012-11-08 10:23:18 +01003446 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3447 alc269vb_toggle_power_output(codec, 0);
3448 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003449 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003450 msleep(150);
3451 }
3452
3453 codec->patch_ops.init(codec);
3454
Kailang Yang1387e2d2012-11-08 10:23:18 +01003455 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3456 alc269vb_toggle_power_output(codec, 1);
3457 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003458 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003459 msleep(200);
3460 }
3461
Takashi Iwaieeecd9d2015-02-25 15:18:50 +01003462 regcache_sync(codec->core.regmap);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003463 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003464
3465 /* on some machine, the BIOS will clear the codec gpio data when enter
3466 * suspend, and won't restore the data after resume, so we restore it
3467 * in the driver.
3468 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02003469 if (spec->gpio_data)
3470 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08003471
Kailang Yangad60d502013-06-28 12:03:01 +02003472 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003473 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003474
Takashi Iwai1d045db2011-07-07 18:23:21 +02003475 return 0;
3476}
Takashi Iwai2a439522011-07-26 09:52:50 +02003477#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003478
David Henningsson108cc102012-07-20 10:37:25 +02003479static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003480 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003481{
3482 struct alc_spec *spec = codec->spec;
3483
Takashi Iwai1727a772013-01-10 09:52:52 +01003484 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003485 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3486}
3487
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01003488static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
3489 const struct hda_fixup *fix,
3490 int action)
3491{
3492 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
3493 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
3494
3495 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
3496 snd_hda_codec_set_pincfg(codec, 0x19,
3497 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
3498 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
3499}
3500
Takashi Iwai1d045db2011-07-07 18:23:21 +02003501static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003502 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003503{
Takashi Iwai98b24882014-08-18 13:47:50 +02003504 if (action == HDA_FIXUP_ACT_INIT)
3505 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003506}
3507
David Henningsson7c478f02013-10-11 10:18:46 +02003508static void alc269_fixup_headset_mic(struct hda_codec *codec,
3509 const struct hda_fixup *fix, int action)
3510{
3511 struct alc_spec *spec = codec->spec;
3512
3513 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3514 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3515}
3516
Takashi Iwai1d045db2011-07-07 18:23:21 +02003517static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003518 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003519{
3520 static const struct hda_verb verbs[] = {
3521 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3522 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3523 {}
3524 };
3525 unsigned int cfg;
3526
Takashi Iwai7639a062015-03-03 10:07:24 +01003527 if (strcmp(codec->core.chip_name, "ALC271X") &&
3528 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02003529 return;
3530 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3531 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3532 snd_hda_sequence_write(codec, verbs);
3533}
3534
Takashi Iwai017f2a12011-07-09 14:42:25 +02003535static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003536 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003537{
3538 struct alc_spec *spec = codec->spec;
3539
Takashi Iwai1727a772013-01-10 09:52:52 +01003540 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003541 return;
3542
3543 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3544 * fix the sample rate of analog I/O to 44.1kHz
3545 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003546 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3547 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02003548}
3549
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003550static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003551 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003552{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003553 /* The digital-mic unit sends PDM (differential signal) instead of
3554 * the standard PCM, thus you can't record a valid mono stream as is.
3555 * Below is a workaround specific to ALC269 to control the dmic
3556 * signal source as mono.
3557 */
Takashi Iwai98b24882014-08-18 13:47:50 +02003558 if (action == HDA_FIXUP_ACT_INIT)
3559 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003560}
3561
Takashi Iwai24519912011-08-16 15:08:49 +02003562static void alc269_quanta_automute(struct hda_codec *codec)
3563{
Takashi Iwai08c189f2012-12-19 15:22:24 +01003564 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02003565
Takashi Iwai1687ccc2014-08-18 13:49:35 +02003566 alc_write_coef_idx(codec, 0x0c, 0x680);
3567 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02003568}
3569
3570static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003571 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02003572{
3573 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01003574 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02003575 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01003576 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02003577}
3578
David Henningssond240d1d2013-04-15 12:50:02 +02003579static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02003580 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02003581{
3582 struct alc_spec *spec = codec->spec;
3583 int vref;
3584 msleep(200);
3585 snd_hda_gen_hp_automute(codec, jack);
3586
3587 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3588 msleep(100);
3589 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3590 vref);
3591 msleep(500);
3592 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3593 vref);
3594}
3595
3596static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3597 const struct hda_fixup *fix, int action)
3598{
3599 struct alc_spec *spec = codec->spec;
3600 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3601 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3602 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3603 }
3604}
3605
3606
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003607/* update mute-LED according to the speaker mute state via mic VREF pin */
3608static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003609{
3610 struct hda_codec *codec = private_data;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003611 struct alc_spec *spec = codec->spec;
3612 unsigned int pinval;
3613
3614 if (spec->mute_led_polarity)
3615 enabled = !enabled;
Takashi Iwai415d5552014-04-03 11:51:21 +02003616 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3617 pinval &= ~AC_PINCTL_VREFEN;
3618 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
Takashi Iwaie40bdb02018-03-17 22:40:18 +01003619 if (spec->mute_led_nid) {
3620 /* temporarily power up/down for setting VREF */
3621 snd_hda_power_up_pm(codec);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003622 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
Takashi Iwaie40bdb02018-03-17 22:40:18 +01003623 snd_hda_power_down_pm(codec);
3624 }
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003625}
3626
David Henningssond5b6b652013-11-06 10:50:44 +01003627/* Make sure the led works even in runtime suspend */
3628static unsigned int led_power_filter(struct hda_codec *codec,
3629 hda_nid_t nid,
3630 unsigned int power_state)
3631{
3632 struct alc_spec *spec = codec->spec;
3633
Hui Wang50dd9052014-07-08 17:56:15 +08003634 if (power_state != AC_PWRST_D3 || nid == 0 ||
3635 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01003636 return power_state;
3637
3638 /* Set pin ctl again, it might have just been set to 0 */
3639 snd_hda_set_pin_ctl(codec, nid,
3640 snd_hda_codec_get_pin_target(codec, nid));
3641
Takashi Iwaicffd3962015-04-09 10:30:25 +02003642 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01003643}
3644
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003645static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3646 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003647{
3648 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003649 const struct dmi_device *dev = NULL;
3650
3651 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3652 return;
3653
3654 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3655 int pol, pin;
3656 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3657 continue;
3658 if (pin < 0x0a || pin >= 0x10)
3659 break;
3660 spec->mute_led_polarity = pol;
3661 spec->mute_led_nid = pin - 0x0a + 0x18;
3662 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
Takashi Iwaifd25a972012-12-20 14:57:18 +01003663 spec->gen.vmaster_mute_enum = 1;
David Henningssond5b6b652013-11-06 10:50:44 +01003664 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01003665 codec_dbg(codec,
3666 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003667 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003668 break;
3669 }
3670}
3671
Takashi Iwai85c467d2018-05-29 11:38:38 +02003672static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
3673 const struct hda_fixup *fix,
3674 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01003675{
3676 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02003677
David Henningssond06ac142013-02-18 11:41:55 +01003678 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3679 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02003680 spec->mute_led_nid = pin;
David Henningssond06ac142013-02-18 11:41:55 +01003681 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3682 spec->gen.vmaster_mute_enum = 1;
David Henningssond5b6b652013-11-06 10:50:44 +01003683 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01003684 }
3685}
3686
Takashi Iwai85c467d2018-05-29 11:38:38 +02003687static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3688 const struct hda_fixup *fix, int action)
3689{
3690 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
3691}
3692
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003693static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3694 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01003695{
Takashi Iwai85c467d2018-05-29 11:38:38 +02003696 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01003697}
3698
Tom Briden7f783bd2017-03-25 10:12:01 +00003699static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
3700 const struct hda_fixup *fix, int action)
3701{
Takashi Iwai85c467d2018-05-29 11:38:38 +02003702 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00003703}
3704
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003705/* update LED status via GPIO */
3706static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3707 bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003708{
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003709 struct alc_spec *spec = codec->spec;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003710
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003711 if (spec->mute_led_polarity)
3712 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02003713 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003714}
3715
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003716/* turn on/off mute LED via GPIO per vmaster hook */
3717static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3718{
3719 struct hda_codec *codec = private_data;
3720 struct alc_spec *spec = codec->spec;
3721
3722 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3723}
3724
3725/* turn on/off mic-mute LED via GPIO per capture hook */
Takashi Iwaid03abec2018-06-19 12:29:13 +02003726static void alc_gpio_micmute_update(struct hda_codec *codec)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003727{
3728 struct alc_spec *spec = codec->spec;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003729
Takashi Iwaid03abec2018-06-19 12:29:13 +02003730 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3731 spec->gen.micmute_led.led_value);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003732}
3733
Takashi Iwai01e4a272018-06-19 22:47:30 +02003734/* setup mute and mic-mute GPIO bits, add hooks appropriately */
3735static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
3736 int action,
3737 unsigned int mute_mask,
3738 unsigned int micmute_mask)
3739{
3740 struct alc_spec *spec = codec->spec;
3741
3742 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
3743
3744 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3745 return;
3746 if (mute_mask) {
3747 spec->gpio_mute_led_mask = mute_mask;
3748 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3749 }
3750 if (micmute_mask) {
3751 spec->gpio_mic_led_mask = micmute_mask;
3752 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
3753 }
3754}
3755
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003756static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3757 const struct hda_fixup *fix, int action)
3758{
Takashi Iwai01e4a272018-06-19 22:47:30 +02003759 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003760}
3761
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08003762static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3763 const struct hda_fixup *fix, int action)
3764{
Takashi Iwai01e4a272018-06-19 22:47:30 +02003765 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003766}
3767
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003768/* turn on/off mic-mute LED per capture hook */
Takashi Iwaid03abec2018-06-19 12:29:13 +02003769static void alc_cap_micmute_update(struct hda_codec *codec)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003770{
3771 struct alc_spec *spec = codec->spec;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003772 unsigned int pinval;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003773
Takashi Iwaid03abec2018-06-19 12:29:13 +02003774 if (!spec->cap_mute_led_nid)
3775 return;
Hui Wangfc1fad92014-07-08 17:56:14 +08003776 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003777 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003778 if (spec->gen.micmute_led.led_value)
3779 pinval |= AC_PINCTL_VREF_80;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003780 else
Takashi Iwaid03abec2018-06-19 12:29:13 +02003781 pinval |= AC_PINCTL_VREF_HIZ;
3782 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003783}
3784
3785static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3786 const struct hda_fixup *fix, int action)
3787{
3788 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003789
Takashi Iwai01e4a272018-06-19 22:47:30 +02003790 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003791 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02003792 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
3793 * enable headphone amp
3794 */
3795 spec->gpio_mask |= 0x10;
3796 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003797 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003798 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
Hui Wang50dd9052014-07-08 17:56:15 +08003799 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003800 }
3801}
3802
David Henningsson7a5255f2014-10-30 08:26:01 +01003803static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3804 const struct hda_fixup *fix, int action)
3805{
David Henningsson7a5255f2014-10-30 08:26:01 +01003806 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01003807
Takashi Iwai01e4a272018-06-19 22:47:30 +02003808 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01003809 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01003810 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003811 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
David Henningsson7a5255f2014-10-30 08:26:01 +01003812 codec->power_filter = led_power_filter;
3813 }
3814}
3815
Takashi Iwai6a30aba2018-04-27 17:17:35 +02003816#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01003817static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3818 struct hda_jack_callback *event)
3819{
3820 struct alc_spec *spec = codec->spec;
3821
3822 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3823 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08003824 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01003825 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08003826 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01003827 input_sync(spec->kb_dev);
3828}
David Henningsson33f4acd2015-01-07 15:50:13 +01003829
Kailang3694cb22015-12-28 11:35:24 +08003830static int alc_register_micmute_input_device(struct hda_codec *codec)
3831{
3832 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08003833 int i;
Kailang3694cb22015-12-28 11:35:24 +08003834
3835 spec->kb_dev = input_allocate_device();
3836 if (!spec->kb_dev) {
3837 codec_err(codec, "Out of memory (input_allocate_device)\n");
3838 return -ENOMEM;
3839 }
Hui Wangc7b60a82015-12-28 11:35:25 +08003840
3841 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
3842
Kailang3694cb22015-12-28 11:35:24 +08003843 spec->kb_dev->name = "Microphone Mute Button";
3844 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08003845 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
3846 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
3847 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
3848 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
3849 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08003850
3851 if (input_register_device(spec->kb_dev)) {
3852 codec_err(codec, "input_register_device failed\n");
3853 input_free_device(spec->kb_dev);
3854 spec->kb_dev = NULL;
3855 return -ENOMEM;
3856 }
3857
3858 return 0;
3859}
3860
Takashi Iwai01e4a272018-06-19 22:47:30 +02003861/* GPIO1 = set according to SKU external amp
3862 * GPIO2 = mic mute hotkey
3863 * GPIO3 = mute LED
3864 * GPIO4 = mic mute LED
3865 */
David Henningsson33f4acd2015-01-07 15:50:13 +01003866static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3867 const struct hda_fixup *fix, int action)
3868{
David Henningsson33f4acd2015-01-07 15:50:13 +01003869 struct alc_spec *spec = codec->spec;
3870
Takashi Iwai01e4a272018-06-19 22:47:30 +02003871 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01003872 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02003873 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08003874 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01003875 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01003876
Takashi Iwai01e4a272018-06-19 22:47:30 +02003877 spec->gpio_mask |= 0x06;
3878 spec->gpio_dir |= 0x02;
3879 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01003880 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01003881 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01003882 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01003883 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01003884 return;
3885 }
3886
3887 if (!spec->kb_dev)
3888 return;
3889
3890 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01003891 case HDA_FIXUP_ACT_FREE:
3892 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01003893 spec->kb_dev = NULL;
3894 }
David Henningsson33f4acd2015-01-07 15:50:13 +01003895}
3896
Takashi Iwai01e4a272018-06-19 22:47:30 +02003897/* Line2 = mic mute hotkey
3898 * GPIO2 = mic mute LED
3899 */
Kailang3694cb22015-12-28 11:35:24 +08003900static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
3901 const struct hda_fixup *fix, int action)
3902{
Kailang3694cb22015-12-28 11:35:24 +08003903 struct alc_spec *spec = codec->spec;
3904
Takashi Iwai01e4a272018-06-19 22:47:30 +02003905 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08003906 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02003907 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08003908 if (alc_register_micmute_input_device(codec) != 0)
3909 return;
3910
Kailang3694cb22015-12-28 11:35:24 +08003911 snd_hda_jack_detect_enable_callback(codec, 0x1b,
3912 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08003913 return;
3914 }
3915
3916 if (!spec->kb_dev)
3917 return;
3918
3919 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08003920 case HDA_FIXUP_ACT_FREE:
3921 input_unregister_device(spec->kb_dev);
3922 spec->kb_dev = NULL;
3923 }
3924}
Takashi Iwaic4696522018-01-15 10:44:35 +01003925#else /* INPUT */
3926#define alc280_fixup_hp_gpio2_mic_hotkey NULL
3927#define alc233_fixup_lenovo_line2_mic_hotkey NULL
3928#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08003929
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003930static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3931 const struct hda_fixup *fix, int action)
3932{
3933 struct alc_spec *spec = codec->spec;
3934
Takashi Iwai1bce62a2018-06-19 23:15:59 +02003935 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003936 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003937 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003938 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003939 }
3940}
3941
Kailang Yang5a367672017-07-21 15:23:53 +08003942static struct coef_fw alc225_pre_hsmode[] = {
3943 UPDATE_COEF(0x4a, 1<<8, 0),
3944 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
3945 UPDATE_COEF(0x63, 3<<14, 3<<14),
3946 UPDATE_COEF(0x4a, 3<<4, 2<<4),
3947 UPDATE_COEF(0x4a, 3<<10, 3<<10),
3948 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
3949 UPDATE_COEF(0x4a, 3<<10, 0),
3950 {}
3951};
3952
David Henningsson73bdd592013-04-15 15:44:14 +02003953static void alc_headset_mode_unplugged(struct hda_codec *codec)
3954{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003955 static struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003956 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
3957 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
3958 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
3959 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
3960 {}
3961 };
Kailang Yange69e7e02016-05-30 15:58:28 +08003962 static struct coef_fw coef0255_1[] = {
3963 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
3964 {}
3965 };
3966 static struct coef_fw coef0256[] = {
3967 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
3968 {}
3969 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02003970 static struct coef_fw coef0233[] = {
3971 WRITE_COEF(0x1b, 0x0c0b),
3972 WRITE_COEF(0x45, 0xc429),
3973 UPDATE_COEF(0x35, 0x4000, 0),
3974 WRITE_COEF(0x06, 0x2104),
3975 WRITE_COEF(0x1a, 0x0001),
3976 WRITE_COEF(0x26, 0x0004),
3977 WRITE_COEF(0x32, 0x42a3),
3978 {}
3979 };
Kailang Yangf3b70332015-04-08 15:01:17 +08003980 static struct coef_fw coef0288[] = {
3981 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
3982 UPDATE_COEF(0x50, 0x2000, 0x2000),
3983 UPDATE_COEF(0x56, 0x0006, 0x0006),
3984 UPDATE_COEF(0x66, 0x0008, 0),
3985 UPDATE_COEF(0x67, 0x2000, 0),
3986 {}
3987 };
Kailang Yang89542932017-07-17 15:03:43 +08003988 static struct coef_fw coef0298[] = {
3989 UPDATE_COEF(0x19, 0x1300, 0x0300),
3990 {}
3991 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02003992 static struct coef_fw coef0292[] = {
3993 WRITE_COEF(0x76, 0x000e),
3994 WRITE_COEF(0x6c, 0x2400),
3995 WRITE_COEF(0x18, 0x7308),
3996 WRITE_COEF(0x6b, 0xc429),
3997 {}
3998 };
3999 static struct coef_fw coef0293[] = {
4000 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4001 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4002 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4003 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4004 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4005 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4006 {}
4007 };
4008 static struct coef_fw coef0668[] = {
4009 WRITE_COEF(0x15, 0x0d40),
4010 WRITE_COEF(0xb7, 0x802b),
4011 {}
4012 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004013 static struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004014 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004015 {}
4016 };
Kailang Yang71683c32017-06-20 16:33:50 +08004017 static struct coef_fw coef0274[] = {
4018 UPDATE_COEF(0x4a, 0x0100, 0),
4019 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4020 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4021 UPDATE_COEF(0x4a, 0x0010, 0),
4022 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4023 WRITE_COEF(0x45, 0x5289),
4024 UPDATE_COEF(0x4a, 0x0c00, 0),
4025 {}
4026 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004027
Takashi Iwai7639a062015-03-03 10:07:24 +01004028 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004029 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004030 alc_process_coef_fw(codec, coef0255_1);
4031 alc_process_coef_fw(codec, coef0255);
4032 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004033 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004034 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004035 alc_process_coef_fw(codec, coef0256);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004036 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004037 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004038 case 0x10ec0234:
4039 case 0x10ec0274:
4040 case 0x10ec0294:
4041 alc_process_coef_fw(codec, coef0274);
4042 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004043 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004044 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004045 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004046 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004047 case 0x10ec0286:
4048 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004049 alc_process_coef_fw(codec, coef0288);
4050 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004051 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004052 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004053 alc_process_coef_fw(codec, coef0288);
4054 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004055 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004056 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004057 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004058 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004059 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004060 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004061 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004062 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004063 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004064 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004065 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004066 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004067 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004068 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004069 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004070 alc_process_coef_fw(codec, coef0225);
4071 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004072 case 0x10ec0867:
4073 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4074 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004075 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004076 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004077}
4078
4079
4080static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4081 hda_nid_t mic_pin)
4082{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004083 static struct coef_fw coef0255[] = {
4084 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4085 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4086 {}
4087 };
4088 static struct coef_fw coef0233[] = {
4089 UPDATE_COEF(0x35, 0, 1<<14),
4090 WRITE_COEF(0x06, 0x2100),
4091 WRITE_COEF(0x1a, 0x0021),
4092 WRITE_COEF(0x26, 0x008c),
4093 {}
4094 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004095 static struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004096 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004097 UPDATE_COEF(0x50, 0x2000, 0),
4098 UPDATE_COEF(0x56, 0x0006, 0),
4099 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4100 UPDATE_COEF(0x66, 0x0008, 0x0008),
4101 UPDATE_COEF(0x67, 0x2000, 0x2000),
4102 {}
4103 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004104 static struct coef_fw coef0292[] = {
4105 WRITE_COEF(0x19, 0xa208),
4106 WRITE_COEF(0x2e, 0xacf0),
4107 {}
4108 };
4109 static struct coef_fw coef0293[] = {
4110 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4111 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4112 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4113 {}
4114 };
4115 static struct coef_fw coef0688[] = {
4116 WRITE_COEF(0xb7, 0x802b),
4117 WRITE_COEF(0xb5, 0x1040),
4118 UPDATE_COEF(0xc3, 0, 1<<12),
4119 {}
4120 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004121 static struct coef_fw coef0225[] = {
4122 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4123 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4124 UPDATE_COEF(0x63, 3<<14, 0),
4125 {}
4126 };
Kailang Yang71683c32017-06-20 16:33:50 +08004127 static struct coef_fw coef0274[] = {
4128 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4129 UPDATE_COEF(0x4a, 0x0010, 0),
4130 UPDATE_COEF(0x6b, 0xf000, 0),
4131 {}
4132 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004133
Takashi Iwai7639a062015-03-03 10:07:24 +01004134 switch (codec->core.vendor_id) {
Kailang Yang736f20a2017-10-20 15:06:34 +08004135 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004136 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004137 case 0x10ec0256:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004138 alc_write_coef_idx(codec, 0x45, 0xc489);
4139 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004140 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004141 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4142 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004143 case 0x10ec0234:
4144 case 0x10ec0274:
4145 case 0x10ec0294:
4146 alc_write_coef_idx(codec, 0x45, 0x4689);
4147 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4148 alc_process_coef_fw(codec, coef0274);
4149 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4150 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004151 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004152 case 0x10ec0283:
4153 alc_write_coef_idx(codec, 0x45, 0xc429);
4154 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004155 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004156 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4157 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004158 case 0x10ec0286:
4159 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004160 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004161 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4162 alc_process_coef_fw(codec, coef0288);
4163 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4164 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004165 case 0x10ec0292:
4166 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004167 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004168 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004169 case 0x10ec0293:
4170 /* Set to TRS mode */
4171 alc_write_coef_idx(codec, 0x45, 0xc429);
4172 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004173 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004174 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4175 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004176 case 0x10ec0867:
4177 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4178 /* fallthru */
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004179 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004180 case 0x10ec0662:
4181 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4182 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4183 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004184 case 0x10ec0668:
4185 alc_write_coef_idx(codec, 0x11, 0x0001);
4186 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004187 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004188 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4189 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004190 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004191 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004192 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004193 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004194 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004195 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004196 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004197 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4198 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4199 alc_process_coef_fw(codec, coef0225);
4200 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4201 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004202 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004203 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004204}
4205
4206static void alc_headset_mode_default(struct hda_codec *codec)
4207{
David Henningsson2ae95572016-02-25 09:37:05 +01004208 static struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004209 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4210 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4211 UPDATE_COEF(0x49, 3<<8, 0<<8),
4212 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4213 UPDATE_COEF(0x63, 3<<14, 0),
4214 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01004215 {}
4216 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004217 static struct coef_fw coef0255[] = {
4218 WRITE_COEF(0x45, 0xc089),
4219 WRITE_COEF(0x45, 0xc489),
4220 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4221 WRITE_COEF(0x49, 0x0049),
4222 {}
4223 };
4224 static struct coef_fw coef0233[] = {
4225 WRITE_COEF(0x06, 0x2100),
4226 WRITE_COEF(0x32, 0x4ea3),
4227 {}
4228 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004229 static struct coef_fw coef0288[] = {
4230 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4231 UPDATE_COEF(0x50, 0x2000, 0x2000),
4232 UPDATE_COEF(0x56, 0x0006, 0x0006),
4233 UPDATE_COEF(0x66, 0x0008, 0),
4234 UPDATE_COEF(0x67, 0x2000, 0),
4235 {}
4236 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004237 static struct coef_fw coef0292[] = {
4238 WRITE_COEF(0x76, 0x000e),
4239 WRITE_COEF(0x6c, 0x2400),
4240 WRITE_COEF(0x6b, 0xc429),
4241 WRITE_COEF(0x18, 0x7308),
4242 {}
4243 };
4244 static struct coef_fw coef0293[] = {
4245 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4246 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4247 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4248 {}
4249 };
4250 static struct coef_fw coef0688[] = {
4251 WRITE_COEF(0x11, 0x0041),
4252 WRITE_COEF(0x15, 0x0d40),
4253 WRITE_COEF(0xb7, 0x802b),
4254 {}
4255 };
Kailang Yang71683c32017-06-20 16:33:50 +08004256 static struct coef_fw coef0274[] = {
4257 WRITE_COEF(0x45, 0x4289),
4258 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4259 UPDATE_COEF(0x6b, 0x0f00, 0),
4260 UPDATE_COEF(0x49, 0x0300, 0x0300),
4261 {}
4262 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004263
Takashi Iwai7639a062015-03-03 10:07:24 +01004264 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08004265 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01004266 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004267 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004268 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004269 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004270 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004271 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01004272 alc_process_coef_fw(codec, coef0225);
4273 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004274 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004275 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004276 case 0x10ec0256:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004277 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004278 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004279 case 0x10ec0234:
4280 case 0x10ec0274:
4281 case 0x10ec0294:
4282 alc_process_coef_fw(codec, coef0274);
4283 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004284 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004285 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004286 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004287 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004288 case 0x10ec0286:
4289 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004290 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004291 alc_process_coef_fw(codec, coef0288);
4292 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004293 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004294 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004295 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004296 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004297 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004298 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004299 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004300 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004301 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004302 case 0x10ec0867:
4303 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4304 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004305 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004306 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004307}
4308
4309/* Iphone type */
4310static void alc_headset_mode_ctia(struct hda_codec *codec)
4311{
Kailang Yang89542932017-07-17 15:03:43 +08004312 int val;
4313
Takashi Iwai54db6c32014-08-18 15:11:19 +02004314 static struct coef_fw coef0255[] = {
4315 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4316 WRITE_COEF(0x1b, 0x0c2b),
4317 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4318 {}
4319 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004320 static struct coef_fw coef0256[] = {
4321 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4322 WRITE_COEF(0x1b, 0x0c6b),
4323 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4324 {}
4325 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004326 static struct coef_fw coef0233[] = {
4327 WRITE_COEF(0x45, 0xd429),
4328 WRITE_COEF(0x1b, 0x0c2b),
4329 WRITE_COEF(0x32, 0x4ea3),
4330 {}
4331 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004332 static struct coef_fw coef0288[] = {
4333 UPDATE_COEF(0x50, 0x2000, 0x2000),
4334 UPDATE_COEF(0x56, 0x0006, 0x0006),
4335 UPDATE_COEF(0x66, 0x0008, 0),
4336 UPDATE_COEF(0x67, 0x2000, 0),
4337 {}
4338 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004339 static struct coef_fw coef0292[] = {
4340 WRITE_COEF(0x6b, 0xd429),
4341 WRITE_COEF(0x76, 0x0008),
4342 WRITE_COEF(0x18, 0x7388),
4343 {}
4344 };
4345 static struct coef_fw coef0293[] = {
4346 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4347 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4348 {}
4349 };
4350 static struct coef_fw coef0688[] = {
4351 WRITE_COEF(0x11, 0x0001),
4352 WRITE_COEF(0x15, 0x0d60),
4353 WRITE_COEF(0xc3, 0x0000),
4354 {}
4355 };
Kailang Yang5a367672017-07-21 15:23:53 +08004356 static struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004357 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004358 UPDATE_COEF(0x63, 3<<14, 2<<14),
4359 {}
4360 };
4361 static struct coef_fw coef0225_2[] = {
4362 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4363 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004364 {}
4365 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004366
Takashi Iwai7639a062015-03-03 10:07:24 +01004367 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004368 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004369 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004370 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004371 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004372 case 0x10ec0256:
4373 alc_process_coef_fw(codec, coef0256);
4374 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004375 case 0x10ec0234:
4376 case 0x10ec0274:
4377 case 0x10ec0294:
4378 alc_write_coef_idx(codec, 0x45, 0xd689);
4379 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004380 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004381 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004382 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004383 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004384 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004385 val = alc_read_coef_idx(codec, 0x50);
4386 if (val & (1 << 12)) {
4387 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4388 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4389 msleep(300);
4390 } else {
4391 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4392 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4393 msleep(300);
4394 }
4395 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004396 case 0x10ec0286:
4397 case 0x10ec0288:
4398 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4399 msleep(300);
4400 alc_process_coef_fw(codec, coef0288);
4401 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004402 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004403 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004404 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004405 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004406 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004407 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004408 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004409 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004410 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004411 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004412 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004413 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004414 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004415 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004416 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004417 val = alc_read_coef_idx(codec, 0x45);
4418 if (val & (1 << 9))
4419 alc_process_coef_fw(codec, coef0225_2);
4420 else
4421 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004422 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004423 case 0x10ec0867:
4424 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4425 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004426 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004427 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004428}
4429
4430/* Nokia type */
4431static void alc_headset_mode_omtp(struct hda_codec *codec)
4432{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004433 static struct coef_fw coef0255[] = {
4434 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4435 WRITE_COEF(0x1b, 0x0c2b),
4436 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4437 {}
4438 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004439 static struct coef_fw coef0256[] = {
4440 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4441 WRITE_COEF(0x1b, 0x0c6b),
4442 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4443 {}
4444 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004445 static struct coef_fw coef0233[] = {
4446 WRITE_COEF(0x45, 0xe429),
4447 WRITE_COEF(0x1b, 0x0c2b),
4448 WRITE_COEF(0x32, 0x4ea3),
4449 {}
4450 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004451 static struct coef_fw coef0288[] = {
4452 UPDATE_COEF(0x50, 0x2000, 0x2000),
4453 UPDATE_COEF(0x56, 0x0006, 0x0006),
4454 UPDATE_COEF(0x66, 0x0008, 0),
4455 UPDATE_COEF(0x67, 0x2000, 0),
4456 {}
4457 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004458 static struct coef_fw coef0292[] = {
4459 WRITE_COEF(0x6b, 0xe429),
4460 WRITE_COEF(0x76, 0x0008),
4461 WRITE_COEF(0x18, 0x7388),
4462 {}
4463 };
4464 static struct coef_fw coef0293[] = {
4465 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4466 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4467 {}
4468 };
4469 static struct coef_fw coef0688[] = {
4470 WRITE_COEF(0x11, 0x0001),
4471 WRITE_COEF(0x15, 0x0d50),
4472 WRITE_COEF(0xc3, 0x0000),
4473 {}
4474 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004475 static struct coef_fw coef0225[] = {
4476 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004477 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004478 {}
4479 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004480
Takashi Iwai7639a062015-03-03 10:07:24 +01004481 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004482 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004483 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004484 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004485 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004486 case 0x10ec0256:
4487 alc_process_coef_fw(codec, coef0256);
4488 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004489 case 0x10ec0234:
4490 case 0x10ec0274:
4491 case 0x10ec0294:
4492 alc_write_coef_idx(codec, 0x45, 0xe689);
4493 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004494 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004495 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004496 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004497 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004498 case 0x10ec0298:
4499 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08004500 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4501 msleep(300);
4502 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004503 case 0x10ec0286:
4504 case 0x10ec0288:
4505 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4506 msleep(300);
4507 alc_process_coef_fw(codec, coef0288);
4508 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004509 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004510 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004511 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004512 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004513 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004514 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004515 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004516 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004517 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004518 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004519 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004520 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004521 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004522 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004523 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004524 alc_process_coef_fw(codec, coef0225);
4525 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004526 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004527 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004528}
4529
4530static void alc_determine_headset_type(struct hda_codec *codec)
4531{
4532 int val;
4533 bool is_ctia = false;
4534 struct alc_spec *spec = codec->spec;
Takashi Iwai54db6c32014-08-18 15:11:19 +02004535 static struct coef_fw coef0255[] = {
4536 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4537 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4538 conteol) */
4539 {}
4540 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004541 static struct coef_fw coef0288[] = {
4542 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4543 {}
4544 };
Kailang Yang89542932017-07-17 15:03:43 +08004545 static struct coef_fw coef0298[] = {
4546 UPDATE_COEF(0x50, 0x2000, 0x2000),
4547 UPDATE_COEF(0x56, 0x0006, 0x0006),
4548 UPDATE_COEF(0x66, 0x0008, 0),
4549 UPDATE_COEF(0x67, 0x2000, 0),
4550 UPDATE_COEF(0x19, 0x1300, 0x1300),
4551 {}
4552 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004553 static struct coef_fw coef0293[] = {
4554 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4555 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4556 {}
4557 };
4558 static struct coef_fw coef0688[] = {
4559 WRITE_COEF(0x11, 0x0001),
4560 WRITE_COEF(0xb7, 0x802b),
4561 WRITE_COEF(0x15, 0x0d60),
4562 WRITE_COEF(0xc3, 0x0c00),
4563 {}
4564 };
Kailang Yang71683c32017-06-20 16:33:50 +08004565 static struct coef_fw coef0274[] = {
4566 UPDATE_COEF(0x4a, 0x0010, 0),
4567 UPDATE_COEF(0x4a, 0x8000, 0),
4568 WRITE_COEF(0x45, 0xd289),
4569 UPDATE_COEF(0x49, 0x0300, 0x0300),
4570 {}
4571 };
David Henningsson73bdd592013-04-15 15:44:14 +02004572
Takashi Iwai7639a062015-03-03 10:07:24 +01004573 switch (codec->core.vendor_id) {
Kailang Yang736f20a2017-10-20 15:06:34 +08004574 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004575 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004576 case 0x10ec0256:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004577 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004578 msleep(300);
4579 val = alc_read_coef_idx(codec, 0x46);
4580 is_ctia = (val & 0x0070) == 0x0070;
4581 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004582 case 0x10ec0234:
4583 case 0x10ec0274:
4584 case 0x10ec0294:
4585 alc_process_coef_fw(codec, coef0274);
4586 msleep(80);
4587 val = alc_read_coef_idx(codec, 0x46);
4588 is_ctia = (val & 0x00f0) == 0x00f0;
4589 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004590 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004591 case 0x10ec0283:
4592 alc_write_coef_idx(codec, 0x45, 0xd029);
4593 msleep(300);
4594 val = alc_read_coef_idx(codec, 0x46);
4595 is_ctia = (val & 0x0070) == 0x0070;
4596 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004597 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004598 snd_hda_codec_write(codec, 0x21, 0,
4599 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4600 msleep(100);
4601 snd_hda_codec_write(codec, 0x21, 0,
4602 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4603 msleep(200);
4604
4605 val = alc_read_coef_idx(codec, 0x50);
4606 if (val & (1 << 12)) {
4607 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4608 alc_process_coef_fw(codec, coef0288);
4609 msleep(350);
4610 val = alc_read_coef_idx(codec, 0x50);
4611 is_ctia = (val & 0x0070) == 0x0070;
4612 } else {
4613 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4614 alc_process_coef_fw(codec, coef0288);
4615 msleep(350);
4616 val = alc_read_coef_idx(codec, 0x50);
4617 is_ctia = (val & 0x0070) == 0x0070;
4618 }
4619 alc_process_coef_fw(codec, coef0298);
4620 snd_hda_codec_write(codec, 0x21, 0,
4621 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4622 msleep(75);
4623 snd_hda_codec_write(codec, 0x21, 0,
4624 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4625 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004626 case 0x10ec0286:
4627 case 0x10ec0288:
4628 alc_process_coef_fw(codec, coef0288);
4629 msleep(350);
4630 val = alc_read_coef_idx(codec, 0x50);
4631 is_ctia = (val & 0x0070) == 0x0070;
4632 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004633 case 0x10ec0292:
4634 alc_write_coef_idx(codec, 0x6b, 0xd429);
4635 msleep(300);
4636 val = alc_read_coef_idx(codec, 0x6c);
4637 is_ctia = (val & 0x001c) == 0x001c;
4638 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004639 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004640 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004641 msleep(300);
4642 val = alc_read_coef_idx(codec, 0x46);
4643 is_ctia = (val & 0x0070) == 0x0070;
4644 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004645 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004646 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004647 msleep(300);
4648 val = alc_read_coef_idx(codec, 0xbe);
4649 is_ctia = (val & 0x1c02) == 0x1c02;
4650 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004651 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004652 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004653 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004654 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004655 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004656 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08004657 snd_hda_codec_write(codec, 0x21, 0,
4658 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4659 msleep(80);
4660 snd_hda_codec_write(codec, 0x21, 0,
4661 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4662
Kailang Yang5a367672017-07-21 15:23:53 +08004663 alc_process_coef_fw(codec, alc225_pre_hsmode);
4664 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4665 val = alc_read_coef_idx(codec, 0x45);
4666 if (val & (1 << 9)) {
4667 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4668 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4669 msleep(800);
4670 val = alc_read_coef_idx(codec, 0x46);
4671 is_ctia = (val & 0x00f0) == 0x00f0;
4672 } else {
4673 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4674 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4675 msleep(800);
4676 val = alc_read_coef_idx(codec, 0x46);
4677 is_ctia = (val & 0x00f0) == 0x00f0;
4678 }
4679 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4680 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4681 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08004682
4683 snd_hda_codec_write(codec, 0x21, 0,
4684 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4685 msleep(80);
4686 snd_hda_codec_write(codec, 0x21, 0,
4687 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004688 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004689 case 0x10ec0867:
4690 is_ctia = true;
4691 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004692 }
4693
Takashi Iwai4e76a882014-02-25 12:21:03 +01004694 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02004695 is_ctia ? "yes" : "no");
4696 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4697}
4698
4699static void alc_update_headset_mode(struct hda_codec *codec)
4700{
4701 struct alc_spec *spec = codec->spec;
4702
4703 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
4704 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
4705
4706 int new_headset_mode;
4707
4708 if (!snd_hda_jack_detect(codec, hp_pin))
4709 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4710 else if (mux_pin == spec->headset_mic_pin)
4711 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4712 else if (mux_pin == spec->headphone_mic_pin)
4713 new_headset_mode = ALC_HEADSET_MODE_MIC;
4714 else
4715 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4716
David Henningsson5959a6b2013-11-12 11:10:57 +01004717 if (new_headset_mode == spec->current_headset_mode) {
4718 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02004719 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01004720 }
David Henningsson73bdd592013-04-15 15:44:14 +02004721
4722 switch (new_headset_mode) {
4723 case ALC_HEADSET_MODE_UNPLUGGED:
4724 alc_headset_mode_unplugged(codec);
4725 spec->gen.hp_jack_present = false;
4726 break;
4727 case ALC_HEADSET_MODE_HEADSET:
4728 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4729 alc_determine_headset_type(codec);
4730 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4731 alc_headset_mode_ctia(codec);
4732 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4733 alc_headset_mode_omtp(codec);
4734 spec->gen.hp_jack_present = true;
4735 break;
4736 case ALC_HEADSET_MODE_MIC:
4737 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4738 spec->gen.hp_jack_present = false;
4739 break;
4740 case ALC_HEADSET_MODE_HEADPHONE:
4741 alc_headset_mode_default(codec);
4742 spec->gen.hp_jack_present = true;
4743 break;
4744 }
4745 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4746 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4747 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02004748 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02004749 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4750 PIN_VREFHIZ);
4751 }
4752 spec->current_headset_mode = new_headset_mode;
4753
4754 snd_hda_gen_update_outputs(codec);
4755}
4756
4757static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01004758 struct snd_kcontrol *kcontrol,
4759 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02004760{
4761 alc_update_headset_mode(codec);
4762}
4763
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02004764static void alc_update_headset_jack_cb(struct hda_codec *codec,
4765 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02004766{
4767 struct alc_spec *spec = codec->spec;
David Henningsson5db4d342013-11-22 12:17:06 +01004768 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02004769 snd_hda_gen_hp_automute(codec, jack);
4770}
4771
4772static void alc_probe_headset_mode(struct hda_codec *codec)
4773{
4774 int i;
4775 struct alc_spec *spec = codec->spec;
4776 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4777
4778 /* Find mic pins */
4779 for (i = 0; i < cfg->num_inputs; i++) {
4780 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4781 spec->headset_mic_pin = cfg->inputs[i].pin;
4782 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4783 spec->headphone_mic_pin = cfg->inputs[i].pin;
4784 }
4785
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02004786 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02004787 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4788 spec->gen.automute_hook = alc_update_headset_mode;
4789 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4790}
4791
4792static void alc_fixup_headset_mode(struct hda_codec *codec,
4793 const struct hda_fixup *fix, int action)
4794{
4795 struct alc_spec *spec = codec->spec;
4796
4797 switch (action) {
4798 case HDA_FIXUP_ACT_PRE_PROBE:
4799 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4800 break;
4801 case HDA_FIXUP_ACT_PROBE:
4802 alc_probe_headset_mode(codec);
4803 break;
4804 case HDA_FIXUP_ACT_INIT:
4805 spec->current_headset_mode = 0;
4806 alc_update_headset_mode(codec);
4807 break;
4808 }
4809}
4810
4811static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4812 const struct hda_fixup *fix, int action)
4813{
4814 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4815 struct alc_spec *spec = codec->spec;
4816 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4817 }
4818 else
4819 alc_fixup_headset_mode(codec, fix, action);
4820}
4821
Kailang Yang31278992014-03-03 15:27:22 +08004822static void alc255_set_default_jack_type(struct hda_codec *codec)
4823{
4824 /* Set to iphone type */
Kailang Yange69e7e02016-05-30 15:58:28 +08004825 static struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004826 WRITE_COEF(0x1b, 0x880b),
4827 WRITE_COEF(0x45, 0xd089),
4828 WRITE_COEF(0x1b, 0x080b),
4829 WRITE_COEF(0x46, 0x0004),
4830 WRITE_COEF(0x1b, 0x0c0b),
4831 {}
4832 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004833 static struct coef_fw alc256fw[] = {
4834 WRITE_COEF(0x1b, 0x884b),
4835 WRITE_COEF(0x45, 0xd089),
4836 WRITE_COEF(0x1b, 0x084b),
4837 WRITE_COEF(0x46, 0x0004),
4838 WRITE_COEF(0x1b, 0x0c4b),
4839 {}
4840 };
4841 switch (codec->core.vendor_id) {
4842 case 0x10ec0255:
4843 alc_process_coef_fw(codec, alc255fw);
4844 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004845 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004846 case 0x10ec0256:
4847 alc_process_coef_fw(codec, alc256fw);
4848 break;
4849 }
Kailang Yang31278992014-03-03 15:27:22 +08004850 msleep(30);
4851}
4852
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004853static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4854 const struct hda_fixup *fix, int action)
4855{
4856 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08004857 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004858 }
4859 alc_fixup_headset_mode(codec, fix, action);
4860}
4861
Kailang Yang31278992014-03-03 15:27:22 +08004862static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
4863 const struct hda_fixup *fix, int action)
4864{
4865 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4866 struct alc_spec *spec = codec->spec;
4867 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4868 alc255_set_default_jack_type(codec);
4869 }
4870 else
4871 alc_fixup_headset_mode(codec, fix, action);
4872}
4873
Kailang Yange1e62b92015-04-08 16:01:22 +08004874static void alc288_update_headset_jack_cb(struct hda_codec *codec,
4875 struct hda_jack_callback *jack)
4876{
4877 struct alc_spec *spec = codec->spec;
4878 int present;
4879
4880 alc_update_headset_jack_cb(codec, jack);
4881 /* Headset Mic enable or disable, only for Dell Dino */
4882 present = spec->gen.hp_jack_present ? 0x40 : 0;
4883 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
4884 present);
4885}
4886
4887static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
4888 const struct hda_fixup *fix, int action)
4889{
4890 alc_fixup_headset_mode(codec, fix, action);
4891 if (action == HDA_FIXUP_ACT_PROBE) {
4892 struct alc_spec *spec = codec->spec;
4893 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
4894 }
4895}
4896
Hui Wang493a52a2014-01-14 14:07:36 +08004897static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
4898 const struct hda_fixup *fix, int action)
4899{
4900 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4901 struct alc_spec *spec = codec->spec;
4902 spec->gen.auto_mute_via_amp = 1;
4903 }
4904}
4905
Takashi Iwai9b745ab2014-03-07 08:37:19 +01004906static void alc_no_shutup(struct hda_codec *codec)
4907{
4908}
4909
4910static void alc_fixup_no_shutup(struct hda_codec *codec,
4911 const struct hda_fixup *fix, int action)
4912{
Gabriele Mazzotta972aa2c2016-12-24 19:50:00 +01004913 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01004914 struct alc_spec *spec = codec->spec;
4915 spec->shutup = alc_no_shutup;
4916 }
4917}
4918
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02004919static void alc_fixup_disable_aamix(struct hda_codec *codec,
4920 const struct hda_fixup *fix, int action)
4921{
4922 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4923 struct alc_spec *spec = codec->spec;
4924 /* Disable AA-loopback as it causes white noise */
4925 spec->gen.mixer_nid = 0;
4926 }
4927}
4928
Takashi Iwai7f57d802015-09-24 17:36:51 +02004929/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
4930static void alc_fixup_tpt440_dock(struct hda_codec *codec,
4931 const struct hda_fixup *fix, int action)
4932{
4933 static const struct hda_pintbl pincfgs[] = {
4934 { 0x16, 0x21211010 }, /* dock headphone */
4935 { 0x19, 0x21a11010 }, /* dock mic */
4936 { }
4937 };
4938 struct alc_spec *spec = codec->spec;
4939
4940 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai70a09762015-12-15 14:59:58 +01004941 spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */
Takashi Iwai7f57d802015-09-24 17:36:51 +02004942 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4943 codec->power_save_node = 0; /* avoid click noises */
4944 snd_hda_apply_pincfgs(codec, pincfgs);
4945 }
4946}
4947
Kailang Yang61fcf8e2018-02-02 15:26:46 +08004948static void alc_fixup_tpt470_dock(struct hda_codec *codec,
4949 const struct hda_fixup *fix, int action)
4950{
4951 static const struct hda_pintbl pincfgs[] = {
4952 { 0x17, 0x21211010 }, /* dock headphone */
4953 { 0x19, 0x21a11010 }, /* dock mic */
4954 { }
4955 };
4956 struct alc_spec *spec = codec->spec;
4957
4958 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4959 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01004960 snd_hda_apply_pincfgs(codec, pincfgs);
4961 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08004962 /* Enable DOCK device */
4963 snd_hda_codec_write(codec, 0x17, 0,
4964 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
4965 /* Enable DOCK device */
4966 snd_hda_codec_write(codec, 0x19, 0,
4967 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08004968 }
4969}
4970
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02004971static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02004972{
4973 struct alc_spec *spec = codec->spec;
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02004974 int hp_pin = spec->gen.autocfg.hp_pins[0];
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02004975
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02004976 /* Prevent pop noises when headphones are plugged in */
4977 snd_hda_codec_write(codec, hp_pin, 0,
4978 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4979 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02004980}
4981
4982static void alc_fixup_dell_xps13(struct hda_codec *codec,
4983 const struct hda_fixup *fix, int action)
4984{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02004985 struct alc_spec *spec = codec->spec;
4986 struct hda_input_mux *imux = &spec->gen.input_mux;
4987 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02004988
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02004989 switch (action) {
4990 case HDA_FIXUP_ACT_PRE_PROBE:
4991 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
4992 * it causes a click noise at start up
4993 */
4994 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
4995 break;
4996 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02004997 spec->shutup = alc_shutup_dell_xps13;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02004998
4999 /* Make the internal mic the default input source. */
5000 for (i = 0; i < imux->num_items; i++) {
5001 if (spec->gen.imux_pins[i] == 0x12) {
5002 spec->gen.cur_mux[0] = i;
5003 break;
5004 }
5005 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005006 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005007 }
5008}
5009
David Henningsson1f8b46c2015-05-12 14:38:15 +02005010static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5011 const struct hda_fixup *fix, int action)
5012{
5013 struct alc_spec *spec = codec->spec;
5014
5015 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5016 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5017 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005018
5019 /* Disable boost for mic-in permanently. (This code is only called
5020 from quirks that guarantee that the headphone is at NID 0x1b.) */
5021 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5022 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005023 } else
5024 alc_fixup_headset_mode(codec, fix, action);
5025}
5026
David Henningsson73bdd592013-04-15 15:44:14 +02005027static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5028 const struct hda_fixup *fix, int action)
5029{
5030 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005031 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005032 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005033 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5034 }
5035 alc_fixup_headset_mode(codec, fix, action);
5036}
5037
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005038/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5039static int find_ext_mic_pin(struct hda_codec *codec)
5040{
5041 struct alc_spec *spec = codec->spec;
5042 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5043 hda_nid_t nid;
5044 unsigned int defcfg;
5045 int i;
5046
5047 for (i = 0; i < cfg->num_inputs; i++) {
5048 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5049 continue;
5050 nid = cfg->inputs[i].pin;
5051 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5052 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5053 continue;
5054 return nid;
5055 }
5056
5057 return 0;
5058}
5059
Dylan Reid08a978d2012-11-18 22:56:40 -08005060static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005061 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005062 int action)
5063{
5064 struct alc_spec *spec = codec->spec;
5065
Takashi Iwai0db75792013-01-23 13:57:20 +01005066 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005067 int mic_pin = find_ext_mic_pin(codec);
5068 int hp_pin = spec->gen.autocfg.hp_pins[0];
5069
5070 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005071 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005072 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005073 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005074}
David Henningsson693b6132012-06-22 19:12:10 +02005075
David Henningsson3e0d6112013-04-22 14:30:14 +02005076static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5077 const struct hda_fixup *fix,
5078 int action)
5079{
5080 struct alc_spec *spec = codec->spec;
5081 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5082 int i;
5083
5084 /* The mic boosts on level 2 and 3 are too noisy
5085 on the internal mic input.
5086 Therefore limit the boost to 0 or 1. */
5087
5088 if (action != HDA_FIXUP_ACT_PROBE)
5089 return;
5090
5091 for (i = 0; i < cfg->num_inputs; i++) {
5092 hda_nid_t nid = cfg->inputs[i].pin;
5093 unsigned int defcfg;
5094 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5095 continue;
5096 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5097 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5098 continue;
5099
5100 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5101 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5102 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5103 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5104 (0 << AC_AMPCAP_MUTE_SHIFT));
5105 }
5106}
5107
Kailang Yangcd217a62013-08-22 10:15:24 +02005108static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005109 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005110{
5111 struct alc_spec *spec = codec->spec;
5112 int vref;
5113
5114 msleep(200);
5115 snd_hda_gen_hp_automute(codec, jack);
5116
5117 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5118
5119 msleep(600);
5120 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5121 vref);
5122}
5123
Kailang Yangcd217a62013-08-22 10:15:24 +02005124static void alc283_fixup_chromebook(struct hda_codec *codec,
5125 const struct hda_fixup *fix, int action)
5126{
5127 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005128
5129 switch (action) {
5130 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005131 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005132 /* Disable AA-loopback as it causes white noise */
5133 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08005134 break;
5135 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08005136 /* MIC2-VREF control */
5137 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005138 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08005139 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02005140 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08005141 break;
5142 }
5143}
5144
5145static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5146 const struct hda_fixup *fix, int action)
5147{
5148 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08005149
5150 switch (action) {
5151 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02005152 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5153 break;
5154 case HDA_FIXUP_ACT_INIT:
5155 /* MIC2-VREF control */
5156 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005157 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02005158 break;
5159 }
5160}
5161
Takashi Iwai7bba2152013-09-06 15:45:38 +02005162/* mute tablet speaker pin (0x14) via dock plugging in addition */
5163static void asus_tx300_automute(struct hda_codec *codec)
5164{
5165 struct alc_spec *spec = codec->spec;
5166 snd_hda_gen_update_outputs(codec);
5167 if (snd_hda_jack_detect(codec, 0x1b))
5168 spec->gen.mute_bits |= (1ULL << 0x14);
5169}
5170
5171static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5172 const struct hda_fixup *fix, int action)
5173{
5174 struct alc_spec *spec = codec->spec;
5175 /* TX300 needs to set up GPIO2 for the speaker amp */
5176 static const struct hda_verb gpio2_verbs[] = {
5177 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
5178 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
5179 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
5180 {}
5181 };
5182 static const struct hda_pintbl dock_pins[] = {
5183 { 0x1b, 0x21114000 }, /* dock speaker pin */
5184 {}
5185 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02005186
5187 switch (action) {
5188 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02005189 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005190 snd_hda_add_verbs(codec, gpio2_verbs);
5191 snd_hda_apply_pincfgs(codec, dock_pins);
5192 spec->gen.auto_mute_via_amp = 1;
5193 spec->gen.automute_hook = asus_tx300_automute;
5194 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005195 snd_hda_gen_hp_automute);
5196 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02005197 case HDA_FIXUP_ACT_PROBE:
5198 spec->init_amp = ALC_INIT_DEFAULT;
5199 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005200 case HDA_FIXUP_ACT_BUILD:
5201 /* this is a bit tricky; give more sane names for the main
5202 * (tablet) speaker and the dock speaker, respectively
5203 */
Takashi Iwai56798e62017-04-11 08:10:52 +02005204 rename_ctl(codec, "Speaker Playback Switch",
5205 "Dock Speaker Playback Switch");
5206 rename_ctl(codec, "Bass Speaker Playback Switch",
5207 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02005208 break;
5209 }
5210}
5211
David Henningsson338cae52013-10-07 10:39:59 +02005212static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5213 const struct hda_fixup *fix, int action)
5214{
David Henningsson0f4881d2013-12-20 16:08:13 +01005215 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5216 /* DAC node 0x03 is giving mono output. We therefore want to
5217 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5218 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5219 hda_nid_t conn1[2] = { 0x0c };
5220 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
5221 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
5222 }
David Henningsson338cae52013-10-07 10:39:59 +02005223}
5224
Hui Wangdd9aa332016-08-01 10:20:32 +08005225static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5226 const struct hda_fixup *fix, int action)
5227{
5228 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5229 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5230 we can't adjust the speaker's volume since this node does not has
5231 Amp-out capability. we change the speaker's route to:
5232 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5233 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5234 speaker's volume now. */
5235
5236 hda_nid_t conn1[1] = { 0x0c };
5237 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
5238 }
5239}
5240
Takashi Iwaie312a862018-03-06 12:14:17 +01005241/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5242static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5243 const struct hda_fixup *fix, int action)
5244{
5245 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5246 hda_nid_t conn[2] = { 0x02, 0x03 };
5247 snd_hda_override_conn_list(codec, 0x17, 2, conn);
5248 }
5249}
5250
Keith Packard98973f22015-07-15 12:14:39 -07005251/* Hook to update amp GPIO4 for automute */
5252static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5253 struct hda_jack_callback *jack)
5254{
5255 struct alc_spec *spec = codec->spec;
5256
5257 snd_hda_gen_hp_automute(codec, jack);
5258 /* mute_led_polarity is set to 0, so we pass inverted value here */
5259 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
5260}
5261
5262/* Manage GPIOs for HP EliteBook Folio 9480m.
5263 *
5264 * GPIO4 is the headphone amplifier power control
5265 * GPIO3 is the audio output mute indicator LED
5266 */
5267
5268static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5269 const struct hda_fixup *fix,
5270 int action)
5271{
5272 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07005273
Takashi Iwai01e4a272018-06-19 22:47:30 +02005274 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07005275 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02005276 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
5277 spec->gpio_mask |= 0x10;
5278 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07005279 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07005280 }
5281}
5282
Kailang Yangca169cc2017-04-25 16:17:40 +08005283static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5284 const struct hda_fixup *fix,
5285 int action)
5286{
5287 alc_fixup_dual_codecs(codec, fix, action);
5288 switch (action) {
5289 case HDA_FIXUP_ACT_PRE_PROBE:
5290 /* override card longname to provide a unique UCM profile */
5291 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5292 break;
5293 case HDA_FIXUP_ACT_BUILD:
5294 /* rename Capture controls depending on the codec */
5295 rename_ctl(codec, "Capture Volume",
5296 codec->addr == 0 ?
5297 "Rear-Panel Capture Volume" :
5298 "Front-Panel Capture Volume");
5299 rename_ctl(codec, "Capture Switch",
5300 codec->addr == 0 ?
5301 "Rear-Panel Capture Switch" :
5302 "Front-Panel Capture Switch");
5303 break;
5304 }
5305}
5306
Kailang Yang92266652017-12-14 15:28:58 +08005307/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5308static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5309 const struct hda_fixup *fix, int action)
5310{
5311 struct alc_spec *spec = codec->spec;
5312 static hda_nid_t preferred_pairs[] = {
5313 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5314 0
5315 };
5316
5317 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5318 return;
5319
5320 spec->gen.preferred_dacs = preferred_pairs;
5321}
5322
Takashi Iwaib317b032014-01-08 11:44:21 +01005323/* for hda_fixup_thinkpad_acpi() */
5324#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01005325
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02005326static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5327 const struct hda_fixup *fix, int action)
5328{
5329 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5330 hda_fixup_thinkpad_acpi(codec, fix, action);
5331}
5332
Hui Wang00ef9942014-07-31 11:52:38 +08005333/* for dell wmi mic mute led */
5334#include "dell_wmi_helper.c"
5335
Tom Bridenbbf8ff62018-05-29 17:34:20 +01005336/* for alc295_fixup_hp_top_speakers */
5337#include "hp_x360_helper.c"
5338
Takashi Iwai1d045db2011-07-07 18:23:21 +02005339enum {
5340 ALC269_FIXUP_SONY_VAIO,
5341 ALC275_FIXUP_SONY_VAIO_GPIO2,
5342 ALC269_FIXUP_DELL_M101Z,
5343 ALC269_FIXUP_SKU_IGNORE,
5344 ALC269_FIXUP_ASUS_G73JW,
5345 ALC269_FIXUP_LENOVO_EAPD,
5346 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02005347 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005348 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02005349 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005350 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02005351 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02005352 ALC269_FIXUP_QUANTA_MUTE,
5353 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02005354 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02005355 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02005356 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01005357 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02005358 ALC269_FIXUP_AMIC,
5359 ALC269_FIXUP_DMIC,
5360 ALC269VB_FIXUP_AMIC,
5361 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005362 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01005363 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005364 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00005365 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01005366 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08005367 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5368 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02005369 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02005370 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005371 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02005372 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02005373 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02005374 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5375 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02005376 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08005377 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02005378 ALC269_FIXUP_HEADSET_MODE,
5379 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02005380 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02005381 ALC269_FIXUP_ASUS_X101_FUNC,
5382 ALC269_FIXUP_ASUS_X101_VERB,
5383 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08005384 ALC271_FIXUP_AMIC_MIC2,
5385 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01005386 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07005387 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02005388 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01005389 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01005390 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01005391 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02005392 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02005393 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08005394 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005395 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02005396 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02005397 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01005398 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5399 ALC290_FIXUP_SUBWOOFER,
5400 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01005401 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01005402 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06005403 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06005404 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005405 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08005406 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005407 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08005408 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08005409 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02005410 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01005411 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02005412 ALC283_FIXUP_HEADSET_MIC,
Hui Wang00ef9942014-07-31 11:52:38 +08005413 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02005414 ALC282_FIXUP_ASPIRE_V5_PINS,
David Henningsson7a5255f2014-10-30 08:26:01 +01005415 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08005416 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01005417 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01005418 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01005419 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07005420 ALC280_FIXUP_HP_9480M,
Kailang Yange1e62b92015-04-08 16:01:22 +08005421 ALC288_FIXUP_DELL_HEADSET_MODE,
5422 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
5423 ALC288_FIXUP_DELL_XPS_13_GPIO6,
Hui Wang831bfdf92015-06-26 12:35:17 +08005424 ALC288_FIXUP_DELL_XPS_13,
5425 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02005426 ALC292_FIXUP_DELL_E7X,
5427 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01005428 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
Kailang Yang977e6272015-05-18 15:31:20 +08005429 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08005430 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08005431 ALC275_FIXUP_DELL_XPS,
Hui Wang8c697292015-11-24 11:08:18 +08005432 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
Hui Wang23adc192015-12-08 12:27:18 +08005433 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08005434 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08005435 ALC255_FIXUP_DELL_SPK_NOISE,
David Henningsson2ae95572016-02-25 09:37:05 +01005436 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01005437 ALC295_FIXUP_DISABLE_DAC3,
Takashi Iwaif8839822016-02-25 14:31:59 +01005438 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08005439 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02005440 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08005441 ALC298_FIXUP_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08005442 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01005443 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08005444 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06005445 ALC256_FIXUP_ASUS_HEADSET_MODE,
5446 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06005447 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06005448 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
5449 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08005450 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Hui Wangf33f79f2017-07-07 12:08:29 +08005451 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08005452 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
PeiSen Houb84e8432017-09-01 15:11:56 +08005453 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08005454 ALC274_FIXUP_DELL_BIND_DACS,
5455 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005456 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08005457 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08005458 ALC255_FIXUP_DELL_HEADSET_MIC,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01005459 ALC295_FIXUP_HP_X360,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005460};
5461
Takashi Iwai1727a772013-01-10 09:52:52 +01005462static const struct hda_fixup alc269_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005463 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01005464 .type = HDA_FIXUP_PINCTLS,
5465 .v.pins = (const struct hda_pintbl[]) {
5466 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02005467 {}
5468 }
5469 },
5470 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005471 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005472 .v.verbs = (const struct hda_verb[]) {
5473 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
5474 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
5475 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5476 { }
5477 },
5478 .chained = true,
5479 .chain_id = ALC269_FIXUP_SONY_VAIO
5480 },
5481 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005482 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005483 .v.verbs = (const struct hda_verb[]) {
5484 /* Enables internal speaker */
5485 {0x20, AC_VERB_SET_COEF_INDEX, 13},
5486 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
5487 {}
5488 }
5489 },
5490 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005491 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02005492 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005493 },
5494 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005495 .type = HDA_FIXUP_PINS,
5496 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005497 { 0x17, 0x99130111 }, /* subwoofer */
5498 { }
5499 }
5500 },
5501 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005502 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005503 .v.verbs = (const struct hda_verb[]) {
5504 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5505 {}
5506 }
5507 },
5508 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005509 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005510 .v.func = alc269_fixup_hweq,
5511 .chained = true,
5512 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5513 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02005514 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5515 .type = HDA_FIXUP_FUNC,
5516 .v.func = alc_fixup_disable_aamix,
5517 .chained = true,
5518 .chain_id = ALC269_FIXUP_SONY_VAIO
5519 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02005520 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005521 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005522 .v.func = alc271_fixup_dmic,
5523 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02005524 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005525 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02005526 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02005527 .chained = true,
5528 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02005529 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005530 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005531 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005532 .v.func = alc269_fixup_stereo_dmic,
5533 },
David Henningsson7c478f02013-10-11 10:18:46 +02005534 [ALC269_FIXUP_HEADSET_MIC] = {
5535 .type = HDA_FIXUP_FUNC,
5536 .v.func = alc269_fixup_headset_mic,
5537 },
Takashi Iwai24519912011-08-16 15:08:49 +02005538 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005539 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02005540 .v.func = alc269_fixup_quanta_mute,
5541 },
5542 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005543 .type = HDA_FIXUP_PINS,
5544 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02005545 { 0x1a, 0x2101103f }, /* dock line-out */
5546 { 0x1b, 0x23a11040 }, /* dock mic-in */
5547 { }
5548 },
5549 .chained = true,
5550 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5551 },
David Henningsson2041d562014-06-13 11:15:44 +02005552 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5553 .type = HDA_FIXUP_PINS,
5554 .v.pins = (const struct hda_pintbl[]) {
5555 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5556 { }
5557 },
5558 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02005559 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5560 .type = HDA_FIXUP_PINS,
5561 .v.pins = (const struct hda_pintbl[]) {
5562 { 0x21, 0x0221102f }, /* HP out */
5563 { }
5564 },
5565 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02005566 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5567 .type = HDA_FIXUP_FUNC,
5568 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5569 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01005570 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5571 .type = HDA_FIXUP_FUNC,
5572 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5573 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02005574 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005575 .type = HDA_FIXUP_PINS,
5576 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005577 { 0x14, 0x99130110 }, /* speaker */
5578 { 0x15, 0x0121401f }, /* HP out */
5579 { 0x18, 0x01a19c20 }, /* mic */
5580 { 0x19, 0x99a3092f }, /* int-mic */
5581 { }
5582 },
5583 },
5584 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005585 .type = HDA_FIXUP_PINS,
5586 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005587 { 0x12, 0x99a3092f }, /* int-mic */
5588 { 0x14, 0x99130110 }, /* speaker */
5589 { 0x15, 0x0121401f }, /* HP out */
5590 { 0x18, 0x01a19c20 }, /* mic */
5591 { }
5592 },
5593 },
5594 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005595 .type = HDA_FIXUP_PINS,
5596 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005597 { 0x14, 0x99130110 }, /* speaker */
5598 { 0x18, 0x01a19c20 }, /* mic */
5599 { 0x19, 0x99a3092f }, /* int-mic */
5600 { 0x21, 0x0121401f }, /* HP out */
5601 { }
5602 },
5603 },
David Henningsson2267ea92012-01-03 08:45:56 +01005604 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005605 .type = HDA_FIXUP_PINS,
5606 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005607 { 0x12, 0x99a3092f }, /* int-mic */
5608 { 0x14, 0x99130110 }, /* speaker */
5609 { 0x18, 0x01a19c20 }, /* mic */
5610 { 0x21, 0x0121401f }, /* HP out */
5611 { }
5612 },
5613 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005614 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005615 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005616 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01005617 },
David Henningssond06ac142013-02-18 11:41:55 +01005618 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5619 .type = HDA_FIXUP_FUNC,
5620 .v.func = alc269_fixup_hp_mute_led_mic1,
5621 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005622 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005623 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005624 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01005625 },
Tom Briden7f783bd2017-03-25 10:12:01 +00005626 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
5627 .type = HDA_FIXUP_FUNC,
5628 .v.func = alc269_fixup_hp_mute_led_mic3,
5629 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01005630 [ALC269_FIXUP_HP_GPIO_LED] = {
5631 .type = HDA_FIXUP_FUNC,
5632 .v.func = alc269_fixup_hp_gpio_led,
5633 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08005634 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5635 .type = HDA_FIXUP_FUNC,
5636 .v.func = alc269_fixup_hp_gpio_mic1_led,
5637 },
5638 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5639 .type = HDA_FIXUP_FUNC,
5640 .v.func = alc269_fixup_hp_line1_mic1_led,
5641 },
David Henningsson693b6132012-06-22 19:12:10 +02005642 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005643 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02005644 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02005645 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005646 [ALC269_FIXUP_NO_SHUTUP] = {
5647 .type = HDA_FIXUP_FUNC,
5648 .v.func = alc_fixup_no_shutup,
5649 },
David Henningsson108cc102012-07-20 10:37:25 +02005650 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005651 .type = HDA_FIXUP_PINS,
5652 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02005653 { 0x19, 0x23a11040 }, /* dock mic */
5654 { 0x1b, 0x2121103f }, /* dock headphone */
5655 { }
5656 },
5657 .chained = true,
5658 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5659 },
5660 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005661 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02005662 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01005663 .chained = true,
5664 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02005665 },
David Henningsson73bdd592013-04-15 15:44:14 +02005666 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5667 .type = HDA_FIXUP_PINS,
5668 .v.pins = (const struct hda_pintbl[]) {
5669 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5670 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5671 { }
5672 },
5673 .chained = true,
5674 .chain_id = ALC269_FIXUP_HEADSET_MODE
5675 },
5676 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5677 .type = HDA_FIXUP_PINS,
5678 .v.pins = (const struct hda_pintbl[]) {
5679 { 0x16, 0x21014020 }, /* dock line out */
5680 { 0x19, 0x21a19030 }, /* dock mic */
5681 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5682 { }
5683 },
5684 .chained = true,
5685 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5686 },
David Henningsson338cae52013-10-07 10:39:59 +02005687 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5688 .type = HDA_FIXUP_PINS,
5689 .v.pins = (const struct hda_pintbl[]) {
5690 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5691 { }
5692 },
5693 .chained = true,
5694 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5695 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08005696 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
5697 .type = HDA_FIXUP_PINS,
5698 .v.pins = (const struct hda_pintbl[]) {
5699 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5700 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5701 { }
5702 },
5703 .chained = true,
5704 .chain_id = ALC269_FIXUP_HEADSET_MODE
5705 },
David Henningsson73bdd592013-04-15 15:44:14 +02005706 [ALC269_FIXUP_HEADSET_MODE] = {
5707 .type = HDA_FIXUP_FUNC,
5708 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08005709 .chained = true,
5710 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02005711 },
5712 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5713 .type = HDA_FIXUP_FUNC,
5714 .v.func = alc_fixup_headset_mode_no_hp_mic,
5715 },
Takashi Iwai78197172015-06-27 10:21:13 +02005716 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
5717 .type = HDA_FIXUP_PINS,
5718 .v.pins = (const struct hda_pintbl[]) {
5719 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
5720 { }
5721 },
5722 .chained = true,
5723 .chain_id = ALC269_FIXUP_HEADSET_MODE,
5724 },
David Henningsson88cfcf82013-10-11 10:18:45 +02005725 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
5726 .type = HDA_FIXUP_PINS,
5727 .v.pins = (const struct hda_pintbl[]) {
5728 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5729 { }
5730 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02005731 .chained = true,
5732 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02005733 },
David Henningssond240d1d2013-04-15 12:50:02 +02005734 [ALC269_FIXUP_ASUS_X101_FUNC] = {
5735 .type = HDA_FIXUP_FUNC,
5736 .v.func = alc269_fixup_x101_headset_mic,
5737 },
5738 [ALC269_FIXUP_ASUS_X101_VERB] = {
5739 .type = HDA_FIXUP_VERBS,
5740 .v.verbs = (const struct hda_verb[]) {
5741 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5742 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
5743 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
5744 { }
5745 },
5746 .chained = true,
5747 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
5748 },
5749 [ALC269_FIXUP_ASUS_X101] = {
5750 .type = HDA_FIXUP_PINS,
5751 .v.pins = (const struct hda_pintbl[]) {
5752 { 0x18, 0x04a1182c }, /* Headset mic */
5753 { }
5754 },
5755 .chained = true,
5756 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
5757 },
Dylan Reid08a978d2012-11-18 22:56:40 -08005758 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005759 .type = HDA_FIXUP_PINS,
5760 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08005761 { 0x14, 0x99130110 }, /* speaker */
5762 { 0x19, 0x01a19c20 }, /* mic */
5763 { 0x1b, 0x99a7012f }, /* int-mic */
5764 { 0x21, 0x0121401f }, /* HP out */
5765 { }
5766 },
5767 },
5768 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005769 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08005770 .v.func = alc271_hp_gate_mic_jack,
5771 .chained = true,
5772 .chain_id = ALC271_FIXUP_AMIC_MIC2,
5773 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01005774 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
5775 .type = HDA_FIXUP_FUNC,
5776 .v.func = alc269_fixup_limit_int_mic_boost,
5777 .chained = true,
5778 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
5779 },
Dylan Reid42397002013-04-05 14:58:22 -07005780 [ALC269_FIXUP_ACER_AC700] = {
5781 .type = HDA_FIXUP_PINS,
5782 .v.pins = (const struct hda_pintbl[]) {
5783 { 0x12, 0x99a3092f }, /* int-mic */
5784 { 0x14, 0x99130110 }, /* speaker */
5785 { 0x18, 0x03a11c20 }, /* mic */
5786 { 0x1e, 0x0346101e }, /* SPDIF1 */
5787 { 0x21, 0x0321101f }, /* HP out */
5788 { }
5789 },
5790 .chained = true,
5791 .chain_id = ALC271_FIXUP_DMIC,
5792 },
David Henningsson3e0d6112013-04-22 14:30:14 +02005793 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
5794 .type = HDA_FIXUP_FUNC,
5795 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01005796 .chained = true,
5797 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02005798 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01005799 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
5800 .type = HDA_FIXUP_FUNC,
5801 .v.func = alc269_fixup_limit_int_mic_boost,
5802 .chained = true,
5803 .chain_id = ALC269VB_FIXUP_DMIC,
5804 },
Takashi Iwai23870832013-11-29 14:13:12 +01005805 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
5806 .type = HDA_FIXUP_VERBS,
5807 .v.verbs = (const struct hda_verb[]) {
5808 /* class-D output amp +5dB */
5809 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
5810 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
5811 {}
5812 },
5813 .chained = true,
5814 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
5815 },
David Henningsson8e35cd42013-11-06 11:20:01 +01005816 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
5817 .type = HDA_FIXUP_FUNC,
5818 .v.func = alc269_fixup_limit_int_mic_boost,
5819 .chained = true,
5820 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
5821 },
Anisse Astier02b504d2013-06-03 11:53:10 +02005822 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
5823 .type = HDA_FIXUP_PINS,
5824 .v.pins = (const struct hda_pintbl[]) {
5825 { 0x12, 0x99a3092f }, /* int-mic */
5826 { 0x18, 0x03a11d20 }, /* mic */
5827 { 0x19, 0x411111f0 }, /* Unused bogus pin */
5828 { }
5829 },
5830 },
Kailang Yangcd217a62013-08-22 10:15:24 +02005831 [ALC283_FIXUP_CHROME_BOOK] = {
5832 .type = HDA_FIXUP_FUNC,
5833 .v.func = alc283_fixup_chromebook,
5834 },
Kailang Yang0202e992013-12-02 15:20:15 +08005835 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
5836 .type = HDA_FIXUP_FUNC,
5837 .v.func = alc283_fixup_sense_combo_jack,
5838 .chained = true,
5839 .chain_id = ALC283_FIXUP_CHROME_BOOK,
5840 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02005841 [ALC282_FIXUP_ASUS_TX300] = {
5842 .type = HDA_FIXUP_FUNC,
5843 .v.func = alc282_fixup_asus_tx300,
5844 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02005845 [ALC283_FIXUP_INT_MIC] = {
5846 .type = HDA_FIXUP_VERBS,
5847 .v.verbs = (const struct hda_verb[]) {
5848 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
5849 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
5850 { }
5851 },
5852 .chained = true,
5853 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
5854 },
David Henningsson0f4881d2013-12-20 16:08:13 +01005855 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
5856 .type = HDA_FIXUP_PINS,
5857 .v.pins = (const struct hda_pintbl[]) {
5858 { 0x17, 0x90170112 }, /* subwoofer */
5859 { }
5860 },
5861 .chained = true,
5862 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5863 },
5864 [ALC290_FIXUP_SUBWOOFER] = {
5865 .type = HDA_FIXUP_PINS,
5866 .v.pins = (const struct hda_pintbl[]) {
5867 { 0x17, 0x90170112 }, /* subwoofer */
5868 { }
5869 },
5870 .chained = true,
5871 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
5872 },
David Henningsson338cae52013-10-07 10:39:59 +02005873 [ALC290_FIXUP_MONO_SPEAKERS] = {
5874 .type = HDA_FIXUP_FUNC,
5875 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01005876 },
5877 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
5878 .type = HDA_FIXUP_FUNC,
5879 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02005880 .chained = true,
5881 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5882 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01005883 [ALC269_FIXUP_THINKPAD_ACPI] = {
5884 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02005885 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02005886 .chained = true,
5887 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01005888 },
David Henningsson56f27012016-01-11 09:33:14 +01005889 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
5890 .type = HDA_FIXUP_FUNC,
5891 .v.func = alc_fixup_inv_dmic,
5892 .chained = true,
5893 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5894 },
Chris Chiu5824ce82017-02-28 14:17:11 -06005895 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
5896 .type = HDA_FIXUP_PINS,
5897 .v.pins = (const struct hda_pintbl[]) {
5898 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5899 { }
5900 },
5901 .chained = true,
5902 .chain_id = ALC255_FIXUP_HEADSET_MODE
5903 },
Chris Chiu615966a2017-02-28 14:17:12 -06005904 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
5905 .type = HDA_FIXUP_PINS,
5906 .v.pins = (const struct hda_pintbl[]) {
5907 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5908 { }
5909 },
5910 .chained = true,
5911 .chain_id = ALC255_FIXUP_HEADSET_MODE
5912 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005913 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5914 .type = HDA_FIXUP_PINS,
5915 .v.pins = (const struct hda_pintbl[]) {
5916 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5917 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5918 { }
5919 },
5920 .chained = true,
5921 .chain_id = ALC255_FIXUP_HEADSET_MODE
5922 },
Kailang Yang31278992014-03-03 15:27:22 +08005923 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5924 .type = HDA_FIXUP_PINS,
5925 .v.pins = (const struct hda_pintbl[]) {
5926 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5927 { }
5928 },
5929 .chained = true,
5930 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
5931 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005932 [ALC255_FIXUP_HEADSET_MODE] = {
5933 .type = HDA_FIXUP_FUNC,
5934 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08005935 .chained = true,
5936 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005937 },
Kailang Yang31278992014-03-03 15:27:22 +08005938 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5939 .type = HDA_FIXUP_FUNC,
5940 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
5941 },
Kailang Yanga22aa262014-04-23 17:34:28 +08005942 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5943 .type = HDA_FIXUP_PINS,
5944 .v.pins = (const struct hda_pintbl[]) {
5945 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5946 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5947 { }
5948 },
5949 .chained = true,
5950 .chain_id = ALC269_FIXUP_HEADSET_MODE
5951 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02005952 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02005953 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02005954 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02005955 .chained = true,
5956 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
5957 },
Takashi Iwai9a811232015-12-09 15:17:43 +01005958 [ALC292_FIXUP_TPT440] = {
5959 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01005960 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01005961 .chained = true,
5962 .chain_id = ALC292_FIXUP_TPT440_DOCK,
5963 },
Anisse Astierabaa22742016-08-24 09:14:13 +02005964 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01005965 .type = HDA_FIXUP_PINS,
5966 .v.pins = (const struct hda_pintbl[]) {
5967 { 0x19, 0x04a110f0 },
5968 { },
5969 },
5970 },
Hui Wang00ef9942014-07-31 11:52:38 +08005971 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
5972 .type = HDA_FIXUP_FUNC,
5973 .v.func = alc_fixup_dell_wmi,
Hui Wang00ef9942014-07-31 11:52:38 +08005974 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02005975 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
5976 .type = HDA_FIXUP_PINS,
5977 .v.pins = (const struct hda_pintbl[]) {
5978 { 0x12, 0x90a60130 },
5979 { 0x14, 0x90170110 },
5980 { 0x17, 0x40000008 },
5981 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02005982 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02005983 { 0x1a, 0x411111f0 },
5984 { 0x1b, 0x411111f0 },
5985 { 0x1d, 0x40f89b2d },
5986 { 0x1e, 0x411111f0 },
5987 { 0x21, 0x0321101f },
5988 { },
5989 },
5990 },
David Henningsson7a5255f2014-10-30 08:26:01 +01005991 [ALC280_FIXUP_HP_GPIO4] = {
5992 .type = HDA_FIXUP_FUNC,
5993 .v.func = alc280_fixup_hp_gpio4,
5994 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08005995 [ALC286_FIXUP_HP_GPIO_LED] = {
5996 .type = HDA_FIXUP_FUNC,
5997 .v.func = alc286_fixup_hp_gpio_led,
5998 },
David Henningsson33f4acd2015-01-07 15:50:13 +01005999 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6000 .type = HDA_FIXUP_FUNC,
6001 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6002 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01006003 [ALC280_FIXUP_HP_DOCK_PINS] = {
6004 .type = HDA_FIXUP_PINS,
6005 .v.pins = (const struct hda_pintbl[]) {
6006 { 0x1b, 0x21011020 }, /* line-out */
6007 { 0x1a, 0x01a1903c }, /* headset mic */
6008 { 0x18, 0x2181103f }, /* line-in */
6009 { },
6010 },
6011 .chained = true,
6012 .chain_id = ALC280_FIXUP_HP_GPIO4
6013 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006014 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6015 .type = HDA_FIXUP_PINS,
6016 .v.pins = (const struct hda_pintbl[]) {
6017 { 0x1b, 0x21011020 }, /* line-out */
6018 { 0x18, 0x2181103f }, /* line-in */
6019 { },
6020 },
6021 .chained = true,
6022 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6023 },
Keith Packard98973f22015-07-15 12:14:39 -07006024 [ALC280_FIXUP_HP_9480M] = {
6025 .type = HDA_FIXUP_FUNC,
6026 .v.func = alc280_fixup_hp_9480m,
6027 },
Kailang Yange1e62b92015-04-08 16:01:22 +08006028 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6029 .type = HDA_FIXUP_FUNC,
6030 .v.func = alc_fixup_headset_mode_dell_alc288,
6031 .chained = true,
6032 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6033 },
6034 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6035 .type = HDA_FIXUP_PINS,
6036 .v.pins = (const struct hda_pintbl[]) {
6037 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6038 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6039 { }
6040 },
6041 .chained = true,
6042 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6043 },
6044 [ALC288_FIXUP_DELL_XPS_13_GPIO6] = {
6045 .type = HDA_FIXUP_VERBS,
6046 .v.verbs = (const struct hda_verb[]) {
6047 {0x01, AC_VERB_SET_GPIO_MASK, 0x40},
6048 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x40},
6049 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6050 { }
6051 },
6052 .chained = true,
6053 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
6054 },
Hui Wang831bfdf92015-06-26 12:35:17 +08006055 [ALC288_FIXUP_DISABLE_AAMIX] = {
6056 .type = HDA_FIXUP_FUNC,
6057 .v.func = alc_fixup_disable_aamix,
6058 .chained = true,
6059 .chain_id = ALC288_FIXUP_DELL_XPS_13_GPIO6
6060 },
6061 [ALC288_FIXUP_DELL_XPS_13] = {
6062 .type = HDA_FIXUP_FUNC,
6063 .v.func = alc_fixup_dell_xps13,
6064 .chained = true,
6065 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6066 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006067 [ALC292_FIXUP_DISABLE_AAMIX] = {
6068 .type = HDA_FIXUP_FUNC,
6069 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08006070 .chained = true,
6071 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006072 },
David Henningssonc04017e2015-12-15 14:44:03 +01006073 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6074 .type = HDA_FIXUP_FUNC,
6075 .v.func = alc_fixup_disable_aamix,
6076 .chained = true,
6077 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6078 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006079 [ALC292_FIXUP_DELL_E7X] = {
6080 .type = HDA_FIXUP_FUNC,
6081 .v.func = alc_fixup_dell_xps13,
6082 .chained = true,
6083 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6084 },
Kailang Yang977e6272015-05-18 15:31:20 +08006085 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6086 .type = HDA_FIXUP_PINS,
6087 .v.pins = (const struct hda_pintbl[]) {
6088 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6089 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6090 { }
6091 },
6092 .chained = true,
6093 .chain_id = ALC269_FIXUP_HEADSET_MODE
6094 },
Hui Wang2f726ae2017-03-31 10:31:40 +08006095 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6096 .type = HDA_FIXUP_PINS,
6097 .v.pins = (const struct hda_pintbl[]) {
6098 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6099 { }
6100 },
6101 .chained = true,
6102 .chain_id = ALC269_FIXUP_HEADSET_MODE
6103 },
Kailang Yang6ed11312015-10-26 15:37:39 +08006104 [ALC275_FIXUP_DELL_XPS] = {
6105 .type = HDA_FIXUP_VERBS,
6106 .v.verbs = (const struct hda_verb[]) {
6107 /* Enables internal speaker */
6108 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6109 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6110 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6111 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6112 {}
6113 }
6114 },
Hui Wang8c697292015-11-24 11:08:18 +08006115 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
6116 .type = HDA_FIXUP_VERBS,
6117 .v.verbs = (const struct hda_verb[]) {
6118 /* Disable pass-through path for FRONT 14h */
6119 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
6120 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
6121 {}
6122 },
6123 .chained = true,
6124 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6125 },
Hui Wang23adc192015-12-08 12:27:18 +08006126 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6127 .type = HDA_FIXUP_FUNC,
6128 .v.func = alc_fixup_disable_aamix,
6129 .chained = true,
6130 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6131 },
Kailang3694cb22015-12-28 11:35:24 +08006132 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6133 .type = HDA_FIXUP_FUNC,
6134 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6135 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006136 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6137 .type = HDA_FIXUP_FUNC,
6138 .v.func = alc_fixup_disable_aamix,
6139 .chained = true,
6140 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6141 },
David Henningsson2ae95572016-02-25 09:37:05 +01006142 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6143 .type = HDA_FIXUP_VERBS,
6144 .v.verbs = (const struct hda_verb[]) {
6145 /* Disable pass-through path for FRONT 14h */
6146 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6147 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6148 {}
6149 },
6150 .chained = true,
6151 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6152 },
Takashi Iwaif8839822016-02-25 14:31:59 +01006153 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6154 .type = HDA_FIXUP_FUNC,
6155 .v.func = alc_fixup_disable_aamix,
6156 .chained = true,
6157 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6158 },
Hui Wange549d192016-04-01 11:00:15 +08006159 [ALC221_FIXUP_HP_FRONT_MIC] = {
6160 .type = HDA_FIXUP_PINS,
6161 .v.pins = (const struct hda_pintbl[]) {
6162 { 0x19, 0x02a19020 }, /* Front Mic */
6163 { }
6164 },
6165 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02006166 [ALC292_FIXUP_TPT460] = {
6167 .type = HDA_FIXUP_FUNC,
6168 .v.func = alc_fixup_tpt440_dock,
6169 .chained = true,
6170 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6171 },
Hui Wangdd9aa332016-08-01 10:20:32 +08006172 [ALC298_FIXUP_SPK_VOLUME] = {
6173 .type = HDA_FIXUP_FUNC,
6174 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08006175 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08006176 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08006177 },
Takashi Iwaie312a862018-03-06 12:14:17 +01006178 [ALC295_FIXUP_DISABLE_DAC3] = {
6179 .type = HDA_FIXUP_FUNC,
6180 .v.func = alc295_fixup_disable_dac3,
6181 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006182 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6183 .type = HDA_FIXUP_PINS,
6184 .v.pins = (const struct hda_pintbl[]) {
6185 { 0x1b, 0x90170151 },
6186 { }
6187 },
6188 .chained = true,
6189 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6190 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006191 [ALC269_FIXUP_ATIV_BOOK_8] = {
6192 .type = HDA_FIXUP_FUNC,
6193 .v.func = alc_fixup_auto_mute_via_amp,
6194 .chained = true,
6195 .chain_id = ALC269_FIXUP_NO_SHUTUP
6196 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006197 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6198 .type = HDA_FIXUP_PINS,
6199 .v.pins = (const struct hda_pintbl[]) {
6200 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6201 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6202 { }
6203 },
6204 .chained = true,
6205 .chain_id = ALC269_FIXUP_HEADSET_MODE
6206 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06006207 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6208 .type = HDA_FIXUP_FUNC,
6209 .v.func = alc_fixup_headset_mode,
6210 },
6211 [ALC256_FIXUP_ASUS_MIC] = {
6212 .type = HDA_FIXUP_PINS,
6213 .v.pins = (const struct hda_pintbl[]) {
6214 { 0x13, 0x90a60160 }, /* use as internal mic */
6215 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6216 { }
6217 },
6218 .chained = true,
6219 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6220 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06006221 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
6222 .type = HDA_FIXUP_VERBS,
6223 .v.verbs = (const struct hda_verb[]) {
6224 /* Set up GPIO2 for the speaker amp */
6225 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
6226 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
6227 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
6228 {}
6229 },
6230 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06006231 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6232 .type = HDA_FIXUP_PINS,
6233 .v.pins = (const struct hda_pintbl[]) {
6234 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6235 { }
6236 },
6237 .chained = true,
6238 .chain_id = ALC269_FIXUP_HEADSET_MIC
6239 },
6240 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6241 .type = HDA_FIXUP_VERBS,
6242 .v.verbs = (const struct hda_verb[]) {
6243 /* Enables internal speaker */
6244 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6245 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6246 {}
6247 },
6248 .chained = true,
6249 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6250 },
Kailang Yangca169cc2017-04-25 16:17:40 +08006251 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6252 .type = HDA_FIXUP_FUNC,
6253 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6254 },
Hui Wangf33f79f2017-07-07 12:08:29 +08006255 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6256 .type = HDA_FIXUP_PINS,
6257 .v.pins = (const struct hda_pintbl[]) {
6258 /* Change the mic location from front to right, otherwise there are
6259 two front mics with the same name, pulseaudio can't handle them.
6260 This is just a temporary workaround, after applying this fixup,
6261 there will be one "Front Mic" and one "Mic" in this machine.
6262 */
6263 { 0x1a, 0x04a19040 },
6264 { }
6265 },
6266 },
Kailang Yang5f364132017-07-25 16:28:16 +08006267 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6268 .type = HDA_FIXUP_PINS,
6269 .v.pins = (const struct hda_pintbl[]) {
6270 { 0x16, 0x0101102f }, /* Rear Headset HP */
6271 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6272 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6273 { 0x1b, 0x02011020 },
6274 { }
6275 },
6276 .chained = true,
6277 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6278 },
PeiSen Houb84e8432017-09-01 15:11:56 +08006279 [ALC700_FIXUP_INTEL_REFERENCE] = {
6280 .type = HDA_FIXUP_VERBS,
6281 .v.verbs = (const struct hda_verb[]) {
6282 /* Enables internal speaker */
6283 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6284 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6285 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6286 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6287 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6288 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6289 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6290 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6291 {}
6292 }
6293 },
Kailang Yang92266652017-12-14 15:28:58 +08006294 [ALC274_FIXUP_DELL_BIND_DACS] = {
6295 .type = HDA_FIXUP_FUNC,
6296 .v.func = alc274_fixup_bind_dacs,
6297 .chained = true,
6298 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6299 },
6300 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6301 .type = HDA_FIXUP_PINS,
6302 .v.pins = (const struct hda_pintbl[]) {
6303 { 0x1b, 0x0401102f },
6304 { }
6305 },
6306 .chained = true,
6307 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6308 },
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006309 [ALC298_FIXUP_TPT470_DOCK] = {
6310 .type = HDA_FIXUP_FUNC,
6311 .v.func = alc_fixup_tpt470_dock,
6312 .chained = true,
6313 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6314 },
Kailang Yangae104a22018-02-05 16:07:20 +08006315 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6316 .type = HDA_FIXUP_PINS,
6317 .v.pins = (const struct hda_pintbl[]) {
6318 { 0x14, 0x0201101f },
6319 { }
6320 },
6321 .chained = true,
6322 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6323 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006324 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
6325 .type = HDA_FIXUP_PINS,
6326 .v.pins = (const struct hda_pintbl[]) {
6327 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6328 { }
6329 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08006330 .chained = true,
6331 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006332 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006333 [ALC295_FIXUP_HP_X360] = {
6334 .type = HDA_FIXUP_FUNC,
6335 .v.func = alc295_fixup_hp_top_speakers,
6336 .chained = true,
6337 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
6338 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02006339};
6340
6341static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01006342 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02006343 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6344 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02006345 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02006346 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6347 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02006348 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6349 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05006350 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006351 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02006352 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01006353 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
David Henningssonaaedfb42013-08-16 14:09:02 +02006354 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08006355 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01006356 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01006357 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006358 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
6359 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01006360 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02006361 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6362 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6363 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01006364 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6365 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01006366 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02006367 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01006368 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08006369 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6370 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08006371 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02006372 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02006373 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08006374 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08006375 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6376 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01006377 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6378 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6379 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6380 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6381 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Feng423cd782016-05-20 15:47:23 +08006382 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006383 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006384 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Kai-Heng Feng423cd782016-05-20 15:47:23 +08006385 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Hui Wangdd9aa332016-08-01 10:20:32 +08006386 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwaie312a862018-03-06 12:14:17 +01006387 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Takashi Iwai493de342017-02-28 17:27:57 +01006388 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kailang Yang5f364132017-07-25 16:28:16 +08006389 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Takashi Iwaie4c9fd12018-01-10 08:34:28 +01006390 SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08006391 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6392 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006393 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6394 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08006395 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yanga22aa262014-04-23 17:34:28 +08006396 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6397 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006398 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006399 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01006400 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
David Henningsson33f4acd2015-01-07 15:50:13 +01006401 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08006402 /* ALC282 */
Hui Wang7976eb42015-02-13 11:14:41 +08006403 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006404 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006405 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006406 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6407 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6408 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6409 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006410 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006411 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006412 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6413 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006414 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006415 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
TienFu Chenb4b33f92015-01-20 15:06:21 +01006416 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
TienFu Chen3271cb22015-02-10 09:09:41 +01006417 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yangc60666b2014-02-21 16:23:35 +08006418 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006419 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6420 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6421 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006422 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Keith Packard98973f22015-07-15 12:14:39 -07006423 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006424 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6425 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006426 /* ALC290 */
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006427 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006428 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006429 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006430 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6431 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6432 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6433 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6434 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006435 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006436 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006437 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006438 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6439 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6440 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006441 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6442 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006443 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006444 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006445 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006446 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006447 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6448 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006449 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6450 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006451 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006452 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6453 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6454 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6455 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwaif8839822016-02-25 14:31:59 +01006456 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
Hui Wange549d192016-04-01 11:00:15 +08006457 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006458 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006459 SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6460 SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006461 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02006462 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02006463 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006464 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006465 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02006466 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006467 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6468 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6469 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006470 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
6471 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
6472 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01006473 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01006474 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02006475 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai017f2a12011-07-09 14:42:25 +02006476 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06006477 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
David Henningsson693b6132012-06-22 19:12:10 +02006478 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06006479 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006480 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006481 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Chris Chiueeed4cd2017-02-28 14:17:15 -06006482 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006483 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
6484 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
6485 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6486 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02006487 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwaif88abaa2014-02-07 12:07:59 +01006488 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
David Henningsson88cfcf82013-10-11 10:18:45 +02006489 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006490 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
6491 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6492 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006493 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwai24519912011-08-16 15:08:49 +02006494 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006495 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006496 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Takashi Iwai88776f32015-05-01 09:20:34 +02006497 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006498 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
David Henningsson2041d562014-06-13 11:15:44 +02006499 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08006500 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
David Henningssona33cc482014-10-07 10:18:41 +02006501 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006502 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Anisse Astierabaa22742016-08-24 09:14:13 +02006503 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
6504 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Kailang Yangca169cc2017-04-25 16:17:40 +08006505 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006506 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
6507 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
6508 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
6509 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
6510 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwai707fba32012-08-02 09:04:39 +02006511 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
Felix Kaechelec8415a42012-08-06 23:02:01 +02006512 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Stefán Freyr84f98fd2012-10-19 22:46:00 +02006513 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02006514 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02006515 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02006516 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01006517 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02006518 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02006519 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05006520 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02006521 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01006522 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02006523 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01006524 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07006525 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02006526 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006527 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6528 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02006529 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02006530 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006531 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
6532 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6533 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01006534 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006535 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6536 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6537 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01006538 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang3694cb22015-12-28 11:35:24 +08006539 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08006540 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08006541 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08006542 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wanga3dafb22018-04-19 13:29:05 +08006543 SND_PCI_QUIRK(0x17aa, 0x3138, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08006544 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
David Henningsson56f27012016-01-11 09:33:14 +01006545 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01006546 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006547 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
David Henningssona4a9e082013-08-16 14:09:01 +02006548 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02006549 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02006550 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02006551 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02006552 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01006553 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02006554 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02006555 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08006556 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02006557 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02006558 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02006559 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006560 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6561 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6562 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02006563 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006564 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6565 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningsson012e7eb2012-08-08 08:43:37 +02006566 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006567 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Anisse Astier02b504d2013-06-03 11:53:10 +02006568 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02006569
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01006570#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02006571 /* Below is a quirk table taken from the old code.
6572 * Basically the device should work as is without the fixup table.
6573 * If BIOS doesn't give a proper info, enable the corresponding
6574 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02006575 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02006576 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
6577 ALC269_FIXUP_AMIC),
6578 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02006579 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
6580 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
6581 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
6582 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
6583 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
6584 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
6585 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
6586 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
6587 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
6588 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
6589 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
6590 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
6591 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
6592 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
6593 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
6594 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
6595 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
6596 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
6597 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
6598 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
6599 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
6600 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
6601 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
6602 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
6603 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
6604 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
6605 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
6606 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
6607 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
6608 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
6609 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
6610 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
6611 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
6612 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
6613 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
6614 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
6615 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
6616 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
6617#endif
6618 {}
6619};
6620
David Henningsson214eef72014-07-22 14:09:35 +02006621static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
6622 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
6623 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
6624 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
6625 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
6626 {}
6627};
6628
Takashi Iwai1727a772013-01-10 09:52:52 +01006629static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006630 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
6631 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02006632 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
6633 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
6634 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02006635 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02006636 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
6637 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02006638 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006639 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006640 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02006641 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
6642 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08006643 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08006644 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02006645 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01006646 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02006647 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02006648 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02006649 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02006650 {}
6651};
Kailang Yangcfc5a842016-02-03 15:20:39 +08006652#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08006653 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02006654
Hui Wange8191a82015-04-24 13:39:59 +08006655#define ALC256_STANDARD_PINS \
6656 {0x12, 0x90a60140}, \
6657 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08006658 {0x21, 0x02211020}
6659
David Henningssonfea185e2014-09-03 10:23:04 +02006660#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08006661 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08006662
David Henningssonfea185e2014-09-03 10:23:04 +02006663#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08006664 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02006665
6666#define ALC292_STANDARD_PINS \
6667 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08006668 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08006669
Hui Wang3f6409702016-09-11 11:26:16 +08006670#define ALC295_STANDARD_PINS \
6671 {0x12, 0xb7a60130}, \
6672 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08006673 {0x21, 0x04211020}
6674
Woodrow Shen703867e2015-08-05 12:34:12 +08006675#define ALC298_STANDARD_PINS \
6676 {0x12, 0x90a60130}, \
6677 {0x21, 0x03211020}
6678
Hui Wange1918932014-05-26 16:22:44 +08006679static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Chris Chiu5824ce82017-02-28 14:17:11 -06006680 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
6681 {0x12, 0x90a601c0},
6682 {0x14, 0x90171120},
6683 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06006684 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6685 {0x14, 0x90170110},
6686 {0x1b, 0x90a70130},
6687 {0x21, 0x03211020}),
6688 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6689 {0x1a, 0x90a70130},
6690 {0x1b, 0x90170110},
6691 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01006692 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08006693 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08006694 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08006695 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01006696 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08006697 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08006698 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08006699 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08006700 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6701 ALC225_STANDARD_PINS,
6702 {0x12, 0xb7a60150},
6703 {0x14, 0x901701a0}),
6704 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6705 ALC225_STANDARD_PINS,
6706 {0x12, 0xb7a60150},
6707 {0x14, 0x901701b0}),
6708 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6709 ALC225_STANDARD_PINS,
6710 {0x12, 0xb7a60130},
6711 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05006712 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6713 {0x1b, 0x01111010},
6714 {0x1e, 0x01451130},
6715 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08006716 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
6717 {0x12, 0x90a60140},
6718 {0x14, 0x90170110},
6719 {0x19, 0x02a11030},
6720 {0x21, 0x02211020}),
Hui Wangf2657882017-10-24 16:53:34 +08006721 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6722 {0x12, 0x90a60140},
6723 {0x14, 0x90170110},
6724 {0x21, 0x02211020}),
6725 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6726 {0x12, 0x90a60140},
6727 {0x14, 0x90170150},
6728 {0x21, 0x02211020}),
Hui Wangc77900e2014-09-03 11:31:07 +08006729 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08006730 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08006731 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02006732 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08006733 {0x14, 0x90170130},
6734 {0x21, 0x02211040}),
6735 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02006736 {0x12, 0x90a60140},
6737 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02006738 {0x21, 0x02211020}),
6739 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6740 {0x12, 0x90a60160},
6741 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02006742 {0x21, 0x02211030}),
6743 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08006744 {0x14, 0x90170110},
6745 {0x1b, 0x02011020},
6746 {0x21, 0x0221101f}),
6747 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08006748 {0x14, 0x90170110},
6749 {0x1b, 0x01011020},
6750 {0x21, 0x0221101f}),
6751 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02006752 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02006753 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02006754 {0x21, 0x0221103f}),
6755 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08006756 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08006757 {0x1b, 0x01011020},
6758 {0x21, 0x0221103f}),
6759 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6760 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08006761 {0x1b, 0x02011020},
6762 {0x21, 0x0221103f}),
6763 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08006764 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08006765 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08006766 {0x21, 0x0221105f}),
6767 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08006768 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08006769 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08006770 {0x21, 0x0221101f}),
6771 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02006772 {0x12, 0x90a60160},
6773 {0x14, 0x90170120},
6774 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02006775 {0x21, 0x0321102f}),
6776 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6777 {0x12, 0x90a60160},
6778 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02006779 {0x21, 0x02211040}),
6780 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6781 {0x12, 0x90a60160},
6782 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02006783 {0x21, 0x02211050}),
6784 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6785 {0x12, 0x90a60170},
6786 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02006787 {0x21, 0x02211030}),
6788 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6789 {0x12, 0x90a60170},
6790 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02006791 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08006792 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08006793 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08006794 {0x14, 0x90171130},
6795 {0x21, 0x02211040}),
6796 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6797 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08006798 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08006799 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02006800 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02006801 {0x12, 0x90a60180},
6802 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02006803 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08006804 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6805 {0x12, 0x90a60180},
6806 {0x14, 0x90170120},
6807 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08006808 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6809 {0x1b, 0x01011020},
6810 {0x21, 0x02211010}),
Kailang Yang7081adf2015-03-30 17:05:37 +08006811 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang285d5dd2017-12-22 11:17:45 +08006812 {0x12, 0x90a60130},
6813 {0x14, 0x90170110},
6814 {0x1b, 0x01011020},
6815 {0x21, 0x0221101f}),
6816 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang81a12312015-05-28 16:48:22 +08006817 {0x12, 0x90a60160},
6818 {0x14, 0x90170120},
Kailang Yang81a12312015-05-28 16:48:22 +08006819 {0x21, 0x02211030}),
6820 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shenf83c3292016-06-24 15:58:34 +08006821 {0x12, 0x90a60170},
6822 {0x14, 0x90170120},
6823 {0x21, 0x02211030}),
Shrirang Bagul311042d2016-08-29 15:19:27 +08006824 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6825 {0x12, 0x90a60180},
6826 {0x14, 0x90170120},
6827 {0x21, 0x02211030}),
Woodrow Shenf83c3292016-06-24 15:58:34 +08006828 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang3f6409702016-09-11 11:26:16 +08006829 {0x12, 0xb7a60130},
6830 {0x14, 0x90170110},
6831 {0x21, 0x02211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01006832 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang3f2f7c52018-01-29 14:23:15 +08006833 {0x12, 0x90a60130},
6834 {0x14, 0x90170110},
6835 {0x14, 0x01011020},
6836 {0x21, 0x0221101f}),
6837 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncf51eb92014-10-30 08:26:02 +01006838 ALC256_STANDARD_PINS),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006839 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
6840 {0x14, 0x90170110},
6841 {0x1b, 0x90a70130},
6842 {0x21, 0x04211020}),
6843 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
6844 {0x14, 0x90170110},
6845 {0x1b, 0x90a70130},
6846 {0x21, 0x03211020}),
Kailang Yang92266652017-12-14 15:28:58 +08006847 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Hui Wang75ee94b2017-11-09 08:48:08 +08006848 {0x12, 0xb7a60130},
6849 {0x13, 0xb8a61140},
6850 {0x16, 0x90170110},
6851 {0x21, 0x04211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01006852 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
6853 {0x12, 0x90a60130},
6854 {0x14, 0x90170110},
6855 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08006856 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08006857 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
6858 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08006859 {0x14, 0x90170110},
6860 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08006861 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08006862 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08006863 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02006864 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006865 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02006866 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02006867 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02006868 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08006869 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006870 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08006871 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08006872 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08006873 {0x21, 0x03211040}),
6874 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006875 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08006876 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08006877 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08006878 {0x21, 0x03211020}),
6879 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006880 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08006881 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08006882 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08006883 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08006884 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02006885 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08006886 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08006887 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08006888 {0x21, 0x04211020}),
David Henningsson76c21322014-06-24 14:46:54 +02006889 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006890 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02006891 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02006892 {0x21, 0x0321101f}),
6893 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6894 {0x12, 0x90a60160},
6895 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02006896 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08006897 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006898 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08006899 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08006900 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08006901 {0x21, 0x0321101f}),
Kailang Yange1e62b92015-04-08 16:01:22 +08006902 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL_XPS_13_GPIO6,
Kailang Yange1e62b92015-04-08 16:01:22 +08006903 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08006904 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08006905 {0x21, 0x0321101f}),
Hui Wangd5078192018-03-02 13:05:36 +08006906 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Hui Wang3f2f7c52018-01-29 14:23:15 +08006907 {0x12, 0xb7a60130},
6908 {0x14, 0x90170110},
6909 {0x21, 0x04211020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006910 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006911 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006912 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08006913 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08006914 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006915 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006916 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006917 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08006918 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08006919 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006920 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006921 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006922 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08006923 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006924 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006925 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006926 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08006927 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08006928 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006929 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006930 {0x14, 0x90170110},
6931 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08006932 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08006933 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006934 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006935 {0x14, 0x90170110},
6936 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08006937 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006938 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006939 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006940 {0x14, 0x90170110},
6941 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08006942 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08006943 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006944 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08006945 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08006946 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08006947 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08006948 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006949 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08006950 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08006951 {0x16, 0x01014020},
6952 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08006953 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02006954 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006955 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08006956 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02006957 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006958 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02006959 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02006960 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08006961 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02006962 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006963 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08006964 {0x13, 0x90a60140}),
Hui Wang3f6409702016-09-11 11:26:16 +08006965 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08006966 ALC295_STANDARD_PINS,
6967 {0x17, 0x21014020},
6968 {0x18, 0x21a19030}),
6969 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6970 ALC295_STANDARD_PINS,
6971 {0x17, 0x21014040},
6972 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08006973 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6974 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08006975 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08006976 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02006977 {0x17, 0x90170110}),
6978 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6979 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08006980 {0x17, 0x90170140}),
6981 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
6982 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02006983 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08006984 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
6985 {0x12, 0xb7a60140},
6986 {0x13, 0xb7a60150},
6987 {0x17, 0x90170110},
6988 {0x1a, 0x03011020},
6989 {0x21, 0x03211030}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08006990 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
6991 ALC225_STANDARD_PINS,
6992 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08006993 {0x17, 0x90170110}),
Hui Wange1918932014-05-26 16:22:44 +08006994 {}
6995};
Takashi Iwai1d045db2011-07-07 18:23:21 +02006996
Takashi Iwai546bb672012-03-07 08:37:19 +01006997static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02006998{
Kailang Yang526af6e2012-03-07 08:25:20 +01006999 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007000 int val;
7001
Kailang Yang526af6e2012-03-07 08:25:20 +01007002 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01007003 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01007004
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007005 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007006 alc_write_coef_idx(codec, 0xf, 0x960b);
7007 alc_write_coef_idx(codec, 0xe, 0x8817);
7008 }
7009
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007010 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007011 alc_write_coef_idx(codec, 0xf, 0x960b);
7012 alc_write_coef_idx(codec, 0xe, 0x8814);
7013 }
7014
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007015 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007016 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02007017 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007018 }
7019
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007020 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007021 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02007022 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007023 /* Capless ramp up clock control */
7024 alc_write_coef_idx(codec, 0xd, val | (1<<10));
7025 }
7026 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02007027 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007028 /* Class D power on reset */
7029 alc_write_coef_idx(codec, 0x17, val | (1<<7));
7030 }
7031 }
7032
Takashi Iwai98b24882014-08-18 13:47:50 +02007033 /* HP */
7034 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007035}
7036
7037/*
7038 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007039static int patch_alc269(struct hda_codec *codec)
7040{
7041 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02007042 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007043
Takashi Iwai3de95172012-05-07 18:03:15 +02007044 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007045 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02007046 return err;
7047
7048 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01007049 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007050 codec->power_save_node = 1;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007051
Takashi Iwai225068a2015-05-29 10:42:14 +02007052#ifdef CONFIG_PM
7053 codec->patch_ops.suspend = alc269_suspend;
7054 codec->patch_ops.resume = alc269_resume;
7055#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08007056 spec->shutup = alc_default_shutup;
7057 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02007058
Takashi Iwai1727a772013-01-10 09:52:52 +01007059 snd_hda_pick_fixup(codec, alc269_fixup_models,
Herton Ronaldo Krzesinski9f720bb92012-09-27 10:38:14 -03007060 alc269_fixup_tbl, alc269_fixups);
Hui Wange1918932014-05-26 16:22:44 +08007061 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
David Henningsson214eef72014-07-22 14:09:35 +02007062 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
7063 alc269_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01007064 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Herton Ronaldo Krzesinski9f720bb92012-09-27 10:38:14 -03007065
7066 alc_auto_parse_customize_define(codec);
7067
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007068 if (has_cdefine_beep(codec))
7069 spec->gen.beep_nid = 0x01;
7070
Takashi Iwai7639a062015-03-03 10:07:24 +01007071 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01007072 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02007073 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007074 switch (alc_get_coef0(codec) & 0x00f0) {
7075 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01007076 if (codec->bus->pci &&
7077 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007078 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02007079 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02007080 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007081 break;
7082 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01007083 if (codec->bus->pci &&
7084 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007085 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02007086 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02007087 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007088 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02007089 case 0x0030:
7090 spec->codec_variant = ALC269_TYPE_ALC269VD;
7091 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007092 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02007093 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007094 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007095 if (err < 0)
7096 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08007097 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01007098 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007099 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01007100 break;
7101
7102 case 0x10ec0280:
7103 case 0x10ec0290:
7104 spec->codec_variant = ALC269_TYPE_ALC280;
7105 break;
7106 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01007107 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08007108 spec->shutup = alc282_shutup;
7109 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01007110 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02007111 case 0x10ec0233:
7112 case 0x10ec0283:
7113 spec->codec_variant = ALC269_TYPE_ALC283;
7114 spec->shutup = alc283_shutup;
7115 spec->init_hook = alc283_init;
7116 break;
Kailang Yang065380f2013-01-10 10:25:48 +01007117 case 0x10ec0284:
7118 case 0x10ec0292:
7119 spec->codec_variant = ALC269_TYPE_ALC284;
7120 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02007121 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08007122 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02007123 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02007124 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08007125 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02007126 spec->codec_variant = ALC269_TYPE_ALC286;
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08007127 spec->shutup = alc286_shutup;
Kailang Yang7fc7d042013-04-25 11:04:43 +02007128 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08007129 case 0x10ec0298:
7130 spec->codec_variant = ALC269_TYPE_ALC298;
7131 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08007132 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02007133 case 0x10ec0255:
7134 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08007135 spec->shutup = alc256_shutup;
7136 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02007137 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08007138 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08007139 case 0x10ec0256:
7140 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08007141 spec->shutup = alc256_shutup;
7142 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02007143 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yangd32b6662015-04-23 15:10:53 +08007144 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
Kailang Yang4344aec2014-12-17 17:39:05 +08007145 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08007146 case 0x10ec0257:
7147 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08007148 spec->shutup = alc256_shutup;
7149 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08007150 spec->gen.mixer_nid = 0;
7151 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08007152 case 0x10ec0215:
7153 case 0x10ec0285:
7154 case 0x10ec0289:
7155 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08007156 spec->shutup = alc225_shutup;
7157 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08007158 spec->gen.mixer_nid = 0;
7159 break;
Kailang Yang42314302016-02-03 15:03:50 +08007160 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08007161 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08007162 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08007163 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08007164 spec->shutup = alc225_shutup;
7165 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01007166 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08007167 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08007168 case 0x10ec0234:
7169 case 0x10ec0274:
7170 case 0x10ec0294:
7171 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08007172 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08007173 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08007174 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08007175 case 0x10ec0700:
7176 case 0x10ec0701:
7177 case 0x10ec0703:
7178 spec->codec_variant = ALC269_TYPE_ALC700;
7179 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08007180 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang6fbae352016-05-30 16:44:20 +08007181 break;
7182
Takashi Iwai1d045db2011-07-07 18:23:21 +02007183 }
7184
Kailang Yangad60d502013-06-28 12:03:01 +02007185 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05007186 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02007187 spec->init_hook = alc5505_dsp_init;
7188 }
7189
Takashi Iwaia4297b52011-08-23 18:40:12 +02007190 /* automatic parse from the BIOS config */
7191 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007192 if (err < 0)
7193 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007194
David Henningsson7d1b6e22015-04-21 10:48:46 +02007195 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid)
7196 set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007197
Takashi Iwai1727a772013-01-10 09:52:52 +01007198 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007199
Takashi Iwai1d045db2011-07-07 18:23:21 +02007200 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007201
7202 error:
7203 alc_free(codec);
7204 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007205}
7206
7207/*
7208 * ALC861
7209 */
7210
Takashi Iwai1d045db2011-07-07 18:23:21 +02007211static int alc861_parse_auto_config(struct hda_codec *codec)
7212{
Takashi Iwai1d045db2011-07-07 18:23:21 +02007213 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007214 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
7215 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007216}
7217
Takashi Iwai1d045db2011-07-07 18:23:21 +02007218/* Pin config fixes */
7219enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007220 ALC861_FIXUP_FSC_AMILO_PI1505,
7221 ALC861_FIXUP_AMP_VREF_0F,
7222 ALC861_FIXUP_NO_JACK_DETECT,
7223 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007224 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007225};
7226
Takashi Iwai31150f22012-01-30 10:54:08 +01007227/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
7228static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007229 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01007230{
7231 struct alc_spec *spec = codec->spec;
7232 unsigned int val;
7233
Takashi Iwai1727a772013-01-10 09:52:52 +01007234 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01007235 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01007236 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01007237 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
7238 val |= AC_PINCTL_IN_EN;
7239 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02007240 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01007241 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01007242}
7243
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007244/* suppress the jack-detection */
7245static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007246 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007247{
Takashi Iwai1727a772013-01-10 09:52:52 +01007248 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007249 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02007250}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007251
Takashi Iwai1727a772013-01-10 09:52:52 +01007252static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007253 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007254 .type = HDA_FIXUP_PINS,
7255 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007256 { 0x0b, 0x0221101f }, /* HP */
7257 { 0x0f, 0x90170310 }, /* speaker */
7258 { }
7259 }
7260 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007261 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007262 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01007263 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01007264 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007265 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007266 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007267 .v.func = alc_fixup_no_jack_detect,
7268 },
7269 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007270 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007271 .v.func = alc861_fixup_asus_amp_vref_0f,
7272 .chained = true,
7273 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007274 },
7275 [ALC660_FIXUP_ASUS_W7J] = {
7276 .type = HDA_FIXUP_VERBS,
7277 .v.verbs = (const struct hda_verb[]) {
7278 /* ASUS W7J needs a magic pin setup on unused NID 0x10
7279 * for enabling outputs
7280 */
7281 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7282 { }
7283 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007284 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007285};
7286
7287static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007288 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01007289 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007290 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
7291 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
7292 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
7293 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
7294 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
7295 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007296 {}
7297};
7298
7299/*
7300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007301static int patch_alc861(struct hda_codec *codec)
7302{
7303 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007304 int err;
7305
Takashi Iwai3de95172012-05-07 18:03:15 +02007306 err = alc_alloc_spec(codec, 0x15);
7307 if (err < 0)
7308 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007309
Takashi Iwai3de95172012-05-07 18:03:15 +02007310 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007311 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007312
Takashi Iwai225068a2015-05-29 10:42:14 +02007313#ifdef CONFIG_PM
7314 spec->power_hook = alc_power_eapd;
7315#endif
7316
Takashi Iwai1727a772013-01-10 09:52:52 +01007317 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
7318 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007319
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007320 /* automatic parse from the BIOS config */
7321 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007322 if (err < 0)
7323 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007324
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007325 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007326 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007327
Takashi Iwai1727a772013-01-10 09:52:52 +01007328 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007329
Takashi Iwai1d045db2011-07-07 18:23:21 +02007330 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007331
7332 error:
7333 alc_free(codec);
7334 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007335}
7336
7337/*
7338 * ALC861-VD support
7339 *
7340 * Based on ALC882
7341 *
7342 * In addition, an independent DAC
7343 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007344static int alc861vd_parse_auto_config(struct hda_codec *codec)
7345{
Takashi Iwai1d045db2011-07-07 18:23:21 +02007346 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007347 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7348 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007349}
7350
Takashi Iwai1d045db2011-07-07 18:23:21 +02007351enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007352 ALC660VD_FIX_ASUS_GPIO1,
7353 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007354};
7355
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007356/* exclude VREF80 */
7357static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007358 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007359{
Takashi Iwai1727a772013-01-10 09:52:52 +01007360 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01007361 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
7362 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007363 }
7364}
7365
Takashi Iwai1727a772013-01-10 09:52:52 +01007366static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007367 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007368 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007369 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007370 /* reset GPIO1 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007371 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7372 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
7373 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
7374 { }
7375 }
7376 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007377 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007378 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007379 .v.func = alc861vd_fixup_dallas,
7380 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02007381};
7382
7383static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007384 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007385 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007386 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007387 {}
7388};
7389
Takashi Iwai1d045db2011-07-07 18:23:21 +02007390/*
7391 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007392static int patch_alc861vd(struct hda_codec *codec)
7393{
7394 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007395 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007396
Takashi Iwai3de95172012-05-07 18:03:15 +02007397 err = alc_alloc_spec(codec, 0x0b);
7398 if (err < 0)
7399 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007400
Takashi Iwai3de95172012-05-07 18:03:15 +02007401 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007402 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007403
Takashi Iwai225068a2015-05-29 10:42:14 +02007404 spec->shutup = alc_eapd_shutup;
7405
Takashi Iwai1727a772013-01-10 09:52:52 +01007406 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
7407 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007408
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007409 /* automatic parse from the BIOS config */
7410 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007411 if (err < 0)
7412 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007413
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007414 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007415 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007416
Takashi Iwai1727a772013-01-10 09:52:52 +01007417 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007418
Takashi Iwai1d045db2011-07-07 18:23:21 +02007419 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007420
7421 error:
7422 alc_free(codec);
7423 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007424}
7425
7426/*
7427 * ALC662 support
7428 *
7429 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
7430 * configuration. Each pin widget can choose any input DACs and a mixer.
7431 * Each ADC is connected from a mixer of all inputs. This makes possible
7432 * 6-channel independent captures.
7433 *
7434 * In addition, an independent DAC for the multi-playback (not used in this
7435 * driver yet).
7436 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007437
7438/*
7439 * BIOS auto configuration
7440 */
7441
Kailang Yangbc9f98a2007-04-12 13:06:07 +02007442static int alc662_parse_auto_config(struct hda_codec *codec)
7443{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02007444 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007445 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
7446 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7447 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02007448
Takashi Iwai7639a062015-03-03 10:07:24 +01007449 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
7450 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
7451 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007452 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01007453 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007454 ssids = alc662_ssids;
7455 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02007456}
7457
Todd Broch6be79482010-12-07 16:51:05 -08007458static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007459 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01007460{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01007461 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01007462 return;
Todd Broch6be79482010-12-07 16:51:05 -08007463 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
7464 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
7465 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
7466 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
7467 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01007468 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08007469}
7470
Takashi Iwai8e383952013-10-30 17:41:12 +01007471static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
7472 { .channels = 2,
7473 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
7474 { .channels = 4,
7475 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
7476 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
7477 { }
7478};
7479
7480/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01007481static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01007482 const struct hda_fixup *fix, int action)
7483{
7484 if (action == HDA_FIXUP_ACT_BUILD) {
7485 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +01007486 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +01007487 }
7488}
7489
Takashi Iwaibf686652014-01-13 16:18:25 +01007490/* avoid D3 for keeping GPIO up */
7491static unsigned int gpio_led_power_filter(struct hda_codec *codec,
7492 hda_nid_t nid,
7493 unsigned int power_state)
7494{
7495 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +02007496 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +01007497 return AC_PWRST_D0;
7498 return power_state;
7499}
7500
Takashi Iwai3e887f32014-01-10 17:50:58 +01007501static void alc662_fixup_led_gpio1(struct hda_codec *codec,
7502 const struct hda_fixup *fix, int action)
7503{
7504 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +01007505
Takashi Iwai01e4a272018-06-19 22:47:30 +02007506 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +01007507 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01007508 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +01007509 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01007510 }
7511}
7512
Kailang Yangc6790c82016-11-25 16:15:17 +08007513static void alc662_usi_automute_hook(struct hda_codec *codec,
7514 struct hda_jack_callback *jack)
7515{
7516 struct alc_spec *spec = codec->spec;
7517 int vref;
7518 msleep(200);
7519 snd_hda_gen_hp_automute(codec, jack);
7520
7521 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
7522 msleep(100);
7523 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7524 vref);
7525}
7526
7527static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
7528 const struct hda_fixup *fix, int action)
7529{
7530 struct alc_spec *spec = codec->spec;
7531 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7532 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7533 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
7534 }
7535}
7536
Kailang Yangf3f91852014-10-24 15:43:46 +08007537static struct coef_fw alc668_coefs[] = {
7538 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
7539 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
7540 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
7541 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
7542 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
7543 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
7544 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
7545 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
7546 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
7547 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
7548 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
7549 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
7550 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
7551 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
7552 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
7553 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
7554 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
7555 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
7556 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
7557 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
7558 {}
7559};
7560
7561static void alc668_restore_default_value(struct hda_codec *codec)
7562{
7563 alc_process_coef_fw(codec, alc668_coefs);
7564}
7565
David Henningsson6cb3b702010-09-09 08:51:44 +02007566enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04007567 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01007568 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02007569 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08007570 ALC272_FIXUP_MARIO,
Anisse Astierd2ebd472011-01-20 12:36:21 +01007571 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02007572 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02007573 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02007574 ALC662_FIXUP_ASUS_MODE1,
7575 ALC662_FIXUP_ASUS_MODE2,
7576 ALC662_FIXUP_ASUS_MODE3,
7577 ALC662_FIXUP_ASUS_MODE4,
7578 ALC662_FIXUP_ASUS_MODE5,
7579 ALC662_FIXUP_ASUS_MODE6,
7580 ALC662_FIXUP_ASUS_MODE7,
7581 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01007582 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02007583 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02007584 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +02007585 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02007586 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02007587 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +02007588 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01007589 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01007590 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007591 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01007592 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08007593 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02007594 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02007595 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02007596 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02007597 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07007598 ALC668_FIXUP_ASUS_Nx51,
Kailang Yang78f4f7c2016-06-07 11:31:34 +08007599 ALC891_FIXUP_HEADSET_MODE,
7600 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08007601 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +02007602 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +08007603 ALC662_FIXUP_USI_FUNC,
7604 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +08007605 ALC662_FIXUP_LENOVO_MULTI_CODECS,
David Henningsson6cb3b702010-09-09 08:51:44 +02007606};
7607
Takashi Iwai1727a772013-01-10 09:52:52 +01007608static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04007609 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007610 .type = HDA_FIXUP_PINS,
7611 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04007612 { 0x15, 0x99130112 }, /* subwoofer */
7613 { }
7614 }
7615 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01007616 [ALC662_FIXUP_LED_GPIO1] = {
7617 .type = HDA_FIXUP_FUNC,
7618 .v.func = alc662_fixup_led_gpio1,
7619 },
David Henningsson6cb3b702010-09-09 08:51:44 +02007620 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007621 .type = HDA_FIXUP_PINS,
7622 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02007623 { 0x17, 0x99130112 }, /* subwoofer */
7624 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01007625 },
7626 .chained = true,
7627 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02007628 },
Todd Broch6be79482010-12-07 16:51:05 -08007629 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007630 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01007631 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01007632 },
7633 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007634 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +01007635 .v.verbs = (const struct hda_verb[]) {
7636 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7637 {}
7638 }
7639 },
David Henningsson94024cd2011-04-29 14:10:55 +02007640 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007641 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02007642 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +02007643 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02007644 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007645 .type = HDA_FIXUP_PINS,
7646 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02007647 { 0x14, 0x0221201f }, /* HP out */
7648 { }
7649 },
7650 .chained = true,
7651 .chain_id = ALC662_FIXUP_SKU_IGNORE
7652 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02007653 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007654 .type = HDA_FIXUP_PINS,
7655 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007656 { 0x14, 0x99130110 }, /* speaker */
7657 { 0x18, 0x01a19c20 }, /* mic */
7658 { 0x19, 0x99a3092f }, /* int-mic */
7659 { 0x21, 0x0121401f }, /* HP out */
7660 { }
7661 },
7662 .chained = true,
7663 .chain_id = ALC662_FIXUP_SKU_IGNORE
7664 },
7665 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007666 .type = HDA_FIXUP_PINS,
7667 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +02007668 { 0x14, 0x99130110 }, /* speaker */
7669 { 0x18, 0x01a19820 }, /* mic */
7670 { 0x19, 0x99a3092f }, /* int-mic */
7671 { 0x1b, 0x0121401f }, /* HP out */
7672 { }
7673 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02007674 .chained = true,
7675 .chain_id = ALC662_FIXUP_SKU_IGNORE
7676 },
7677 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007678 .type = HDA_FIXUP_PINS,
7679 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007680 { 0x14, 0x99130110 }, /* speaker */
7681 { 0x15, 0x0121441f }, /* HP */
7682 { 0x18, 0x01a19840 }, /* mic */
7683 { 0x19, 0x99a3094f }, /* int-mic */
7684 { 0x21, 0x01211420 }, /* HP2 */
7685 { }
7686 },
7687 .chained = true,
7688 .chain_id = ALC662_FIXUP_SKU_IGNORE
7689 },
7690 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007691 .type = HDA_FIXUP_PINS,
7692 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007693 { 0x14, 0x99130110 }, /* speaker */
7694 { 0x16, 0x99130111 }, /* speaker */
7695 { 0x18, 0x01a19840 }, /* mic */
7696 { 0x19, 0x99a3094f }, /* int-mic */
7697 { 0x21, 0x0121441f }, /* HP */
7698 { }
7699 },
7700 .chained = true,
7701 .chain_id = ALC662_FIXUP_SKU_IGNORE
7702 },
7703 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007704 .type = HDA_FIXUP_PINS,
7705 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007706 { 0x14, 0x99130110 }, /* speaker */
7707 { 0x15, 0x0121441f }, /* HP */
7708 { 0x16, 0x99130111 }, /* speaker */
7709 { 0x18, 0x01a19840 }, /* mic */
7710 { 0x19, 0x99a3094f }, /* int-mic */
7711 { }
7712 },
7713 .chained = true,
7714 .chain_id = ALC662_FIXUP_SKU_IGNORE
7715 },
7716 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007717 .type = HDA_FIXUP_PINS,
7718 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007719 { 0x14, 0x99130110 }, /* speaker */
7720 { 0x15, 0x01211420 }, /* HP2 */
7721 { 0x18, 0x01a19840 }, /* mic */
7722 { 0x19, 0x99a3094f }, /* int-mic */
7723 { 0x1b, 0x0121441f }, /* HP */
7724 { }
7725 },
7726 .chained = true,
7727 .chain_id = ALC662_FIXUP_SKU_IGNORE
7728 },
7729 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007730 .type = HDA_FIXUP_PINS,
7731 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007732 { 0x14, 0x99130110 }, /* speaker */
7733 { 0x17, 0x99130111 }, /* speaker */
7734 { 0x18, 0x01a19840 }, /* mic */
7735 { 0x19, 0x99a3094f }, /* int-mic */
7736 { 0x1b, 0x01214020 }, /* HP */
7737 { 0x21, 0x0121401f }, /* HP */
7738 { }
7739 },
7740 .chained = true,
7741 .chain_id = ALC662_FIXUP_SKU_IGNORE
7742 },
7743 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007744 .type = HDA_FIXUP_PINS,
7745 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007746 { 0x14, 0x99130110 }, /* speaker */
7747 { 0x12, 0x99a30970 }, /* int-mic */
7748 { 0x15, 0x01214020 }, /* HP */
7749 { 0x17, 0x99130111 }, /* speaker */
7750 { 0x18, 0x01a19840 }, /* mic */
7751 { 0x21, 0x0121401f }, /* HP */
7752 { }
7753 },
7754 .chained = true,
7755 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +02007756 },
Takashi Iwai1565cc32012-02-13 12:03:25 +01007757 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007758 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +01007759 .v.func = alc_fixup_no_jack_detect,
7760 },
David Henningssonedfe3bf2012-06-12 13:15:12 +02007761 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007762 .type = HDA_FIXUP_PINS,
7763 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +02007764 { 0x1b, 0x02214020 }, /* Front HP */
7765 { }
7766 }
7767 },
Takashi Iwai125821a2012-06-22 14:30:29 +02007768 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007769 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02007770 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +02007771 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02007772 [ALC668_FIXUP_DELL_XPS13] = {
7773 .type = HDA_FIXUP_FUNC,
7774 .v.func = alc_fixup_dell_xps13,
7775 .chained = true,
7776 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
7777 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02007778 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
7779 .type = HDA_FIXUP_FUNC,
7780 .v.func = alc_fixup_disable_aamix,
7781 .chained = true,
7782 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
7783 },
Hui Wang493a52a2014-01-14 14:07:36 +08007784 [ALC668_FIXUP_AUTO_MUTE] = {
7785 .type = HDA_FIXUP_FUNC,
7786 .v.func = alc_fixup_auto_mute_via_amp,
7787 .chained = true,
7788 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
7789 },
David Henningsson1f8b46c2015-05-12 14:38:15 +02007790 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
7791 .type = HDA_FIXUP_PINS,
7792 .v.pins = (const struct hda_pintbl[]) {
7793 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7794 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
7795 { }
7796 },
7797 .chained = true,
7798 .chain_id = ALC662_FIXUP_HEADSET_MODE
7799 },
7800 [ALC662_FIXUP_HEADSET_MODE] = {
7801 .type = HDA_FIXUP_FUNC,
7802 .v.func = alc_fixup_headset_mode_alc662,
7803 },
David Henningsson73bdd592013-04-15 15:44:14 +02007804 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
7805 .type = HDA_FIXUP_PINS,
7806 .v.pins = (const struct hda_pintbl[]) {
7807 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7808 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7809 { }
7810 },
7811 .chained = true,
7812 .chain_id = ALC668_FIXUP_HEADSET_MODE
7813 },
7814 [ALC668_FIXUP_HEADSET_MODE] = {
7815 .type = HDA_FIXUP_FUNC,
7816 .v.func = alc_fixup_headset_mode_alc668,
7817 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01007818 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +01007819 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01007820 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +01007821 .chained = true,
7822 .chain_id = ALC662_FIXUP_ASUS_MODE4
7823 },
David Henningsson61a75f12014-02-07 09:31:08 +01007824 [ALC662_FIXUP_BASS_16] = {
7825 .type = HDA_FIXUP_PINS,
7826 .v.pins = (const struct hda_pintbl[]) {
7827 {0x16, 0x80106111}, /* bass speaker */
7828 {}
7829 },
7830 .chained = true,
7831 .chain_id = ALC662_FIXUP_BASS_CHMAP,
7832 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007833 [ALC662_FIXUP_BASS_1A] = {
7834 .type = HDA_FIXUP_PINS,
7835 .v.pins = (const struct hda_pintbl[]) {
7836 {0x1a, 0x80106111}, /* bass speaker */
7837 {}
7838 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01007839 .chained = true,
7840 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007841 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01007842 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007843 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01007844 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007845 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02007846 [ALC662_FIXUP_ASUS_Nx50] = {
7847 .type = HDA_FIXUP_FUNC,
7848 .v.func = alc_fixup_auto_mute_via_amp,
7849 .chained = true,
7850 .chain_id = ALC662_FIXUP_BASS_1A
7851 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02007852 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
7853 .type = HDA_FIXUP_FUNC,
7854 .v.func = alc_fixup_headset_mode_alc668,
7855 .chain_id = ALC662_FIXUP_BASS_CHMAP
7856 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07007857 [ALC668_FIXUP_ASUS_Nx51] = {
7858 .type = HDA_FIXUP_PINS,
7859 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02007860 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7861 { 0x1a, 0x90170151 }, /* bass speaker */
7862 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07007863 {}
7864 },
7865 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02007866 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07007867 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +08007868 [ALC891_FIXUP_HEADSET_MODE] = {
7869 .type = HDA_FIXUP_FUNC,
7870 .v.func = alc_fixup_headset_mode,
7871 },
7872 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
7873 .type = HDA_FIXUP_PINS,
7874 .v.pins = (const struct hda_pintbl[]) {
7875 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7876 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7877 { }
7878 },
7879 .chained = true,
7880 .chain_id = ALC891_FIXUP_HEADSET_MODE
7881 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08007882 [ALC662_FIXUP_ACER_VERITON] = {
7883 .type = HDA_FIXUP_PINS,
7884 .v.pins = (const struct hda_pintbl[]) {
7885 { 0x15, 0x50170120 }, /* no internal speaker */
7886 { }
7887 }
7888 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +02007889 [ALC892_FIXUP_ASROCK_MOBO] = {
7890 .type = HDA_FIXUP_PINS,
7891 .v.pins = (const struct hda_pintbl[]) {
7892 { 0x15, 0x40f000f0 }, /* disabled */
7893 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +02007894 { }
7895 }
7896 },
Kailang Yangc6790c82016-11-25 16:15:17 +08007897 [ALC662_FIXUP_USI_FUNC] = {
7898 .type = HDA_FIXUP_FUNC,
7899 .v.func = alc662_fixup_usi_headset_mic,
7900 },
7901 [ALC662_FIXUP_USI_HEADSET_MODE] = {
7902 .type = HDA_FIXUP_PINS,
7903 .v.pins = (const struct hda_pintbl[]) {
7904 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
7905 { 0x18, 0x01a1903d },
7906 { }
7907 },
7908 .chained = true,
7909 .chain_id = ALC662_FIXUP_USI_FUNC
7910 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007911 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
7912 .type = HDA_FIXUP_FUNC,
7913 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
7914 },
David Henningsson6cb3b702010-09-09 08:51:44 +02007915};
7916
Takashi Iwaia9111322011-05-02 11:30:18 +02007917static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007918 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +02007919 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +01007920 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +01007921 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +02007922 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +02007923 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +02007924 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -04007925 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
David Henningsson73bdd592013-04-15 15:44:14 +02007926 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7927 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +02007928 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02007929 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +02007930 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +01007931 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff992013-11-07 09:28:59 +01007932 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +08007933 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7934 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +08007935 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02007936 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Kaho Ng2da2dc92016-05-09 00:27:49 +08007937 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +02007938 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwaidb8948e2016-01-18 09:17:30 +01007939 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02007940 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
David Henningsson8e54b4a2014-02-07 09:31:07 +01007941 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +01007942 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07007943 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
7944 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Takashi Iwaic7efff92017-01-04 21:38:16 +01007945 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +01007946 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +01007947 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +01007948 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +02007949 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -05007950 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +08007951 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +08007952 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +06007953 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +02007954 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +02007955 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +02007956 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08007957 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Anisse Astierd2ebd472011-01-20 12:36:21 +01007958 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +02007959
7960#if 0
7961 /* Below is a quirk table taken from the old code.
7962 * Basically the device should work as is without the fixup table.
7963 * If BIOS doesn't give a proper info, enable the corresponding
7964 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02007965 */
Takashi Iwai53c334a2011-08-23 18:27:14 +02007966 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
7967 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
7968 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
7969 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
7970 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
7971 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7972 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
7973 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
7974 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
7975 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7976 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
7977 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
7978 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
7979 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
7980 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
7981 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7982 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
7983 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
7984 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7985 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
7986 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
7987 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7988 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
7989 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
7990 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
7991 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7992 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
7993 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
7994 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7995 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
7996 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7997 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
7998 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
7999 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
8000 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
8001 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
8002 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
8003 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
8004 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
8005 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8006 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
8007 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
8008 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8009 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
8010 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
8011 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
8012 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
8013 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
8014 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8015 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
8016#endif
David Henningsson6cb3b702010-09-09 08:51:44 +02008017 {}
8018};
8019
Takashi Iwai1727a772013-01-10 09:52:52 +01008020static const struct hda_model_fixup alc662_fixup_models[] = {
Todd Broch6be79482010-12-07 16:51:05 -08008021 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwai53c334a2011-08-23 18:27:14 +02008022 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
8023 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
8024 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
8025 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
8026 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
8027 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
8028 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
8029 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02008030 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningssone32aa852013-06-17 11:04:02 +02008031 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02008032 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Todd Broch6be79482010-12-07 16:51:05 -08008033 {}
8034};
David Henningsson6cb3b702010-09-09 08:51:44 +02008035
Hui Wang532895c2014-05-29 15:59:19 +08008036static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008037 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8038 {0x17, 0x02211010},
8039 {0x18, 0x01a19030},
8040 {0x1a, 0x01813040},
8041 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +02008042 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02008043 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +02008044 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +02008045 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +08008046 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +02008047 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8048 {0x12, 0x99a30130},
8049 {0x14, 0x90170110},
8050 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008051 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008052 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8053 {0x12, 0x99a30140},
8054 {0x14, 0x90170110},
8055 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008056 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008057 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8058 {0x12, 0x99a30150},
8059 {0x14, 0x90170110},
8060 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008061 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008062 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +02008063 {0x14, 0x90170110},
8064 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008065 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008066 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
8067 {0x12, 0x90a60130},
8068 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08008069 {0x15, 0x0321101f}),
Hui Wang532895c2014-05-29 15:59:19 +08008070 {}
8071};
8072
Takashi Iwai1d045db2011-07-07 18:23:21 +02008073/*
8074 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008075static int patch_alc662(struct hda_codec *codec)
8076{
8077 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02008078 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008079
Takashi Iwai3de95172012-05-07 18:03:15 +02008080 err = alc_alloc_spec(codec, 0x0b);
8081 if (err < 0)
8082 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008083
Takashi Iwai3de95172012-05-07 18:03:15 +02008084 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008085
Takashi Iwai225068a2015-05-29 10:42:14 +02008086 spec->shutup = alc_eapd_shutup;
8087
Takashi Iwai53c334a2011-08-23 18:27:14 +02008088 /* handle multiple HPs as is */
8089 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
8090
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +02008091 alc_fix_pll_init(codec, 0x20, 0x04, 15);
8092
Takashi Iwai7639a062015-03-03 10:07:24 +01008093 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +08008094 case 0x10ec0668:
8095 spec->init_hook = alc668_restore_default_value;
8096 break;
Kailang Yangf3f91852014-10-24 15:43:46 +08008097 }
Kailang Yang8663ff72012-06-29 09:35:52 +02008098
Takashi Iwai1727a772013-01-10 09:52:52 +01008099 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +02008100 alc662_fixup_tbl, alc662_fixups);
Hui Wang532895c2014-05-29 15:59:19 +08008101 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01008102 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +02008103
8104 alc_auto_parse_customize_define(codec);
8105
Takashi Iwai7504b6c2013-03-18 11:25:51 +01008106 if (has_cdefine_beep(codec))
8107 spec->gen.beep_nid = 0x01;
8108
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008109 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +01008110 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008111 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +08008112 err = alc_codec_rename(codec, "ALC272X");
8113 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008114 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008115 }
Kailang Yang274693f2009-12-03 10:07:50 +01008116
Takashi Iwaib9c51062011-08-24 18:08:07 +02008117 /* automatic parse from the BIOS config */
8118 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008119 if (err < 0)
8120 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008121
Takashi Iwai7504b6c2013-03-18 11:25:51 +01008122 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +01008123 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +01008124 case 0x10ec0662:
8125 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
8126 break;
8127 case 0x10ec0272:
8128 case 0x10ec0663:
8129 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +08008130 case 0x10ec0668:
Kailang Yangda00c242010-03-19 11:23:45 +01008131 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
8132 break;
8133 case 0x10ec0273:
8134 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
8135 break;
8136 }
Kailang Yangcec27c82010-02-04 14:18:18 +01008137 }
Takashi Iwai2134ea42008-01-10 16:53:55 +01008138
Takashi Iwai1727a772013-01-10 09:52:52 +01008139 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01008140
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008141 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008142
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008143 error:
8144 alc_free(codec);
8145 return err;
Kailang Yangb478b992011-05-18 11:51:15 +02008146}
8147
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008148/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008149 * ALC680 support
8150 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008151
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008152static int alc680_parse_auto_config(struct hda_codec *codec)
8153{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02008154 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008155}
8156
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008157/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008158 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008159static int patch_alc680(struct hda_codec *codec)
8160{
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008161 int err;
8162
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008163 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02008164 err = alc_alloc_spec(codec, 0);
8165 if (err < 0)
8166 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008167
Takashi Iwai1ebec5f2011-08-15 13:21:48 +02008168 /* automatic parse from the BIOS config */
8169 err = alc680_parse_auto_config(codec);
8170 if (err < 0) {
8171 alc_free(codec);
8172 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008173 }
8174
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008175 return 0;
8176}
8177
8178/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07008179 * patch entries
8180 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008181static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +08008182 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008183 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +08008184 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008185 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
8186 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008187 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008188 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +08008189 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008190 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
8191 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +08008192 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008193 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
8194 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
8195 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
8196 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
8197 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
8198 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
8199 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008200 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008201 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
8202 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
8203 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
8204 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
8205 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
8206 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +08008207 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008208 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
8209 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +08008210 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008211 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
8212 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
8213 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008214 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +08008215 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008216 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +08008217 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008218 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
8219 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
8220 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
8221 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
8222 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
8223 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
8224 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
8225 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
8226 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
8227 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
8228 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
8229 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
8230 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
8231 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +08008232 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
8233 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
8234 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008235 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008236 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
8237 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
8238 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
8239 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
8240 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
8241 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
8242 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
8243 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
8244 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
8245 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
8246 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
8247 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
8248 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +08008249 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +08008250 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -07008251 {} /* terminator */
8252};
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008253MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +01008254
8255MODULE_LICENSE("GPL");
8256MODULE_DESCRIPTION("Realtek HD-audio codec");
8257
Takashi Iwaid8a766a2015-02-17 15:25:37 +01008258static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008259 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +01008260};
8261
Takashi Iwaid8a766a2015-02-17 15:25:37 +01008262module_hda_codec_driver(realtek_driver);