blob: 786b29eb2ba9e11a891435b282863449aedff1de [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 Iwai177943a32011-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 Iwai177943a32011-11-09 12:55:18 +01002131 },
2132 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002133 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a32011-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 Iwai177943a32011-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
3734static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3735 const struct hda_fixup *fix, int action)
3736{
3737 struct alc_spec *spec = codec->spec;
3738 static const struct hda_verb gpio_init[] = {
3739 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3740 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3741 {}
3742 };
3743
3744 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003745 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003746 spec->mute_led_polarity = 0;
3747 spec->gpio_mute_led_mask = 0x08;
3748 spec->gpio_mic_led_mask = 0x10;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003749 snd_hda_add_verbs(codec, gpio_init);
Takashi Iwaid03abec2018-06-19 12:29:13 +02003750 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003751 }
3752}
3753
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08003754static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3755 const struct hda_fixup *fix, int action)
3756{
3757 struct alc_spec *spec = codec->spec;
3758 static const struct hda_verb gpio_init[] = {
3759 { 0x01, AC_VERB_SET_GPIO_MASK, 0x22 },
3760 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x22 },
3761 {}
3762 };
3763
3764 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3765 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08003766 spec->mute_led_polarity = 0;
3767 spec->gpio_mute_led_mask = 0x02;
3768 spec->gpio_mic_led_mask = 0x20;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003769 snd_hda_add_verbs(codec, gpio_init);
Takashi Iwaid03abec2018-06-19 12:29:13 +02003770 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003771 }
3772}
3773
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003774/* turn on/off mic-mute LED per capture hook */
Takashi Iwaid03abec2018-06-19 12:29:13 +02003775static void alc_cap_micmute_update(struct hda_codec *codec)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003776{
3777 struct alc_spec *spec = codec->spec;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003778 unsigned int pinval;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003779
Takashi Iwaid03abec2018-06-19 12:29:13 +02003780 if (!spec->cap_mute_led_nid)
3781 return;
Hui Wangfc1fad92014-07-08 17:56:14 +08003782 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003783 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003784 if (spec->gen.micmute_led.led_value)
3785 pinval |= AC_PINCTL_VREF_80;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003786 else
Takashi Iwaid03abec2018-06-19 12:29:13 +02003787 pinval |= AC_PINCTL_VREF_HIZ;
3788 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003789}
3790
3791static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3792 const struct hda_fixup *fix, int action)
3793{
3794 struct alc_spec *spec = codec->spec;
3795 static const struct hda_verb gpio_init[] = {
3796 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3797 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3798 {}
3799 };
3800
3801 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003802 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003803 spec->mute_led_polarity = 0;
3804 spec->gpio_mute_led_mask = 0x08;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003805 spec->cap_mute_led_nid = 0x18;
3806 snd_hda_add_verbs(codec, gpio_init);
Takashi Iwaid03abec2018-06-19 12:29:13 +02003807 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
Hui Wang50dd9052014-07-08 17:56:15 +08003808 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003809 }
3810}
3811
David Henningsson7a5255f2014-10-30 08:26:01 +01003812static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3813 const struct hda_fixup *fix, int action)
3814{
3815 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3816 struct alc_spec *spec = codec->spec;
3817 static const struct hda_verb gpio_init[] = {
3818 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3819 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3820 {}
3821 };
3822
3823 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003824 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003825 spec->mute_led_polarity = 0;
3826 spec->gpio_mute_led_mask = 0x08;
David Henningsson7a5255f2014-10-30 08:26:01 +01003827 spec->cap_mute_led_nid = 0x18;
3828 snd_hda_add_verbs(codec, gpio_init);
Takashi Iwaid03abec2018-06-19 12:29:13 +02003829 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
David Henningsson7a5255f2014-10-30 08:26:01 +01003830 codec->power_filter = led_power_filter;
3831 }
3832}
3833
Takashi Iwai6a30aba2018-04-27 17:17:35 +02003834#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01003835static void gpio2_mic_hotkey_event(struct hda_codec *codec,
3836 struct hda_jack_callback *event)
3837{
3838 struct alc_spec *spec = codec->spec;
3839
3840 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
3841 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08003842 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01003843 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08003844 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01003845 input_sync(spec->kb_dev);
3846}
David Henningsson33f4acd2015-01-07 15:50:13 +01003847
Kailang3694cb22015-12-28 11:35:24 +08003848static int alc_register_micmute_input_device(struct hda_codec *codec)
3849{
3850 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08003851 int i;
Kailang3694cb22015-12-28 11:35:24 +08003852
3853 spec->kb_dev = input_allocate_device();
3854 if (!spec->kb_dev) {
3855 codec_err(codec, "Out of memory (input_allocate_device)\n");
3856 return -ENOMEM;
3857 }
Hui Wangc7b60a82015-12-28 11:35:25 +08003858
3859 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
3860
Kailang3694cb22015-12-28 11:35:24 +08003861 spec->kb_dev->name = "Microphone Mute Button";
3862 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08003863 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
3864 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
3865 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
3866 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
3867 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08003868
3869 if (input_register_device(spec->kb_dev)) {
3870 codec_err(codec, "input_register_device failed\n");
3871 input_free_device(spec->kb_dev);
3872 spec->kb_dev = NULL;
3873 return -ENOMEM;
3874 }
3875
3876 return 0;
3877}
3878
David Henningsson33f4acd2015-01-07 15:50:13 +01003879static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
3880 const struct hda_fixup *fix, int action)
3881{
David Henningsson33f4acd2015-01-07 15:50:13 +01003882 /* GPIO1 = set according to SKU external amp
3883 GPIO2 = mic mute hotkey
3884 GPIO3 = mute LED
3885 GPIO4 = mic mute LED */
3886 static const struct hda_verb gpio_init[] = {
3887 { 0x01, AC_VERB_SET_GPIO_MASK, 0x1e },
3888 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x1a },
3889 { 0x01, AC_VERB_SET_GPIO_DATA, 0x02 },
3890 {}
3891 };
3892
3893 struct alc_spec *spec = codec->spec;
3894
3895 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02003896 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08003897 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01003898 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01003899
3900 snd_hda_add_verbs(codec, gpio_init);
Takashi Iwai7639a062015-03-03 10:07:24 +01003901 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01003902 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01003903 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01003904 gpio2_mic_hotkey_event);
3905
3906 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
David Henningsson33f4acd2015-01-07 15:50:13 +01003907 spec->mute_led_polarity = 0;
3908 spec->gpio_mute_led_mask = 0x08;
3909 spec->gpio_mic_led_mask = 0x10;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003910 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
David Henningsson33f4acd2015-01-07 15:50:13 +01003911 return;
3912 }
3913
3914 if (!spec->kb_dev)
3915 return;
3916
3917 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01003918 case HDA_FIXUP_ACT_FREE:
3919 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01003920 spec->kb_dev = NULL;
3921 }
David Henningsson33f4acd2015-01-07 15:50:13 +01003922}
3923
Kailang3694cb22015-12-28 11:35:24 +08003924static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
3925 const struct hda_fixup *fix, int action)
3926{
3927 /* Line2 = mic mute hotkey
3928 GPIO2 = mic mute LED */
3929 static const struct hda_verb gpio_init[] = {
3930 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
3931 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
3932 {}
3933 };
3934
3935 struct alc_spec *spec = codec->spec;
3936
3937 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02003938 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08003939 if (alc_register_micmute_input_device(codec) != 0)
3940 return;
3941
3942 snd_hda_add_verbs(codec, gpio_init);
3943 snd_hda_jack_detect_enable_callback(codec, 0x1b,
3944 gpio2_mic_hotkey_event);
3945
Kailang3694cb22015-12-28 11:35:24 +08003946 spec->mute_led_polarity = 0;
3947 spec->gpio_mic_led_mask = 0x04;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003948 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update);
Kailang3694cb22015-12-28 11:35:24 +08003949 return;
3950 }
3951
3952 if (!spec->kb_dev)
3953 return;
3954
3955 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08003956 case HDA_FIXUP_ACT_FREE:
3957 input_unregister_device(spec->kb_dev);
3958 spec->kb_dev = NULL;
3959 }
3960}
Takashi Iwaic4696522018-01-15 10:44:35 +01003961#else /* INPUT */
3962#define alc280_fixup_hp_gpio2_mic_hotkey NULL
3963#define alc233_fixup_lenovo_line2_mic_hotkey NULL
3964#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08003965
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003966static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3967 const struct hda_fixup *fix, int action)
3968{
3969 struct alc_spec *spec = codec->spec;
3970
Takashi Iwai1bce62a2018-06-19 23:15:59 +02003971 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003972 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003973 spec->cap_mute_led_nid = 0x18;
Takashi Iwaid03abec2018-06-19 12:29:13 +02003974 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003975 }
3976}
3977
Kailang Yang5a367672017-07-21 15:23:53 +08003978static struct coef_fw alc225_pre_hsmode[] = {
3979 UPDATE_COEF(0x4a, 1<<8, 0),
3980 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
3981 UPDATE_COEF(0x63, 3<<14, 3<<14),
3982 UPDATE_COEF(0x4a, 3<<4, 2<<4),
3983 UPDATE_COEF(0x4a, 3<<10, 3<<10),
3984 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
3985 UPDATE_COEF(0x4a, 3<<10, 0),
3986 {}
3987};
3988
David Henningsson73bdd592013-04-15 15:44:14 +02003989static void alc_headset_mode_unplugged(struct hda_codec *codec)
3990{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003991 static struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003992 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
3993 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
3994 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
3995 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
3996 {}
3997 };
Kailang Yange69e7e02016-05-30 15:58:28 +08003998 static struct coef_fw coef0255_1[] = {
3999 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
4000 {}
4001 };
4002 static struct coef_fw coef0256[] = {
4003 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
4004 {}
4005 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004006 static struct coef_fw coef0233[] = {
4007 WRITE_COEF(0x1b, 0x0c0b),
4008 WRITE_COEF(0x45, 0xc429),
4009 UPDATE_COEF(0x35, 0x4000, 0),
4010 WRITE_COEF(0x06, 0x2104),
4011 WRITE_COEF(0x1a, 0x0001),
4012 WRITE_COEF(0x26, 0x0004),
4013 WRITE_COEF(0x32, 0x42a3),
4014 {}
4015 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004016 static struct coef_fw coef0288[] = {
4017 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4018 UPDATE_COEF(0x50, 0x2000, 0x2000),
4019 UPDATE_COEF(0x56, 0x0006, 0x0006),
4020 UPDATE_COEF(0x66, 0x0008, 0),
4021 UPDATE_COEF(0x67, 0x2000, 0),
4022 {}
4023 };
Kailang Yang89542932017-07-17 15:03:43 +08004024 static struct coef_fw coef0298[] = {
4025 UPDATE_COEF(0x19, 0x1300, 0x0300),
4026 {}
4027 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004028 static struct coef_fw coef0292[] = {
4029 WRITE_COEF(0x76, 0x000e),
4030 WRITE_COEF(0x6c, 0x2400),
4031 WRITE_COEF(0x18, 0x7308),
4032 WRITE_COEF(0x6b, 0xc429),
4033 {}
4034 };
4035 static struct coef_fw coef0293[] = {
4036 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4037 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4038 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4039 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4040 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4041 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4042 {}
4043 };
4044 static struct coef_fw coef0668[] = {
4045 WRITE_COEF(0x15, 0x0d40),
4046 WRITE_COEF(0xb7, 0x802b),
4047 {}
4048 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004049 static struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004050 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004051 {}
4052 };
Kailang Yang71683c32017-06-20 16:33:50 +08004053 static struct coef_fw coef0274[] = {
4054 UPDATE_COEF(0x4a, 0x0100, 0),
4055 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4056 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4057 UPDATE_COEF(0x4a, 0x0010, 0),
4058 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4059 WRITE_COEF(0x45, 0x5289),
4060 UPDATE_COEF(0x4a, 0x0c00, 0),
4061 {}
4062 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004063
Takashi Iwai7639a062015-03-03 10:07:24 +01004064 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004065 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004066 alc_process_coef_fw(codec, coef0255_1);
4067 alc_process_coef_fw(codec, coef0255);
4068 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004069 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004070 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004071 alc_process_coef_fw(codec, coef0256);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004072 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004073 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004074 case 0x10ec0234:
4075 case 0x10ec0274:
4076 case 0x10ec0294:
4077 alc_process_coef_fw(codec, coef0274);
4078 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004079 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004080 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004081 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004082 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004083 case 0x10ec0286:
4084 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004085 alc_process_coef_fw(codec, coef0288);
4086 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004087 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004088 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004089 alc_process_coef_fw(codec, coef0288);
4090 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004091 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004092 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004093 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004094 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004095 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004096 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004097 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004098 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004099 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004100 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004101 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004102 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004103 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004104 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004105 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004106 alc_process_coef_fw(codec, coef0225);
4107 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004108 case 0x10ec0867:
4109 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4110 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004111 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004112 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004113}
4114
4115
4116static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4117 hda_nid_t mic_pin)
4118{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004119 static struct coef_fw coef0255[] = {
4120 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4121 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4122 {}
4123 };
4124 static struct coef_fw coef0233[] = {
4125 UPDATE_COEF(0x35, 0, 1<<14),
4126 WRITE_COEF(0x06, 0x2100),
4127 WRITE_COEF(0x1a, 0x0021),
4128 WRITE_COEF(0x26, 0x008c),
4129 {}
4130 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004131 static struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004132 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004133 UPDATE_COEF(0x50, 0x2000, 0),
4134 UPDATE_COEF(0x56, 0x0006, 0),
4135 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4136 UPDATE_COEF(0x66, 0x0008, 0x0008),
4137 UPDATE_COEF(0x67, 0x2000, 0x2000),
4138 {}
4139 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004140 static struct coef_fw coef0292[] = {
4141 WRITE_COEF(0x19, 0xa208),
4142 WRITE_COEF(0x2e, 0xacf0),
4143 {}
4144 };
4145 static struct coef_fw coef0293[] = {
4146 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4147 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4148 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4149 {}
4150 };
4151 static struct coef_fw coef0688[] = {
4152 WRITE_COEF(0xb7, 0x802b),
4153 WRITE_COEF(0xb5, 0x1040),
4154 UPDATE_COEF(0xc3, 0, 1<<12),
4155 {}
4156 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004157 static struct coef_fw coef0225[] = {
4158 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4159 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4160 UPDATE_COEF(0x63, 3<<14, 0),
4161 {}
4162 };
Kailang Yang71683c32017-06-20 16:33:50 +08004163 static struct coef_fw coef0274[] = {
4164 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4165 UPDATE_COEF(0x4a, 0x0010, 0),
4166 UPDATE_COEF(0x6b, 0xf000, 0),
4167 {}
4168 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004169
Takashi Iwai7639a062015-03-03 10:07:24 +01004170 switch (codec->core.vendor_id) {
Kailang Yang736f20a2017-10-20 15:06:34 +08004171 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004172 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004173 case 0x10ec0256:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004174 alc_write_coef_idx(codec, 0x45, 0xc489);
4175 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004176 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004177 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4178 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004179 case 0x10ec0234:
4180 case 0x10ec0274:
4181 case 0x10ec0294:
4182 alc_write_coef_idx(codec, 0x45, 0x4689);
4183 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4184 alc_process_coef_fw(codec, coef0274);
4185 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4186 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004187 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004188 case 0x10ec0283:
4189 alc_write_coef_idx(codec, 0x45, 0xc429);
4190 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004191 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004192 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4193 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004194 case 0x10ec0286:
4195 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004196 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004197 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4198 alc_process_coef_fw(codec, coef0288);
4199 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4200 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004201 case 0x10ec0292:
4202 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004203 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004204 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004205 case 0x10ec0293:
4206 /* Set to TRS mode */
4207 alc_write_coef_idx(codec, 0x45, 0xc429);
4208 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004209 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004210 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4211 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004212 case 0x10ec0867:
4213 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
4214 /* fallthru */
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08004215 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02004216 case 0x10ec0662:
4217 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4218 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4219 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004220 case 0x10ec0668:
4221 alc_write_coef_idx(codec, 0x11, 0x0001);
4222 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02004223 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004224 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4225 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004226 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004227 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004228 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004229 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004230 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004231 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004232 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004233 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
4234 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
4235 alc_process_coef_fw(codec, coef0225);
4236 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
4237 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004238 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004239 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004240}
4241
4242static void alc_headset_mode_default(struct hda_codec *codec)
4243{
David Henningsson2ae95572016-02-25 09:37:05 +01004244 static struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004245 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
4246 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
4247 UPDATE_COEF(0x49, 3<<8, 0<<8),
4248 UPDATE_COEF(0x4a, 3<<4, 3<<4),
4249 UPDATE_COEF(0x63, 3<<14, 0),
4250 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01004251 {}
4252 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004253 static struct coef_fw coef0255[] = {
4254 WRITE_COEF(0x45, 0xc089),
4255 WRITE_COEF(0x45, 0xc489),
4256 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4257 WRITE_COEF(0x49, 0x0049),
4258 {}
4259 };
4260 static struct coef_fw coef0233[] = {
4261 WRITE_COEF(0x06, 0x2100),
4262 WRITE_COEF(0x32, 0x4ea3),
4263 {}
4264 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004265 static struct coef_fw coef0288[] = {
4266 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
4267 UPDATE_COEF(0x50, 0x2000, 0x2000),
4268 UPDATE_COEF(0x56, 0x0006, 0x0006),
4269 UPDATE_COEF(0x66, 0x0008, 0),
4270 UPDATE_COEF(0x67, 0x2000, 0),
4271 {}
4272 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004273 static struct coef_fw coef0292[] = {
4274 WRITE_COEF(0x76, 0x000e),
4275 WRITE_COEF(0x6c, 0x2400),
4276 WRITE_COEF(0x6b, 0xc429),
4277 WRITE_COEF(0x18, 0x7308),
4278 {}
4279 };
4280 static struct coef_fw coef0293[] = {
4281 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4282 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
4283 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4284 {}
4285 };
4286 static struct coef_fw coef0688[] = {
4287 WRITE_COEF(0x11, 0x0041),
4288 WRITE_COEF(0x15, 0x0d40),
4289 WRITE_COEF(0xb7, 0x802b),
4290 {}
4291 };
Kailang Yang71683c32017-06-20 16:33:50 +08004292 static struct coef_fw coef0274[] = {
4293 WRITE_COEF(0x45, 0x4289),
4294 UPDATE_COEF(0x4a, 0x0010, 0x0010),
4295 UPDATE_COEF(0x6b, 0x0f00, 0),
4296 UPDATE_COEF(0x49, 0x0300, 0x0300),
4297 {}
4298 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004299
Takashi Iwai7639a062015-03-03 10:07:24 +01004300 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08004301 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01004302 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004303 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004304 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004305 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004306 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004307 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01004308 alc_process_coef_fw(codec, coef0225);
4309 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004310 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004311 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004312 case 0x10ec0256:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004313 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004314 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004315 case 0x10ec0234:
4316 case 0x10ec0274:
4317 case 0x10ec0294:
4318 alc_process_coef_fw(codec, coef0274);
4319 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004320 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004321 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004322 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004323 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004324 case 0x10ec0286:
4325 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004326 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08004327 alc_process_coef_fw(codec, coef0288);
4328 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004329 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004330 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004331 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004332 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004333 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004334 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004335 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004336 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004337 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004338 case 0x10ec0867:
4339 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4340 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004341 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004342 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004343}
4344
4345/* Iphone type */
4346static void alc_headset_mode_ctia(struct hda_codec *codec)
4347{
Kailang Yang89542932017-07-17 15:03:43 +08004348 int val;
4349
Takashi Iwai54db6c32014-08-18 15:11:19 +02004350 static struct coef_fw coef0255[] = {
4351 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4352 WRITE_COEF(0x1b, 0x0c2b),
4353 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4354 {}
4355 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004356 static struct coef_fw coef0256[] = {
4357 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
4358 WRITE_COEF(0x1b, 0x0c6b),
4359 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4360 {}
4361 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004362 static struct coef_fw coef0233[] = {
4363 WRITE_COEF(0x45, 0xd429),
4364 WRITE_COEF(0x1b, 0x0c2b),
4365 WRITE_COEF(0x32, 0x4ea3),
4366 {}
4367 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004368 static struct coef_fw coef0288[] = {
4369 UPDATE_COEF(0x50, 0x2000, 0x2000),
4370 UPDATE_COEF(0x56, 0x0006, 0x0006),
4371 UPDATE_COEF(0x66, 0x0008, 0),
4372 UPDATE_COEF(0x67, 0x2000, 0),
4373 {}
4374 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004375 static struct coef_fw coef0292[] = {
4376 WRITE_COEF(0x6b, 0xd429),
4377 WRITE_COEF(0x76, 0x0008),
4378 WRITE_COEF(0x18, 0x7388),
4379 {}
4380 };
4381 static struct coef_fw coef0293[] = {
4382 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
4383 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4384 {}
4385 };
4386 static struct coef_fw coef0688[] = {
4387 WRITE_COEF(0x11, 0x0001),
4388 WRITE_COEF(0x15, 0x0d60),
4389 WRITE_COEF(0xc3, 0x0000),
4390 {}
4391 };
Kailang Yang5a367672017-07-21 15:23:53 +08004392 static struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004393 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004394 UPDATE_COEF(0x63, 3<<14, 2<<14),
4395 {}
4396 };
4397 static struct coef_fw coef0225_2[] = {
4398 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
4399 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004400 {}
4401 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004402
Takashi Iwai7639a062015-03-03 10:07:24 +01004403 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004404 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004405 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004406 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004407 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004408 case 0x10ec0256:
4409 alc_process_coef_fw(codec, coef0256);
4410 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004411 case 0x10ec0234:
4412 case 0x10ec0274:
4413 case 0x10ec0294:
4414 alc_write_coef_idx(codec, 0x45, 0xd689);
4415 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004416 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004417 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004418 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004419 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004420 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004421 val = alc_read_coef_idx(codec, 0x50);
4422 if (val & (1 << 12)) {
4423 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4424 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4425 msleep(300);
4426 } else {
4427 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4428 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4429 msleep(300);
4430 }
4431 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004432 case 0x10ec0286:
4433 case 0x10ec0288:
4434 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
4435 msleep(300);
4436 alc_process_coef_fw(codec, coef0288);
4437 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004438 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004439 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004440 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004441 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004442 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004443 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004444 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004445 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004446 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004447 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004448 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004449 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004450 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004451 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004452 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08004453 val = alc_read_coef_idx(codec, 0x45);
4454 if (val & (1 << 9))
4455 alc_process_coef_fw(codec, coef0225_2);
4456 else
4457 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004458 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004459 case 0x10ec0867:
4460 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4461 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004462 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004463 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004464}
4465
4466/* Nokia type */
4467static void alc_headset_mode_omtp(struct hda_codec *codec)
4468{
Takashi Iwai54db6c32014-08-18 15:11:19 +02004469 static struct coef_fw coef0255[] = {
4470 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4471 WRITE_COEF(0x1b, 0x0c2b),
4472 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4473 {}
4474 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004475 static struct coef_fw coef0256[] = {
4476 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
4477 WRITE_COEF(0x1b, 0x0c6b),
4478 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
4479 {}
4480 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004481 static struct coef_fw coef0233[] = {
4482 WRITE_COEF(0x45, 0xe429),
4483 WRITE_COEF(0x1b, 0x0c2b),
4484 WRITE_COEF(0x32, 0x4ea3),
4485 {}
4486 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004487 static struct coef_fw coef0288[] = {
4488 UPDATE_COEF(0x50, 0x2000, 0x2000),
4489 UPDATE_COEF(0x56, 0x0006, 0x0006),
4490 UPDATE_COEF(0x66, 0x0008, 0),
4491 UPDATE_COEF(0x67, 0x2000, 0),
4492 {}
4493 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004494 static struct coef_fw coef0292[] = {
4495 WRITE_COEF(0x6b, 0xe429),
4496 WRITE_COEF(0x76, 0x0008),
4497 WRITE_COEF(0x18, 0x7388),
4498 {}
4499 };
4500 static struct coef_fw coef0293[] = {
4501 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
4502 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
4503 {}
4504 };
4505 static struct coef_fw coef0688[] = {
4506 WRITE_COEF(0x11, 0x0001),
4507 WRITE_COEF(0x15, 0x0d50),
4508 WRITE_COEF(0xc3, 0x0000),
4509 {}
4510 };
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004511 static struct coef_fw coef0225[] = {
4512 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08004513 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004514 {}
4515 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004516
Takashi Iwai7639a062015-03-03 10:07:24 +01004517 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004518 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004519 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004520 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004521 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004522 case 0x10ec0256:
4523 alc_process_coef_fw(codec, coef0256);
4524 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004525 case 0x10ec0234:
4526 case 0x10ec0274:
4527 case 0x10ec0294:
4528 alc_write_coef_idx(codec, 0x45, 0xe689);
4529 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004530 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004531 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004532 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004533 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004534 case 0x10ec0298:
4535 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08004536 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4537 msleep(300);
4538 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004539 case 0x10ec0286:
4540 case 0x10ec0288:
4541 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
4542 msleep(300);
4543 alc_process_coef_fw(codec, coef0288);
4544 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004545 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004546 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004547 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004548 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004549 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004550 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004551 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004552 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004553 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004554 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004555 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004556 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004557 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004558 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004559 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004560 alc_process_coef_fw(codec, coef0225);
4561 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004562 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004563 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004564}
4565
4566static void alc_determine_headset_type(struct hda_codec *codec)
4567{
4568 int val;
4569 bool is_ctia = false;
4570 struct alc_spec *spec = codec->spec;
Takashi Iwai54db6c32014-08-18 15:11:19 +02004571 static struct coef_fw coef0255[] = {
4572 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
4573 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
4574 conteol) */
4575 {}
4576 };
Kailang Yangf3b70332015-04-08 15:01:17 +08004577 static struct coef_fw coef0288[] = {
4578 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
4579 {}
4580 };
Kailang Yang89542932017-07-17 15:03:43 +08004581 static struct coef_fw coef0298[] = {
4582 UPDATE_COEF(0x50, 0x2000, 0x2000),
4583 UPDATE_COEF(0x56, 0x0006, 0x0006),
4584 UPDATE_COEF(0x66, 0x0008, 0),
4585 UPDATE_COEF(0x67, 0x2000, 0),
4586 UPDATE_COEF(0x19, 0x1300, 0x1300),
4587 {}
4588 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004589 static struct coef_fw coef0293[] = {
4590 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
4591 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
4592 {}
4593 };
4594 static struct coef_fw coef0688[] = {
4595 WRITE_COEF(0x11, 0x0001),
4596 WRITE_COEF(0xb7, 0x802b),
4597 WRITE_COEF(0x15, 0x0d60),
4598 WRITE_COEF(0xc3, 0x0c00),
4599 {}
4600 };
Kailang Yang71683c32017-06-20 16:33:50 +08004601 static struct coef_fw coef0274[] = {
4602 UPDATE_COEF(0x4a, 0x0010, 0),
4603 UPDATE_COEF(0x4a, 0x8000, 0),
4604 WRITE_COEF(0x45, 0xd289),
4605 UPDATE_COEF(0x49, 0x0300, 0x0300),
4606 {}
4607 };
David Henningsson73bdd592013-04-15 15:44:14 +02004608
Takashi Iwai7639a062015-03-03 10:07:24 +01004609 switch (codec->core.vendor_id) {
Kailang Yang736f20a2017-10-20 15:06:34 +08004610 case 0x10ec0236:
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004611 case 0x10ec0255:
Kailang Yang7081adf2015-03-30 17:05:37 +08004612 case 0x10ec0256:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004613 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004614 msleep(300);
4615 val = alc_read_coef_idx(codec, 0x46);
4616 is_ctia = (val & 0x0070) == 0x0070;
4617 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004618 case 0x10ec0234:
4619 case 0x10ec0274:
4620 case 0x10ec0294:
4621 alc_process_coef_fw(codec, coef0274);
4622 msleep(80);
4623 val = alc_read_coef_idx(codec, 0x46);
4624 is_ctia = (val & 0x00f0) == 0x00f0;
4625 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004626 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004627 case 0x10ec0283:
4628 alc_write_coef_idx(codec, 0x45, 0xd029);
4629 msleep(300);
4630 val = alc_read_coef_idx(codec, 0x46);
4631 is_ctia = (val & 0x0070) == 0x0070;
4632 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004633 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004634 snd_hda_codec_write(codec, 0x21, 0,
4635 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4636 msleep(100);
4637 snd_hda_codec_write(codec, 0x21, 0,
4638 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4639 msleep(200);
4640
4641 val = alc_read_coef_idx(codec, 0x50);
4642 if (val & (1 << 12)) {
4643 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
4644 alc_process_coef_fw(codec, coef0288);
4645 msleep(350);
4646 val = alc_read_coef_idx(codec, 0x50);
4647 is_ctia = (val & 0x0070) == 0x0070;
4648 } else {
4649 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
4650 alc_process_coef_fw(codec, coef0288);
4651 msleep(350);
4652 val = alc_read_coef_idx(codec, 0x50);
4653 is_ctia = (val & 0x0070) == 0x0070;
4654 }
4655 alc_process_coef_fw(codec, coef0298);
4656 snd_hda_codec_write(codec, 0x21, 0,
4657 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4658 msleep(75);
4659 snd_hda_codec_write(codec, 0x21, 0,
4660 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
4661 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004662 case 0x10ec0286:
4663 case 0x10ec0288:
4664 alc_process_coef_fw(codec, coef0288);
4665 msleep(350);
4666 val = alc_read_coef_idx(codec, 0x50);
4667 is_ctia = (val & 0x0070) == 0x0070;
4668 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004669 case 0x10ec0292:
4670 alc_write_coef_idx(codec, 0x6b, 0xd429);
4671 msleep(300);
4672 val = alc_read_coef_idx(codec, 0x6c);
4673 is_ctia = (val & 0x001c) == 0x001c;
4674 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004675 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004676 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004677 msleep(300);
4678 val = alc_read_coef_idx(codec, 0x46);
4679 is_ctia = (val & 0x0070) == 0x0070;
4680 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004681 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004682 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02004683 msleep(300);
4684 val = alc_read_coef_idx(codec, 0xbe);
4685 is_ctia = (val & 0x1c02) == 0x1c02;
4686 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004687 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004688 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004689 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004690 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004691 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004692 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08004693 snd_hda_codec_write(codec, 0x21, 0,
4694 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
4695 msleep(80);
4696 snd_hda_codec_write(codec, 0x21, 0,
4697 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
4698
Kailang Yang5a367672017-07-21 15:23:53 +08004699 alc_process_coef_fw(codec, alc225_pre_hsmode);
4700 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
4701 val = alc_read_coef_idx(codec, 0x45);
4702 if (val & (1 << 9)) {
4703 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4704 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
4705 msleep(800);
4706 val = alc_read_coef_idx(codec, 0x46);
4707 is_ctia = (val & 0x00f0) == 0x00f0;
4708 } else {
4709 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
4710 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
4711 msleep(800);
4712 val = alc_read_coef_idx(codec, 0x46);
4713 is_ctia = (val & 0x00f0) == 0x00f0;
4714 }
4715 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
4716 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
4717 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08004718
4719 snd_hda_codec_write(codec, 0x21, 0,
4720 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
4721 msleep(80);
4722 snd_hda_codec_write(codec, 0x21, 0,
4723 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004724 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004725 case 0x10ec0867:
4726 is_ctia = true;
4727 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004728 }
4729
Takashi Iwai4e76a882014-02-25 12:21:03 +01004730 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02004731 is_ctia ? "yes" : "no");
4732 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
4733}
4734
4735static void alc_update_headset_mode(struct hda_codec *codec)
4736{
4737 struct alc_spec *spec = codec->spec;
4738
4739 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
4740 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
4741
4742 int new_headset_mode;
4743
4744 if (!snd_hda_jack_detect(codec, hp_pin))
4745 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
4746 else if (mux_pin == spec->headset_mic_pin)
4747 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
4748 else if (mux_pin == spec->headphone_mic_pin)
4749 new_headset_mode = ALC_HEADSET_MODE_MIC;
4750 else
4751 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
4752
David Henningsson5959a6b2013-11-12 11:10:57 +01004753 if (new_headset_mode == spec->current_headset_mode) {
4754 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02004755 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01004756 }
David Henningsson73bdd592013-04-15 15:44:14 +02004757
4758 switch (new_headset_mode) {
4759 case ALC_HEADSET_MODE_UNPLUGGED:
4760 alc_headset_mode_unplugged(codec);
4761 spec->gen.hp_jack_present = false;
4762 break;
4763 case ALC_HEADSET_MODE_HEADSET:
4764 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
4765 alc_determine_headset_type(codec);
4766 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
4767 alc_headset_mode_ctia(codec);
4768 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
4769 alc_headset_mode_omtp(codec);
4770 spec->gen.hp_jack_present = true;
4771 break;
4772 case ALC_HEADSET_MODE_MIC:
4773 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
4774 spec->gen.hp_jack_present = false;
4775 break;
4776 case ALC_HEADSET_MODE_HEADPHONE:
4777 alc_headset_mode_default(codec);
4778 spec->gen.hp_jack_present = true;
4779 break;
4780 }
4781 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
4782 snd_hda_set_pin_ctl_cache(codec, hp_pin,
4783 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02004784 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02004785 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
4786 PIN_VREFHIZ);
4787 }
4788 spec->current_headset_mode = new_headset_mode;
4789
4790 snd_hda_gen_update_outputs(codec);
4791}
4792
4793static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01004794 struct snd_kcontrol *kcontrol,
4795 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02004796{
4797 alc_update_headset_mode(codec);
4798}
4799
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02004800static void alc_update_headset_jack_cb(struct hda_codec *codec,
4801 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02004802{
4803 struct alc_spec *spec = codec->spec;
David Henningsson5db4d342013-11-22 12:17:06 +01004804 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02004805 snd_hda_gen_hp_automute(codec, jack);
4806}
4807
4808static void alc_probe_headset_mode(struct hda_codec *codec)
4809{
4810 int i;
4811 struct alc_spec *spec = codec->spec;
4812 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4813
4814 /* Find mic pins */
4815 for (i = 0; i < cfg->num_inputs; i++) {
4816 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
4817 spec->headset_mic_pin = cfg->inputs[i].pin;
4818 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
4819 spec->headphone_mic_pin = cfg->inputs[i].pin;
4820 }
4821
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02004822 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02004823 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
4824 spec->gen.automute_hook = alc_update_headset_mode;
4825 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
4826}
4827
4828static void alc_fixup_headset_mode(struct hda_codec *codec,
4829 const struct hda_fixup *fix, int action)
4830{
4831 struct alc_spec *spec = codec->spec;
4832
4833 switch (action) {
4834 case HDA_FIXUP_ACT_PRE_PROBE:
4835 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
4836 break;
4837 case HDA_FIXUP_ACT_PROBE:
4838 alc_probe_headset_mode(codec);
4839 break;
4840 case HDA_FIXUP_ACT_INIT:
4841 spec->current_headset_mode = 0;
4842 alc_update_headset_mode(codec);
4843 break;
4844 }
4845}
4846
4847static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
4848 const struct hda_fixup *fix, int action)
4849{
4850 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4851 struct alc_spec *spec = codec->spec;
4852 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4853 }
4854 else
4855 alc_fixup_headset_mode(codec, fix, action);
4856}
4857
Kailang Yang31278992014-03-03 15:27:22 +08004858static void alc255_set_default_jack_type(struct hda_codec *codec)
4859{
4860 /* Set to iphone type */
Kailang Yange69e7e02016-05-30 15:58:28 +08004861 static struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004862 WRITE_COEF(0x1b, 0x880b),
4863 WRITE_COEF(0x45, 0xd089),
4864 WRITE_COEF(0x1b, 0x080b),
4865 WRITE_COEF(0x46, 0x0004),
4866 WRITE_COEF(0x1b, 0x0c0b),
4867 {}
4868 };
Kailang Yange69e7e02016-05-30 15:58:28 +08004869 static struct coef_fw alc256fw[] = {
4870 WRITE_COEF(0x1b, 0x884b),
4871 WRITE_COEF(0x45, 0xd089),
4872 WRITE_COEF(0x1b, 0x084b),
4873 WRITE_COEF(0x46, 0x0004),
4874 WRITE_COEF(0x1b, 0x0c4b),
4875 {}
4876 };
4877 switch (codec->core.vendor_id) {
4878 case 0x10ec0255:
4879 alc_process_coef_fw(codec, alc255fw);
4880 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08004881 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08004882 case 0x10ec0256:
4883 alc_process_coef_fw(codec, alc256fw);
4884 break;
4885 }
Kailang Yang31278992014-03-03 15:27:22 +08004886 msleep(30);
4887}
4888
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004889static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
4890 const struct hda_fixup *fix, int action)
4891{
4892 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08004893 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004894 }
4895 alc_fixup_headset_mode(codec, fix, action);
4896}
4897
Kailang Yang31278992014-03-03 15:27:22 +08004898static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
4899 const struct hda_fixup *fix, int action)
4900{
4901 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4902 struct alc_spec *spec = codec->spec;
4903 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4904 alc255_set_default_jack_type(codec);
4905 }
4906 else
4907 alc_fixup_headset_mode(codec, fix, action);
4908}
4909
Kailang Yange1e62b92015-04-08 16:01:22 +08004910static void alc288_update_headset_jack_cb(struct hda_codec *codec,
4911 struct hda_jack_callback *jack)
4912{
4913 struct alc_spec *spec = codec->spec;
4914 int present;
4915
4916 alc_update_headset_jack_cb(codec, jack);
4917 /* Headset Mic enable or disable, only for Dell Dino */
4918 present = spec->gen.hp_jack_present ? 0x40 : 0;
4919 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
4920 present);
4921}
4922
4923static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
4924 const struct hda_fixup *fix, int action)
4925{
4926 alc_fixup_headset_mode(codec, fix, action);
4927 if (action == HDA_FIXUP_ACT_PROBE) {
4928 struct alc_spec *spec = codec->spec;
4929 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
4930 }
4931}
4932
Hui Wang493a52a2014-01-14 14:07:36 +08004933static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
4934 const struct hda_fixup *fix, int action)
4935{
4936 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4937 struct alc_spec *spec = codec->spec;
4938 spec->gen.auto_mute_via_amp = 1;
4939 }
4940}
4941
Takashi Iwai9b745ab2014-03-07 08:37:19 +01004942static void alc_no_shutup(struct hda_codec *codec)
4943{
4944}
4945
4946static void alc_fixup_no_shutup(struct hda_codec *codec,
4947 const struct hda_fixup *fix, int action)
4948{
Gabriele Mazzotta972aa2c2016-12-24 19:50:00 +01004949 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01004950 struct alc_spec *spec = codec->spec;
4951 spec->shutup = alc_no_shutup;
4952 }
4953}
4954
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02004955static void alc_fixup_disable_aamix(struct hda_codec *codec,
4956 const struct hda_fixup *fix, int action)
4957{
4958 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4959 struct alc_spec *spec = codec->spec;
4960 /* Disable AA-loopback as it causes white noise */
4961 spec->gen.mixer_nid = 0;
4962 }
4963}
4964
Takashi Iwai7f57d802015-09-24 17:36:51 +02004965/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
4966static void alc_fixup_tpt440_dock(struct hda_codec *codec,
4967 const struct hda_fixup *fix, int action)
4968{
4969 static const struct hda_pintbl pincfgs[] = {
4970 { 0x16, 0x21211010 }, /* dock headphone */
4971 { 0x19, 0x21a11010 }, /* dock mic */
4972 { }
4973 };
4974 struct alc_spec *spec = codec->spec;
4975
4976 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai70a09762015-12-15 14:59:58 +01004977 spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */
Takashi Iwai7f57d802015-09-24 17:36:51 +02004978 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4979 codec->power_save_node = 0; /* avoid click noises */
4980 snd_hda_apply_pincfgs(codec, pincfgs);
4981 }
4982}
4983
Kailang Yang61fcf8e2018-02-02 15:26:46 +08004984static void alc_fixup_tpt470_dock(struct hda_codec *codec,
4985 const struct hda_fixup *fix, int action)
4986{
4987 static const struct hda_pintbl pincfgs[] = {
4988 { 0x17, 0x21211010 }, /* dock headphone */
4989 { 0x19, 0x21a11010 }, /* dock mic */
4990 { }
4991 };
4992 struct alc_spec *spec = codec->spec;
4993
4994 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4995 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01004996 snd_hda_apply_pincfgs(codec, pincfgs);
4997 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08004998 /* Enable DOCK device */
4999 snd_hda_codec_write(codec, 0x17, 0,
5000 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5001 /* Enable DOCK device */
5002 snd_hda_codec_write(codec, 0x19, 0,
5003 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005004 }
5005}
5006
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005007static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005008{
5009 struct alc_spec *spec = codec->spec;
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005010 int hp_pin = spec->gen.autocfg.hp_pins[0];
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005011
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005012 /* Prevent pop noises when headphones are plugged in */
5013 snd_hda_codec_write(codec, hp_pin, 0,
5014 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5015 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005016}
5017
5018static void alc_fixup_dell_xps13(struct hda_codec *codec,
5019 const struct hda_fixup *fix, int action)
5020{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005021 struct alc_spec *spec = codec->spec;
5022 struct hda_input_mux *imux = &spec->gen.input_mux;
5023 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005024
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005025 switch (action) {
5026 case HDA_FIXUP_ACT_PRE_PROBE:
5027 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5028 * it causes a click noise at start up
5029 */
5030 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
5031 break;
5032 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005033 spec->shutup = alc_shutup_dell_xps13;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005034
5035 /* Make the internal mic the default input source. */
5036 for (i = 0; i < imux->num_items; i++) {
5037 if (spec->gen.imux_pins[i] == 0x12) {
5038 spec->gen.cur_mux[0] = i;
5039 break;
5040 }
5041 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005042 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005043 }
5044}
5045
David Henningsson1f8b46c2015-05-12 14:38:15 +02005046static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5047 const struct hda_fixup *fix, int action)
5048{
5049 struct alc_spec *spec = codec->spec;
5050
5051 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5052 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5053 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005054
5055 /* Disable boost for mic-in permanently. (This code is only called
5056 from quirks that guarantee that the headphone is at NID 0x1b.) */
5057 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5058 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005059 } else
5060 alc_fixup_headset_mode(codec, fix, action);
5061}
5062
David Henningsson73bdd592013-04-15 15:44:14 +02005063static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5064 const struct hda_fixup *fix, int action)
5065{
5066 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005067 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005068 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005069 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5070 }
5071 alc_fixup_headset_mode(codec, fix, action);
5072}
5073
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005074/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5075static int find_ext_mic_pin(struct hda_codec *codec)
5076{
5077 struct alc_spec *spec = codec->spec;
5078 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5079 hda_nid_t nid;
5080 unsigned int defcfg;
5081 int i;
5082
5083 for (i = 0; i < cfg->num_inputs; i++) {
5084 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5085 continue;
5086 nid = cfg->inputs[i].pin;
5087 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5088 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5089 continue;
5090 return nid;
5091 }
5092
5093 return 0;
5094}
5095
Dylan Reid08a978d2012-11-18 22:56:40 -08005096static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005097 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08005098 int action)
5099{
5100 struct alc_spec *spec = codec->spec;
5101
Takashi Iwai0db75792013-01-23 13:57:20 +01005102 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005103 int mic_pin = find_ext_mic_pin(codec);
5104 int hp_pin = spec->gen.autocfg.hp_pins[0];
5105
5106 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01005107 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005108 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01005109 }
Dylan Reid08a978d2012-11-18 22:56:40 -08005110}
David Henningsson693b6132012-06-22 19:12:10 +02005111
David Henningsson3e0d6112013-04-22 14:30:14 +02005112static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
5113 const struct hda_fixup *fix,
5114 int action)
5115{
5116 struct alc_spec *spec = codec->spec;
5117 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5118 int i;
5119
5120 /* The mic boosts on level 2 and 3 are too noisy
5121 on the internal mic input.
5122 Therefore limit the boost to 0 or 1. */
5123
5124 if (action != HDA_FIXUP_ACT_PROBE)
5125 return;
5126
5127 for (i = 0; i < cfg->num_inputs; i++) {
5128 hda_nid_t nid = cfg->inputs[i].pin;
5129 unsigned int defcfg;
5130 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5131 continue;
5132 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5133 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
5134 continue;
5135
5136 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
5137 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
5138 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
5139 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
5140 (0 << AC_AMPCAP_MUTE_SHIFT));
5141 }
5142}
5143
Kailang Yangcd217a62013-08-22 10:15:24 +02005144static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005145 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02005146{
5147 struct alc_spec *spec = codec->spec;
5148 int vref;
5149
5150 msleep(200);
5151 snd_hda_gen_hp_automute(codec, jack);
5152
5153 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
5154
5155 msleep(600);
5156 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
5157 vref);
5158}
5159
Kailang Yangcd217a62013-08-22 10:15:24 +02005160static void alc283_fixup_chromebook(struct hda_codec *codec,
5161 const struct hda_fixup *fix, int action)
5162{
5163 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02005164
5165 switch (action) {
5166 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08005167 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01005168 /* Disable AA-loopback as it causes white noise */
5169 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08005170 break;
5171 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08005172 /* MIC2-VREF control */
5173 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005174 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08005175 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02005176 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08005177 break;
5178 }
5179}
5180
5181static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
5182 const struct hda_fixup *fix, int action)
5183{
5184 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08005185
5186 switch (action) {
5187 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02005188 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
5189 break;
5190 case HDA_FIXUP_ACT_INIT:
5191 /* MIC2-VREF control */
5192 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02005193 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02005194 break;
5195 }
5196}
5197
Takashi Iwai7bba2152013-09-06 15:45:38 +02005198/* mute tablet speaker pin (0x14) via dock plugging in addition */
5199static void asus_tx300_automute(struct hda_codec *codec)
5200{
5201 struct alc_spec *spec = codec->spec;
5202 snd_hda_gen_update_outputs(codec);
5203 if (snd_hda_jack_detect(codec, 0x1b))
5204 spec->gen.mute_bits |= (1ULL << 0x14);
5205}
5206
5207static void alc282_fixup_asus_tx300(struct hda_codec *codec,
5208 const struct hda_fixup *fix, int action)
5209{
5210 struct alc_spec *spec = codec->spec;
5211 /* TX300 needs to set up GPIO2 for the speaker amp */
5212 static const struct hda_verb gpio2_verbs[] = {
5213 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
5214 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
5215 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
5216 {}
5217 };
5218 static const struct hda_pintbl dock_pins[] = {
5219 { 0x1b, 0x21114000 }, /* dock speaker pin */
5220 {}
5221 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02005222
5223 switch (action) {
5224 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02005225 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005226 snd_hda_add_verbs(codec, gpio2_verbs);
5227 snd_hda_apply_pincfgs(codec, dock_pins);
5228 spec->gen.auto_mute_via_amp = 1;
5229 spec->gen.automute_hook = asus_tx300_automute;
5230 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005231 snd_hda_gen_hp_automute);
5232 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02005233 case HDA_FIXUP_ACT_PROBE:
5234 spec->init_amp = ALC_INIT_DEFAULT;
5235 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02005236 case HDA_FIXUP_ACT_BUILD:
5237 /* this is a bit tricky; give more sane names for the main
5238 * (tablet) speaker and the dock speaker, respectively
5239 */
Takashi Iwai56798e62017-04-11 08:10:52 +02005240 rename_ctl(codec, "Speaker Playback Switch",
5241 "Dock Speaker Playback Switch");
5242 rename_ctl(codec, "Bass Speaker Playback Switch",
5243 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02005244 break;
5245 }
5246}
5247
David Henningsson338cae52013-10-07 10:39:59 +02005248static void alc290_fixup_mono_speakers(struct hda_codec *codec,
5249 const struct hda_fixup *fix, int action)
5250{
David Henningsson0f4881d2013-12-20 16:08:13 +01005251 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5252 /* DAC node 0x03 is giving mono output. We therefore want to
5253 make sure 0x14 (front speaker) and 0x15 (headphones) use the
5254 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
5255 hda_nid_t conn1[2] = { 0x0c };
5256 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
5257 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
5258 }
David Henningsson338cae52013-10-07 10:39:59 +02005259}
5260
Hui Wangdd9aa332016-08-01 10:20:32 +08005261static void alc298_fixup_speaker_volume(struct hda_codec *codec,
5262 const struct hda_fixup *fix, int action)
5263{
5264 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5265 /* The speaker is routed to the Node 0x06 by a mistake, as a result
5266 we can't adjust the speaker's volume since this node does not has
5267 Amp-out capability. we change the speaker's route to:
5268 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
5269 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
5270 speaker's volume now. */
5271
5272 hda_nid_t conn1[1] = { 0x0c };
5273 snd_hda_override_conn_list(codec, 0x17, 1, conn1);
5274 }
5275}
5276
Takashi Iwaie312a862018-03-06 12:14:17 +01005277/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
5278static void alc295_fixup_disable_dac3(struct hda_codec *codec,
5279 const struct hda_fixup *fix, int action)
5280{
5281 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5282 hda_nid_t conn[2] = { 0x02, 0x03 };
5283 snd_hda_override_conn_list(codec, 0x17, 2, conn);
5284 }
5285}
5286
Keith Packard98973f22015-07-15 12:14:39 -07005287/* Hook to update amp GPIO4 for automute */
5288static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
5289 struct hda_jack_callback *jack)
5290{
5291 struct alc_spec *spec = codec->spec;
5292
5293 snd_hda_gen_hp_automute(codec, jack);
5294 /* mute_led_polarity is set to 0, so we pass inverted value here */
5295 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present);
5296}
5297
5298/* Manage GPIOs for HP EliteBook Folio 9480m.
5299 *
5300 * GPIO4 is the headphone amplifier power control
5301 * GPIO3 is the audio output mute indicator LED
5302 */
5303
5304static void alc280_fixup_hp_9480m(struct hda_codec *codec,
5305 const struct hda_fixup *fix,
5306 int action)
5307{
5308 struct alc_spec *spec = codec->spec;
5309 static const struct hda_verb gpio_init[] = {
5310 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
5311 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
5312 {}
5313 };
5314
5315 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5316 /* Set the hooks to turn the headphone amp on/off
5317 * as needed
5318 */
5319 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
5320 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
5321
Keith Packard98973f22015-07-15 12:14:39 -07005322 /* GPIO3 is connected to the output mute LED,
5323 * high is on, low is off
5324 */
5325 spec->mute_led_polarity = 0;
5326 spec->gpio_mute_led_mask = 0x08;
5327
5328 /* Initialize GPIO configuration */
5329 snd_hda_add_verbs(codec, gpio_init);
5330 }
5331}
5332
Kailang Yangca169cc2017-04-25 16:17:40 +08005333static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
5334 const struct hda_fixup *fix,
5335 int action)
5336{
5337 alc_fixup_dual_codecs(codec, fix, action);
5338 switch (action) {
5339 case HDA_FIXUP_ACT_PRE_PROBE:
5340 /* override card longname to provide a unique UCM profile */
5341 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
5342 break;
5343 case HDA_FIXUP_ACT_BUILD:
5344 /* rename Capture controls depending on the codec */
5345 rename_ctl(codec, "Capture Volume",
5346 codec->addr == 0 ?
5347 "Rear-Panel Capture Volume" :
5348 "Front-Panel Capture Volume");
5349 rename_ctl(codec, "Capture Switch",
5350 codec->addr == 0 ?
5351 "Rear-Panel Capture Switch" :
5352 "Front-Panel Capture Switch");
5353 break;
5354 }
5355}
5356
Kailang Yang92266652017-12-14 15:28:58 +08005357/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
5358static void alc274_fixup_bind_dacs(struct hda_codec *codec,
5359 const struct hda_fixup *fix, int action)
5360{
5361 struct alc_spec *spec = codec->spec;
5362 static hda_nid_t preferred_pairs[] = {
5363 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
5364 0
5365 };
5366
5367 if (action != HDA_FIXUP_ACT_PRE_PROBE)
5368 return;
5369
5370 spec->gen.preferred_dacs = preferred_pairs;
5371}
5372
Takashi Iwaib317b032014-01-08 11:44:21 +01005373/* for hda_fixup_thinkpad_acpi() */
5374#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01005375
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02005376static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
5377 const struct hda_fixup *fix, int action)
5378{
5379 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
5380 hda_fixup_thinkpad_acpi(codec, fix, action);
5381}
5382
Hui Wang00ef9942014-07-31 11:52:38 +08005383/* for dell wmi mic mute led */
5384#include "dell_wmi_helper.c"
5385
Tom Bridenbbf8ff62018-05-29 17:34:20 +01005386/* for alc295_fixup_hp_top_speakers */
5387#include "hp_x360_helper.c"
5388
Takashi Iwai1d045db2011-07-07 18:23:21 +02005389enum {
5390 ALC269_FIXUP_SONY_VAIO,
5391 ALC275_FIXUP_SONY_VAIO_GPIO2,
5392 ALC269_FIXUP_DELL_M101Z,
5393 ALC269_FIXUP_SKU_IGNORE,
5394 ALC269_FIXUP_ASUS_G73JW,
5395 ALC269_FIXUP_LENOVO_EAPD,
5396 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02005397 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005398 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02005399 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005400 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02005401 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02005402 ALC269_FIXUP_QUANTA_MUTE,
5403 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02005404 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02005405 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02005406 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01005407 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02005408 ALC269_FIXUP_AMIC,
5409 ALC269_FIXUP_DMIC,
5410 ALC269VB_FIXUP_AMIC,
5411 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005412 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01005413 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005414 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00005415 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01005416 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08005417 ALC269_FIXUP_HP_GPIO_MIC1_LED,
5418 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02005419 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02005420 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005421 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02005422 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02005423 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02005424 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5425 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02005426 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08005427 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02005428 ALC269_FIXUP_HEADSET_MODE,
5429 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02005430 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02005431 ALC269_FIXUP_ASUS_X101_FUNC,
5432 ALC269_FIXUP_ASUS_X101_VERB,
5433 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08005434 ALC271_FIXUP_AMIC_MIC2,
5435 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01005436 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07005437 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02005438 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01005439 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01005440 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01005441 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02005442 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02005443 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08005444 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02005445 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02005446 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02005447 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01005448 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5449 ALC290_FIXUP_SUBWOOFER,
5450 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01005451 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01005452 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06005453 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06005454 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005455 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08005456 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005457 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08005458 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08005459 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02005460 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01005461 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02005462 ALC283_FIXUP_HEADSET_MIC,
Hui Wang00ef9942014-07-31 11:52:38 +08005463 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02005464 ALC282_FIXUP_ASPIRE_V5_PINS,
David Henningsson7a5255f2014-10-30 08:26:01 +01005465 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08005466 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01005467 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01005468 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01005469 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07005470 ALC280_FIXUP_HP_9480M,
Kailang Yange1e62b92015-04-08 16:01:22 +08005471 ALC288_FIXUP_DELL_HEADSET_MODE,
5472 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
5473 ALC288_FIXUP_DELL_XPS_13_GPIO6,
Hui Wang831bfdf92015-06-26 12:35:17 +08005474 ALC288_FIXUP_DELL_XPS_13,
5475 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02005476 ALC292_FIXUP_DELL_E7X,
5477 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01005478 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
Kailang Yang977e6272015-05-18 15:31:20 +08005479 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08005480 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08005481 ALC275_FIXUP_DELL_XPS,
Hui Wang8c697292015-11-24 11:08:18 +08005482 ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE,
Hui Wang23adc192015-12-08 12:27:18 +08005483 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08005484 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08005485 ALC255_FIXUP_DELL_SPK_NOISE,
David Henningsson2ae95572016-02-25 09:37:05 +01005486 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01005487 ALC295_FIXUP_DISABLE_DAC3,
Takashi Iwaif8839822016-02-25 14:31:59 +01005488 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08005489 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02005490 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08005491 ALC298_FIXUP_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08005492 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01005493 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08005494 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06005495 ALC256_FIXUP_ASUS_HEADSET_MODE,
5496 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06005497 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06005498 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
5499 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08005500 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Hui Wangf33f79f2017-07-07 12:08:29 +08005501 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08005502 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
PeiSen Houb84e8432017-09-01 15:11:56 +08005503 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08005504 ALC274_FIXUP_DELL_BIND_DACS,
5505 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005506 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08005507 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08005508 ALC255_FIXUP_DELL_HEADSET_MIC,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01005509 ALC295_FIXUP_HP_X360,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005510};
5511
Takashi Iwai1727a772013-01-10 09:52:52 +01005512static const struct hda_fixup alc269_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005513 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01005514 .type = HDA_FIXUP_PINCTLS,
5515 .v.pins = (const struct hda_pintbl[]) {
5516 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02005517 {}
5518 }
5519 },
5520 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005521 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005522 .v.verbs = (const struct hda_verb[]) {
5523 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
5524 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
5525 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
5526 { }
5527 },
5528 .chained = true,
5529 .chain_id = ALC269_FIXUP_SONY_VAIO
5530 },
5531 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005532 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005533 .v.verbs = (const struct hda_verb[]) {
5534 /* Enables internal speaker */
5535 {0x20, AC_VERB_SET_COEF_INDEX, 13},
5536 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
5537 {}
5538 }
5539 },
5540 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005541 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02005542 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005543 },
5544 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005545 .type = HDA_FIXUP_PINS,
5546 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005547 { 0x17, 0x99130111 }, /* subwoofer */
5548 { }
5549 }
5550 },
5551 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005552 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005553 .v.verbs = (const struct hda_verb[]) {
5554 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5555 {}
5556 }
5557 },
5558 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005559 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005560 .v.func = alc269_fixup_hweq,
5561 .chained = true,
5562 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
5563 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02005564 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
5565 .type = HDA_FIXUP_FUNC,
5566 .v.func = alc_fixup_disable_aamix,
5567 .chained = true,
5568 .chain_id = ALC269_FIXUP_SONY_VAIO
5569 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02005570 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005571 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005572 .v.func = alc271_fixup_dmic,
5573 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02005574 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005575 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02005576 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02005577 .chained = true,
5578 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02005579 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005580 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005581 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02005582 .v.func = alc269_fixup_stereo_dmic,
5583 },
David Henningsson7c478f02013-10-11 10:18:46 +02005584 [ALC269_FIXUP_HEADSET_MIC] = {
5585 .type = HDA_FIXUP_FUNC,
5586 .v.func = alc269_fixup_headset_mic,
5587 },
Takashi Iwai24519912011-08-16 15:08:49 +02005588 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005589 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02005590 .v.func = alc269_fixup_quanta_mute,
5591 },
5592 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005593 .type = HDA_FIXUP_PINS,
5594 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02005595 { 0x1a, 0x2101103f }, /* dock line-out */
5596 { 0x1b, 0x23a11040 }, /* dock mic-in */
5597 { }
5598 },
5599 .chained = true,
5600 .chain_id = ALC269_FIXUP_QUANTA_MUTE
5601 },
David Henningsson2041d562014-06-13 11:15:44 +02005602 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
5603 .type = HDA_FIXUP_PINS,
5604 .v.pins = (const struct hda_pintbl[]) {
5605 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
5606 { }
5607 },
5608 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02005609 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
5610 .type = HDA_FIXUP_PINS,
5611 .v.pins = (const struct hda_pintbl[]) {
5612 { 0x21, 0x0221102f }, /* HP out */
5613 { }
5614 },
5615 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02005616 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
5617 .type = HDA_FIXUP_FUNC,
5618 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
5619 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01005620 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
5621 .type = HDA_FIXUP_FUNC,
5622 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
5623 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02005624 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005625 .type = HDA_FIXUP_PINS,
5626 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005627 { 0x14, 0x99130110 }, /* speaker */
5628 { 0x15, 0x0121401f }, /* HP out */
5629 { 0x18, 0x01a19c20 }, /* mic */
5630 { 0x19, 0x99a3092f }, /* int-mic */
5631 { }
5632 },
5633 },
5634 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005635 .type = HDA_FIXUP_PINS,
5636 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005637 { 0x12, 0x99a3092f }, /* int-mic */
5638 { 0x14, 0x99130110 }, /* speaker */
5639 { 0x15, 0x0121401f }, /* HP out */
5640 { 0x18, 0x01a19c20 }, /* mic */
5641 { }
5642 },
5643 },
5644 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005645 .type = HDA_FIXUP_PINS,
5646 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005647 { 0x14, 0x99130110 }, /* speaker */
5648 { 0x18, 0x01a19c20 }, /* mic */
5649 { 0x19, 0x99a3092f }, /* int-mic */
5650 { 0x21, 0x0121401f }, /* HP out */
5651 { }
5652 },
5653 },
David Henningsson2267ea92012-01-03 08:45:56 +01005654 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005655 .type = HDA_FIXUP_PINS,
5656 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005657 { 0x12, 0x99a3092f }, /* int-mic */
5658 { 0x14, 0x99130110 }, /* speaker */
5659 { 0x18, 0x01a19c20 }, /* mic */
5660 { 0x21, 0x0121401f }, /* HP out */
5661 { }
5662 },
5663 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005664 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005665 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005666 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01005667 },
David Henningssond06ac142013-02-18 11:41:55 +01005668 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
5669 .type = HDA_FIXUP_FUNC,
5670 .v.func = alc269_fixup_hp_mute_led_mic1,
5671 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005672 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005673 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01005674 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01005675 },
Tom Briden7f783bd2017-03-25 10:12:01 +00005676 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
5677 .type = HDA_FIXUP_FUNC,
5678 .v.func = alc269_fixup_hp_mute_led_mic3,
5679 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01005680 [ALC269_FIXUP_HP_GPIO_LED] = {
5681 .type = HDA_FIXUP_FUNC,
5682 .v.func = alc269_fixup_hp_gpio_led,
5683 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08005684 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
5685 .type = HDA_FIXUP_FUNC,
5686 .v.func = alc269_fixup_hp_gpio_mic1_led,
5687 },
5688 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
5689 .type = HDA_FIXUP_FUNC,
5690 .v.func = alc269_fixup_hp_line1_mic1_led,
5691 },
David Henningsson693b6132012-06-22 19:12:10 +02005692 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005693 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02005694 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02005695 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005696 [ALC269_FIXUP_NO_SHUTUP] = {
5697 .type = HDA_FIXUP_FUNC,
5698 .v.func = alc_fixup_no_shutup,
5699 },
David Henningsson108cc102012-07-20 10:37:25 +02005700 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005701 .type = HDA_FIXUP_PINS,
5702 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02005703 { 0x19, 0x23a11040 }, /* dock mic */
5704 { 0x1b, 0x2121103f }, /* dock headphone */
5705 { }
5706 },
5707 .chained = true,
5708 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
5709 },
5710 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005711 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02005712 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01005713 .chained = true,
5714 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02005715 },
David Henningsson73bdd592013-04-15 15:44:14 +02005716 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5717 .type = HDA_FIXUP_PINS,
5718 .v.pins = (const struct hda_pintbl[]) {
5719 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5720 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5721 { }
5722 },
5723 .chained = true,
5724 .chain_id = ALC269_FIXUP_HEADSET_MODE
5725 },
5726 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5727 .type = HDA_FIXUP_PINS,
5728 .v.pins = (const struct hda_pintbl[]) {
5729 { 0x16, 0x21014020 }, /* dock line out */
5730 { 0x19, 0x21a19030 }, /* dock mic */
5731 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5732 { }
5733 },
5734 .chained = true,
5735 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5736 },
David Henningsson338cae52013-10-07 10:39:59 +02005737 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
5738 .type = HDA_FIXUP_PINS,
5739 .v.pins = (const struct hda_pintbl[]) {
5740 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5741 { }
5742 },
5743 .chained = true,
5744 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
5745 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08005746 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
5747 .type = HDA_FIXUP_PINS,
5748 .v.pins = (const struct hda_pintbl[]) {
5749 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5750 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5751 { }
5752 },
5753 .chained = true,
5754 .chain_id = ALC269_FIXUP_HEADSET_MODE
5755 },
David Henningsson73bdd592013-04-15 15:44:14 +02005756 [ALC269_FIXUP_HEADSET_MODE] = {
5757 .type = HDA_FIXUP_FUNC,
5758 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08005759 .chained = true,
5760 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02005761 },
5762 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5763 .type = HDA_FIXUP_FUNC,
5764 .v.func = alc_fixup_headset_mode_no_hp_mic,
5765 },
Takashi Iwai78197172015-06-27 10:21:13 +02005766 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
5767 .type = HDA_FIXUP_PINS,
5768 .v.pins = (const struct hda_pintbl[]) {
5769 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
5770 { }
5771 },
5772 .chained = true,
5773 .chain_id = ALC269_FIXUP_HEADSET_MODE,
5774 },
David Henningsson88cfcf82013-10-11 10:18:45 +02005775 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
5776 .type = HDA_FIXUP_PINS,
5777 .v.pins = (const struct hda_pintbl[]) {
5778 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5779 { }
5780 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02005781 .chained = true,
5782 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02005783 },
David Henningssond240d1d2013-04-15 12:50:02 +02005784 [ALC269_FIXUP_ASUS_X101_FUNC] = {
5785 .type = HDA_FIXUP_FUNC,
5786 .v.func = alc269_fixup_x101_headset_mic,
5787 },
5788 [ALC269_FIXUP_ASUS_X101_VERB] = {
5789 .type = HDA_FIXUP_VERBS,
5790 .v.verbs = (const struct hda_verb[]) {
5791 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
5792 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
5793 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
5794 { }
5795 },
5796 .chained = true,
5797 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
5798 },
5799 [ALC269_FIXUP_ASUS_X101] = {
5800 .type = HDA_FIXUP_PINS,
5801 .v.pins = (const struct hda_pintbl[]) {
5802 { 0x18, 0x04a1182c }, /* Headset mic */
5803 { }
5804 },
5805 .chained = true,
5806 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
5807 },
Dylan Reid08a978d2012-11-18 22:56:40 -08005808 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005809 .type = HDA_FIXUP_PINS,
5810 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08005811 { 0x14, 0x99130110 }, /* speaker */
5812 { 0x19, 0x01a19c20 }, /* mic */
5813 { 0x1b, 0x99a7012f }, /* int-mic */
5814 { 0x21, 0x0121401f }, /* HP out */
5815 { }
5816 },
5817 },
5818 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005819 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08005820 .v.func = alc271_hp_gate_mic_jack,
5821 .chained = true,
5822 .chain_id = ALC271_FIXUP_AMIC_MIC2,
5823 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01005824 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
5825 .type = HDA_FIXUP_FUNC,
5826 .v.func = alc269_fixup_limit_int_mic_boost,
5827 .chained = true,
5828 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
5829 },
Dylan Reid42397002013-04-05 14:58:22 -07005830 [ALC269_FIXUP_ACER_AC700] = {
5831 .type = HDA_FIXUP_PINS,
5832 .v.pins = (const struct hda_pintbl[]) {
5833 { 0x12, 0x99a3092f }, /* int-mic */
5834 { 0x14, 0x99130110 }, /* speaker */
5835 { 0x18, 0x03a11c20 }, /* mic */
5836 { 0x1e, 0x0346101e }, /* SPDIF1 */
5837 { 0x21, 0x0321101f }, /* HP out */
5838 { }
5839 },
5840 .chained = true,
5841 .chain_id = ALC271_FIXUP_DMIC,
5842 },
David Henningsson3e0d6112013-04-22 14:30:14 +02005843 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
5844 .type = HDA_FIXUP_FUNC,
5845 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01005846 .chained = true,
5847 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02005848 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01005849 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
5850 .type = HDA_FIXUP_FUNC,
5851 .v.func = alc269_fixup_limit_int_mic_boost,
5852 .chained = true,
5853 .chain_id = ALC269VB_FIXUP_DMIC,
5854 },
Takashi Iwai23870832013-11-29 14:13:12 +01005855 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
5856 .type = HDA_FIXUP_VERBS,
5857 .v.verbs = (const struct hda_verb[]) {
5858 /* class-D output amp +5dB */
5859 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
5860 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
5861 {}
5862 },
5863 .chained = true,
5864 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
5865 },
David Henningsson8e35cd42013-11-06 11:20:01 +01005866 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
5867 .type = HDA_FIXUP_FUNC,
5868 .v.func = alc269_fixup_limit_int_mic_boost,
5869 .chained = true,
5870 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
5871 },
Anisse Astier02b504d2013-06-03 11:53:10 +02005872 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
5873 .type = HDA_FIXUP_PINS,
5874 .v.pins = (const struct hda_pintbl[]) {
5875 { 0x12, 0x99a3092f }, /* int-mic */
5876 { 0x18, 0x03a11d20 }, /* mic */
5877 { 0x19, 0x411111f0 }, /* Unused bogus pin */
5878 { }
5879 },
5880 },
Kailang Yangcd217a62013-08-22 10:15:24 +02005881 [ALC283_FIXUP_CHROME_BOOK] = {
5882 .type = HDA_FIXUP_FUNC,
5883 .v.func = alc283_fixup_chromebook,
5884 },
Kailang Yang0202e992013-12-02 15:20:15 +08005885 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
5886 .type = HDA_FIXUP_FUNC,
5887 .v.func = alc283_fixup_sense_combo_jack,
5888 .chained = true,
5889 .chain_id = ALC283_FIXUP_CHROME_BOOK,
5890 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02005891 [ALC282_FIXUP_ASUS_TX300] = {
5892 .type = HDA_FIXUP_FUNC,
5893 .v.func = alc282_fixup_asus_tx300,
5894 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02005895 [ALC283_FIXUP_INT_MIC] = {
5896 .type = HDA_FIXUP_VERBS,
5897 .v.verbs = (const struct hda_verb[]) {
5898 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
5899 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
5900 { }
5901 },
5902 .chained = true,
5903 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
5904 },
David Henningsson0f4881d2013-12-20 16:08:13 +01005905 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
5906 .type = HDA_FIXUP_PINS,
5907 .v.pins = (const struct hda_pintbl[]) {
5908 { 0x17, 0x90170112 }, /* subwoofer */
5909 { }
5910 },
5911 .chained = true,
5912 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
5913 },
5914 [ALC290_FIXUP_SUBWOOFER] = {
5915 .type = HDA_FIXUP_PINS,
5916 .v.pins = (const struct hda_pintbl[]) {
5917 { 0x17, 0x90170112 }, /* subwoofer */
5918 { }
5919 },
5920 .chained = true,
5921 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
5922 },
David Henningsson338cae52013-10-07 10:39:59 +02005923 [ALC290_FIXUP_MONO_SPEAKERS] = {
5924 .type = HDA_FIXUP_FUNC,
5925 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01005926 },
5927 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
5928 .type = HDA_FIXUP_FUNC,
5929 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02005930 .chained = true,
5931 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
5932 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01005933 [ALC269_FIXUP_THINKPAD_ACPI] = {
5934 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02005935 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02005936 .chained = true,
5937 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01005938 },
David Henningsson56f27012016-01-11 09:33:14 +01005939 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
5940 .type = HDA_FIXUP_FUNC,
5941 .v.func = alc_fixup_inv_dmic,
5942 .chained = true,
5943 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
5944 },
Chris Chiu5824ce82017-02-28 14:17:11 -06005945 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
5946 .type = HDA_FIXUP_PINS,
5947 .v.pins = (const struct hda_pintbl[]) {
5948 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5949 { }
5950 },
5951 .chained = true,
5952 .chain_id = ALC255_FIXUP_HEADSET_MODE
5953 },
Chris Chiu615966a2017-02-28 14:17:12 -06005954 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
5955 .type = HDA_FIXUP_PINS,
5956 .v.pins = (const struct hda_pintbl[]) {
5957 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5958 { }
5959 },
5960 .chained = true,
5961 .chain_id = ALC255_FIXUP_HEADSET_MODE
5962 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005963 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5964 .type = HDA_FIXUP_PINS,
5965 .v.pins = (const struct hda_pintbl[]) {
5966 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5967 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5968 { }
5969 },
5970 .chained = true,
5971 .chain_id = ALC255_FIXUP_HEADSET_MODE
5972 },
Kailang Yang31278992014-03-03 15:27:22 +08005973 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
5974 .type = HDA_FIXUP_PINS,
5975 .v.pins = (const struct hda_pintbl[]) {
5976 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5977 { }
5978 },
5979 .chained = true,
5980 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
5981 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005982 [ALC255_FIXUP_HEADSET_MODE] = {
5983 .type = HDA_FIXUP_FUNC,
5984 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08005985 .chained = true,
5986 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005987 },
Kailang Yang31278992014-03-03 15:27:22 +08005988 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
5989 .type = HDA_FIXUP_FUNC,
5990 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
5991 },
Kailang Yanga22aa262014-04-23 17:34:28 +08005992 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
5993 .type = HDA_FIXUP_PINS,
5994 .v.pins = (const struct hda_pintbl[]) {
5995 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
5996 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
5997 { }
5998 },
5999 .chained = true,
6000 .chain_id = ALC269_FIXUP_HEADSET_MODE
6001 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02006002 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02006003 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02006004 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006005 .chained = true,
6006 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
6007 },
Takashi Iwai9a811232015-12-09 15:17:43 +01006008 [ALC292_FIXUP_TPT440] = {
6009 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01006010 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01006011 .chained = true,
6012 .chain_id = ALC292_FIXUP_TPT440_DOCK,
6013 },
Anisse Astierabaa22742016-08-24 09:14:13 +02006014 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01006015 .type = HDA_FIXUP_PINS,
6016 .v.pins = (const struct hda_pintbl[]) {
6017 { 0x19, 0x04a110f0 },
6018 { },
6019 },
6020 },
Hui Wang00ef9942014-07-31 11:52:38 +08006021 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
6022 .type = HDA_FIXUP_FUNC,
6023 .v.func = alc_fixup_dell_wmi,
Hui Wang00ef9942014-07-31 11:52:38 +08006024 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006025 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
6026 .type = HDA_FIXUP_PINS,
6027 .v.pins = (const struct hda_pintbl[]) {
6028 { 0x12, 0x90a60130 },
6029 { 0x14, 0x90170110 },
6030 { 0x17, 0x40000008 },
6031 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02006032 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02006033 { 0x1a, 0x411111f0 },
6034 { 0x1b, 0x411111f0 },
6035 { 0x1d, 0x40f89b2d },
6036 { 0x1e, 0x411111f0 },
6037 { 0x21, 0x0321101f },
6038 { },
6039 },
6040 },
David Henningsson7a5255f2014-10-30 08:26:01 +01006041 [ALC280_FIXUP_HP_GPIO4] = {
6042 .type = HDA_FIXUP_FUNC,
6043 .v.func = alc280_fixup_hp_gpio4,
6044 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006045 [ALC286_FIXUP_HP_GPIO_LED] = {
6046 .type = HDA_FIXUP_FUNC,
6047 .v.func = alc286_fixup_hp_gpio_led,
6048 },
David Henningsson33f4acd2015-01-07 15:50:13 +01006049 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
6050 .type = HDA_FIXUP_FUNC,
6051 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
6052 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01006053 [ALC280_FIXUP_HP_DOCK_PINS] = {
6054 .type = HDA_FIXUP_PINS,
6055 .v.pins = (const struct hda_pintbl[]) {
6056 { 0x1b, 0x21011020 }, /* line-out */
6057 { 0x1a, 0x01a1903c }, /* headset mic */
6058 { 0x18, 0x2181103f }, /* line-in */
6059 { },
6060 },
6061 .chained = true,
6062 .chain_id = ALC280_FIXUP_HP_GPIO4
6063 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006064 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
6065 .type = HDA_FIXUP_PINS,
6066 .v.pins = (const struct hda_pintbl[]) {
6067 { 0x1b, 0x21011020 }, /* line-out */
6068 { 0x18, 0x2181103f }, /* line-in */
6069 { },
6070 },
6071 .chained = true,
6072 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
6073 },
Keith Packard98973f22015-07-15 12:14:39 -07006074 [ALC280_FIXUP_HP_9480M] = {
6075 .type = HDA_FIXUP_FUNC,
6076 .v.func = alc280_fixup_hp_9480m,
6077 },
Kailang Yange1e62b92015-04-08 16:01:22 +08006078 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
6079 .type = HDA_FIXUP_FUNC,
6080 .v.func = alc_fixup_headset_mode_dell_alc288,
6081 .chained = true,
6082 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
6083 },
6084 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6085 .type = HDA_FIXUP_PINS,
6086 .v.pins = (const struct hda_pintbl[]) {
6087 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6088 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6089 { }
6090 },
6091 .chained = true,
6092 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
6093 },
6094 [ALC288_FIXUP_DELL_XPS_13_GPIO6] = {
6095 .type = HDA_FIXUP_VERBS,
6096 .v.verbs = (const struct hda_verb[]) {
6097 {0x01, AC_VERB_SET_GPIO_MASK, 0x40},
6098 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x40},
6099 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
6100 { }
6101 },
6102 .chained = true,
6103 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
6104 },
Hui Wang831bfdf92015-06-26 12:35:17 +08006105 [ALC288_FIXUP_DISABLE_AAMIX] = {
6106 .type = HDA_FIXUP_FUNC,
6107 .v.func = alc_fixup_disable_aamix,
6108 .chained = true,
6109 .chain_id = ALC288_FIXUP_DELL_XPS_13_GPIO6
6110 },
6111 [ALC288_FIXUP_DELL_XPS_13] = {
6112 .type = HDA_FIXUP_FUNC,
6113 .v.func = alc_fixup_dell_xps13,
6114 .chained = true,
6115 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
6116 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006117 [ALC292_FIXUP_DISABLE_AAMIX] = {
6118 .type = HDA_FIXUP_FUNC,
6119 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08006120 .chained = true,
6121 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006122 },
David Henningssonc04017e2015-12-15 14:44:03 +01006123 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
6124 .type = HDA_FIXUP_FUNC,
6125 .v.func = alc_fixup_disable_aamix,
6126 .chained = true,
6127 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
6128 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006129 [ALC292_FIXUP_DELL_E7X] = {
6130 .type = HDA_FIXUP_FUNC,
6131 .v.func = alc_fixup_dell_xps13,
6132 .chained = true,
6133 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
6134 },
Kailang Yang977e6272015-05-18 15:31:20 +08006135 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6136 .type = HDA_FIXUP_PINS,
6137 .v.pins = (const struct hda_pintbl[]) {
6138 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6139 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6140 { }
6141 },
6142 .chained = true,
6143 .chain_id = ALC269_FIXUP_HEADSET_MODE
6144 },
Hui Wang2f726ae2017-03-31 10:31:40 +08006145 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
6146 .type = HDA_FIXUP_PINS,
6147 .v.pins = (const struct hda_pintbl[]) {
6148 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6149 { }
6150 },
6151 .chained = true,
6152 .chain_id = ALC269_FIXUP_HEADSET_MODE
6153 },
Kailang Yang6ed11312015-10-26 15:37:39 +08006154 [ALC275_FIXUP_DELL_XPS] = {
6155 .type = HDA_FIXUP_VERBS,
6156 .v.verbs = (const struct hda_verb[]) {
6157 /* Enables internal speaker */
6158 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
6159 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
6160 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
6161 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
6162 {}
6163 }
6164 },
Hui Wang8c697292015-11-24 11:08:18 +08006165 [ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
6166 .type = HDA_FIXUP_VERBS,
6167 .v.verbs = (const struct hda_verb[]) {
6168 /* Disable pass-through path for FRONT 14h */
6169 {0x20, AC_VERB_SET_COEF_INDEX, 0x36},
6170 {0x20, AC_VERB_SET_PROC_COEF, 0x1737},
6171 {}
6172 },
6173 .chained = true,
6174 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6175 },
Hui Wang23adc192015-12-08 12:27:18 +08006176 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
6177 .type = HDA_FIXUP_FUNC,
6178 .v.func = alc_fixup_disable_aamix,
6179 .chained = true,
6180 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
6181 },
Kailang3694cb22015-12-28 11:35:24 +08006182 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
6183 .type = HDA_FIXUP_FUNC,
6184 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
6185 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006186 [ALC255_FIXUP_DELL_SPK_NOISE] = {
6187 .type = HDA_FIXUP_FUNC,
6188 .v.func = alc_fixup_disable_aamix,
6189 .chained = true,
6190 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6191 },
David Henningsson2ae95572016-02-25 09:37:05 +01006192 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
6193 .type = HDA_FIXUP_VERBS,
6194 .v.verbs = (const struct hda_verb[]) {
6195 /* Disable pass-through path for FRONT 14h */
6196 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
6197 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
6198 {}
6199 },
6200 .chained = true,
6201 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6202 },
Takashi Iwaif8839822016-02-25 14:31:59 +01006203 [ALC280_FIXUP_HP_HEADSET_MIC] = {
6204 .type = HDA_FIXUP_FUNC,
6205 .v.func = alc_fixup_disable_aamix,
6206 .chained = true,
6207 .chain_id = ALC269_FIXUP_HEADSET_MIC,
6208 },
Hui Wange549d192016-04-01 11:00:15 +08006209 [ALC221_FIXUP_HP_FRONT_MIC] = {
6210 .type = HDA_FIXUP_PINS,
6211 .v.pins = (const struct hda_pintbl[]) {
6212 { 0x19, 0x02a19020 }, /* Front Mic */
6213 { }
6214 },
6215 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02006216 [ALC292_FIXUP_TPT460] = {
6217 .type = HDA_FIXUP_FUNC,
6218 .v.func = alc_fixup_tpt440_dock,
6219 .chained = true,
6220 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
6221 },
Hui Wangdd9aa332016-08-01 10:20:32 +08006222 [ALC298_FIXUP_SPK_VOLUME] = {
6223 .type = HDA_FIXUP_FUNC,
6224 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08006225 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08006226 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08006227 },
Takashi Iwaie312a862018-03-06 12:14:17 +01006228 [ALC295_FIXUP_DISABLE_DAC3] = {
6229 .type = HDA_FIXUP_FUNC,
6230 .v.func = alc295_fixup_disable_dac3,
6231 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006232 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
6233 .type = HDA_FIXUP_PINS,
6234 .v.pins = (const struct hda_pintbl[]) {
6235 { 0x1b, 0x90170151 },
6236 { }
6237 },
6238 .chained = true,
6239 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6240 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006241 [ALC269_FIXUP_ATIV_BOOK_8] = {
6242 .type = HDA_FIXUP_FUNC,
6243 .v.func = alc_fixup_auto_mute_via_amp,
6244 .chained = true,
6245 .chain_id = ALC269_FIXUP_NO_SHUTUP
6246 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006247 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
6248 .type = HDA_FIXUP_PINS,
6249 .v.pins = (const struct hda_pintbl[]) {
6250 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6251 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
6252 { }
6253 },
6254 .chained = true,
6255 .chain_id = ALC269_FIXUP_HEADSET_MODE
6256 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06006257 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
6258 .type = HDA_FIXUP_FUNC,
6259 .v.func = alc_fixup_headset_mode,
6260 },
6261 [ALC256_FIXUP_ASUS_MIC] = {
6262 .type = HDA_FIXUP_PINS,
6263 .v.pins = (const struct hda_pintbl[]) {
6264 { 0x13, 0x90a60160 }, /* use as internal mic */
6265 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
6266 { }
6267 },
6268 .chained = true,
6269 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
6270 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06006271 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
6272 .type = HDA_FIXUP_VERBS,
6273 .v.verbs = (const struct hda_verb[]) {
6274 /* Set up GPIO2 for the speaker amp */
6275 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
6276 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
6277 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
6278 {}
6279 },
6280 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06006281 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
6282 .type = HDA_FIXUP_PINS,
6283 .v.pins = (const struct hda_pintbl[]) {
6284 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6285 { }
6286 },
6287 .chained = true,
6288 .chain_id = ALC269_FIXUP_HEADSET_MIC
6289 },
6290 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
6291 .type = HDA_FIXUP_VERBS,
6292 .v.verbs = (const struct hda_verb[]) {
6293 /* Enables internal speaker */
6294 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
6295 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
6296 {}
6297 },
6298 .chained = true,
6299 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
6300 },
Kailang Yangca169cc2017-04-25 16:17:40 +08006301 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
6302 .type = HDA_FIXUP_FUNC,
6303 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
6304 },
Hui Wangf33f79f2017-07-07 12:08:29 +08006305 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
6306 .type = HDA_FIXUP_PINS,
6307 .v.pins = (const struct hda_pintbl[]) {
6308 /* Change the mic location from front to right, otherwise there are
6309 two front mics with the same name, pulseaudio can't handle them.
6310 This is just a temporary workaround, after applying this fixup,
6311 there will be one "Front Mic" and one "Mic" in this machine.
6312 */
6313 { 0x1a, 0x04a19040 },
6314 { }
6315 },
6316 },
Kailang Yang5f364132017-07-25 16:28:16 +08006317 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
6318 .type = HDA_FIXUP_PINS,
6319 .v.pins = (const struct hda_pintbl[]) {
6320 { 0x16, 0x0101102f }, /* Rear Headset HP */
6321 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
6322 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
6323 { 0x1b, 0x02011020 },
6324 { }
6325 },
6326 .chained = true,
6327 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
6328 },
PeiSen Houb84e8432017-09-01 15:11:56 +08006329 [ALC700_FIXUP_INTEL_REFERENCE] = {
6330 .type = HDA_FIXUP_VERBS,
6331 .v.verbs = (const struct hda_verb[]) {
6332 /* Enables internal speaker */
6333 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
6334 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
6335 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
6336 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
6337 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
6338 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
6339 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
6340 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
6341 {}
6342 }
6343 },
Kailang Yang92266652017-12-14 15:28:58 +08006344 [ALC274_FIXUP_DELL_BIND_DACS] = {
6345 .type = HDA_FIXUP_FUNC,
6346 .v.func = alc274_fixup_bind_dacs,
6347 .chained = true,
6348 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
6349 },
6350 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
6351 .type = HDA_FIXUP_PINS,
6352 .v.pins = (const struct hda_pintbl[]) {
6353 { 0x1b, 0x0401102f },
6354 { }
6355 },
6356 .chained = true,
6357 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
6358 },
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006359 [ALC298_FIXUP_TPT470_DOCK] = {
6360 .type = HDA_FIXUP_FUNC,
6361 .v.func = alc_fixup_tpt470_dock,
6362 .chained = true,
6363 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
6364 },
Kailang Yangae104a22018-02-05 16:07:20 +08006365 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
6366 .type = HDA_FIXUP_PINS,
6367 .v.pins = (const struct hda_pintbl[]) {
6368 { 0x14, 0x0201101f },
6369 { }
6370 },
6371 .chained = true,
6372 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
6373 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006374 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
6375 .type = HDA_FIXUP_PINS,
6376 .v.pins = (const struct hda_pintbl[]) {
6377 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
6378 { }
6379 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08006380 .chained = true,
6381 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006382 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006383 [ALC295_FIXUP_HP_X360] = {
6384 .type = HDA_FIXUP_FUNC,
6385 .v.func = alc295_fixup_hp_top_speakers,
6386 .chained = true,
6387 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
6388 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02006389};
6390
6391static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01006392 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02006393 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6394 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02006395 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02006396 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
6397 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02006398 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6399 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05006400 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006401 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02006402 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01006403 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
David Henningssonaaedfb42013-08-16 14:09:02 +02006404 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08006405 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01006406 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01006407 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006408 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
6409 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01006410 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02006411 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6412 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
6413 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01006414 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
6415 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01006416 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02006417 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01006418 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08006419 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6420 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08006421 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02006422 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02006423 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08006424 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08006425 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6426 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01006427 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6428 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6429 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6430 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
6431 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Feng423cd782016-05-20 15:47:23 +08006432 SND_PCI_QUIRK(0x1028, 0x0704, "Dell XPS 13 9350", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006433 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006434 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Kai-Heng Feng423cd782016-05-20 15:47:23 +08006435 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Hui Wangdd9aa332016-08-01 10:20:32 +08006436 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwaie312a862018-03-06 12:14:17 +01006437 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Takashi Iwai493de342017-02-28 17:27:57 +01006438 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kailang Yang5f364132017-07-25 16:28:16 +08006439 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Takashi Iwaie4c9fd12018-01-10 08:34:28 +01006440 SND_PCI_QUIRK(0x1028, 0x082a, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08006441 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
6442 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006443 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
6444 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08006445 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yanga22aa262014-04-23 17:34:28 +08006446 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
6447 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006448 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006449 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01006450 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
David Henningsson33f4acd2015-01-07 15:50:13 +01006451 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08006452 /* ALC282 */
Hui Wang7976eb42015-02-13 11:14:41 +08006453 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006454 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006455 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006456 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6457 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6458 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
6459 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006460 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006461 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006462 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6463 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006464 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006465 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
TienFu Chenb4b33f92015-01-20 15:06:21 +01006466 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
TienFu Chen3271cb22015-02-10 09:09:41 +01006467 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yangc60666b2014-02-21 16:23:35 +08006468 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006469 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6470 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6471 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006472 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Keith Packard98973f22015-07-15 12:14:39 -07006473 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006474 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6475 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006476 /* ALC290 */
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006477 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006478 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006479 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006480 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6481 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6482 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6483 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6484 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006485 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006486 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006487 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006488 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6489 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6490 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006491 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
6492 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006493 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08006494 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006495 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006496 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006497 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6498 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006499 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6500 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08006501 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08006502 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6503 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6504 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
6505 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwaif8839822016-02-25 14:31:59 +01006506 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
Hui Wange549d192016-04-01 11:00:15 +08006507 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006508 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006509 SND_PCI_QUIRK(0x103c, 0x82bf, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
6510 SND_PCI_QUIRK(0x103c, 0x82c0, "HP", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006511 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02006512 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02006513 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006514 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006515 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02006516 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006517 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
6518 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
6519 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006520 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
6521 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
6522 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01006523 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01006524 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02006525 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai017f2a12011-07-09 14:42:25 +02006526 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06006527 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
David Henningsson693b6132012-06-22 19:12:10 +02006528 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06006529 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02006530 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006531 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Chris Chiueeed4cd2017-02-28 14:17:15 -06006532 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006533 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
6534 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
6535 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
6536 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02006537 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwaif88abaa2014-02-07 12:07:59 +01006538 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
David Henningsson88cfcf82013-10-11 10:18:45 +02006539 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006540 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
6541 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6542 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006543 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwai24519912011-08-16 15:08:49 +02006544 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006545 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006546 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Takashi Iwai88776f32015-05-01 09:20:34 +02006547 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006548 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
David Henningsson2041d562014-06-13 11:15:44 +02006549 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08006550 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
David Henningssona33cc482014-10-07 10:18:41 +02006551 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006552 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Anisse Astierabaa22742016-08-24 09:14:13 +02006553 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
6554 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Kailang Yangca169cc2017-04-25 16:17:40 +08006555 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006556 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
6557 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
6558 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
6559 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
6560 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwai707fba32012-08-02 09:04:39 +02006561 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
Felix Kaechelec8415a42012-08-06 23:02:01 +02006562 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Stefán Freyr84f98fd2012-10-19 22:46:00 +02006563 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02006564 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02006565 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02006566 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01006567 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02006568 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02006569 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05006570 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02006571 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01006572 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02006573 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01006574 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07006575 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02006576 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006577 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6578 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02006579 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02006580 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006581 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
6582 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6583 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01006584 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006585 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6586 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6587 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01006588 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang3694cb22015-12-28 11:35:24 +08006589 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08006590 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08006591 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08006592 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wanga3dafb22018-04-19 13:29:05 +08006593 SND_PCI_QUIRK(0x17aa, 0x3138, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08006594 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
David Henningsson56f27012016-01-11 09:33:14 +01006595 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01006596 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006597 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
David Henningssona4a9e082013-08-16 14:09:01 +02006598 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02006599 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02006600 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02006601 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02006602 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01006603 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02006604 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02006605 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08006606 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02006607 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02006608 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02006609 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006610 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6611 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6612 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02006613 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006614 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
6615 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningsson012e7eb2012-08-08 08:43:37 +02006616 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
Takashi Iwai1d045db2011-07-07 18:23:21 +02006617 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Anisse Astier02b504d2013-06-03 11:53:10 +02006618 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02006619
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01006620#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02006621 /* Below is a quirk table taken from the old code.
6622 * Basically the device should work as is without the fixup table.
6623 * If BIOS doesn't give a proper info, enable the corresponding
6624 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02006625 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02006626 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
6627 ALC269_FIXUP_AMIC),
6628 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02006629 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
6630 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
6631 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
6632 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
6633 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
6634 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
6635 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
6636 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
6637 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
6638 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
6639 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
6640 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
6641 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
6642 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
6643 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
6644 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
6645 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
6646 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
6647 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
6648 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
6649 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
6650 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
6651 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
6652 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
6653 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
6654 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
6655 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
6656 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
6657 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
6658 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
6659 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
6660 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
6661 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
6662 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
6663 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
6664 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
6665 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
6666 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
6667#endif
6668 {}
6669};
6670
David Henningsson214eef72014-07-22 14:09:35 +02006671static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
6672 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
6673 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
6674 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
6675 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
6676 {}
6677};
6678
Takashi Iwai1727a772013-01-10 09:52:52 +01006679static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02006680 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
6681 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02006682 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
6683 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
6684 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02006685 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02006686 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
6687 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02006688 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006689 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006690 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02006691 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
6692 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08006693 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08006694 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02006695 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01006696 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02006697 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02006698 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02006699 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02006700 {}
6701};
Kailang Yangcfc5a842016-02-03 15:20:39 +08006702#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08006703 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02006704
Hui Wange8191a82015-04-24 13:39:59 +08006705#define ALC256_STANDARD_PINS \
6706 {0x12, 0x90a60140}, \
6707 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08006708 {0x21, 0x02211020}
6709
David Henningssonfea185e2014-09-03 10:23:04 +02006710#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08006711 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08006712
David Henningssonfea185e2014-09-03 10:23:04 +02006713#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08006714 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02006715
6716#define ALC292_STANDARD_PINS \
6717 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08006718 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08006719
Hui Wang3f6409702016-09-11 11:26:16 +08006720#define ALC295_STANDARD_PINS \
6721 {0x12, 0xb7a60130}, \
6722 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08006723 {0x21, 0x04211020}
6724
Woodrow Shen703867e2015-08-05 12:34:12 +08006725#define ALC298_STANDARD_PINS \
6726 {0x12, 0x90a60130}, \
6727 {0x21, 0x03211020}
6728
Hui Wange1918932014-05-26 16:22:44 +08006729static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Chris Chiu5824ce82017-02-28 14:17:11 -06006730 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
6731 {0x12, 0x90a601c0},
6732 {0x14, 0x90171120},
6733 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06006734 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6735 {0x14, 0x90170110},
6736 {0x1b, 0x90a70130},
6737 {0x21, 0x03211020}),
6738 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
6739 {0x1a, 0x90a70130},
6740 {0x1b, 0x90170110},
6741 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01006742 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08006743 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08006744 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08006745 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01006746 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08006747 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08006748 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08006749 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08006750 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6751 ALC225_STANDARD_PINS,
6752 {0x12, 0xb7a60150},
6753 {0x14, 0x901701a0}),
6754 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6755 ALC225_STANDARD_PINS,
6756 {0x12, 0xb7a60150},
6757 {0x14, 0x901701b0}),
6758 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
6759 ALC225_STANDARD_PINS,
6760 {0x12, 0xb7a60130},
6761 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05006762 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6763 {0x1b, 0x01111010},
6764 {0x1e, 0x01451130},
6765 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08006766 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
6767 {0x12, 0x90a60140},
6768 {0x14, 0x90170110},
6769 {0x19, 0x02a11030},
6770 {0x21, 0x02211020}),
Hui Wangf2657882017-10-24 16:53:34 +08006771 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6772 {0x12, 0x90a60140},
6773 {0x14, 0x90170110},
6774 {0x21, 0x02211020}),
6775 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6776 {0x12, 0x90a60140},
6777 {0x14, 0x90170150},
6778 {0x21, 0x02211020}),
Hui Wangc77900e2014-09-03 11:31:07 +08006779 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08006780 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08006781 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02006782 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08006783 {0x14, 0x90170130},
6784 {0x21, 0x02211040}),
6785 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02006786 {0x12, 0x90a60140},
6787 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02006788 {0x21, 0x02211020}),
6789 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6790 {0x12, 0x90a60160},
6791 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02006792 {0x21, 0x02211030}),
6793 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08006794 {0x14, 0x90170110},
6795 {0x1b, 0x02011020},
6796 {0x21, 0x0221101f}),
6797 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08006798 {0x14, 0x90170110},
6799 {0x1b, 0x01011020},
6800 {0x21, 0x0221101f}),
6801 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02006802 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02006803 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02006804 {0x21, 0x0221103f}),
6805 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08006806 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08006807 {0x1b, 0x01011020},
6808 {0x21, 0x0221103f}),
6809 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6810 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08006811 {0x1b, 0x02011020},
6812 {0x21, 0x0221103f}),
6813 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08006814 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08006815 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08006816 {0x21, 0x0221105f}),
6817 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08006818 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08006819 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08006820 {0x21, 0x0221101f}),
6821 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02006822 {0x12, 0x90a60160},
6823 {0x14, 0x90170120},
6824 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02006825 {0x21, 0x0321102f}),
6826 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6827 {0x12, 0x90a60160},
6828 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02006829 {0x21, 0x02211040}),
6830 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6831 {0x12, 0x90a60160},
6832 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02006833 {0x21, 0x02211050}),
6834 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6835 {0x12, 0x90a60170},
6836 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02006837 {0x21, 0x02211030}),
6838 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6839 {0x12, 0x90a60170},
6840 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02006841 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08006842 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08006843 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08006844 {0x14, 0x90171130},
6845 {0x21, 0x02211040}),
6846 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6847 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08006848 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08006849 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02006850 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02006851 {0x12, 0x90a60180},
6852 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02006853 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08006854 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6855 {0x12, 0x90a60180},
6856 {0x14, 0x90170120},
6857 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08006858 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6859 {0x1b, 0x01011020},
6860 {0x21, 0x02211010}),
Kailang Yang7081adf2015-03-30 17:05:37 +08006861 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang285d5dd2017-12-22 11:17:45 +08006862 {0x12, 0x90a60130},
6863 {0x14, 0x90170110},
6864 {0x1b, 0x01011020},
6865 {0x21, 0x0221101f}),
6866 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang81a12312015-05-28 16:48:22 +08006867 {0x12, 0x90a60160},
6868 {0x14, 0x90170120},
Kailang Yang81a12312015-05-28 16:48:22 +08006869 {0x21, 0x02211030}),
6870 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shenf83c3292016-06-24 15:58:34 +08006871 {0x12, 0x90a60170},
6872 {0x14, 0x90170120},
6873 {0x21, 0x02211030}),
Shrirang Bagul311042d2016-08-29 15:19:27 +08006874 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell Inspiron 5468", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6875 {0x12, 0x90a60180},
6876 {0x14, 0x90170120},
6877 {0x21, 0x02211030}),
Woodrow Shenf83c3292016-06-24 15:58:34 +08006878 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang3f6409702016-09-11 11:26:16 +08006879 {0x12, 0xb7a60130},
6880 {0x14, 0x90170110},
6881 {0x21, 0x02211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01006882 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang3f2f7c52018-01-29 14:23:15 +08006883 {0x12, 0x90a60130},
6884 {0x14, 0x90170110},
6885 {0x14, 0x01011020},
6886 {0x21, 0x0221101f}),
6887 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncf51eb92014-10-30 08:26:02 +01006888 ALC256_STANDARD_PINS),
Chris Chiuc1732ed2017-02-28 14:17:13 -06006889 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
6890 {0x14, 0x90170110},
6891 {0x1b, 0x90a70130},
6892 {0x21, 0x04211020}),
6893 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
6894 {0x14, 0x90170110},
6895 {0x1b, 0x90a70130},
6896 {0x21, 0x03211020}),
Kailang Yang92266652017-12-14 15:28:58 +08006897 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Hui Wang75ee94b2017-11-09 08:48:08 +08006898 {0x12, 0xb7a60130},
6899 {0x13, 0xb8a61140},
6900 {0x16, 0x90170110},
6901 {0x21, 0x04211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01006902 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
6903 {0x12, 0x90a60130},
6904 {0x14, 0x90170110},
6905 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08006906 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08006907 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
6908 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08006909 {0x14, 0x90170110},
6910 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08006911 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08006912 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08006913 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02006914 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006915 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02006916 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02006917 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02006918 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08006919 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006920 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08006921 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08006922 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08006923 {0x21, 0x03211040}),
6924 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006925 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08006926 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08006927 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08006928 {0x21, 0x03211020}),
6929 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006930 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08006931 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08006932 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08006933 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08006934 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02006935 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08006936 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08006937 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08006938 {0x21, 0x04211020}),
David Henningsson76c21322014-06-24 14:46:54 +02006939 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006940 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02006941 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02006942 {0x21, 0x0321101f}),
6943 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6944 {0x12, 0x90a60160},
6945 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02006946 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08006947 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006948 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08006949 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08006950 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08006951 {0x21, 0x0321101f}),
Kailang Yange1e62b92015-04-08 16:01:22 +08006952 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL_XPS_13_GPIO6,
Kailang Yange1e62b92015-04-08 16:01:22 +08006953 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08006954 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08006955 {0x21, 0x0321101f}),
Hui Wangd5078192018-03-02 13:05:36 +08006956 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Hui Wang3f2f7c52018-01-29 14:23:15 +08006957 {0x12, 0xb7a60130},
6958 {0x14, 0x90170110},
6959 {0x21, 0x04211020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006960 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006961 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006962 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08006963 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08006964 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006965 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006966 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006967 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08006968 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08006969 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006970 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006971 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006972 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08006973 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006974 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006975 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006976 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08006977 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08006978 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006979 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006980 {0x14, 0x90170110},
6981 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08006982 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08006983 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006984 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006985 {0x14, 0x90170110},
6986 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08006987 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08006988 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02006989 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08006990 {0x14, 0x90170110},
6991 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08006992 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08006993 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006994 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08006995 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08006996 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08006997 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08006998 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02006999 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08007000 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08007001 {0x16, 0x01014020},
7002 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08007003 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02007004 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007005 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08007006 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02007007 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007008 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02007009 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02007010 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08007011 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02007012 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02007013 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08007014 {0x13, 0x90a60140}),
Hui Wang3f6409702016-09-11 11:26:16 +08007015 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08007016 ALC295_STANDARD_PINS,
7017 {0x17, 0x21014020},
7018 {0x18, 0x21a19030}),
7019 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7020 ALC295_STANDARD_PINS,
7021 {0x17, 0x21014040},
7022 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08007023 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
7024 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08007025 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08007026 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02007027 {0x17, 0x90170110}),
7028 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7029 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08007030 {0x17, 0x90170140}),
7031 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
7032 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02007033 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08007034 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
7035 {0x12, 0xb7a60140},
7036 {0x13, 0xb7a60150},
7037 {0x17, 0x90170110},
7038 {0x1a, 0x03011020},
7039 {0x21, 0x03211030}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08007040 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
7041 ALC225_STANDARD_PINS,
7042 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08007043 {0x17, 0x90170110}),
Hui Wange1918932014-05-26 16:22:44 +08007044 {}
7045};
Takashi Iwai1d045db2011-07-07 18:23:21 +02007046
Takashi Iwai546bb672012-03-07 08:37:19 +01007047static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02007048{
Kailang Yang526af6e2012-03-07 08:25:20 +01007049 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007050 int val;
7051
Kailang Yang526af6e2012-03-07 08:25:20 +01007052 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01007053 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01007054
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007055 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007056 alc_write_coef_idx(codec, 0xf, 0x960b);
7057 alc_write_coef_idx(codec, 0xe, 0x8817);
7058 }
7059
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007060 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007061 alc_write_coef_idx(codec, 0xf, 0x960b);
7062 alc_write_coef_idx(codec, 0xe, 0x8814);
7063 }
7064
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007065 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007066 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02007067 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007068 }
7069
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007070 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007071 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02007072 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007073 /* Capless ramp up clock control */
7074 alc_write_coef_idx(codec, 0xd, val | (1<<10));
7075 }
7076 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02007077 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007078 /* Class D power on reset */
7079 alc_write_coef_idx(codec, 0x17, val | (1<<7));
7080 }
7081 }
7082
Takashi Iwai98b24882014-08-18 13:47:50 +02007083 /* HP */
7084 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007085}
7086
7087/*
7088 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007089static int patch_alc269(struct hda_codec *codec)
7090{
7091 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02007092 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007093
Takashi Iwai3de95172012-05-07 18:03:15 +02007094 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007095 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02007096 return err;
7097
7098 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01007099 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007100 codec->power_save_node = 1;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007101
Takashi Iwai225068a2015-05-29 10:42:14 +02007102#ifdef CONFIG_PM
7103 codec->patch_ops.suspend = alc269_suspend;
7104 codec->patch_ops.resume = alc269_resume;
7105#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08007106 spec->shutup = alc_default_shutup;
7107 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02007108
Takashi Iwai1727a772013-01-10 09:52:52 +01007109 snd_hda_pick_fixup(codec, alc269_fixup_models,
Herton Ronaldo Krzesinski9f720bb92012-09-27 10:38:14 -03007110 alc269_fixup_tbl, alc269_fixups);
Hui Wange1918932014-05-26 16:22:44 +08007111 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
David Henningsson214eef72014-07-22 14:09:35 +02007112 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
7113 alc269_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01007114 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Herton Ronaldo Krzesinski9f720bb92012-09-27 10:38:14 -03007115
7116 alc_auto_parse_customize_define(codec);
7117
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007118 if (has_cdefine_beep(codec))
7119 spec->gen.beep_nid = 0x01;
7120
Takashi Iwai7639a062015-03-03 10:07:24 +01007121 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01007122 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02007123 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007124 switch (alc_get_coef0(codec) & 0x00f0) {
7125 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01007126 if (codec->bus->pci &&
7127 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007128 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02007129 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02007130 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007131 break;
7132 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01007133 if (codec->bus->pci &&
7134 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007135 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02007136 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02007137 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007138 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02007139 case 0x0030:
7140 spec->codec_variant = ALC269_TYPE_ALC269VD;
7141 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007142 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02007143 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02007144 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007145 if (err < 0)
7146 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08007147 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01007148 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007149 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01007150 break;
7151
7152 case 0x10ec0280:
7153 case 0x10ec0290:
7154 spec->codec_variant = ALC269_TYPE_ALC280;
7155 break;
7156 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01007157 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08007158 spec->shutup = alc282_shutup;
7159 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01007160 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02007161 case 0x10ec0233:
7162 case 0x10ec0283:
7163 spec->codec_variant = ALC269_TYPE_ALC283;
7164 spec->shutup = alc283_shutup;
7165 spec->init_hook = alc283_init;
7166 break;
Kailang Yang065380f2013-01-10 10:25:48 +01007167 case 0x10ec0284:
7168 case 0x10ec0292:
7169 spec->codec_variant = ALC269_TYPE_ALC284;
7170 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02007171 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08007172 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02007173 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02007174 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08007175 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02007176 spec->codec_variant = ALC269_TYPE_ALC286;
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08007177 spec->shutup = alc286_shutup;
Kailang Yang7fc7d042013-04-25 11:04:43 +02007178 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08007179 case 0x10ec0298:
7180 spec->codec_variant = ALC269_TYPE_ALC298;
7181 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08007182 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02007183 case 0x10ec0255:
7184 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08007185 spec->shutup = alc256_shutup;
7186 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02007187 break;
Kailang Yang736f20a2017-10-20 15:06:34 +08007188 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08007189 case 0x10ec0256:
7190 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08007191 spec->shutup = alc256_shutup;
7192 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02007193 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yangd32b6662015-04-23 15:10:53 +08007194 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/
Kailang Yang4344aec2014-12-17 17:39:05 +08007195 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08007196 case 0x10ec0257:
7197 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08007198 spec->shutup = alc256_shutup;
7199 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +08007200 spec->gen.mixer_nid = 0;
7201 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +08007202 case 0x10ec0215:
7203 case 0x10ec0285:
7204 case 0x10ec0289:
7205 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +08007206 spec->shutup = alc225_shutup;
7207 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +08007208 spec->gen.mixer_nid = 0;
7209 break;
Kailang Yang42314302016-02-03 15:03:50 +08007210 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +08007211 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08007212 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +08007213 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +08007214 spec->shutup = alc225_shutup;
7215 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +01007216 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +08007217 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08007218 case 0x10ec0234:
7219 case 0x10ec0274:
7220 case 0x10ec0294:
7221 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +08007222 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +08007223 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08007224 break;
Kailang Yang6fbae352016-05-30 16:44:20 +08007225 case 0x10ec0700:
7226 case 0x10ec0701:
7227 case 0x10ec0703:
7228 spec->codec_variant = ALC269_TYPE_ALC700;
7229 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +08007230 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang6fbae352016-05-30 16:44:20 +08007231 break;
7232
Takashi Iwai1d045db2011-07-07 18:23:21 +02007233 }
7234
Kailang Yangad60d502013-06-28 12:03:01 +02007235 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05007236 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02007237 spec->init_hook = alc5505_dsp_init;
7238 }
7239
Takashi Iwaia4297b52011-08-23 18:40:12 +02007240 /* automatic parse from the BIOS config */
7241 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007242 if (err < 0)
7243 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007244
David Henningsson7d1b6e22015-04-21 10:48:46 +02007245 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid)
7246 set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007247
Takashi Iwai1727a772013-01-10 09:52:52 +01007248 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007249
Takashi Iwai1d045db2011-07-07 18:23:21 +02007250 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007251
7252 error:
7253 alc_free(codec);
7254 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007255}
7256
7257/*
7258 * ALC861
7259 */
7260
Takashi Iwai1d045db2011-07-07 18:23:21 +02007261static int alc861_parse_auto_config(struct hda_codec *codec)
7262{
Takashi Iwai1d045db2011-07-07 18:23:21 +02007263 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007264 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
7265 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007266}
7267
Takashi Iwai1d045db2011-07-07 18:23:21 +02007268/* Pin config fixes */
7269enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007270 ALC861_FIXUP_FSC_AMILO_PI1505,
7271 ALC861_FIXUP_AMP_VREF_0F,
7272 ALC861_FIXUP_NO_JACK_DETECT,
7273 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007274 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007275};
7276
Takashi Iwai31150f22012-01-30 10:54:08 +01007277/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
7278static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007279 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01007280{
7281 struct alc_spec *spec = codec->spec;
7282 unsigned int val;
7283
Takashi Iwai1727a772013-01-10 09:52:52 +01007284 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01007285 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01007286 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01007287 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
7288 val |= AC_PINCTL_IN_EN;
7289 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02007290 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01007291 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01007292}
7293
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007294/* suppress the jack-detection */
7295static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007296 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007297{
Takashi Iwai1727a772013-01-10 09:52:52 +01007298 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007299 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02007300}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007301
Takashi Iwai1727a772013-01-10 09:52:52 +01007302static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007303 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007304 .type = HDA_FIXUP_PINS,
7305 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007306 { 0x0b, 0x0221101f }, /* HP */
7307 { 0x0f, 0x90170310 }, /* speaker */
7308 { }
7309 }
7310 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007311 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007312 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01007313 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01007314 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007315 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007316 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007317 .v.func = alc_fixup_no_jack_detect,
7318 },
7319 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007320 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007321 .v.func = alc861_fixup_asus_amp_vref_0f,
7322 .chained = true,
7323 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007324 },
7325 [ALC660_FIXUP_ASUS_W7J] = {
7326 .type = HDA_FIXUP_VERBS,
7327 .v.verbs = (const struct hda_verb[]) {
7328 /* ASUS W7J needs a magic pin setup on unused NID 0x10
7329 * for enabling outputs
7330 */
7331 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
7332 { }
7333 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007334 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02007335};
7336
7337static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01007338 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01007339 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01007340 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
7341 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
7342 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
7343 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
7344 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
7345 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007346 {}
7347};
7348
7349/*
7350 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007351static int patch_alc861(struct hda_codec *codec)
7352{
7353 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007354 int err;
7355
Takashi Iwai3de95172012-05-07 18:03:15 +02007356 err = alc_alloc_spec(codec, 0x15);
7357 if (err < 0)
7358 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007359
Takashi Iwai3de95172012-05-07 18:03:15 +02007360 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007361 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007362
Takashi Iwai225068a2015-05-29 10:42:14 +02007363#ifdef CONFIG_PM
7364 spec->power_hook = alc_power_eapd;
7365#endif
7366
Takashi Iwai1727a772013-01-10 09:52:52 +01007367 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
7368 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007369
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007370 /* automatic parse from the BIOS config */
7371 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007372 if (err < 0)
7373 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007374
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007375 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007376 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007377
Takashi Iwai1727a772013-01-10 09:52:52 +01007378 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007379
Takashi Iwai1d045db2011-07-07 18:23:21 +02007380 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007381
7382 error:
7383 alc_free(codec);
7384 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007385}
7386
7387/*
7388 * ALC861-VD support
7389 *
7390 * Based on ALC882
7391 *
7392 * In addition, an independent DAC
7393 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007394static int alc861vd_parse_auto_config(struct hda_codec *codec)
7395{
Takashi Iwai1d045db2011-07-07 18:23:21 +02007396 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007397 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7398 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007399}
7400
Takashi Iwai1d045db2011-07-07 18:23:21 +02007401enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007402 ALC660VD_FIX_ASUS_GPIO1,
7403 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007404};
7405
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007406/* exclude VREF80 */
7407static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007408 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007409{
Takashi Iwai1727a772013-01-10 09:52:52 +01007410 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01007411 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
7412 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007413 }
7414}
7415
Takashi Iwai1727a772013-01-10 09:52:52 +01007416static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007417 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007418 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007419 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007420 /* reset GPIO1 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007421 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
7422 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
7423 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
7424 { }
7425 }
7426 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007427 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007428 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007429 .v.func = alc861vd_fixup_dallas,
7430 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02007431};
7432
7433static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007434 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007435 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02007436 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02007437 {}
7438};
7439
Takashi Iwai1d045db2011-07-07 18:23:21 +02007440/*
7441 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007442static int patch_alc861vd(struct hda_codec *codec)
7443{
7444 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007445 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007446
Takashi Iwai3de95172012-05-07 18:03:15 +02007447 err = alc_alloc_spec(codec, 0x0b);
7448 if (err < 0)
7449 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007450
Takashi Iwai3de95172012-05-07 18:03:15 +02007451 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007452 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007453
Takashi Iwai225068a2015-05-29 10:42:14 +02007454 spec->shutup = alc_eapd_shutup;
7455
Takashi Iwai1727a772013-01-10 09:52:52 +01007456 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
7457 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007458
Takashi Iwaicb4e4822011-08-23 17:34:25 +02007459 /* automatic parse from the BIOS config */
7460 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007461 if (err < 0)
7462 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007463
Takashi Iwai7504b6c2013-03-18 11:25:51 +01007464 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007465 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02007466
Takashi Iwai1727a772013-01-10 09:52:52 +01007467 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01007468
Takashi Iwai1d045db2011-07-07 18:23:21 +02007469 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02007470
7471 error:
7472 alc_free(codec);
7473 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02007474}
7475
7476/*
7477 * ALC662 support
7478 *
7479 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
7480 * configuration. Each pin widget can choose any input DACs and a mixer.
7481 * Each ADC is connected from a mixer of all inputs. This makes possible
7482 * 6-channel independent captures.
7483 *
7484 * In addition, an independent DAC for the multi-playback (not used in this
7485 * driver yet).
7486 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02007487
7488/*
7489 * BIOS auto configuration
7490 */
7491
Kailang Yangbc9f98a2007-04-12 13:06:07 +02007492static int alc662_parse_auto_config(struct hda_codec *codec)
7493{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02007494 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007495 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
7496 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
7497 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02007498
Takashi Iwai7639a062015-03-03 10:07:24 +01007499 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
7500 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
7501 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007502 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01007503 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02007504 ssids = alc662_ssids;
7505 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02007506}
7507
Todd Broch6be79482010-12-07 16:51:05 -08007508static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01007509 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01007510{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01007511 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01007512 return;
Todd Broch6be79482010-12-07 16:51:05 -08007513 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
7514 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
7515 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
7516 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
7517 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01007518 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08007519}
7520
Takashi Iwai8e383952013-10-30 17:41:12 +01007521static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
7522 { .channels = 2,
7523 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
7524 { .channels = 4,
7525 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
7526 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
7527 { }
7528};
7529
7530/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01007531static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01007532 const struct hda_fixup *fix, int action)
7533{
7534 if (action == HDA_FIXUP_ACT_BUILD) {
7535 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +01007536 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +01007537 }
7538}
7539
Takashi Iwaibf686652014-01-13 16:18:25 +01007540/* avoid D3 for keeping GPIO up */
7541static unsigned int gpio_led_power_filter(struct hda_codec *codec,
7542 hda_nid_t nid,
7543 unsigned int power_state)
7544{
7545 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +02007546 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +01007547 return AC_PWRST_D0;
7548 return power_state;
7549}
7550
Takashi Iwai3e887f32014-01-10 17:50:58 +01007551static void alc662_fixup_led_gpio1(struct hda_codec *codec,
7552 const struct hda_fixup *fix, int action)
7553{
7554 struct alc_spec *spec = codec->spec;
7555 static const struct hda_verb gpio_init[] = {
7556 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
7557 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
7558 {}
7559 };
7560
7561 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01007562 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01007563 spec->mute_led_polarity = 1;
7564 spec->gpio_mute_led_mask = 0x01;
Takashi Iwai3e887f32014-01-10 17:50:58 +01007565 snd_hda_add_verbs(codec, gpio_init);
Takashi Iwaibf686652014-01-13 16:18:25 +01007566 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01007567 }
7568}
7569
Kailang Yangc6790c82016-11-25 16:15:17 +08007570static void alc662_usi_automute_hook(struct hda_codec *codec,
7571 struct hda_jack_callback *jack)
7572{
7573 struct alc_spec *spec = codec->spec;
7574 int vref;
7575 msleep(200);
7576 snd_hda_gen_hp_automute(codec, jack);
7577
7578 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
7579 msleep(100);
7580 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
7581 vref);
7582}
7583
7584static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
7585 const struct hda_fixup *fix, int action)
7586{
7587 struct alc_spec *spec = codec->spec;
7588 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
7589 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
7590 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
7591 }
7592}
7593
Kailang Yangf3f91852014-10-24 15:43:46 +08007594static struct coef_fw alc668_coefs[] = {
7595 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
7596 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
7597 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
7598 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
7599 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
7600 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
7601 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
7602 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
7603 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
7604 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
7605 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
7606 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
7607 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
7608 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
7609 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
7610 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
7611 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
7612 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
7613 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
7614 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
7615 {}
7616};
7617
7618static void alc668_restore_default_value(struct hda_codec *codec)
7619{
7620 alc_process_coef_fw(codec, alc668_coefs);
7621}
7622
David Henningsson6cb3b702010-09-09 08:51:44 +02007623enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04007624 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01007625 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02007626 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08007627 ALC272_FIXUP_MARIO,
Anisse Astierd2ebd472011-01-20 12:36:21 +01007628 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02007629 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02007630 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02007631 ALC662_FIXUP_ASUS_MODE1,
7632 ALC662_FIXUP_ASUS_MODE2,
7633 ALC662_FIXUP_ASUS_MODE3,
7634 ALC662_FIXUP_ASUS_MODE4,
7635 ALC662_FIXUP_ASUS_MODE5,
7636 ALC662_FIXUP_ASUS_MODE6,
7637 ALC662_FIXUP_ASUS_MODE7,
7638 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01007639 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02007640 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02007641 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +02007642 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02007643 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02007644 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +02007645 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01007646 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01007647 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007648 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01007649 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08007650 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02007651 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02007652 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02007653 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02007654 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07007655 ALC668_FIXUP_ASUS_Nx51,
Kailang Yang78f4f7c2016-06-07 11:31:34 +08007656 ALC891_FIXUP_HEADSET_MODE,
7657 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08007658 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +02007659 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +08007660 ALC662_FIXUP_USI_FUNC,
7661 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +08007662 ALC662_FIXUP_LENOVO_MULTI_CODECS,
David Henningsson6cb3b702010-09-09 08:51:44 +02007663};
7664
Takashi Iwai1727a772013-01-10 09:52:52 +01007665static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04007666 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007667 .type = HDA_FIXUP_PINS,
7668 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04007669 { 0x15, 0x99130112 }, /* subwoofer */
7670 { }
7671 }
7672 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01007673 [ALC662_FIXUP_LED_GPIO1] = {
7674 .type = HDA_FIXUP_FUNC,
7675 .v.func = alc662_fixup_led_gpio1,
7676 },
David Henningsson6cb3b702010-09-09 08:51:44 +02007677 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007678 .type = HDA_FIXUP_PINS,
7679 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02007680 { 0x17, 0x99130112 }, /* subwoofer */
7681 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01007682 },
7683 .chained = true,
7684 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02007685 },
Todd Broch6be79482010-12-07 16:51:05 -08007686 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007687 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01007688 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01007689 },
7690 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007691 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +01007692 .v.verbs = (const struct hda_verb[]) {
7693 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7694 {}
7695 }
7696 },
David Henningsson94024cd2011-04-29 14:10:55 +02007697 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007698 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02007699 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +02007700 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02007701 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007702 .type = HDA_FIXUP_PINS,
7703 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02007704 { 0x14, 0x0221201f }, /* HP out */
7705 { }
7706 },
7707 .chained = true,
7708 .chain_id = ALC662_FIXUP_SKU_IGNORE
7709 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02007710 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007711 .type = HDA_FIXUP_PINS,
7712 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007713 { 0x14, 0x99130110 }, /* speaker */
7714 { 0x18, 0x01a19c20 }, /* mic */
7715 { 0x19, 0x99a3092f }, /* int-mic */
7716 { 0x21, 0x0121401f }, /* HP out */
7717 { }
7718 },
7719 .chained = true,
7720 .chain_id = ALC662_FIXUP_SKU_IGNORE
7721 },
7722 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007723 .type = HDA_FIXUP_PINS,
7724 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +02007725 { 0x14, 0x99130110 }, /* speaker */
7726 { 0x18, 0x01a19820 }, /* mic */
7727 { 0x19, 0x99a3092f }, /* int-mic */
7728 { 0x1b, 0x0121401f }, /* HP out */
7729 { }
7730 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02007731 .chained = true,
7732 .chain_id = ALC662_FIXUP_SKU_IGNORE
7733 },
7734 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007735 .type = HDA_FIXUP_PINS,
7736 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007737 { 0x14, 0x99130110 }, /* speaker */
7738 { 0x15, 0x0121441f }, /* HP */
7739 { 0x18, 0x01a19840 }, /* mic */
7740 { 0x19, 0x99a3094f }, /* int-mic */
7741 { 0x21, 0x01211420 }, /* HP2 */
7742 { }
7743 },
7744 .chained = true,
7745 .chain_id = ALC662_FIXUP_SKU_IGNORE
7746 },
7747 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007748 .type = HDA_FIXUP_PINS,
7749 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007750 { 0x14, 0x99130110 }, /* speaker */
7751 { 0x16, 0x99130111 }, /* speaker */
7752 { 0x18, 0x01a19840 }, /* mic */
7753 { 0x19, 0x99a3094f }, /* int-mic */
7754 { 0x21, 0x0121441f }, /* HP */
7755 { }
7756 },
7757 .chained = true,
7758 .chain_id = ALC662_FIXUP_SKU_IGNORE
7759 },
7760 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007761 .type = HDA_FIXUP_PINS,
7762 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007763 { 0x14, 0x99130110 }, /* speaker */
7764 { 0x15, 0x0121441f }, /* HP */
7765 { 0x16, 0x99130111 }, /* speaker */
7766 { 0x18, 0x01a19840 }, /* mic */
7767 { 0x19, 0x99a3094f }, /* int-mic */
7768 { }
7769 },
7770 .chained = true,
7771 .chain_id = ALC662_FIXUP_SKU_IGNORE
7772 },
7773 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007774 .type = HDA_FIXUP_PINS,
7775 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007776 { 0x14, 0x99130110 }, /* speaker */
7777 { 0x15, 0x01211420 }, /* HP2 */
7778 { 0x18, 0x01a19840 }, /* mic */
7779 { 0x19, 0x99a3094f }, /* int-mic */
7780 { 0x1b, 0x0121441f }, /* HP */
7781 { }
7782 },
7783 .chained = true,
7784 .chain_id = ALC662_FIXUP_SKU_IGNORE
7785 },
7786 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007787 .type = HDA_FIXUP_PINS,
7788 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007789 { 0x14, 0x99130110 }, /* speaker */
7790 { 0x17, 0x99130111 }, /* speaker */
7791 { 0x18, 0x01a19840 }, /* mic */
7792 { 0x19, 0x99a3094f }, /* int-mic */
7793 { 0x1b, 0x01214020 }, /* HP */
7794 { 0x21, 0x0121401f }, /* HP */
7795 { }
7796 },
7797 .chained = true,
7798 .chain_id = ALC662_FIXUP_SKU_IGNORE
7799 },
7800 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007801 .type = HDA_FIXUP_PINS,
7802 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007803 { 0x14, 0x99130110 }, /* speaker */
7804 { 0x12, 0x99a30970 }, /* int-mic */
7805 { 0x15, 0x01214020 }, /* HP */
7806 { 0x17, 0x99130111 }, /* speaker */
7807 { 0x18, 0x01a19840 }, /* mic */
7808 { 0x21, 0x0121401f }, /* HP */
7809 { }
7810 },
7811 .chained = true,
7812 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +02007813 },
Takashi Iwai1565cc32012-02-13 12:03:25 +01007814 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007815 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +01007816 .v.func = alc_fixup_no_jack_detect,
7817 },
David Henningssonedfe3bf2012-06-12 13:15:12 +02007818 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007819 .type = HDA_FIXUP_PINS,
7820 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +02007821 { 0x1b, 0x02214020 }, /* Front HP */
7822 { }
7823 }
7824 },
Takashi Iwai125821a2012-06-22 14:30:29 +02007825 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007826 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02007827 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +02007828 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02007829 [ALC668_FIXUP_DELL_XPS13] = {
7830 .type = HDA_FIXUP_FUNC,
7831 .v.func = alc_fixup_dell_xps13,
7832 .chained = true,
7833 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
7834 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02007835 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
7836 .type = HDA_FIXUP_FUNC,
7837 .v.func = alc_fixup_disable_aamix,
7838 .chained = true,
7839 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
7840 },
Hui Wang493a52a2014-01-14 14:07:36 +08007841 [ALC668_FIXUP_AUTO_MUTE] = {
7842 .type = HDA_FIXUP_FUNC,
7843 .v.func = alc_fixup_auto_mute_via_amp,
7844 .chained = true,
7845 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
7846 },
David Henningsson1f8b46c2015-05-12 14:38:15 +02007847 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
7848 .type = HDA_FIXUP_PINS,
7849 .v.pins = (const struct hda_pintbl[]) {
7850 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7851 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
7852 { }
7853 },
7854 .chained = true,
7855 .chain_id = ALC662_FIXUP_HEADSET_MODE
7856 },
7857 [ALC662_FIXUP_HEADSET_MODE] = {
7858 .type = HDA_FIXUP_FUNC,
7859 .v.func = alc_fixup_headset_mode_alc662,
7860 },
David Henningsson73bdd592013-04-15 15:44:14 +02007861 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
7862 .type = HDA_FIXUP_PINS,
7863 .v.pins = (const struct hda_pintbl[]) {
7864 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7865 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7866 { }
7867 },
7868 .chained = true,
7869 .chain_id = ALC668_FIXUP_HEADSET_MODE
7870 },
7871 [ALC668_FIXUP_HEADSET_MODE] = {
7872 .type = HDA_FIXUP_FUNC,
7873 .v.func = alc_fixup_headset_mode_alc668,
7874 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01007875 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +01007876 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01007877 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +01007878 .chained = true,
7879 .chain_id = ALC662_FIXUP_ASUS_MODE4
7880 },
David Henningsson61a75f12014-02-07 09:31:08 +01007881 [ALC662_FIXUP_BASS_16] = {
7882 .type = HDA_FIXUP_PINS,
7883 .v.pins = (const struct hda_pintbl[]) {
7884 {0x16, 0x80106111}, /* bass speaker */
7885 {}
7886 },
7887 .chained = true,
7888 .chain_id = ALC662_FIXUP_BASS_CHMAP,
7889 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007890 [ALC662_FIXUP_BASS_1A] = {
7891 .type = HDA_FIXUP_PINS,
7892 .v.pins = (const struct hda_pintbl[]) {
7893 {0x1a, 0x80106111}, /* bass speaker */
7894 {}
7895 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01007896 .chained = true,
7897 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007898 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01007899 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007900 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01007901 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01007902 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02007903 [ALC662_FIXUP_ASUS_Nx50] = {
7904 .type = HDA_FIXUP_FUNC,
7905 .v.func = alc_fixup_auto_mute_via_amp,
7906 .chained = true,
7907 .chain_id = ALC662_FIXUP_BASS_1A
7908 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02007909 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
7910 .type = HDA_FIXUP_FUNC,
7911 .v.func = alc_fixup_headset_mode_alc668,
7912 .chain_id = ALC662_FIXUP_BASS_CHMAP
7913 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07007914 [ALC668_FIXUP_ASUS_Nx51] = {
7915 .type = HDA_FIXUP_PINS,
7916 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02007917 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7918 { 0x1a, 0x90170151 }, /* bass speaker */
7919 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07007920 {}
7921 },
7922 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +02007923 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07007924 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +08007925 [ALC891_FIXUP_HEADSET_MODE] = {
7926 .type = HDA_FIXUP_FUNC,
7927 .v.func = alc_fixup_headset_mode,
7928 },
7929 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
7930 .type = HDA_FIXUP_PINS,
7931 .v.pins = (const struct hda_pintbl[]) {
7932 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
7933 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
7934 { }
7935 },
7936 .chained = true,
7937 .chain_id = ALC891_FIXUP_HEADSET_MODE
7938 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08007939 [ALC662_FIXUP_ACER_VERITON] = {
7940 .type = HDA_FIXUP_PINS,
7941 .v.pins = (const struct hda_pintbl[]) {
7942 { 0x15, 0x50170120 }, /* no internal speaker */
7943 { }
7944 }
7945 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +02007946 [ALC892_FIXUP_ASROCK_MOBO] = {
7947 .type = HDA_FIXUP_PINS,
7948 .v.pins = (const struct hda_pintbl[]) {
7949 { 0x15, 0x40f000f0 }, /* disabled */
7950 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +02007951 { }
7952 }
7953 },
Kailang Yangc6790c82016-11-25 16:15:17 +08007954 [ALC662_FIXUP_USI_FUNC] = {
7955 .type = HDA_FIXUP_FUNC,
7956 .v.func = alc662_fixup_usi_headset_mic,
7957 },
7958 [ALC662_FIXUP_USI_HEADSET_MODE] = {
7959 .type = HDA_FIXUP_PINS,
7960 .v.pins = (const struct hda_pintbl[]) {
7961 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
7962 { 0x18, 0x01a1903d },
7963 { }
7964 },
7965 .chained = true,
7966 .chain_id = ALC662_FIXUP_USI_FUNC
7967 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007968 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
7969 .type = HDA_FIXUP_FUNC,
7970 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
7971 },
David Henningsson6cb3b702010-09-09 08:51:44 +02007972};
7973
Takashi Iwaia9111322011-05-02 11:30:18 +02007974static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +02007975 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +02007976 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +01007977 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +01007978 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +02007979 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +02007980 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +02007981 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -04007982 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
David Henningsson73bdd592013-04-15 15:44:14 +02007983 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7984 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +02007985 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02007986 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +02007987 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +01007988 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +01007989 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +08007990 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
7991 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +08007992 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02007993 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Kaho Ng2da2dc92016-05-09 00:27:49 +08007994 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +02007995 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwaidb8948e2016-01-18 09:17:30 +01007996 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +02007997 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
David Henningsson8e54b4a2014-02-07 09:31:07 +01007998 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +01007999 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +07008000 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
8001 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Takashi Iwaic7efff92017-01-04 21:38:16 +01008002 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +01008003 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +01008004 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +01008005 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +02008006 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -05008007 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +08008008 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +08008009 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Valentine Sinitsynd4118582010-10-01 22:24:08 +06008010 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +02008011 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +02008012 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +02008013 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +08008014 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Anisse Astierd2ebd472011-01-20 12:36:21 +01008015 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +02008016
8017#if 0
8018 /* Below is a quirk table taken from the old code.
8019 * Basically the device should work as is without the fixup table.
8020 * If BIOS doesn't give a proper info, enable the corresponding
8021 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02008022 */
Takashi Iwai53c334a2011-08-23 18:27:14 +02008023 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
8024 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
8025 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
8026 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
8027 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8028 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8029 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8030 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
8031 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
8032 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8033 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
8034 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
8035 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
8036 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
8037 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
8038 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8039 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
8040 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
8041 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8042 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8043 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8044 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8045 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
8046 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
8047 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
8048 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8049 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
8050 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
8051 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8052 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
8053 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8054 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8055 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
8056 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
8057 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
8058 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
8059 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
8060 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
8061 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
8062 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
8063 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
8064 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
8065 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8066 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
8067 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
8068 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
8069 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
8070 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
8071 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
8072 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
8073#endif
David Henningsson6cb3b702010-09-09 08:51:44 +02008074 {}
8075};
8076
Takashi Iwai1727a772013-01-10 09:52:52 +01008077static const struct hda_model_fixup alc662_fixup_models[] = {
Todd Broch6be79482010-12-07 16:51:05 -08008078 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwai53c334a2011-08-23 18:27:14 +02008079 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
8080 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
8081 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
8082 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
8083 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
8084 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
8085 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
8086 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02008087 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningssone32aa852013-06-17 11:04:02 +02008088 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02008089 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Todd Broch6be79482010-12-07 16:51:05 -08008090 {}
8091};
David Henningsson6cb3b702010-09-09 08:51:44 +02008092
Hui Wang532895c2014-05-29 15:59:19 +08008093static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008094 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
8095 {0x17, 0x02211010},
8096 {0x18, 0x01a19030},
8097 {0x1a, 0x01813040},
8098 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +02008099 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +02008100 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +02008101 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +02008102 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +08008103 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +02008104 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8105 {0x12, 0x99a30130},
8106 {0x14, 0x90170110},
8107 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008108 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008109 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8110 {0x12, 0x99a30140},
8111 {0x14, 0x90170110},
8112 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008113 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008114 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
8115 {0x12, 0x99a30150},
8116 {0x14, 0x90170110},
8117 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008118 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008119 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +02008120 {0x14, 0x90170110},
8121 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +08008122 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +02008123 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
8124 {0x12, 0x90a60130},
8125 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08008126 {0x15, 0x0321101f}),
Hui Wang532895c2014-05-29 15:59:19 +08008127 {}
8128};
8129
Takashi Iwai1d045db2011-07-07 18:23:21 +02008130/*
8131 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008132static int patch_alc662(struct hda_codec *codec)
8133{
8134 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02008135 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008136
Takashi Iwai3de95172012-05-07 18:03:15 +02008137 err = alc_alloc_spec(codec, 0x0b);
8138 if (err < 0)
8139 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008140
Takashi Iwai3de95172012-05-07 18:03:15 +02008141 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008142
Takashi Iwai225068a2015-05-29 10:42:14 +02008143 spec->shutup = alc_eapd_shutup;
8144
Takashi Iwai53c334a2011-08-23 18:27:14 +02008145 /* handle multiple HPs as is */
8146 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
8147
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +02008148 alc_fix_pll_init(codec, 0x20, 0x04, 15);
8149
Takashi Iwai7639a062015-03-03 10:07:24 +01008150 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +08008151 case 0x10ec0668:
8152 spec->init_hook = alc668_restore_default_value;
8153 break;
Kailang Yangf3f91852014-10-24 15:43:46 +08008154 }
Kailang Yang8663ff72012-06-29 09:35:52 +02008155
Takashi Iwai1727a772013-01-10 09:52:52 +01008156 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +02008157 alc662_fixup_tbl, alc662_fixups);
Hui Wang532895c2014-05-29 15:59:19 +08008158 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01008159 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +02008160
8161 alc_auto_parse_customize_define(codec);
8162
Takashi Iwai7504b6c2013-03-18 11:25:51 +01008163 if (has_cdefine_beep(codec))
8164 spec->gen.beep_nid = 0x01;
8165
Takashi Iwai1bb7e432011-10-17 16:50:59 +02008166 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +01008167 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008168 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +08008169 err = alc_codec_rename(codec, "ALC272X");
8170 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008171 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +02008172 }
Kailang Yang274693f2009-12-03 10:07:50 +01008173
Takashi Iwaib9c51062011-08-24 18:08:07 +02008174 /* automatic parse from the BIOS config */
8175 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008176 if (err < 0)
8177 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008178
Takashi Iwai7504b6c2013-03-18 11:25:51 +01008179 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +01008180 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +01008181 case 0x10ec0662:
8182 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
8183 break;
8184 case 0x10ec0272:
8185 case 0x10ec0663:
8186 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +08008187 case 0x10ec0668:
Kailang Yangda00c242010-03-19 11:23:45 +01008188 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
8189 break;
8190 case 0x10ec0273:
8191 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
8192 break;
8193 }
Kailang Yangcec27c82010-02-04 14:18:18 +01008194 }
Takashi Iwai2134ea42008-01-10 16:53:55 +01008195
Takashi Iwai1727a772013-01-10 09:52:52 +01008196 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01008197
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008198 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008199
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02008200 error:
8201 alc_free(codec);
8202 return err;
Kailang Yangb478b992011-05-18 11:51:15 +02008203}
8204
Kailang Yangbc9f98a2007-04-12 13:06:07 +02008205/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008206 * ALC680 support
8207 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008208
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008209static int alc680_parse_auto_config(struct hda_codec *codec)
8210{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02008211 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008212}
8213
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008214/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008215 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008216static int patch_alc680(struct hda_codec *codec)
8217{
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008218 int err;
8219
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008220 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02008221 err = alc_alloc_spec(codec, 0);
8222 if (err < 0)
8223 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02008224
Takashi Iwai1ebec5f2011-08-15 13:21:48 +02008225 /* automatic parse from the BIOS config */
8226 err = alc680_parse_auto_config(codec);
8227 if (err < 0) {
8228 alc_free(codec);
8229 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008230 }
8231
Kailang Yangd1eb57f2010-06-23 16:25:26 +02008232 return 0;
8233}
8234
8235/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07008236 * patch entries
8237 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008238static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +08008239 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008240 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +08008241 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008242 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
8243 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008244 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008245 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +08008246 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008247 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
8248 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +08008249 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008250 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
8251 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
8252 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
8253 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
8254 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
8255 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
8256 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008257 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008258 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
8259 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
8260 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
8261 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
8262 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
8263 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +08008264 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008265 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
8266 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +08008267 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008268 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
8269 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
8270 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08008271 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +08008272 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008273 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +08008274 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008275 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
8276 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
8277 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
8278 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
8279 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
8280 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
8281 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
8282 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
8283 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
8284 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
8285 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
8286 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
8287 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
8288 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +08008289 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
8290 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
8291 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +08008292 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008293 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
8294 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
8295 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
8296 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
8297 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
8298 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
8299 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
8300 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
8301 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
8302 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
8303 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
8304 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
8305 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +08008306 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +08008307 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -07008308 {} /* terminator */
8309};
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008310MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +01008311
8312MODULE_LICENSE("GPL");
8313MODULE_DESCRIPTION("Realtek HD-audio codec");
8314
Takashi Iwaid8a766a2015-02-17 15:25:37 +01008315static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +02008316 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +01008317};
8318
Takashi Iwaid8a766a2015-02-17 15:25:37 +01008319module_hda_codec_driver(realtek_driver);