blob: a722067c491cb9110e4d9ef5375197058e2f1488 [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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032#include <sound/core.h>
Kailang Yang9ad0e492010-09-14 23:22:00 +020033#include <sound/jack.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include "hda_codec.h"
35#include "hda_local.h"
Takashi Iwai23d30f22012-05-07 17:17:32 +020036#include "hda_auto_parser.h"
Takashi Iwai1835a0f2011-10-27 22:12:46 +020037#include "hda_jack.h"
Takashi Iwai08c189f2012-12-19 15:22:24 +010038#include "hda_generic.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070039
Takashi Iwaicd63a5f2013-07-05 12:13:59 +020040/* keep halting ALC5505 DSP, for power saving */
41#define HALT_REALTEK_ALC5505
42
Kailang Yangdf694da2005-12-05 19:42:22 +010043/* for GPIO Poll */
44#define GPIO_MASK 0x03
45
Takashi Iwai4a79ba32009-04-22 16:31:35 +020046/* extra amp-initialization sequence types */
47enum {
48 ALC_INIT_NONE,
49 ALC_INIT_DEFAULT,
50 ALC_INIT_GPIO1,
51 ALC_INIT_GPIO2,
52 ALC_INIT_GPIO3,
53};
54
David Henningsson73bdd592013-04-15 15:44:14 +020055enum {
56 ALC_HEADSET_MODE_UNKNOWN,
57 ALC_HEADSET_MODE_UNPLUGGED,
58 ALC_HEADSET_MODE_HEADSET,
59 ALC_HEADSET_MODE_MIC,
60 ALC_HEADSET_MODE_HEADPHONE,
61};
62
63enum {
64 ALC_HEADSET_TYPE_UNKNOWN,
65 ALC_HEADSET_TYPE_CTIA,
66 ALC_HEADSET_TYPE_OMTP,
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 Iwai08fb0d02013-01-10 17:33:58 +010093 /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */
94 int mute_led_polarity;
95 hda_nid_t mute_led_nid;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +080096 hda_nid_t cap_mute_led_nid;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010097
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +010098 unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */
Takashi Iwai0f32fd192014-11-19 12:16:14 +010099 unsigned int gpio_mute_led_mask;
100 unsigned int gpio_mic_led_mask;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +0100101
David Henningsson73bdd592013-04-15 15:44:14 +0200102 hda_nid_t headset_mic_pin;
103 hda_nid_t headphone_mic_pin;
104 int current_headset_mode;
105 int current_headset_type;
106
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100107 /* hooks */
108 void (*init_hook)(struct hda_codec *codec);
Takashi Iwai83012a72012-08-24 18:38:08 +0200109#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500110 void (*power_hook)(struct hda_codec *codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100111#endif
Takashi Iwai1c7161532011-04-07 10:37:16 +0200112 void (*shutup)(struct hda_codec *codec);
Takashi Iwaid922b512011-04-28 12:18:53 +0200113
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200114 int init_amp;
Takashi Iwaid433a672010-09-20 15:11:54 +0200115 int codec_variant; /* flag for other variants */
Kailang Yang97a26572013-11-29 00:35:26 -0500116 unsigned int has_alc5505_dsp:1;
117 unsigned int no_depop_delay:1;
Takashi Iwaie64f14f2009-01-20 18:32:55 +0100118
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200119 /* for PLL fix */
120 hda_nid_t pll_nid;
121 unsigned int pll_coef_idx, pll_coef_bit;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200122 unsigned int coef0;
Kailang Yangdf694da2005-12-05 19:42:22 +0100123};
124
Takashi Iwai23f0c042009-02-26 13:03:58 +0100125/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200126 * COEF access helper functions
127 */
128
129static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
130 unsigned int coef_idx)
131{
132 unsigned int val;
133
134 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
135 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
136 return val;
137}
138
139#define alc_read_coef_idx(codec, coef_idx) \
140 alc_read_coefex_idx(codec, 0x20, coef_idx)
141
142static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
143 unsigned int coef_idx, unsigned int coef_val)
144{
145 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
146 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
147}
148
149#define alc_write_coef_idx(codec, coef_idx, coef_val) \
150 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
151
Takashi Iwai98b24882014-08-18 13:47:50 +0200152static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
153 unsigned int coef_idx, unsigned int mask,
154 unsigned int bits_set)
155{
156 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
157
158 if (val != -1)
159 alc_write_coefex_idx(codec, nid, coef_idx,
160 (val & ~mask) | bits_set);
161}
162
163#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
164 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
165
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200166/* a special bypass for COEF 0; read the cached value at the second time */
167static unsigned int alc_get_coef0(struct hda_codec *codec)
168{
169 struct alc_spec *spec = codec->spec;
170
171 if (!spec->coef0)
172 spec->coef0 = alc_read_coef_idx(codec, 0);
173 return spec->coef0;
174}
175
Takashi Iwai54db6c32014-08-18 15:11:19 +0200176/* coef writes/updates batch */
177struct coef_fw {
178 unsigned char nid;
179 unsigned char idx;
180 unsigned short mask;
181 unsigned short val;
182};
183
184#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
185 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
186#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
187#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
188#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
189
190static void alc_process_coef_fw(struct hda_codec *codec,
191 const struct coef_fw *fw)
192{
193 for (; fw->nid; fw++) {
194 if (fw->mask == (unsigned short)-1)
195 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
196 else
197 alc_update_coefex_idx(codec, fw->nid, fw->idx,
198 fw->mask, fw->val);
199 }
200}
201
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200202/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200203 * Append the given mixer and verb elements for the later use
204 * The mixer array is referred in build_controls(), and init_verbs are
205 * called in init().
Takashi Iwaid88897e2008-10-31 15:01:37 +0100206 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200207static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix)
Takashi Iwaid88897e2008-10-31 15:01:37 +0100208{
209 if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers)))
210 return;
211 spec->mixers[spec->num_mixers++] = mix;
212}
213
Takashi Iwaid88897e2008-10-31 15:01:37 +0100214/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200215 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100216 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200217/* Enable GPIO mask and set output */
Takashi Iwaia9111322011-05-02 11:30:18 +0200218static const struct hda_verb alc_gpio1_init_verbs[] = {
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200219 {0x01, AC_VERB_SET_GPIO_MASK, 0x01},
220 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
221 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
222 { }
223};
224
Takashi Iwaia9111322011-05-02 11:30:18 +0200225static const struct hda_verb alc_gpio2_init_verbs[] = {
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200226 {0x01, AC_VERB_SET_GPIO_MASK, 0x02},
227 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},
228 {0x01, AC_VERB_SET_GPIO_DATA, 0x02},
229 { }
230};
231
Takashi Iwaia9111322011-05-02 11:30:18 +0200232static const struct hda_verb alc_gpio3_init_verbs[] = {
Kailang Yangbdd148a2007-05-08 15:19:08 +0200233 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
234 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03},
235 {0x01, AC_VERB_SET_GPIO_DATA, 0x03},
236 { }
237};
238
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200239/*
240 * Fix hardware PLL issue
241 * On some codecs, the analog PLL gating control must be off while
242 * the default value is 1.
243 */
244static void alc_fix_pll(struct hda_codec *codec)
245{
246 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200247
Takashi Iwai98b24882014-08-18 13:47:50 +0200248 if (spec->pll_nid)
249 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
250 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200251}
252
253static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
254 unsigned int coef_idx, unsigned int coef_bit)
255{
256 struct alc_spec *spec = codec->spec;
257 spec->pll_nid = nid;
258 spec->pll_coef_idx = coef_idx;
259 spec->pll_coef_bit = coef_bit;
260 alc_fix_pll(codec);
261}
262
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100263/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200264static void alc_update_knob_master(struct hda_codec *codec,
265 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100266{
267 unsigned int val;
268 struct snd_kcontrol *kctl;
269 struct snd_ctl_elem_value *uctl;
270
271 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
272 if (!kctl)
273 return;
274 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
275 if (!uctl)
276 return;
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200277 val = snd_hda_codec_read(codec, jack->tbl->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100278 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
279 val &= HDA_AMP_VOLMASK;
280 uctl->value.integer.value[0] = val;
281 uctl->value.integer.value[1] = val;
282 kctl->put(kctl, uctl);
283 kfree(uctl);
284}
285
David Henningsson29adc4b2012-09-25 11:31:00 +0200286static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100287{
David Henningsson29adc4b2012-09-25 11:31:00 +0200288 /* For some reason, the res given from ALC880 is broken.
289 Here we adjust it properly. */
290 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100291}
292
Kailang Yang394c97f2014-11-12 17:38:08 +0800293/* Change EAPD to verb control */
294static void alc_fill_eapd_coef(struct hda_codec *codec)
295{
296 int coef;
297
298 coef = alc_get_coef0(codec);
299
300 switch (codec->vendor_id) {
301 case 0x10ec0262:
302 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
303 break;
304 case 0x10ec0267:
305 case 0x10ec0268:
306 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
307 break;
308 case 0x10ec0269:
309 if ((coef & 0x00f0) == 0x0010)
310 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
311 if ((coef & 0x00f0) == 0x0020)
312 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
313 if ((coef & 0x00f0) == 0x0030)
314 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
315 break;
316 case 0x10ec0280:
317 case 0x10ec0284:
318 case 0x10ec0290:
319 case 0x10ec0292:
320 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
321 break;
322 case 0x10ec0233:
323 case 0x10ec0255:
324 case 0x10ec0282:
325 case 0x10ec0283:
326 case 0x10ec0286:
327 case 0x10ec0288:
328 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
329 break;
330 case 0x10ec0285:
331 case 0x10ec0293:
332 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
333 break;
334 case 0x10ec0662:
335 if ((coef & 0x00f0) == 0x0030)
336 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
337 break;
338 case 0x10ec0272:
339 case 0x10ec0273:
340 case 0x10ec0663:
341 case 0x10ec0665:
342 case 0x10ec0670:
343 case 0x10ec0671:
344 case 0x10ec0672:
345 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
346 break;
347 case 0x10ec0668:
348 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
349 break;
350 case 0x10ec0867:
351 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
352 break;
353 case 0x10ec0888:
354 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
355 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
356 break;
357 case 0x10ec0892:
358 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
359 break;
360 case 0x10ec0899:
361 case 0x10ec0900:
362 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
363 break;
364 }
365}
366
Kailang Yangf9423e72008-05-27 12:32:25 +0200367/* additional initialization for ALC888 variants */
368static void alc888_coef_init(struct hda_codec *codec)
369{
Kailang Yang1df88742014-10-29 16:10:13 +0800370 switch (alc_get_coef0(codec) & 0x00f0) {
371 /* alc888-VA */
372 case 0x00:
373 /* alc888-VB */
374 case 0x10:
375 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
376 break;
377 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200378}
379
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100380/* turn on/off EAPD control (only if available) */
381static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
382{
383 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
384 return;
385 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
386 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
387 on ? 2 : 0);
388}
389
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200390/* turn on/off EAPD controls of the codec */
391static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
392{
393 /* We currently only handle front, HP */
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200394 static hda_nid_t pins[] = {
395 0x0f, 0x10, 0x14, 0x15, 0
396 };
397 hda_nid_t *p;
398 for (p = pins; *p; p++)
399 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200400}
401
Takashi Iwai1c7161532011-04-07 10:37:16 +0200402/* generic shutup callback;
403 * just turning off EPAD and a little pause for avoiding pop-noise
404 */
405static void alc_eapd_shutup(struct hda_codec *codec)
406{
Kailang Yang97a26572013-11-29 00:35:26 -0500407 struct alc_spec *spec = codec->spec;
408
Takashi Iwai1c7161532011-04-07 10:37:16 +0200409 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500410 if (!spec->no_depop_delay)
411 msleep(200);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200412 snd_hda_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200413}
414
Takashi Iwai1d045db2011-07-07 18:23:21 +0200415/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200416static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200417{
Kailang Yang394c97f2014-11-12 17:38:08 +0800418 alc_fill_eapd_coef(codec);
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200419 alc_auto_setup_eapd(codec, true);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200420 switch (type) {
421 case ALC_INIT_GPIO1:
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200422 snd_hda_sequence_write(codec, alc_gpio1_init_verbs);
423 break;
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200424 case ALC_INIT_GPIO2:
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200425 snd_hda_sequence_write(codec, alc_gpio2_init_verbs);
426 break;
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200427 case ALC_INIT_GPIO3:
Kailang Yangbdd148a2007-05-08 15:19:08 +0200428 snd_hda_sequence_write(codec, alc_gpio3_init_verbs);
429 break;
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200430 case ALC_INIT_DEFAULT:
Kailang Yangc9b58002007-10-16 14:30:01 +0200431 switch (codec->vendor_id) {
432 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200433 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200434 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200435 case 0x10ec0880:
436 case 0x10ec0882:
437 case 0x10ec0883:
438 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800439 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200440 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200441 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200442 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200443 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200444 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200445 break;
446 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200447}
Kailang Yangea1fb292008-08-26 12:58:38 +0200448
Takashi Iwai1d045db2011-07-07 18:23:21 +0200449
450/*
451 * Realtek SSID verification
452 */
453
David Henningsson90622912010-10-14 14:50:18 +0200454/* Could be any non-zero and even value. When used as fixup, tells
455 * the driver to ignore any present sku defines.
456 */
457#define ALC_FIXUP_SKU_IGNORE (2)
458
Takashi Iwai23d30f22012-05-07 17:17:32 +0200459static void alc_fixup_sku_ignore(struct hda_codec *codec,
460 const struct hda_fixup *fix, int action)
461{
462 struct alc_spec *spec = codec->spec;
463 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
464 spec->cdefine.fixup = 1;
465 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
466 }
467}
468
Mengdong Linb5c66112013-11-29 00:35:35 -0500469static void alc_fixup_no_depop_delay(struct hda_codec *codec,
470 const struct hda_fixup *fix, int action)
471{
472 struct alc_spec *spec = codec->spec;
473
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500474 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500475 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500476 codec->depop_delay = 0;
477 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500478}
479
Kailang Yangda00c242010-03-19 11:23:45 +0100480static int alc_auto_parse_customize_define(struct hda_codec *codec)
481{
482 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100483 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100484 struct alc_spec *spec = codec->spec;
485
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200486 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
487
David Henningsson90622912010-10-14 14:50:18 +0200488 if (spec->cdefine.fixup) {
489 ass = spec->cdefine.sku_cfg;
490 if (ass == ALC_FIXUP_SKU_IGNORE)
491 return -1;
492 goto do_sku;
493 }
494
Takashi Iwai5100cd02014-02-15 10:03:19 +0100495 if (!codec->bus->pci)
496 return -1;
Kailang Yangda00c242010-03-19 11:23:45 +0100497 ass = codec->subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200498 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100499 goto do_sku;
500
501 nid = 0x1d;
502 if (codec->vendor_id == 0x10ec0260)
503 nid = 0x17;
504 ass = snd_hda_codec_get_pincfg(codec, nid);
505
506 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100507 codec_info(codec, "%s: SKU not ready 0x%08x\n",
508 codec->chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100509 return -1;
510 }
511
512 /* check sum */
513 tmp = 0;
514 for (i = 1; i < 16; i++) {
515 if ((ass >> i) & 1)
516 tmp++;
517 }
518 if (((ass >> 16) & 0xf) != tmp)
519 return -1;
520
521 spec->cdefine.port_connectivity = ass >> 30;
522 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
523 spec->cdefine.check_sum = (ass >> 16) & 0xf;
524 spec->cdefine.customization = ass >> 8;
525do_sku:
526 spec->cdefine.sku_cfg = ass;
527 spec->cdefine.external_amp = (ass & 0x38) >> 3;
528 spec->cdefine.platform_type = (ass & 0x4) >> 2;
529 spec->cdefine.swap = (ass & 0x2) >> 1;
530 spec->cdefine.override = ass & 0x1;
531
Takashi Iwai4e76a882014-02-25 12:21:03 +0100532 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100533 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100534 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100535 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100536 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
537 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
538 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
539 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
540 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
541 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
542 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100543
544 return 0;
545}
546
Takashi Iwai08c189f2012-12-19 15:22:24 +0100547/* return the position of NID in the list, or -1 if not found */
548static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
549{
550 int i;
551 for (i = 0; i < nums; i++)
552 if (list[i] == nid)
553 return i;
554 return -1;
555}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200556/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200557static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
558{
Takashi Iwai21268962011-07-07 15:01:13 +0200559 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200560}
561
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200562/* check subsystem ID and set up device-specific initialization;
563 * return 1 if initialized, 0 if invalid SSID
564 */
565/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
566 * 31 ~ 16 : Manufacture ID
567 * 15 ~ 8 : SKU ID
568 * 7 ~ 0 : Assembly ID
569 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
570 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100571static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200572{
573 unsigned int ass, tmp, i;
574 unsigned nid;
575 struct alc_spec *spec = codec->spec;
576
David Henningsson90622912010-10-14 14:50:18 +0200577 if (spec->cdefine.fixup) {
578 ass = spec->cdefine.sku_cfg;
579 if (ass == ALC_FIXUP_SKU_IGNORE)
580 return 0;
581 goto do_sku;
582 }
583
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200584 ass = codec->subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100585 if (codec->bus->pci &&
586 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200587 goto do_sku;
588
589 /* invalid SSID, check the special NID pin defcfg instead */
590 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400591 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200592 * 29~21 : reserve
593 * 20 : PCBEEP input
594 * 19~16 : Check sum (15:1)
595 * 15~1 : Custom
596 * 0 : override
597 */
598 nid = 0x1d;
599 if (codec->vendor_id == 0x10ec0260)
600 nid = 0x17;
601 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100602 codec_dbg(codec,
603 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200604 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100605 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200606 return 0;
607 if ((ass >> 30) != 1) /* no physical connection */
608 return 0;
609
610 /* check sum */
611 tmp = 0;
612 for (i = 1; i < 16; i++) {
613 if ((ass >> i) & 1)
614 tmp++;
615 }
616 if (((ass >> 16) & 0xf) != tmp)
617 return 0;
618do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100619 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200620 ass & 0xffff, codec->vendor_id);
621 /*
622 * 0 : override
623 * 1 : Swap Jack
624 * 2 : 0 --> Desktop, 1 --> Laptop
625 * 3~5 : External Amplifier control
626 * 7~6 : Reserved
627 */
628 tmp = (ass & 0x38) >> 3; /* external Amp control */
629 switch (tmp) {
630 case 1:
631 spec->init_amp = ALC_INIT_GPIO1;
632 break;
633 case 3:
634 spec->init_amp = ALC_INIT_GPIO2;
635 break;
636 case 7:
637 spec->init_amp = ALC_INIT_GPIO3;
638 break;
639 case 5:
Takashi Iwai5a8cfb42010-11-26 17:11:18 +0100640 default:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200641 spec->init_amp = ALC_INIT_DEFAULT;
642 break;
643 }
644
645 /* is laptop or Desktop and enable the function "Mute internal speaker
646 * when the external headphone out jack is plugged"
647 */
648 if (!(ass & 0x8000))
649 return 1;
650 /*
651 * 10~8 : Jack location
652 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
653 * 14~13: Resvered
654 * 15 : 1 --> enable the function "Mute internal speaker
655 * when the external headphone out jack is plugged"
656 */
Takashi Iwai08c189f2012-12-19 15:22:24 +0100657 if (!spec->gen.autocfg.hp_pins[0] &&
658 !(spec->gen.autocfg.line_out_pins[0] &&
659 spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200660 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200661 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100662 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100663 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
664 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200665 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100666 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200667 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200668 return 1;
669}
Kailang Yangea1fb292008-08-26 12:58:38 +0200670
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200671/* Check the validity of ALC subsystem-id
672 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
673static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200674{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100675 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200676 struct alc_spec *spec = codec->spec;
Takashi Iwai4e76a882014-02-25 12:21:03 +0100677 codec_dbg(codec,
678 "realtek: Enable default setup for auto mode as fallback\n");
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200679 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200680 }
Takashi Iwai21268962011-07-07 15:01:13 +0200681}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200682
Takashi Iwai41e41f12005-06-08 14:48:49 +0200683/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200684 */
685
David Henningsson9d36a7d2014-10-07 10:18:42 +0200686static void alc_fixup_inv_dmic(struct hda_codec *codec,
687 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200688{
689 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100690
David Henningsson9d36a7d2014-10-07 10:18:42 +0200691 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200692}
693
Takashi Iwai603c4012008-07-30 15:01:44 +0200694
Takashi Iwai67d634c2009-11-16 15:35:59 +0100695#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100696/* additional beep mixers; the actual parameters are overwritten at build */
Takashi Iwaia9111322011-05-02 11:30:18 +0200697static const struct snd_kcontrol_new alc_beep_mixer[] = {
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100698 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
Jaroslav Kysela123c07a2009-10-21 14:48:23 +0200699 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100700 { } /* end */
701};
Takashi Iwai67d634c2009-11-16 15:35:59 +0100702#endif
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100703
Takashi Iwai2eab6942012-12-18 15:30:41 +0100704static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700705{
706 struct alc_spec *spec = codec->spec;
Takashi Iwai666a70d2012-12-17 20:29:29 +0100707 int i, err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700708
Takashi Iwai08c189f2012-12-19 15:22:24 +0100709 err = snd_hda_gen_build_controls(codec);
710 if (err < 0)
711 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700712
713 for (i = 0; i < spec->num_mixers; i++) {
714 err = snd_hda_add_new_ctls(codec, spec->mixers[i]);
715 if (err < 0)
716 return err;
717 }
Takashi Iwai2134ea42008-01-10 16:53:55 +0100718
Takashi Iwai67d634c2009-11-16 15:35:59 +0100719#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100720 /* create beep controls if needed */
721 if (spec->beep_amp) {
Takashi Iwaia9111322011-05-02 11:30:18 +0200722 const struct snd_kcontrol_new *knew;
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100723 for (knew = alc_beep_mixer; knew->name; knew++) {
724 struct snd_kcontrol *kctl;
725 kctl = snd_ctl_new1(knew, codec);
726 if (!kctl)
727 return -ENOMEM;
728 kctl->private_value = spec->beep_amp;
Jaroslav Kysela5e26dfd2009-12-10 13:57:01 +0100729 err = snd_hda_ctl_add(codec, 0, kctl);
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100730 if (err < 0)
731 return err;
732 }
733 }
Takashi Iwai67d634c2009-11-16 15:35:59 +0100734#endif
Takashi Iwai45bdd1c2009-02-06 16:11:25 +0100735
Takashi Iwai1727a772013-01-10 09:52:52 +0100736 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100737 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700738}
739
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200740
Linus Torvalds1da177e2005-04-16 15:20:36 -0700741/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100742 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200743 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200744
Linus Torvalds1da177e2005-04-16 15:20:36 -0700745static int alc_init(struct hda_codec *codec)
746{
747 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200748
Takashi Iwai546bb672012-03-07 08:37:19 +0100749 if (spec->init_hook)
750 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100751
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200752 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200753 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200754
Takashi Iwai08c189f2012-12-19 15:22:24 +0100755 snd_hda_gen_init(codec);
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100756
Takashi Iwai1727a772013-01-10 09:52:52 +0100757 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200758
Linus Torvalds1da177e2005-04-16 15:20:36 -0700759 return 0;
760}
761
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100762static inline void alc_shutup(struct hda_codec *codec)
763{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200764 struct alc_spec *spec = codec->spec;
765
766 if (spec && spec->shutup)
767 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200768 else
769 snd_hda_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100770}
771
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100772#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700773
Takashi Iwai83012a72012-08-24 18:38:08 +0200774#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500775static void alc_power_eapd(struct hda_codec *codec)
776{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200777 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500778}
779
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200780static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100781{
782 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100783 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100784 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500785 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100786 return 0;
787}
788#endif
789
Takashi Iwai2a439522011-07-26 09:52:50 +0200790#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100791static int alc_resume(struct hda_codec *codec)
792{
Kailang Yang97a26572013-11-29 00:35:26 -0500793 struct alc_spec *spec = codec->spec;
794
795 if (!spec->no_depop_delay)
796 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100797 codec->patch_ops.init(codec);
798 snd_hda_codec_resume_amp(codec);
799 snd_hda_codec_resume_cache(codec);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200800 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100801 return 0;
802}
Takashi Iwaie044c392008-10-27 16:56:24 +0100803#endif
804
Linus Torvalds1da177e2005-04-16 15:20:36 -0700805/*
806 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200807static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700808 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100809 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700810 .init = alc_init,
811 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200812 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200813#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100814 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100815 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100816 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200817#endif
Daniel T Chenc97259d2009-12-27 18:52:08 -0500818 .reboot_notify = alc_shutup,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700819};
820
David Henningsson29adc4b2012-09-25 11:31:00 +0200821
Kailang Yangc027ddc2010-03-19 11:33:06 +0100822/* replace the codec chip_name with the given string */
823static int alc_codec_rename(struct hda_codec *codec, const char *name)
824{
825 kfree(codec->chip_name);
826 codec->chip_name = kstrdup(name, GFP_KERNEL);
827 if (!codec->chip_name) {
828 alc_free(codec);
829 return -ENOMEM;
830 }
831 return 0;
832}
833
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200834/*
Kailang Yang4b016932013-11-28 11:55:09 +0100835 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200836 */
837struct alc_codec_rename_table {
838 unsigned int vendor_id;
839 unsigned short coef_mask;
840 unsigned short coef_bits;
841 const char *name;
842};
843
Kailang Yang4b016932013-11-28 11:55:09 +0100844struct alc_codec_rename_pci_table {
845 unsigned int codec_vendor_id;
846 unsigned short pci_subvendor;
847 unsigned short pci_subdevice;
848 const char *name;
849};
850
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200851static struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800852 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200853 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
854 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
855 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
856 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
857 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
858 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
859 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +0200860 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800861 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200862 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
863 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
864 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
865 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
866 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
867 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
868 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
869 { } /* terminator */
870};
871
Kailang Yang4b016932013-11-28 11:55:09 +0100872static struct alc_codec_rename_pci_table rename_pci_tbl[] = {
873 { 0x10ec0280, 0x1028, 0, "ALC3220" },
874 { 0x10ec0282, 0x1028, 0, "ALC3221" },
875 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +0800876 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +0100877 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +0800878 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +0100879 { 0x10ec0255, 0x1028, 0, "ALC3234" },
880 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +0800881 { 0x10ec0275, 0x1028, 0, "ALC3260" },
882 { 0x10ec0899, 0x1028, 0, "ALC3861" },
883 { 0x10ec0670, 0x1025, 0, "ALC669X" },
884 { 0x10ec0676, 0x1025, 0, "ALC679X" },
885 { 0x10ec0282, 0x1043, 0, "ALC3229" },
886 { 0x10ec0233, 0x1043, 0, "ALC3236" },
887 { 0x10ec0280, 0x103c, 0, "ALC3228" },
888 { 0x10ec0282, 0x103c, 0, "ALC3227" },
889 { 0x10ec0286, 0x103c, 0, "ALC3242" },
890 { 0x10ec0290, 0x103c, 0, "ALC3241" },
891 { 0x10ec0668, 0x103c, 0, "ALC3662" },
892 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
893 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +0100894 { } /* terminator */
895};
896
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200897static int alc_codec_rename_from_preset(struct hda_codec *codec)
898{
899 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +0100900 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200901
902 for (p = rename_tbl; p->vendor_id; p++) {
903 if (p->vendor_id != codec->vendor_id)
904 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200905 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200906 return alc_codec_rename(codec, p->name);
907 }
Kailang Yang4b016932013-11-28 11:55:09 +0100908
Takashi Iwai5100cd02014-02-15 10:03:19 +0100909 if (!codec->bus->pci)
910 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +0100911 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
912 if (q->codec_vendor_id != codec->vendor_id)
913 continue;
914 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
915 continue;
916 if (!q->pci_subdevice ||
917 q->pci_subdevice == codec->bus->pci->subsystem_device)
918 return alc_codec_rename(codec, q->name);
919 }
920
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200921 return 0;
922}
923
Takashi Iwaie4770622011-07-08 11:11:35 +0200924
925/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200926 * Digital-beep handlers
927 */
928#ifdef CONFIG_SND_HDA_INPUT_BEEP
929#define set_beep_amp(spec, nid, idx, dir) \
930 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
931
932static const struct snd_pci_quirk beep_white_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +0200933 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -0700934 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +0200935 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +0100936 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +0200937 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
938 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
939 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +0100940 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +0200941 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
942 {}
943};
944
945static inline int has_cdefine_beep(struct hda_codec *codec)
946{
947 struct alc_spec *spec = codec->spec;
948 const struct snd_pci_quirk *q;
949 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
950 if (q)
951 return q->value;
952 return spec->cdefine.enable_pcbeep;
953}
954#else
955#define set_beep_amp(spec, nid, idx, dir) /* NOP */
956#define has_cdefine_beep(codec) 0
957#endif
958
959/* parse the BIOS configuration and set up the alc_spec */
960/* return 1 if successful, 0 if the proper config is not found,
961 * or a negative error code
962 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200963static int alc_parse_auto_config(struct hda_codec *codec,
964 const hda_nid_t *ignore_nids,
965 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +0200966{
967 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100968 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +0200969 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +0200970
Takashi Iwai53c334a2011-08-23 18:27:14 +0200971 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
972 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +0200973 if (err < 0)
974 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200975
976 if (ssid_nids)
977 alc_ssid_check(codec, ssid_nids);
978
Takashi Iwai08c189f2012-12-19 15:22:24 +0100979 err = snd_hda_gen_parse_auto_config(codec, cfg);
980 if (err < 0)
981 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +0100982
Takashi Iwai1d045db2011-07-07 18:23:21 +0200983 return 1;
984}
985
Takashi Iwai3de95172012-05-07 18:03:15 +0200986/* common preparation job for alc_spec */
987static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
988{
989 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
990 int err;
991
992 if (!spec)
993 return -ENOMEM;
994 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100995 snd_hda_gen_spec_init(&spec->gen);
996 spec->gen.mixer_nid = mixer_nid;
997 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +0100998 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100999 /* FIXME: do we need this for all Realtek codec models? */
1000 codec->spdif_status_reset = 1;
Takashi Iwai3de95172012-05-07 18:03:15 +02001001
1002 err = alc_codec_rename_from_preset(codec);
1003 if (err < 0) {
1004 kfree(spec);
1005 return err;
1006 }
1007 return 0;
1008}
1009
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001010static int alc880_parse_auto_config(struct hda_codec *codec)
1011{
1012 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001013 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001014 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1015}
1016
Takashi Iwai1d045db2011-07-07 18:23:21 +02001017/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001018 * ALC880 fix-ups
1019 */
1020enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001021 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001022 ALC880_FIXUP_GPIO2,
1023 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001024 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001025 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001026 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001027 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001028 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001029 ALC880_FIXUP_VOL_KNOB,
1030 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001031 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001032 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001033 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001034 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001035 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001036 ALC880_FIXUP_3ST_BASE,
1037 ALC880_FIXUP_3ST,
1038 ALC880_FIXUP_3ST_DIG,
1039 ALC880_FIXUP_5ST_BASE,
1040 ALC880_FIXUP_5ST,
1041 ALC880_FIXUP_5ST_DIG,
1042 ALC880_FIXUP_6ST_BASE,
1043 ALC880_FIXUP_6ST,
1044 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001045 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001046};
1047
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001048/* enable the volume-knob widget support on NID 0x21 */
1049static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001050 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001051{
Takashi Iwai1727a772013-01-10 09:52:52 +01001052 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001053 snd_hda_jack_detect_enable_callback(codec, 0x21,
1054 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001055}
1056
Takashi Iwai1727a772013-01-10 09:52:52 +01001057static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001058 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001059 .type = HDA_FIXUP_VERBS,
Takashi Iwai411225a2012-02-20 17:48:19 +01001060 .v.verbs = alc_gpio1_init_verbs,
1061 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001062 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001063 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001064 .v.verbs = alc_gpio2_init_verbs,
1065 },
1066 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001067 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001068 .v.verbs = (const struct hda_verb[]) {
1069 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1070 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1071 { }
1072 },
1073 .chained = true,
1074 .chain_id = ALC880_FIXUP_GPIO2,
1075 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001076 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001077 .type = HDA_FIXUP_PINS,
1078 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001079 /* disable bogus unused pins */
1080 { 0x16, 0x411111f0 },
1081 { 0x18, 0x411111f0 },
1082 { 0x1a, 0x411111f0 },
1083 { }
1084 }
1085 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001086 [ALC880_FIXUP_LG_LW25] = {
1087 .type = HDA_FIXUP_PINS,
1088 .v.pins = (const struct hda_pintbl[]) {
1089 { 0x1a, 0x0181344f }, /* line-in */
1090 { 0x1b, 0x0321403f }, /* headphone */
1091 { }
1092 }
1093 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001094 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001095 .type = HDA_FIXUP_PINS,
1096 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001097 /* disable bogus unused pins */
1098 { 0x17, 0x411111f0 },
1099 { }
1100 },
1101 .chained = true,
1102 .chain_id = ALC880_FIXUP_GPIO2,
1103 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001104 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001105 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001106 .v.verbs = (const struct hda_verb[]) {
1107 /* change to EAPD mode */
1108 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1109 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1110 {}
1111 },
1112 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001113 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001114 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001115 .v.verbs = (const struct hda_verb[]) {
1116 /* change to EAPD mode */
1117 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1118 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1119 {}
1120 },
1121 .chained = true,
1122 .chain_id = ALC880_FIXUP_GPIO2,
1123 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001124 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001125 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001126 .v.func = alc880_fixup_vol_knob,
1127 },
1128 [ALC880_FIXUP_FUJITSU] = {
1129 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001130 .type = HDA_FIXUP_PINS,
1131 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001132 { 0x14, 0x0121411f }, /* HP */
1133 { 0x15, 0x99030120 }, /* speaker */
1134 { 0x16, 0x99030130 }, /* bass speaker */
1135 { 0x17, 0x411111f0 }, /* N/A */
1136 { 0x18, 0x411111f0 }, /* N/A */
1137 { 0x19, 0x01a19950 }, /* mic-in */
1138 { 0x1a, 0x411111f0 }, /* N/A */
1139 { 0x1b, 0x411111f0 }, /* N/A */
1140 { 0x1c, 0x411111f0 }, /* N/A */
1141 { 0x1d, 0x411111f0 }, /* N/A */
1142 { 0x1e, 0x01454140 }, /* SPDIF out */
1143 { }
1144 },
1145 .chained = true,
1146 .chain_id = ALC880_FIXUP_VOL_KNOB,
1147 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001148 [ALC880_FIXUP_F1734] = {
1149 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001150 .type = HDA_FIXUP_PINS,
1151 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiba533812012-02-20 16:36:52 +01001152 { 0x14, 0x0121411f }, /* HP */
1153 { 0x15, 0x99030120 }, /* speaker */
1154 { 0x16, 0x411111f0 }, /* N/A */
1155 { 0x17, 0x411111f0 }, /* N/A */
1156 { 0x18, 0x411111f0 }, /* N/A */
1157 { 0x19, 0x01a19950 }, /* mic-in */
1158 { 0x1a, 0x411111f0 }, /* N/A */
1159 { 0x1b, 0x411111f0 }, /* N/A */
1160 { 0x1c, 0x411111f0 }, /* N/A */
1161 { 0x1d, 0x411111f0 }, /* N/A */
1162 { 0x1e, 0x411111f0 }, /* N/A */
1163 { }
1164 },
1165 .chained = true,
1166 .chain_id = ALC880_FIXUP_VOL_KNOB,
1167 },
Takashi Iwai817de922012-02-20 17:20:48 +01001168 [ALC880_FIXUP_UNIWILL] = {
1169 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001170 .type = HDA_FIXUP_PINS,
1171 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001172 { 0x14, 0x0121411f }, /* HP */
1173 { 0x15, 0x99030120 }, /* speaker */
1174 { 0x16, 0x99030130 }, /* bass speaker */
1175 { }
1176 },
1177 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001178 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001179 .type = HDA_FIXUP_PINS,
1180 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001181 /* disable bogus unused pins */
1182 { 0x17, 0x411111f0 },
1183 { 0x19, 0x411111f0 },
1184 { 0x1b, 0x411111f0 },
1185 { 0x1f, 0x411111f0 },
1186 { }
1187 }
1188 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001189 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001190 .type = HDA_FIXUP_PINS,
1191 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001192 /* set up the whole pins as BIOS is utterly broken */
1193 { 0x14, 0x99030120 }, /* speaker */
1194 { 0x15, 0x0121411f }, /* HP */
1195 { 0x16, 0x411111f0 }, /* N/A */
1196 { 0x17, 0x411111f0 }, /* N/A */
1197 { 0x18, 0x01a19950 }, /* mic-in */
1198 { 0x19, 0x411111f0 }, /* N/A */
1199 { 0x1a, 0x01813031 }, /* line-in */
1200 { 0x1b, 0x411111f0 }, /* N/A */
1201 { 0x1c, 0x411111f0 }, /* N/A */
1202 { 0x1d, 0x411111f0 }, /* N/A */
1203 { 0x1e, 0x0144111e }, /* SPDIF */
1204 { }
1205 }
1206 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001207 [ALC880_FIXUP_ASUS_W5A] = {
1208 .type = HDA_FIXUP_PINS,
1209 .v.pins = (const struct hda_pintbl[]) {
1210 /* set up the whole pins as BIOS is utterly broken */
1211 { 0x14, 0x0121411f }, /* HP */
1212 { 0x15, 0x411111f0 }, /* N/A */
1213 { 0x16, 0x411111f0 }, /* N/A */
1214 { 0x17, 0x411111f0 }, /* N/A */
1215 { 0x18, 0x90a60160 }, /* mic */
1216 { 0x19, 0x411111f0 }, /* N/A */
1217 { 0x1a, 0x411111f0 }, /* N/A */
1218 { 0x1b, 0x411111f0 }, /* N/A */
1219 { 0x1c, 0x411111f0 }, /* N/A */
1220 { 0x1d, 0x411111f0 }, /* N/A */
1221 { 0x1e, 0xb743111e }, /* SPDIF out */
1222 { }
1223 },
1224 .chained = true,
1225 .chain_id = ALC880_FIXUP_GPIO1,
1226 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001227 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001228 .type = HDA_FIXUP_PINS,
1229 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001230 { 0x14, 0x01014010 }, /* line-out */
1231 { 0x15, 0x411111f0 }, /* N/A */
1232 { 0x16, 0x411111f0 }, /* N/A */
1233 { 0x17, 0x411111f0 }, /* N/A */
1234 { 0x18, 0x01a19c30 }, /* mic-in */
1235 { 0x19, 0x0121411f }, /* HP */
1236 { 0x1a, 0x01813031 }, /* line-in */
1237 { 0x1b, 0x02a19c40 }, /* front-mic */
1238 { 0x1c, 0x411111f0 }, /* N/A */
1239 { 0x1d, 0x411111f0 }, /* N/A */
1240 /* 0x1e is filled in below */
1241 { 0x1f, 0x411111f0 }, /* N/A */
1242 { }
1243 }
1244 },
1245 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001246 .type = HDA_FIXUP_PINS,
1247 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001248 { 0x1e, 0x411111f0 }, /* N/A */
1249 { }
1250 },
1251 .chained = true,
1252 .chain_id = ALC880_FIXUP_3ST_BASE,
1253 },
1254 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001255 .type = HDA_FIXUP_PINS,
1256 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001257 { 0x1e, 0x0144111e }, /* SPDIF */
1258 { }
1259 },
1260 .chained = true,
1261 .chain_id = ALC880_FIXUP_3ST_BASE,
1262 },
1263 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001264 .type = HDA_FIXUP_PINS,
1265 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001266 { 0x14, 0x01014010 }, /* front */
1267 { 0x15, 0x411111f0 }, /* N/A */
1268 { 0x16, 0x01011411 }, /* CLFE */
1269 { 0x17, 0x01016412 }, /* surr */
1270 { 0x18, 0x01a19c30 }, /* mic-in */
1271 { 0x19, 0x0121411f }, /* HP */
1272 { 0x1a, 0x01813031 }, /* line-in */
1273 { 0x1b, 0x02a19c40 }, /* front-mic */
1274 { 0x1c, 0x411111f0 }, /* N/A */
1275 { 0x1d, 0x411111f0 }, /* N/A */
1276 /* 0x1e is filled in below */
1277 { 0x1f, 0x411111f0 }, /* N/A */
1278 { }
1279 }
1280 },
1281 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001282 .type = HDA_FIXUP_PINS,
1283 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001284 { 0x1e, 0x411111f0 }, /* N/A */
1285 { }
1286 },
1287 .chained = true,
1288 .chain_id = ALC880_FIXUP_5ST_BASE,
1289 },
1290 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001291 .type = HDA_FIXUP_PINS,
1292 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001293 { 0x1e, 0x0144111e }, /* SPDIF */
1294 { }
1295 },
1296 .chained = true,
1297 .chain_id = ALC880_FIXUP_5ST_BASE,
1298 },
1299 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001300 .type = HDA_FIXUP_PINS,
1301 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001302 { 0x14, 0x01014010 }, /* front */
1303 { 0x15, 0x01016412 }, /* surr */
1304 { 0x16, 0x01011411 }, /* CLFE */
1305 { 0x17, 0x01012414 }, /* side */
1306 { 0x18, 0x01a19c30 }, /* mic-in */
1307 { 0x19, 0x02a19c40 }, /* front-mic */
1308 { 0x1a, 0x01813031 }, /* line-in */
1309 { 0x1b, 0x0121411f }, /* HP */
1310 { 0x1c, 0x411111f0 }, /* N/A */
1311 { 0x1d, 0x411111f0 }, /* N/A */
1312 /* 0x1e is filled in below */
1313 { 0x1f, 0x411111f0 }, /* N/A */
1314 { }
1315 }
1316 },
1317 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001318 .type = HDA_FIXUP_PINS,
1319 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001320 { 0x1e, 0x411111f0 }, /* N/A */
1321 { }
1322 },
1323 .chained = true,
1324 .chain_id = ALC880_FIXUP_6ST_BASE,
1325 },
1326 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001327 .type = HDA_FIXUP_PINS,
1328 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001329 { 0x1e, 0x0144111e }, /* SPDIF */
1330 { }
1331 },
1332 .chained = true,
1333 .chain_id = ALC880_FIXUP_6ST_BASE,
1334 },
Takashi Iwai53971452013-01-23 18:21:37 +01001335 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1336 .type = HDA_FIXUP_PINS,
1337 .v.pins = (const struct hda_pintbl[]) {
1338 { 0x1b, 0x0121401f }, /* HP with jack detect */
1339 { }
1340 },
1341 .chained_before = true,
1342 .chain_id = ALC880_FIXUP_6ST_BASE,
1343 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001344};
1345
1346static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001347 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001348 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001349 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001350 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001351 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001352 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001353 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001354 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001355 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001356 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001357 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001358 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001359 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001360 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaiba533812012-02-20 16:36:52 +01001361 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001362 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001363 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001364 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001365 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1366 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1367 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001368 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001369 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001370
1371 /* Below is the copied entries from alc880_quirks.c.
1372 * It's not quite sure whether BIOS sets the correct pin-config table
1373 * on these machines, thus they are kept to be compatible with
1374 * the old static quirks. Once when it's confirmed to work without
1375 * these overrides, it'd be better to remove.
1376 */
1377 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1378 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1379 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1380 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1381 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1382 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1383 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1384 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1385 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1386 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1387 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1388 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1389 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1390 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1391 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1392 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1393 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1394 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1395 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1396 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1397 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1398 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1399 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1400 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1401 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1402 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1403 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1404 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1405 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1406 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1407 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1408 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1409 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1410 /* default Intel */
1411 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1412 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1413 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1414 {}
1415};
1416
Takashi Iwai1727a772013-01-10 09:52:52 +01001417static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001418 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1419 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1420 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1421 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1422 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1423 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001424 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001425 {}
1426};
1427
1428
1429/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001430 * OK, here we have finally the patch for ALC880
1431 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001432static int patch_alc880(struct hda_codec *codec)
1433{
1434 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001435 int err;
1436
Takashi Iwai3de95172012-05-07 18:03:15 +02001437 err = alc_alloc_spec(codec, 0x0b);
1438 if (err < 0)
1439 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001440
Takashi Iwai3de95172012-05-07 18:03:15 +02001441 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001442 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001443 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001444
Takashi Iwai1727a772013-01-10 09:52:52 +01001445 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001446 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001447 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001448
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001449 /* automatic parse from the BIOS config */
1450 err = alc880_parse_auto_config(codec);
1451 if (err < 0)
1452 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001453
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001454 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001455 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001456
Takashi Iwai1d045db2011-07-07 18:23:21 +02001457 codec->patch_ops = alc_patch_ops;
David Henningsson29adc4b2012-09-25 11:31:00 +02001458 codec->patch_ops.unsol_event = alc880_unsol_event;
1459
Takashi Iwai1d045db2011-07-07 18:23:21 +02001460
Takashi Iwai1727a772013-01-10 09:52:52 +01001461 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001462
Takashi Iwai1d045db2011-07-07 18:23:21 +02001463 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001464
1465 error:
1466 alc_free(codec);
1467 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001468}
1469
1470
1471/*
1472 * ALC260 support
1473 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001474static int alc260_parse_auto_config(struct hda_codec *codec)
1475{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001476 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001477 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1478 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001479}
1480
Takashi Iwai1d045db2011-07-07 18:23:21 +02001481/*
1482 * Pin config fixes
1483 */
1484enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001485 ALC260_FIXUP_HP_DC5750,
1486 ALC260_FIXUP_HP_PIN_0F,
1487 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001488 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001489 ALC260_FIXUP_GPIO1_TOGGLE,
1490 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001491 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001492 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001493 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001494 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001495 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001496};
1497
Takashi Iwai20f7d922012-02-16 12:35:16 +01001498static void alc260_gpio1_automute(struct hda_codec *codec)
1499{
1500 struct alc_spec *spec = codec->spec;
1501 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001502 spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001503}
1504
1505static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001506 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001507{
1508 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001509 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001510 /* although the machine has only one output pin, we need to
1511 * toggle GPIO1 according to the jack state
1512 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001513 spec->gen.automute_hook = alc260_gpio1_automute;
1514 spec->gen.detect_hp = 1;
1515 spec->gen.automute_speaker = 1;
1516 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001517 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001518 snd_hda_gen_hp_automute);
Takashi Iwaic9ce6b22012-12-18 18:12:44 +01001519 snd_hda_add_verbs(codec, alc_gpio1_init_verbs);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001520 }
1521}
1522
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001523static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001524 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001525{
1526 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001527 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001528 { 0x0f, 0x02214000 }, /* HP/speaker */
1529 { 0x12, 0x90a60160 }, /* int mic */
1530 { 0x13, 0x02a19000 }, /* ext mic */
1531 { 0x18, 0x01446000 }, /* SPDIF out */
1532 /* disable bogus I/O pins */
1533 { 0x10, 0x411111f0 },
1534 { 0x11, 0x411111f0 },
1535 { 0x14, 0x411111f0 },
1536 { 0x15, 0x411111f0 },
1537 { 0x16, 0x411111f0 },
1538 { 0x17, 0x411111f0 },
1539 { 0x19, 0x411111f0 },
1540 { }
1541 };
1542
1543 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001544 case HDA_FIXUP_ACT_PRE_PROBE:
1545 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001546 break;
Takashi Iwai1727a772013-01-10 09:52:52 +01001547 case HDA_FIXUP_ACT_PROBE:
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001548 spec->init_amp = ALC_INIT_NONE;
1549 break;
1550 }
1551}
1552
Takashi Iwai39aedee2013-01-10 17:10:40 +01001553static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1554 const struct hda_fixup *fix, int action)
1555{
1556 struct alc_spec *spec = codec->spec;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001557 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001558 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001559}
1560
1561static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1562 const struct hda_fixup *fix, int action)
1563{
1564 struct alc_spec *spec = codec->spec;
1565 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001566 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001567 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001568 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001569}
1570
Takashi Iwai1727a772013-01-10 09:52:52 +01001571static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001572 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001573 .type = HDA_FIXUP_PINS,
1574 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001575 { 0x11, 0x90130110 }, /* speaker */
1576 { }
1577 }
1578 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001579 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001580 .type = HDA_FIXUP_PINS,
1581 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001582 { 0x0f, 0x01214000 }, /* HP */
1583 { }
1584 }
1585 },
1586 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001587 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001588 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001589 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1590 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001591 { }
1592 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001593 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001594 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001595 .type = HDA_FIXUP_VERBS,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001596 .v.verbs = alc_gpio1_init_verbs,
1597 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001598 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001599 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001600 .v.func = alc260_fixup_gpio1_toggle,
1601 .chained = true,
1602 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1603 },
1604 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001605 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001606 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001607 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1608 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001609 { }
1610 },
1611 .chained = true,
1612 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1613 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001614 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001615 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001616 .v.func = alc260_fixup_gpio1_toggle,
1617 .chained = true,
1618 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001619 },
1620 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001621 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001622 .v.func = alc260_fixup_kn1,
1623 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001624 [ALC260_FIXUP_FSC_S7020] = {
1625 .type = HDA_FIXUP_FUNC,
1626 .v.func = alc260_fixup_fsc_s7020,
1627 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001628 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1629 .type = HDA_FIXUP_FUNC,
1630 .v.func = alc260_fixup_fsc_s7020_jwse,
1631 .chained = true,
1632 .chain_id = ALC260_FIXUP_FSC_S7020,
1633 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001634 [ALC260_FIXUP_VAIO_PINS] = {
1635 .type = HDA_FIXUP_PINS,
1636 .v.pins = (const struct hda_pintbl[]) {
1637 /* Pin configs are missing completely on some VAIOs */
1638 { 0x0f, 0x01211020 },
1639 { 0x10, 0x0001003f },
1640 { 0x11, 0x411111f0 },
1641 { 0x12, 0x01a15930 },
1642 { 0x13, 0x411111f0 },
1643 { 0x14, 0x411111f0 },
1644 { 0x15, 0x411111f0 },
1645 { 0x16, 0x411111f0 },
1646 { 0x17, 0x411111f0 },
1647 { 0x18, 0x411111f0 },
1648 { 0x19, 0x411111f0 },
1649 { }
1650 }
1651 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001652};
1653
1654static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001655 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001656 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001657 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001658 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001659 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001660 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001661 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001662 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001663 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001664 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001665 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001666 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001667 {}
1668};
1669
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001670static const struct hda_model_fixup alc260_fixup_models[] = {
1671 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1672 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1673 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1674 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1675 {}
1676};
1677
Takashi Iwai1d045db2011-07-07 18:23:21 +02001678/*
1679 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001680static int patch_alc260(struct hda_codec *codec)
1681{
1682 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001683 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001684
Takashi Iwai3de95172012-05-07 18:03:15 +02001685 err = alc_alloc_spec(codec, 0x07);
1686 if (err < 0)
1687 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001688
Takashi Iwai3de95172012-05-07 18:03:15 +02001689 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001690 /* as quite a few machines require HP amp for speaker outputs,
1691 * it's easier to enable it unconditionally; even if it's unneeded,
1692 * it's almost harmless.
1693 */
1694 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001695 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001696
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001697 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1698 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001699 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001700
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001701 /* automatic parse from the BIOS config */
1702 err = alc260_parse_auto_config(codec);
1703 if (err < 0)
1704 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001705
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001706 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001707 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001708
Takashi Iwai1d045db2011-07-07 18:23:21 +02001709 codec->patch_ops = alc_patch_ops;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001710 spec->shutup = alc_eapd_shutup;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001711
Takashi Iwai1727a772013-01-10 09:52:52 +01001712 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001713
Takashi Iwai1d045db2011-07-07 18:23:21 +02001714 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001715
1716 error:
1717 alc_free(codec);
1718 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001719}
1720
1721
1722/*
1723 * ALC882/883/885/888/889 support
1724 *
1725 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1726 * configuration. Each pin widget can choose any input DACs and a mixer.
1727 * Each ADC is connected from a mixer of all inputs. This makes possible
1728 * 6-channel independent captures.
1729 *
1730 * In addition, an independent DAC for the multi-playback (not used in this
1731 * driver yet).
1732 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001733
1734/*
1735 * Pin config fixes
1736 */
1737enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001738 ALC882_FIXUP_ABIT_AW9D_MAX,
1739 ALC882_FIXUP_LENOVO_Y530,
1740 ALC882_FIXUP_PB_M5210,
1741 ALC882_FIXUP_ACER_ASPIRE_7736,
1742 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001743 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001744 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001745 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001746 ALC888_FIXUP_EEE1601,
Takashi Iwai177943a2011-11-09 12:55:18 +01001747 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001748 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001749 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001750 ALC882_FIXUP_GPIO1,
1751 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001752 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001753 ALC889_FIXUP_COEF,
1754 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001755 ALC882_FIXUP_ACER_ASPIRE_4930G,
1756 ALC882_FIXUP_ACER_ASPIRE_8930G,
1757 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001758 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001759 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001760 ALC889_FIXUP_MBP_VREF,
1761 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001762 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001763 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001764 ALC889_FIXUP_MP11_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001765 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001766 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001767 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001768 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001769};
1770
Takashi Iwai68ef0562011-11-09 18:24:44 +01001771static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001772 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001773{
Takashi Iwai1727a772013-01-10 09:52:52 +01001774 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001775 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001776 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001777}
1778
Takashi Iwai56710872011-11-14 17:42:11 +01001779/* toggle speaker-output according to the hp-jack state */
1780static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1781{
1782 unsigned int gpiostate, gpiomask, gpiodir;
1783
1784 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
1785 AC_VERB_GET_GPIO_DATA, 0);
1786
1787 if (!muted)
1788 gpiostate |= (1 << pin);
1789 else
1790 gpiostate &= ~(1 << pin);
1791
1792 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
1793 AC_VERB_GET_GPIO_MASK, 0);
1794 gpiomask |= (1 << pin);
1795
1796 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
1797 AC_VERB_GET_GPIO_DIRECTION, 0);
1798 gpiodir |= (1 << pin);
1799
1800
1801 snd_hda_codec_write(codec, codec->afg, 0,
1802 AC_VERB_SET_GPIO_MASK, gpiomask);
1803 snd_hda_codec_write(codec, codec->afg, 0,
1804 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1805
1806 msleep(1);
1807
1808 snd_hda_codec_write(codec, codec->afg, 0,
1809 AC_VERB_SET_GPIO_DATA, gpiostate);
1810}
1811
1812/* set up GPIO at initialization */
1813static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001814 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001815{
Takashi Iwai1727a772013-01-10 09:52:52 +01001816 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai56710872011-11-14 17:42:11 +01001817 return;
1818 alc882_gpio_mute(codec, 0, 0);
1819 alc882_gpio_mute(codec, 1, 0);
1820}
1821
Takashi Iwai02a237b2012-02-13 15:25:07 +01001822/* Fix the connection of some pins for ALC889:
1823 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1824 * work correctly (bko#42740)
1825 */
1826static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001827 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01001828{
Takashi Iwai1727a772013-01-10 09:52:52 +01001829 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001830 /* fake the connections during parsing the tree */
Takashi Iwai02a237b2012-02-13 15:25:07 +01001831 hda_nid_t conn1[2] = { 0x0c, 0x0d };
1832 hda_nid_t conn2[2] = { 0x0e, 0x0f };
1833 snd_hda_override_conn_list(codec, 0x14, 2, conn1);
1834 snd_hda_override_conn_list(codec, 0x15, 2, conn1);
1835 snd_hda_override_conn_list(codec, 0x18, 2, conn2);
1836 snd_hda_override_conn_list(codec, 0x1a, 2, conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01001837 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01001838 /* restore the connections */
1839 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
1840 snd_hda_override_conn_list(codec, 0x14, 5, conn);
1841 snd_hda_override_conn_list(codec, 0x15, 5, conn);
1842 snd_hda_override_conn_list(codec, 0x18, 5, conn);
1843 snd_hda_override_conn_list(codec, 0x1a, 5, conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01001844 }
1845}
1846
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001847/* Set VREF on HP pin */
1848static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001849 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001850{
1851 struct alc_spec *spec = codec->spec;
1852 static hda_nid_t nids[2] = { 0x14, 0x15 };
1853 int i;
1854
Takashi Iwai1727a772013-01-10 09:52:52 +01001855 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001856 return;
1857 for (i = 0; i < ARRAY_SIZE(nids); i++) {
1858 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
1859 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
1860 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001861 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001862 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001863 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01001864 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001865 break;
1866 }
1867}
1868
Takashi Iwai0756f092013-12-04 13:59:45 +01001869static void alc889_fixup_mac_pins(struct hda_codec *codec,
1870 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001871{
1872 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001873 int i;
1874
Takashi Iwai0756f092013-12-04 13:59:45 +01001875 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001876 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01001877 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001878 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02001879 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001880 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01001881 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001882}
1883
Takashi Iwai0756f092013-12-04 13:59:45 +01001884/* Set VREF on speaker pins on imac91 */
1885static void alc889_fixup_imac91_vref(struct hda_codec *codec,
1886 const struct hda_fixup *fix, int action)
1887{
1888 static hda_nid_t nids[2] = { 0x18, 0x1a };
1889
1890 if (action == HDA_FIXUP_ACT_INIT)
1891 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1892}
1893
Adrien Vergée7729a42014-01-24 14:56:14 -05001894/* Set VREF on speaker pins on mba11 */
1895static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1896 const struct hda_fixup *fix, int action)
1897{
1898 static hda_nid_t nids[1] = { 0x18 };
1899
1900 if (action == HDA_FIXUP_ACT_INIT)
1901 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1902}
1903
Takashi Iwai0756f092013-12-04 13:59:45 +01001904/* Set VREF on speaker pins on mba21 */
1905static void alc889_fixup_mba21_vref(struct hda_codec *codec,
1906 const struct hda_fixup *fix, int action)
1907{
1908 static hda_nid_t nids[2] = { 0x18, 0x19 };
1909
1910 if (action == HDA_FIXUP_ACT_INIT)
1911 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1912}
1913
Takashi Iwaie427c232012-07-29 10:04:08 +02001914/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09001915 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
1916 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02001917 */
1918static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001919 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02001920{
1921 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02001922 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01001923 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02001924 spec->gen.no_multi_io = 1;
1925 }
Takashi Iwaie427c232012-07-29 10:04:08 +02001926}
1927
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001928static void alc_fixup_bass_chmap(struct hda_codec *codec,
1929 const struct hda_fixup *fix, int action);
1930
Takashi Iwai1727a772013-01-10 09:52:52 +01001931static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001932 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001933 .type = HDA_FIXUP_PINS,
1934 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001935 { 0x15, 0x01080104 }, /* side */
1936 { 0x16, 0x01011012 }, /* rear */
1937 { 0x17, 0x01016011 }, /* clfe */
1938 { }
1939 }
1940 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001941 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001942 .type = HDA_FIXUP_PINS,
1943 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001944 { 0x15, 0x99130112 }, /* rear int speakers */
1945 { 0x16, 0x99130111 }, /* subwoofer */
1946 { }
1947 }
1948 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001949 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01001950 .type = HDA_FIXUP_PINCTLS,
1951 .v.pins = (const struct hda_pintbl[]) {
1952 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001953 {}
1954 }
1955 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001956 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001957 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02001958 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001959 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001960 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001961 .type = HDA_FIXUP_PINS,
1962 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02001963 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
1964 { }
1965 }
1966 },
Marton Balint8f239212012-03-05 21:33:23 +01001967 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001968 .type = HDA_FIXUP_PINS,
1969 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01001970 { 0x1c, 0x993301f0 }, /* CD */
1971 { }
1972 }
1973 },
David Henningssonb2c53e22014-01-01 14:01:34 +01001974 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
1975 .type = HDA_FIXUP_PINS,
1976 .v.pins = (const struct hda_pintbl[]) {
1977 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
1978 { }
1979 },
1980 .chained = true,
1981 .chain_id = ALC889_FIXUP_CD,
1982 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001983 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001984 .type = HDA_FIXUP_PINS,
1985 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001986 { 0x17, 0x90170111 }, /* hidden surround speaker */
1987 { }
1988 }
1989 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001990 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001991 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001992 .v.verbs = (const struct hda_verb[]) {
1993 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
1994 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
1995 { }
1996 }
Takashi Iwai177943a2011-11-09 12:55:18 +01001997 },
1998 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001999 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a2011-11-09 12:55:18 +01002000 .v.verbs = (const struct hda_verb[]) {
2001 /* change to EAPD mode */
2002 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2003 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2004 { }
2005 }
2006 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002007 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002008 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002009 .v.verbs = (const struct hda_verb[]) {
2010 /* change to EAPD mode */
2011 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2012 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2013 { }
2014 }
2015 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002016 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002017 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002018 .v.verbs = (const struct hda_verb[]) {
2019 /* eanable EAPD on Acer laptops */
2020 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2021 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2022 { }
2023 }
2024 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002025 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002026 .type = HDA_FIXUP_VERBS,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002027 .v.verbs = alc_gpio1_init_verbs,
2028 },
2029 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002030 .type = HDA_FIXUP_VERBS,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002031 .v.verbs = alc_gpio2_init_verbs,
2032 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002033 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002034 .type = HDA_FIXUP_VERBS,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002035 .v.verbs = alc_gpio3_init_verbs,
2036 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002037 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002038 .type = HDA_FIXUP_VERBS,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002039 .v.verbs = alc_gpio1_init_verbs,
2040 .chained = true,
2041 .chain_id = ALC882_FIXUP_EAPD,
2042 },
2043 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002044 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002045 .v.func = alc889_fixup_coef,
2046 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002047 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002048 .type = HDA_FIXUP_PINS,
2049 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002050 { 0x16, 0x99130111 }, /* CLFE speaker */
2051 { 0x17, 0x99130112 }, /* surround speaker */
2052 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002053 },
2054 .chained = true,
2055 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002056 },
2057 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002058 .type = HDA_FIXUP_PINS,
2059 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002060 { 0x16, 0x99130111 }, /* CLFE speaker */
2061 { 0x1b, 0x99130112 }, /* surround speaker */
2062 { }
2063 },
2064 .chained = true,
2065 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2066 },
2067 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2068 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002069 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002070 .v.verbs = (const struct hda_verb[]) {
2071 /* Enable all DACs */
2072 /* DAC DISABLE/MUTE 1? */
2073 /* setting bits 1-5 disables DAC nids 0x02-0x06
2074 * apparently. Init=0x38 */
2075 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2076 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2077 /* DAC DISABLE/MUTE 2? */
2078 /* some bit here disables the other DACs.
2079 * Init=0x4900 */
2080 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2081 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2082 /* DMIC fix
2083 * This laptop has a stereo digital microphone.
2084 * The mics are only 1cm apart which makes the stereo
2085 * useless. However, either the mic or the ALC889
2086 * makes the signal become a difference/sum signal
2087 * instead of standard stereo, which is annoying.
2088 * So instead we flip this bit which makes the
2089 * codec replicate the sum signal to both channels,
2090 * turning it into a normal mono mic.
2091 */
2092 /* DMIC_CONTROL? Init value = 0x0001 */
2093 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2094 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2095 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2096 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2097 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002098 },
2099 .chained = true,
2100 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002101 },
Takashi Iwai56710872011-11-14 17:42:11 +01002102 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002103 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002104 .v.func = alc885_fixup_macpro_gpio,
2105 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002106 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002107 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002108 .v.func = alc889_fixup_dac_route,
2109 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002110 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002111 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002112 .v.func = alc889_fixup_mbp_vref,
2113 .chained = true,
2114 .chain_id = ALC882_FIXUP_GPIO1,
2115 },
2116 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002117 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002118 .v.func = alc889_fixup_imac91_vref,
2119 .chained = true,
2120 .chain_id = ALC882_FIXUP_GPIO1,
2121 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002122 [ALC889_FIXUP_MBA11_VREF] = {
2123 .type = HDA_FIXUP_FUNC,
2124 .v.func = alc889_fixup_mba11_vref,
2125 .chained = true,
2126 .chain_id = ALC889_FIXUP_MBP_VREF,
2127 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002128 [ALC889_FIXUP_MBA21_VREF] = {
2129 .type = HDA_FIXUP_FUNC,
2130 .v.func = alc889_fixup_mba21_vref,
2131 .chained = true,
2132 .chain_id = ALC889_FIXUP_MBP_VREF,
2133 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002134 [ALC889_FIXUP_MP11_VREF] = {
2135 .type = HDA_FIXUP_FUNC,
2136 .v.func = alc889_fixup_mba11_vref,
2137 .chained = true,
2138 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2139 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002140 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002141 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002142 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002143 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002144 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002145 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002146 .v.func = alc882_fixup_no_primary_hp,
2147 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002148 [ALC887_FIXUP_ASUS_BASS] = {
2149 .type = HDA_FIXUP_PINS,
2150 .v.pins = (const struct hda_pintbl[]) {
2151 {0x16, 0x99130130}, /* bass speaker */
2152 {}
2153 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002154 .chained = true,
2155 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2156 },
2157 [ALC887_FIXUP_BASS_CHMAP] = {
2158 .type = HDA_FIXUP_FUNC,
2159 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002160 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002161};
2162
2163static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002164 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2165 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2166 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2167 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2168 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2169 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002170 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2171 ALC882_FIXUP_ACER_ASPIRE_4930G),
2172 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2173 ALC882_FIXUP_ACER_ASPIRE_4930G),
2174 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2175 ALC882_FIXUP_ACER_ASPIRE_8930G),
2176 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2177 ALC882_FIXUP_ACER_ASPIRE_8930G),
2178 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2179 ALC882_FIXUP_ACER_ASPIRE_4930G),
2180 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2181 ALC882_FIXUP_ACER_ASPIRE_4930G),
2182 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2183 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002184 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002185 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2186 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002187 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002188 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002189 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a2011-11-09 12:55:18 +01002190 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002191 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002192 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002193 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002194 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002195 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002196 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Fernando Luis Vázquez Cao12e31a72013-02-12 16:47:44 +09002197 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002198
2199 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002200 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2201 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2202 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002203 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002204 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2205 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002206 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2207 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002208 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002209 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002210 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002211 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2212 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002213 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002214 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2215 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2216 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Josh Boyer29ebe402012-04-12 13:55:36 -04002217 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai05193632012-11-12 10:07:36 +01002218 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002219 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2220 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2221 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002222
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002223 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
Takashi Iwaibca40132012-05-07 11:13:14 +02002224 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwaieb844d52011-11-09 18:03:07 +01002225 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
David Henningssonb2c53e22014-01-01 14:01:34 +01002226 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002227 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002228 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2229 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002230 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002231 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002232 {}
2233};
2234
Takashi Iwai1727a772013-01-10 09:52:52 +01002235static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai912093b2012-04-11 14:03:41 +02002236 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2237 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2238 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002239 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002240 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002241 {}
2242};
2243
Takashi Iwai1d045db2011-07-07 18:23:21 +02002244/*
2245 * BIOS auto configuration
2246 */
2247/* almost identical with ALC880 parser... */
2248static int alc882_parse_auto_config(struct hda_codec *codec)
2249{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002250 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002251 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2252 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002253}
2254
Takashi Iwai1d045db2011-07-07 18:23:21 +02002255/*
2256 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002257static int patch_alc882(struct hda_codec *codec)
2258{
2259 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002260 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002261
Takashi Iwai3de95172012-05-07 18:03:15 +02002262 err = alc_alloc_spec(codec, 0x0b);
2263 if (err < 0)
2264 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002265
Takashi Iwai3de95172012-05-07 18:03:15 +02002266 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002267
2268 switch (codec->vendor_id) {
2269 case 0x10ec0882:
2270 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002271 case 0x10ec0900:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002272 break;
2273 default:
2274 /* ALC883 and variants */
2275 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2276 break;
2277 }
2278
Takashi Iwai1727a772013-01-10 09:52:52 +01002279 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002280 alc882_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002281 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002282
2283 alc_auto_parse_customize_define(codec);
2284
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002285 if (has_cdefine_beep(codec))
2286 spec->gen.beep_nid = 0x01;
2287
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002288 /* automatic parse from the BIOS config */
2289 err = alc882_parse_auto_config(codec);
2290 if (err < 0)
2291 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002292
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002293 if (!spec->gen.no_analog && spec->gen.beep_nid)
Takashi Iwai1d045db2011-07-07 18:23:21 +02002294 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2295
Takashi Iwai1d045db2011-07-07 18:23:21 +02002296 codec->patch_ops = alc_patch_ops;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002297
Takashi Iwai1727a772013-01-10 09:52:52 +01002298 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002299
Takashi Iwai1d045db2011-07-07 18:23:21 +02002300 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002301
2302 error:
2303 alc_free(codec);
2304 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002305}
2306
2307
2308/*
2309 * ALC262 support
2310 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002311static int alc262_parse_auto_config(struct hda_codec *codec)
2312{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002313 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002314 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2315 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002316}
2317
2318/*
2319 * Pin config fixes
2320 */
2321enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002322 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002323 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002324 ALC262_FIXUP_HP_Z200,
2325 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002326 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002327 ALC262_FIXUP_BENQ,
2328 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002329 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002330 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002331};
2332
Takashi Iwai1727a772013-01-10 09:52:52 +01002333static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002334 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002335 .type = HDA_FIXUP_PINS,
2336 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002337 { 0x14, 0x99130110 }, /* speaker */
2338 { 0x15, 0x0221142f }, /* front HP */
2339 { 0x1b, 0x0121141f }, /* rear HP */
2340 { }
2341 }
2342 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002343 [ALC262_FIXUP_FSC_S7110] = {
2344 .type = HDA_FIXUP_PINS,
2345 .v.pins = (const struct hda_pintbl[]) {
2346 { 0x15, 0x90170110 }, /* speaker */
2347 { }
2348 },
2349 .chained = true,
2350 .chain_id = ALC262_FIXUP_BENQ,
2351 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002352 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002353 .type = HDA_FIXUP_PINS,
2354 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002355 { 0x16, 0x99130120 }, /* internal speaker */
2356 { }
2357 }
2358 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002359 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002360 .type = HDA_FIXUP_PINS,
2361 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002362 { 0x14, 0x1993e1f0 }, /* int AUX */
2363 { }
2364 }
2365 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002366 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002367 .type = HDA_FIXUP_PINCTLS,
2368 .v.pins = (const struct hda_pintbl[]) {
2369 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002370 {}
2371 },
2372 .chained = true,
2373 .chain_id = ALC262_FIXUP_BENQ,
2374 },
2375 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002376 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002377 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002378 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2379 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2380 {}
2381 }
2382 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002383 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002384 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002385 .v.verbs = (const struct hda_verb[]) {
2386 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2387 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2388 {}
2389 }
2390 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002391 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002392 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002393 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002394 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002395 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2396 .type = HDA_FIXUP_FUNC,
2397 .v.func = alc_fixup_no_depop_delay,
2398 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002399};
2400
2401static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002402 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002403 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002404 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002405 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
2406 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002407 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002408 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2409 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002410 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002411 {}
2412};
2413
Takashi Iwai1727a772013-01-10 09:52:52 +01002414static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002415 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2416 {}
2417};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002418
Takashi Iwai1d045db2011-07-07 18:23:21 +02002419/*
2420 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002421static int patch_alc262(struct hda_codec *codec)
2422{
2423 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002424 int err;
2425
Takashi Iwai3de95172012-05-07 18:03:15 +02002426 err = alc_alloc_spec(codec, 0x0b);
2427 if (err < 0)
2428 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002429
Takashi Iwai3de95172012-05-07 18:03:15 +02002430 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002431 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002432
2433#if 0
2434 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2435 * under-run
2436 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002437 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002438#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002439 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2440
Takashi Iwai1727a772013-01-10 09:52:52 +01002441 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002442 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002443 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002444
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002445 alc_auto_parse_customize_define(codec);
2446
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002447 if (has_cdefine_beep(codec))
2448 spec->gen.beep_nid = 0x01;
2449
Takashi Iwai42399f72011-11-07 17:18:44 +01002450 /* automatic parse from the BIOS config */
2451 err = alc262_parse_auto_config(codec);
2452 if (err < 0)
2453 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002454
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002455 if (!spec->gen.no_analog && spec->gen.beep_nid)
Takashi Iwai1d045db2011-07-07 18:23:21 +02002456 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2457
Takashi Iwai1d045db2011-07-07 18:23:21 +02002458 codec->patch_ops = alc_patch_ops;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002459 spec->shutup = alc_eapd_shutup;
2460
Takashi Iwai1727a772013-01-10 09:52:52 +01002461 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002462
Takashi Iwai1d045db2011-07-07 18:23:21 +02002463 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002464
2465 error:
2466 alc_free(codec);
2467 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002468}
2469
2470/*
2471 * ALC268
2472 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002473/* bind Beep switches of both NID 0x0f and 0x10 */
2474static const struct hda_bind_ctls alc268_bind_beep_sw = {
2475 .ops = &snd_hda_bind_sw,
2476 .values = {
2477 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
2478 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
2479 0
2480 },
2481};
2482
2483static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2484 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
2485 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
2486 { }
2487};
2488
2489/* set PCBEEP vol = 0, mute connections */
2490static const struct hda_verb alc268_beep_init_verbs[] = {
2491 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2492 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2493 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2494 { }
2495};
2496
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002497enum {
2498 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002499 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002500 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002501};
2502
Takashi Iwai1727a772013-01-10 09:52:52 +01002503static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002504 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002505 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002506 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002507 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002508 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002509 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02002510 .v.verbs = (const struct hda_verb[]) {
2511 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
2512 {}
2513 }
2514 },
Takashi Iwai24eff322013-11-04 18:21:08 +01002515 [ALC268_FIXUP_SPDIF] = {
2516 .type = HDA_FIXUP_PINS,
2517 .v.pins = (const struct hda_pintbl[]) {
2518 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
2519 {}
2520 }
2521 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002522};
2523
Takashi Iwai1727a772013-01-10 09:52:52 +01002524static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002525 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02002526 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
2527 {}
2528};
2529
2530static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01002531 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01002532 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02002533 /* below is codec SSID since multiple Toshiba laptops have the
2534 * same PCI SSID 1179:ff00
2535 */
2536 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002537 {}
2538};
2539
Takashi Iwai1d045db2011-07-07 18:23:21 +02002540/*
2541 * BIOS auto configuration
2542 */
2543static int alc268_parse_auto_config(struct hda_codec *codec)
2544{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002545 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002546 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002547}
2548
Takashi Iwai1d045db2011-07-07 18:23:21 +02002549/*
2550 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002551static int patch_alc268(struct hda_codec *codec)
2552{
2553 struct alc_spec *spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002554 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002555
Takashi Iwai1d045db2011-07-07 18:23:21 +02002556 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02002557 err = alc_alloc_spec(codec, 0);
2558 if (err < 0)
2559 return err;
2560
2561 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002562 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002563
Takashi Iwai1727a772013-01-10 09:52:52 +01002564 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
2565 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002566
Takashi Iwai6ebb8052011-08-16 15:15:40 +02002567 /* automatic parse from the BIOS config */
2568 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002569 if (err < 0)
2570 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002571
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002572 if (err > 0 && !spec->gen.no_analog &&
2573 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
2574 add_mixer(spec, alc268_beep_mixer);
2575 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002576 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
2577 /* override the amp caps for beep generator */
2578 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
2579 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
2580 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
2581 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
2582 (0 << AC_AMPCAP_MUTE_SHIFT));
2583 }
2584
Takashi Iwai1d045db2011-07-07 18:23:21 +02002585 codec->patch_ops = alc_patch_ops;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002586 spec->shutup = alc_eapd_shutup;
2587
Takashi Iwai1727a772013-01-10 09:52:52 +01002588 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002589
Takashi Iwai1d045db2011-07-07 18:23:21 +02002590 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002591
2592 error:
2593 alc_free(codec);
2594 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002595}
2596
2597/*
2598 * ALC269
2599 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01002600
2601static int playback_pcm_open(struct hda_pcm_stream *hinfo,
2602 struct hda_codec *codec,
2603 struct snd_pcm_substream *substream)
2604{
2605 struct hda_gen_spec *spec = codec->spec;
2606 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream,
2607 hinfo);
2608}
2609
2610static int playback_pcm_prepare(struct hda_pcm_stream *hinfo,
2611 struct hda_codec *codec,
2612 unsigned int stream_tag,
2613 unsigned int format,
2614 struct snd_pcm_substream *substream)
2615{
2616 struct hda_gen_spec *spec = codec->spec;
2617 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout,
2618 stream_tag, format, substream);
2619}
2620
2621static int playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
2622 struct hda_codec *codec,
2623 struct snd_pcm_substream *substream)
2624{
2625 struct hda_gen_spec *spec = codec->spec;
2626 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
2627}
2628
Takashi Iwai1d045db2011-07-07 18:23:21 +02002629static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
2630 .substreams = 1,
2631 .channels_min = 2,
2632 .channels_max = 8,
2633 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2634 /* NID is set in alc_build_pcms */
2635 .ops = {
Takashi Iwai08c189f2012-12-19 15:22:24 +01002636 .open = playback_pcm_open,
2637 .prepare = playback_pcm_prepare,
2638 .cleanup = playback_pcm_cleanup
Takashi Iwai1d045db2011-07-07 18:23:21 +02002639 },
2640};
2641
2642static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
2643 .substreams = 1,
2644 .channels_min = 2,
2645 .channels_max = 2,
2646 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
2647 /* NID is set in alc_build_pcms */
2648};
2649
Takashi Iwai1d045db2011-07-07 18:23:21 +02002650/* different alc269-variants */
2651enum {
2652 ALC269_TYPE_ALC269VA,
2653 ALC269_TYPE_ALC269VB,
2654 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02002655 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01002656 ALC269_TYPE_ALC280,
2657 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02002658 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01002659 ALC269_TYPE_ALC284,
Kailang Yang161ebf22013-10-24 11:36:33 +02002660 ALC269_TYPE_ALC285,
Kailang Yang7fc7d042013-04-25 11:04:43 +02002661 ALC269_TYPE_ALC286,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02002662 ALC269_TYPE_ALC255,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002663};
2664
2665/*
2666 * BIOS auto configuration
2667 */
2668static int alc269_parse_auto_config(struct hda_codec *codec)
2669{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002670 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002671 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
2672 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2673 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02002674 const hda_nid_t *ssids;
2675
2676 switch (spec->codec_variant) {
2677 case ALC269_TYPE_ALC269VA:
2678 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01002679 case ALC269_TYPE_ALC280:
2680 case ALC269_TYPE_ALC284:
Kailang Yang161ebf22013-10-24 11:36:33 +02002681 case ALC269_TYPE_ALC285:
Kailang Yangadcc70b2012-05-25 08:08:38 +02002682 ssids = alc269va_ssids;
2683 break;
2684 case ALC269_TYPE_ALC269VB:
2685 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01002686 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02002687 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02002688 case ALC269_TYPE_ALC286:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02002689 case ALC269_TYPE_ALC255:
Kailang Yangadcc70b2012-05-25 08:08:38 +02002690 ssids = alc269_ssids;
2691 break;
2692 default:
2693 ssids = alc269_ssids;
2694 break;
2695 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002696
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002697 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002698}
2699
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08002700static int find_ext_mic_pin(struct hda_codec *codec);
2701
2702static void alc286_shutup(struct hda_codec *codec)
2703{
2704 int i;
2705 int mic_pin = find_ext_mic_pin(codec);
2706 /* don't shut up pins when unloading the driver; otherwise it breaks
2707 * the default pin setup at the next load of the driver
2708 */
2709 if (codec->bus->shutdown)
2710 return;
2711 for (i = 0; i < codec->init_pins.used; i++) {
2712 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
2713 /* use read here for syncing after issuing each verb */
2714 if (pin->nid != mic_pin)
2715 snd_hda_codec_read(codec, pin->nid, 0,
2716 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
2717 }
2718 codec->pins_shutup = 1;
2719}
2720
Kailang Yang1387e2d2012-11-08 10:23:18 +01002721static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02002722{
Takashi Iwai98b24882014-08-18 13:47:50 +02002723 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002724}
2725
2726static void alc269_shutup(struct hda_codec *codec)
2727{
Kailang Yangadcc70b2012-05-25 08:08:38 +02002728 struct alc_spec *spec = codec->spec;
2729
Kailang Yang1387e2d2012-11-08 10:23:18 +01002730 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
2731 alc269vb_toggle_power_output(codec, 0);
2732 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
2733 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002734 msleep(150);
2735 }
Takashi Iwai9bfb2842013-07-24 14:31:50 +02002736 snd_hda_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002737}
2738
Takashi Iwai54db6c32014-08-18 15:11:19 +02002739static struct coef_fw alc282_coefs[] = {
2740 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08002741 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02002742 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2743 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2744 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2745 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2746 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2747 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
2748 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2749 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2750 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
2751 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
2752 WRITE_COEF(0x34, 0xa0c0), /* ANC */
2753 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
2754 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2755 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2756 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2757 WRITE_COEF(0x63, 0x2902), /* PLL */
2758 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
2759 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
2760 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
2761 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
2762 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
2763 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
2764 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
2765 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
2766 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
2767 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
2768 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
2769 {}
2770};
2771
Kailang Yangcb149cb2014-03-18 16:45:32 +08002772static void alc282_restore_default_value(struct hda_codec *codec)
2773{
Takashi Iwai54db6c32014-08-18 15:11:19 +02002774 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08002775}
2776
Kailang Yang7b5c7a02014-03-18 16:15:54 +08002777static void alc282_init(struct hda_codec *codec)
2778{
2779 struct alc_spec *spec = codec->spec;
2780 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2781 bool hp_pin_sense;
2782 int coef78;
2783
Kailang Yangcb149cb2014-03-18 16:45:32 +08002784 alc282_restore_default_value(codec);
2785
Kailang Yang7b5c7a02014-03-18 16:15:54 +08002786 if (!hp_pin)
2787 return;
2788 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2789 coef78 = alc_read_coef_idx(codec, 0x78);
2790
2791 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
2792 /* Headphone capless set to high power mode */
2793 alc_write_coef_idx(codec, 0x78, 0x9004);
2794
2795 if (hp_pin_sense)
2796 msleep(2);
2797
2798 snd_hda_codec_write(codec, hp_pin, 0,
2799 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2800
2801 if (hp_pin_sense)
2802 msleep(85);
2803
2804 snd_hda_codec_write(codec, hp_pin, 0,
2805 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2806
2807 if (hp_pin_sense)
2808 msleep(100);
2809
2810 /* Headphone capless set to normal mode */
2811 alc_write_coef_idx(codec, 0x78, coef78);
2812}
2813
2814static void alc282_shutup(struct hda_codec *codec)
2815{
2816 struct alc_spec *spec = codec->spec;
2817 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2818 bool hp_pin_sense;
2819 int coef78;
2820
2821 if (!hp_pin) {
2822 alc269_shutup(codec);
2823 return;
2824 }
2825
2826 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2827 coef78 = alc_read_coef_idx(codec, 0x78);
2828 alc_write_coef_idx(codec, 0x78, 0x9004);
2829
2830 if (hp_pin_sense)
2831 msleep(2);
2832
2833 snd_hda_codec_write(codec, hp_pin, 0,
2834 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2835
2836 if (hp_pin_sense)
2837 msleep(85);
2838
2839 snd_hda_codec_write(codec, hp_pin, 0,
2840 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2841
2842 if (hp_pin_sense)
2843 msleep(100);
2844
2845 alc_auto_setup_eapd(codec, false);
2846 snd_hda_shutup_pins(codec);
2847 alc_write_coef_idx(codec, 0x78, coef78);
2848}
2849
Takashi Iwai54db6c32014-08-18 15:11:19 +02002850static struct coef_fw alc283_coefs[] = {
2851 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08002852 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02002853 WRITE_COEF(0x07, 0x0200), /* DMIC control */
2854 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
2855 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
2856 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
2857 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
2858 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
2859 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
2860 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
2861 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
2862 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
2863 WRITE_COEF(0x22, 0xa0c0), /* ANC */
2864 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
2865 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
2866 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
2867 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
2868 WRITE_COEF(0x2e, 0x2902), /* PLL */
2869 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
2870 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
2871 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
2872 WRITE_COEF(0x36, 0x0), /* capless control 5 */
2873 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
2874 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
2875 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
2876 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
2877 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
2878 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
2879 WRITE_COEF(0x49, 0x0), /* test mode */
2880 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
2881 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
2882 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08002883 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02002884 {}
2885};
2886
Kailang Yang6bd55b02014-03-17 13:51:27 +08002887static void alc283_restore_default_value(struct hda_codec *codec)
2888{
Takashi Iwai54db6c32014-08-18 15:11:19 +02002889 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08002890}
2891
Kailang Yang2af02be2013-08-22 10:03:50 +02002892static void alc283_init(struct hda_codec *codec)
2893{
2894 struct alc_spec *spec = codec->spec;
2895 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2896 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02002897
Kailang Yang8314f222014-04-03 17:28:39 +08002898 if (!spec->gen.autocfg.hp_outs) {
2899 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
2900 hp_pin = spec->gen.autocfg.line_out_pins[0];
2901 }
2902
Kailang Yang6bd55b02014-03-17 13:51:27 +08002903 alc283_restore_default_value(codec);
2904
Kailang Yang2af02be2013-08-22 10:03:50 +02002905 if (!hp_pin)
2906 return;
2907 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2908
2909 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
2910 /* Headphone capless set to high power mode */
2911 alc_write_coef_idx(codec, 0x43, 0x9004);
2912
2913 snd_hda_codec_write(codec, hp_pin, 0,
2914 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2915
2916 if (hp_pin_sense)
2917 msleep(85);
2918
2919 snd_hda_codec_write(codec, hp_pin, 0,
2920 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
2921
2922 if (hp_pin_sense)
2923 msleep(85);
2924 /* Index 0x46 Combo jack auto switch control 2 */
2925 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02002926 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02002927 /* Headphone capless set to normal mode */
2928 alc_write_coef_idx(codec, 0x43, 0x9614);
2929}
2930
2931static void alc283_shutup(struct hda_codec *codec)
2932{
2933 struct alc_spec *spec = codec->spec;
2934 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
2935 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02002936
Kailang Yang8314f222014-04-03 17:28:39 +08002937 if (!spec->gen.autocfg.hp_outs) {
2938 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
2939 hp_pin = spec->gen.autocfg.line_out_pins[0];
2940 }
2941
Kailang Yang2af02be2013-08-22 10:03:50 +02002942 if (!hp_pin) {
2943 alc269_shutup(codec);
2944 return;
2945 }
2946
2947 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
2948
2949 alc_write_coef_idx(codec, 0x43, 0x9004);
2950
Harsha Priyab450b172014-10-09 11:04:56 +00002951 /*depop hp during suspend*/
2952 alc_write_coef_idx(codec, 0x06, 0x2100);
2953
Kailang Yang2af02be2013-08-22 10:03:50 +02002954 snd_hda_codec_write(codec, hp_pin, 0,
2955 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
2956
2957 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02002958 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02002959
2960 snd_hda_codec_write(codec, hp_pin, 0,
2961 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
2962
Takashi Iwai98b24882014-08-18 13:47:50 +02002963 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02002964
2965 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02002966 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08002967 alc_auto_setup_eapd(codec, false);
Kailang Yang2af02be2013-08-22 10:03:50 +02002968 snd_hda_shutup_pins(codec);
2969 alc_write_coef_idx(codec, 0x43, 0x9614);
2970}
2971
Kailang Yangad60d502013-06-28 12:03:01 +02002972static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
2973 unsigned int val)
2974{
2975 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
2976 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
2977 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
2978}
2979
2980static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
2981{
2982 unsigned int val;
2983
2984 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
2985 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
2986 & 0xffff;
2987 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
2988 << 16;
2989 return val;
2990}
2991
2992static void alc5505_dsp_halt(struct hda_codec *codec)
2993{
2994 unsigned int val;
2995
2996 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
2997 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
2998 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
2999 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3000 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3001 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3002 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3003 val = alc5505_coef_get(codec, 0x6220);
3004 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3005}
3006
3007static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3008{
3009 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3010 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3011 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3012 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3013 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3014 alc5505_coef_set(codec, 0x880c, 0x00000004);
3015}
3016
3017static void alc5505_dsp_init(struct hda_codec *codec)
3018{
3019 unsigned int val;
3020
3021 alc5505_dsp_halt(codec);
3022 alc5505_dsp_back_from_halt(codec);
3023 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3024 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3025 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3026 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3027 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3028 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3029 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3030 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3031 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3032 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3033 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3034 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3035 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3036
3037 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3038 if (val <= 3)
3039 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3040 else
3041 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3042
3043 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3044 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3045 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3046 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3047 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3048 alc5505_coef_set(codec, 0x880c, 0x00000003);
3049 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003050
3051#ifdef HALT_REALTEK_ALC5505
3052 alc5505_dsp_halt(codec);
3053#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003054}
3055
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003056#ifdef HALT_REALTEK_ALC5505
3057#define alc5505_dsp_suspend(codec) /* NOP */
3058#define alc5505_dsp_resume(codec) /* NOP */
3059#else
3060#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3061#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3062#endif
3063
Takashi Iwai2a439522011-07-26 09:52:50 +02003064#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003065static int alc269_suspend(struct hda_codec *codec)
3066{
3067 struct alc_spec *spec = codec->spec;
3068
3069 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003070 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02003071 return alc_suspend(codec);
3072}
3073
Takashi Iwai1d045db2011-07-07 18:23:21 +02003074static int alc269_resume(struct hda_codec *codec)
3075{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003076 struct alc_spec *spec = codec->spec;
3077
Kailang Yang1387e2d2012-11-08 10:23:18 +01003078 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3079 alc269vb_toggle_power_output(codec, 0);
3080 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003081 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003082 msleep(150);
3083 }
3084
3085 codec->patch_ops.init(codec);
3086
Kailang Yang1387e2d2012-11-08 10:23:18 +01003087 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3088 alc269vb_toggle_power_output(codec, 1);
3089 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02003090 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003091 msleep(200);
3092 }
3093
Takashi Iwai1d045db2011-07-07 18:23:21 +02003094 snd_hda_codec_resume_amp(codec);
3095 snd_hda_codec_resume_cache(codec);
3096 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08003097
3098 /* on some machine, the BIOS will clear the codec gpio data when enter
3099 * suspend, and won't restore the data after resume, so we restore it
3100 * in the driver.
3101 */
3102 if (spec->gpio_led)
3103 snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA,
3104 spec->gpio_led);
3105
Kailang Yangad60d502013-06-28 12:03:01 +02003106 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003107 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02003108
Takashi Iwai1d045db2011-07-07 18:23:21 +02003109 return 0;
3110}
Takashi Iwai2a439522011-07-26 09:52:50 +02003111#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003112
David Henningsson108cc102012-07-20 10:37:25 +02003113static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003114 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02003115{
3116 struct alc_spec *spec = codec->spec;
3117
Takashi Iwai1727a772013-01-10 09:52:52 +01003118 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02003119 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
3120}
3121
Takashi Iwai1d045db2011-07-07 18:23:21 +02003122static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003123 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003124{
Takashi Iwai98b24882014-08-18 13:47:50 +02003125 if (action == HDA_FIXUP_ACT_INIT)
3126 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003127}
3128
David Henningsson7c478f02013-10-11 10:18:46 +02003129static void alc269_fixup_headset_mic(struct hda_codec *codec,
3130 const struct hda_fixup *fix, int action)
3131{
3132 struct alc_spec *spec = codec->spec;
3133
3134 if (action == HDA_FIXUP_ACT_PRE_PROBE)
3135 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3136}
3137
Takashi Iwai1d045db2011-07-07 18:23:21 +02003138static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003139 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003140{
3141 static const struct hda_verb verbs[] = {
3142 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
3143 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
3144 {}
3145 };
3146 unsigned int cfg;
3147
Dylan Reid42397002013-04-05 14:58:22 -07003148 if (strcmp(codec->chip_name, "ALC271X") &&
3149 strcmp(codec->chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02003150 return;
3151 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
3152 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
3153 snd_hda_sequence_write(codec, verbs);
3154}
3155
Takashi Iwai017f2a12011-07-09 14:42:25 +02003156static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003157 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003158{
3159 struct alc_spec *spec = codec->spec;
3160
Takashi Iwai1727a772013-01-10 09:52:52 +01003161 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02003162 return;
3163
3164 /* Due to a hardware problem on Lenovo Ideadpad, we need to
3165 * fix the sample rate of analog I/O to 44.1kHz
3166 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003167 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
3168 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02003169}
3170
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003171static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003172 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003173{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003174 /* The digital-mic unit sends PDM (differential signal) instead of
3175 * the standard PCM, thus you can't record a valid mono stream as is.
3176 * Below is a workaround specific to ALC269 to control the dmic
3177 * signal source as mono.
3178 */
Takashi Iwai98b24882014-08-18 13:47:50 +02003179 if (action == HDA_FIXUP_ACT_INIT)
3180 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02003181}
3182
Takashi Iwai24519912011-08-16 15:08:49 +02003183static void alc269_quanta_automute(struct hda_codec *codec)
3184{
Takashi Iwai08c189f2012-12-19 15:22:24 +01003185 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02003186
Takashi Iwai1687ccc2014-08-18 13:49:35 +02003187 alc_write_coef_idx(codec, 0x0c, 0x680);
3188 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02003189}
3190
3191static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01003192 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02003193{
3194 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01003195 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02003196 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01003197 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02003198}
3199
David Henningssond240d1d2013-04-15 12:50:02 +02003200static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02003201 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02003202{
3203 struct alc_spec *spec = codec->spec;
3204 int vref;
3205 msleep(200);
3206 snd_hda_gen_hp_automute(codec, jack);
3207
3208 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
3209 msleep(100);
3210 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3211 vref);
3212 msleep(500);
3213 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3214 vref);
3215}
3216
3217static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
3218 const struct hda_fixup *fix, int action)
3219{
3220 struct alc_spec *spec = codec->spec;
3221 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3222 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3223 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
3224 }
3225}
3226
3227
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003228/* update mute-LED according to the speaker mute state via mic VREF pin */
3229static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003230{
3231 struct hda_codec *codec = private_data;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003232 struct alc_spec *spec = codec->spec;
3233 unsigned int pinval;
3234
3235 if (spec->mute_led_polarity)
3236 enabled = !enabled;
Takashi Iwai415d5552014-04-03 11:51:21 +02003237 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
3238 pinval &= ~AC_PINCTL_VREFEN;
3239 pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003240 if (spec->mute_led_nid)
3241 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003242}
3243
David Henningssond5b6b652013-11-06 10:50:44 +01003244/* Make sure the led works even in runtime suspend */
3245static unsigned int led_power_filter(struct hda_codec *codec,
3246 hda_nid_t nid,
3247 unsigned int power_state)
3248{
3249 struct alc_spec *spec = codec->spec;
3250
Hui Wang50dd9052014-07-08 17:56:15 +08003251 if (power_state != AC_PWRST_D3 || nid == 0 ||
3252 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01003253 return power_state;
3254
3255 /* Set pin ctl again, it might have just been set to 0 */
3256 snd_hda_set_pin_ctl(codec, nid,
3257 snd_hda_codec_get_pin_target(codec, nid));
3258
3259 return AC_PWRST_D0;
3260}
3261
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003262static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
3263 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003264{
3265 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003266 const struct dmi_device *dev = NULL;
3267
3268 if (action != HDA_FIXUP_ACT_PRE_PROBE)
3269 return;
3270
3271 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
3272 int pol, pin;
3273 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
3274 continue;
3275 if (pin < 0x0a || pin >= 0x10)
3276 break;
3277 spec->mute_led_polarity = pol;
3278 spec->mute_led_nid = pin - 0x0a + 0x18;
3279 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
Takashi Iwaifd25a972012-12-20 14:57:18 +01003280 spec->gen.vmaster_mute_enum = 1;
David Henningssond5b6b652013-11-06 10:50:44 +01003281 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01003282 codec_dbg(codec,
3283 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003284 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01003285 break;
3286 }
3287}
3288
David Henningssond06ac142013-02-18 11:41:55 +01003289static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
3290 const struct hda_fixup *fix, int action)
3291{
3292 struct alc_spec *spec = codec->spec;
3293 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3294 spec->mute_led_polarity = 0;
3295 spec->mute_led_nid = 0x18;
3296 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3297 spec->gen.vmaster_mute_enum = 1;
David Henningssond5b6b652013-11-06 10:50:44 +01003298 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01003299 }
3300}
3301
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003302static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
3303 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01003304{
3305 struct alc_spec *spec = codec->spec;
Takashi Iwai9bb1f062013-01-10 17:14:29 +01003306 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08fb0d02013-01-10 17:33:58 +01003307 spec->mute_led_polarity = 0;
3308 spec->mute_led_nid = 0x19;
3309 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
Takashi Iwaifd25a972012-12-20 14:57:18 +01003310 spec->gen.vmaster_mute_enum = 1;
David Henningssond5b6b652013-11-06 10:50:44 +01003311 codec->power_filter = led_power_filter;
Takashi Iwai420b0fe2012-03-12 12:35:27 +01003312 }
3313}
3314
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003315/* update LED status via GPIO */
3316static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
3317 bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003318{
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003319 struct alc_spec *spec = codec->spec;
3320 unsigned int oldval = spec->gpio_led;
3321
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003322 if (spec->mute_led_polarity)
3323 enabled = !enabled;
3324
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003325 if (enabled)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003326 spec->gpio_led &= ~mask;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003327 else
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003328 spec->gpio_led |= mask;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003329 if (spec->gpio_led != oldval)
3330 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
3331 spec->gpio_led);
3332}
3333
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003334/* turn on/off mute LED via GPIO per vmaster hook */
3335static void alc_fixup_gpio_mute_hook(void *private_data, int enabled)
3336{
3337 struct hda_codec *codec = private_data;
3338 struct alc_spec *spec = codec->spec;
3339
3340 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled);
3341}
3342
3343/* turn on/off mic-mute LED via GPIO per capture hook */
3344static void alc_fixup_gpio_mic_mute_hook(struct hda_codec *codec,
3345 struct snd_kcontrol *kcontrol,
3346 struct snd_ctl_elem_value *ucontrol)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003347{
3348 struct alc_spec *spec = codec->spec;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003349
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003350 if (ucontrol)
3351 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
3352 ucontrol->value.integer.value[0] ||
3353 ucontrol->value.integer.value[1]);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003354}
3355
3356static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
3357 const struct hda_fixup *fix, int action)
3358{
3359 struct alc_spec *spec = codec->spec;
3360 static const struct hda_verb gpio_init[] = {
3361 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3362 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3363 {}
3364 };
3365
3366 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003367 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3368 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003369 spec->gpio_led = 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003370 spec->mute_led_polarity = 0;
3371 spec->gpio_mute_led_mask = 0x08;
3372 spec->gpio_mic_led_mask = 0x10;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01003373 snd_hda_add_verbs(codec, gpio_init);
3374 }
3375}
3376
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08003377static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
3378 const struct hda_fixup *fix, int action)
3379{
3380 struct alc_spec *spec = codec->spec;
3381 static const struct hda_verb gpio_init[] = {
3382 { 0x01, AC_VERB_SET_GPIO_MASK, 0x22 },
3383 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x22 },
3384 {}
3385 };
3386
3387 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3388 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
3389 spec->gen.cap_sync_hook = alc_fixup_gpio_mic_mute_hook;
3390 spec->gpio_led = 0;
3391 spec->mute_led_polarity = 0;
3392 spec->gpio_mute_led_mask = 0x02;
3393 spec->gpio_mic_led_mask = 0x20;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003394 snd_hda_add_verbs(codec, gpio_init);
3395 }
3396}
3397
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003398/* turn on/off mic-mute LED per capture hook */
3399static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec,
3400 struct snd_kcontrol *kcontrol,
3401 struct snd_ctl_elem_value *ucontrol)
3402{
3403 struct alc_spec *spec = codec->spec;
3404 unsigned int pinval, enable, disable;
3405
Hui Wangfc1fad92014-07-08 17:56:14 +08003406 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003407 pinval &= ~AC_PINCTL_VREFEN;
3408 enable = pinval | AC_PINCTL_VREF_80;
3409 disable = pinval | AC_PINCTL_VREF_HIZ;
3410
3411 if (!ucontrol)
3412 return;
3413
3414 if (ucontrol->value.integer.value[0] ||
3415 ucontrol->value.integer.value[1])
3416 pinval = disable;
3417 else
3418 pinval = enable;
3419
3420 if (spec->cap_mute_led_nid)
3421 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval);
3422}
3423
3424static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
3425 const struct hda_fixup *fix, int action)
3426{
3427 struct alc_spec *spec = codec->spec;
3428 static const struct hda_verb gpio_init[] = {
3429 { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 },
3430 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 },
3431 {}
3432 };
3433
3434 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003435 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003436 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3437 spec->gpio_led = 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003438 spec->mute_led_polarity = 0;
3439 spec->gpio_mute_led_mask = 0x08;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003440 spec->cap_mute_led_nid = 0x18;
3441 snd_hda_add_verbs(codec, gpio_init);
Hui Wang50dd9052014-07-08 17:56:15 +08003442 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003443 }
3444}
3445
David Henningsson7a5255f2014-10-30 08:26:01 +01003446static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
3447 const struct hda_fixup *fix, int action)
3448{
3449 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */
3450 struct alc_spec *spec = codec->spec;
3451 static const struct hda_verb gpio_init[] = {
3452 { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 },
3453 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 },
3454 {}
3455 };
3456
3457 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003458 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
David Henningsson7a5255f2014-10-30 08:26:01 +01003459 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3460 spec->gpio_led = 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01003461 spec->mute_led_polarity = 0;
3462 spec->gpio_mute_led_mask = 0x08;
David Henningsson7a5255f2014-10-30 08:26:01 +01003463 spec->cap_mute_led_nid = 0x18;
3464 snd_hda_add_verbs(codec, gpio_init);
3465 codec->power_filter = led_power_filter;
3466 }
3467}
3468
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08003469static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
3470 const struct hda_fixup *fix, int action)
3471{
3472 struct alc_spec *spec = codec->spec;
3473
3474 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3475 spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook;
3476 spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook;
3477 spec->mute_led_polarity = 0;
3478 spec->mute_led_nid = 0x1a;
3479 spec->cap_mute_led_nid = 0x18;
3480 spec->gen.vmaster_mute_enum = 1;
3481 codec->power_filter = led_power_filter;
3482 }
3483}
3484
David Henningsson73bdd592013-04-15 15:44:14 +02003485static void alc_headset_mode_unplugged(struct hda_codec *codec)
3486{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003487 static struct coef_fw coef0255[] = {
3488 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
3489 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
3490 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
3491 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
3492 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
3493 {}
3494 };
3495 static struct coef_fw coef0233[] = {
3496 WRITE_COEF(0x1b, 0x0c0b),
3497 WRITE_COEF(0x45, 0xc429),
3498 UPDATE_COEF(0x35, 0x4000, 0),
3499 WRITE_COEF(0x06, 0x2104),
3500 WRITE_COEF(0x1a, 0x0001),
3501 WRITE_COEF(0x26, 0x0004),
3502 WRITE_COEF(0x32, 0x42a3),
3503 {}
3504 };
3505 static struct coef_fw coef0292[] = {
3506 WRITE_COEF(0x76, 0x000e),
3507 WRITE_COEF(0x6c, 0x2400),
3508 WRITE_COEF(0x18, 0x7308),
3509 WRITE_COEF(0x6b, 0xc429),
3510 {}
3511 };
3512 static struct coef_fw coef0293[] = {
3513 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
3514 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
3515 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
3516 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
3517 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
3518 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
3519 {}
3520 };
3521 static struct coef_fw coef0668[] = {
3522 WRITE_COEF(0x15, 0x0d40),
3523 WRITE_COEF(0xb7, 0x802b),
3524 {}
3525 };
3526
David Henningsson73bdd592013-04-15 15:44:14 +02003527 switch (codec->vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003528 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003529 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003530 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08003531 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02003532 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003533 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02003534 break;
3535 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003536 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02003537 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08003538 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003539 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08003540 break;
David Henningsson73bdd592013-04-15 15:44:14 +02003541 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003542 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02003543 break;
3544 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01003545 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02003546}
3547
3548
3549static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
3550 hda_nid_t mic_pin)
3551{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003552 static struct coef_fw coef0255[] = {
3553 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
3554 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
3555 {}
3556 };
3557 static struct coef_fw coef0233[] = {
3558 UPDATE_COEF(0x35, 0, 1<<14),
3559 WRITE_COEF(0x06, 0x2100),
3560 WRITE_COEF(0x1a, 0x0021),
3561 WRITE_COEF(0x26, 0x008c),
3562 {}
3563 };
3564 static struct coef_fw coef0292[] = {
3565 WRITE_COEF(0x19, 0xa208),
3566 WRITE_COEF(0x2e, 0xacf0),
3567 {}
3568 };
3569 static struct coef_fw coef0293[] = {
3570 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
3571 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
3572 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
3573 {}
3574 };
3575 static struct coef_fw coef0688[] = {
3576 WRITE_COEF(0xb7, 0x802b),
3577 WRITE_COEF(0xb5, 0x1040),
3578 UPDATE_COEF(0xc3, 0, 1<<12),
3579 {}
3580 };
3581
David Henningsson73bdd592013-04-15 15:44:14 +02003582 switch (codec->vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003583 case 0x10ec0255:
3584 alc_write_coef_idx(codec, 0x45, 0xc489);
3585 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02003586 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003587 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3588 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08003589 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02003590 case 0x10ec0283:
3591 alc_write_coef_idx(codec, 0x45, 0xc429);
3592 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02003593 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02003594 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3595 break;
3596 case 0x10ec0292:
3597 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02003598 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02003599 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08003600 case 0x10ec0293:
3601 /* Set to TRS mode */
3602 alc_write_coef_idx(codec, 0x45, 0xc429);
3603 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02003604 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08003605 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3606 break;
David Henningsson73bdd592013-04-15 15:44:14 +02003607 case 0x10ec0668:
3608 alc_write_coef_idx(codec, 0x11, 0x0001);
3609 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02003610 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02003611 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
3612 break;
3613 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01003614 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02003615}
3616
3617static void alc_headset_mode_default(struct hda_codec *codec)
3618{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003619 static struct coef_fw coef0255[] = {
3620 WRITE_COEF(0x45, 0xc089),
3621 WRITE_COEF(0x45, 0xc489),
3622 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3623 WRITE_COEF(0x49, 0x0049),
3624 {}
3625 };
3626 static struct coef_fw coef0233[] = {
3627 WRITE_COEF(0x06, 0x2100),
3628 WRITE_COEF(0x32, 0x4ea3),
3629 {}
3630 };
3631 static struct coef_fw coef0292[] = {
3632 WRITE_COEF(0x76, 0x000e),
3633 WRITE_COEF(0x6c, 0x2400),
3634 WRITE_COEF(0x6b, 0xc429),
3635 WRITE_COEF(0x18, 0x7308),
3636 {}
3637 };
3638 static struct coef_fw coef0293[] = {
3639 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
3640 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
3641 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
3642 {}
3643 };
3644 static struct coef_fw coef0688[] = {
3645 WRITE_COEF(0x11, 0x0041),
3646 WRITE_COEF(0x15, 0x0d40),
3647 WRITE_COEF(0xb7, 0x802b),
3648 {}
3649 };
3650
David Henningsson73bdd592013-04-15 15:44:14 +02003651 switch (codec->vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003652 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003653 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003654 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08003655 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02003656 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003657 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02003658 break;
3659 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003660 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02003661 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08003662 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003663 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08003664 break;
David Henningsson73bdd592013-04-15 15:44:14 +02003665 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003666 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02003667 break;
3668 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01003669 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02003670}
3671
3672/* Iphone type */
3673static void alc_headset_mode_ctia(struct hda_codec *codec)
3674{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003675 static struct coef_fw coef0255[] = {
3676 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
3677 WRITE_COEF(0x1b, 0x0c2b),
3678 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3679 {}
3680 };
3681 static struct coef_fw coef0233[] = {
3682 WRITE_COEF(0x45, 0xd429),
3683 WRITE_COEF(0x1b, 0x0c2b),
3684 WRITE_COEF(0x32, 0x4ea3),
3685 {}
3686 };
3687 static struct coef_fw coef0292[] = {
3688 WRITE_COEF(0x6b, 0xd429),
3689 WRITE_COEF(0x76, 0x0008),
3690 WRITE_COEF(0x18, 0x7388),
3691 {}
3692 };
3693 static struct coef_fw coef0293[] = {
3694 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
3695 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
3696 {}
3697 };
3698 static struct coef_fw coef0688[] = {
3699 WRITE_COEF(0x11, 0x0001),
3700 WRITE_COEF(0x15, 0x0d60),
3701 WRITE_COEF(0xc3, 0x0000),
3702 {}
3703 };
3704
David Henningsson73bdd592013-04-15 15:44:14 +02003705 switch (codec->vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003706 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003707 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003708 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08003709 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02003710 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003711 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02003712 break;
3713 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003714 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02003715 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08003716 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003717 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08003718 break;
David Henningsson73bdd592013-04-15 15:44:14 +02003719 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003720 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02003721 break;
3722 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01003723 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02003724}
3725
3726/* Nokia type */
3727static void alc_headset_mode_omtp(struct hda_codec *codec)
3728{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003729 static struct coef_fw coef0255[] = {
3730 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
3731 WRITE_COEF(0x1b, 0x0c2b),
3732 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
3733 {}
3734 };
3735 static struct coef_fw coef0233[] = {
3736 WRITE_COEF(0x45, 0xe429),
3737 WRITE_COEF(0x1b, 0x0c2b),
3738 WRITE_COEF(0x32, 0x4ea3),
3739 {}
3740 };
3741 static struct coef_fw coef0292[] = {
3742 WRITE_COEF(0x6b, 0xe429),
3743 WRITE_COEF(0x76, 0x0008),
3744 WRITE_COEF(0x18, 0x7388),
3745 {}
3746 };
3747 static struct coef_fw coef0293[] = {
3748 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
3749 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
3750 {}
3751 };
3752 static struct coef_fw coef0688[] = {
3753 WRITE_COEF(0x11, 0x0001),
3754 WRITE_COEF(0x15, 0x0d50),
3755 WRITE_COEF(0xc3, 0x0000),
3756 {}
3757 };
3758
David Henningsson73bdd592013-04-15 15:44:14 +02003759 switch (codec->vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003760 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003761 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003762 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08003763 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02003764 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003765 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02003766 break;
3767 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003768 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02003769 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08003770 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003771 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08003772 break;
David Henningsson73bdd592013-04-15 15:44:14 +02003773 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003774 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02003775 break;
3776 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01003777 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02003778}
3779
3780static void alc_determine_headset_type(struct hda_codec *codec)
3781{
3782 int val;
3783 bool is_ctia = false;
3784 struct alc_spec *spec = codec->spec;
Takashi Iwai54db6c32014-08-18 15:11:19 +02003785 static struct coef_fw coef0255[] = {
3786 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
3787 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
3788 conteol) */
3789 {}
3790 };
3791 static struct coef_fw coef0293[] = {
3792 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
3793 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
3794 {}
3795 };
3796 static struct coef_fw coef0688[] = {
3797 WRITE_COEF(0x11, 0x0001),
3798 WRITE_COEF(0xb7, 0x802b),
3799 WRITE_COEF(0x15, 0x0d60),
3800 WRITE_COEF(0xc3, 0x0c00),
3801 {}
3802 };
David Henningsson73bdd592013-04-15 15:44:14 +02003803
3804 switch (codec->vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003805 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003806 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003807 msleep(300);
3808 val = alc_read_coef_idx(codec, 0x46);
3809 is_ctia = (val & 0x0070) == 0x0070;
3810 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08003811 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02003812 case 0x10ec0283:
3813 alc_write_coef_idx(codec, 0x45, 0xd029);
3814 msleep(300);
3815 val = alc_read_coef_idx(codec, 0x46);
3816 is_ctia = (val & 0x0070) == 0x0070;
3817 break;
3818 case 0x10ec0292:
3819 alc_write_coef_idx(codec, 0x6b, 0xd429);
3820 msleep(300);
3821 val = alc_read_coef_idx(codec, 0x6c);
3822 is_ctia = (val & 0x001c) == 0x001c;
3823 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08003824 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003825 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08003826 msleep(300);
3827 val = alc_read_coef_idx(codec, 0x46);
3828 is_ctia = (val & 0x0070) == 0x0070;
3829 break;
David Henningsson73bdd592013-04-15 15:44:14 +02003830 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02003831 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02003832 msleep(300);
3833 val = alc_read_coef_idx(codec, 0xbe);
3834 is_ctia = (val & 0x1c02) == 0x1c02;
3835 break;
3836 }
3837
Takashi Iwai4e76a882014-02-25 12:21:03 +01003838 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02003839 is_ctia ? "yes" : "no");
3840 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
3841}
3842
3843static void alc_update_headset_mode(struct hda_codec *codec)
3844{
3845 struct alc_spec *spec = codec->spec;
3846
3847 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
3848 hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0];
3849
3850 int new_headset_mode;
3851
3852 if (!snd_hda_jack_detect(codec, hp_pin))
3853 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
3854 else if (mux_pin == spec->headset_mic_pin)
3855 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
3856 else if (mux_pin == spec->headphone_mic_pin)
3857 new_headset_mode = ALC_HEADSET_MODE_MIC;
3858 else
3859 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
3860
David Henningsson5959a6b2013-11-12 11:10:57 +01003861 if (new_headset_mode == spec->current_headset_mode) {
3862 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02003863 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01003864 }
David Henningsson73bdd592013-04-15 15:44:14 +02003865
3866 switch (new_headset_mode) {
3867 case ALC_HEADSET_MODE_UNPLUGGED:
3868 alc_headset_mode_unplugged(codec);
3869 spec->gen.hp_jack_present = false;
3870 break;
3871 case ALC_HEADSET_MODE_HEADSET:
3872 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
3873 alc_determine_headset_type(codec);
3874 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
3875 alc_headset_mode_ctia(codec);
3876 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
3877 alc_headset_mode_omtp(codec);
3878 spec->gen.hp_jack_present = true;
3879 break;
3880 case ALC_HEADSET_MODE_MIC:
3881 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
3882 spec->gen.hp_jack_present = false;
3883 break;
3884 case ALC_HEADSET_MODE_HEADPHONE:
3885 alc_headset_mode_default(codec);
3886 spec->gen.hp_jack_present = true;
3887 break;
3888 }
3889 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
3890 snd_hda_set_pin_ctl_cache(codec, hp_pin,
3891 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
3892 if (spec->headphone_mic_pin)
3893 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
3894 PIN_VREFHIZ);
3895 }
3896 spec->current_headset_mode = new_headset_mode;
3897
3898 snd_hda_gen_update_outputs(codec);
3899}
3900
3901static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01003902 struct snd_kcontrol *kcontrol,
3903 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02003904{
3905 alc_update_headset_mode(codec);
3906}
3907
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02003908static void alc_update_headset_jack_cb(struct hda_codec *codec,
3909 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02003910{
3911 struct alc_spec *spec = codec->spec;
David Henningsson5db4d342013-11-22 12:17:06 +01003912 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02003913 snd_hda_gen_hp_automute(codec, jack);
3914}
3915
3916static void alc_probe_headset_mode(struct hda_codec *codec)
3917{
3918 int i;
3919 struct alc_spec *spec = codec->spec;
3920 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
3921
3922 /* Find mic pins */
3923 for (i = 0; i < cfg->num_inputs; i++) {
3924 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
3925 spec->headset_mic_pin = cfg->inputs[i].pin;
3926 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
3927 spec->headphone_mic_pin = cfg->inputs[i].pin;
3928 }
3929
3930 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
3931 spec->gen.automute_hook = alc_update_headset_mode;
3932 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
3933}
3934
3935static void alc_fixup_headset_mode(struct hda_codec *codec,
3936 const struct hda_fixup *fix, int action)
3937{
3938 struct alc_spec *spec = codec->spec;
3939
3940 switch (action) {
3941 case HDA_FIXUP_ACT_PRE_PROBE:
3942 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
3943 break;
3944 case HDA_FIXUP_ACT_PROBE:
3945 alc_probe_headset_mode(codec);
3946 break;
3947 case HDA_FIXUP_ACT_INIT:
3948 spec->current_headset_mode = 0;
3949 alc_update_headset_mode(codec);
3950 break;
3951 }
3952}
3953
3954static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
3955 const struct hda_fixup *fix, int action)
3956{
3957 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3958 struct alc_spec *spec = codec->spec;
3959 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3960 }
3961 else
3962 alc_fixup_headset_mode(codec, fix, action);
3963}
3964
Kailang Yang31278992014-03-03 15:27:22 +08003965static void alc255_set_default_jack_type(struct hda_codec *codec)
3966{
3967 /* Set to iphone type */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003968 static struct coef_fw fw[] = {
3969 WRITE_COEF(0x1b, 0x880b),
3970 WRITE_COEF(0x45, 0xd089),
3971 WRITE_COEF(0x1b, 0x080b),
3972 WRITE_COEF(0x46, 0x0004),
3973 WRITE_COEF(0x1b, 0x0c0b),
3974 {}
3975 };
3976 alc_process_coef_fw(codec, fw);
Kailang Yang31278992014-03-03 15:27:22 +08003977 msleep(30);
3978}
3979
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003980static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
3981 const struct hda_fixup *fix, int action)
3982{
3983 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08003984 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08003985 }
3986 alc_fixup_headset_mode(codec, fix, action);
3987}
3988
Kailang Yang31278992014-03-03 15:27:22 +08003989static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
3990 const struct hda_fixup *fix, int action)
3991{
3992 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
3993 struct alc_spec *spec = codec->spec;
3994 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
3995 alc255_set_default_jack_type(codec);
3996 }
3997 else
3998 alc_fixup_headset_mode(codec, fix, action);
3999}
4000
Hui Wang493a52a2014-01-14 14:07:36 +08004001static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
4002 const struct hda_fixup *fix, int action)
4003{
4004 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4005 struct alc_spec *spec = codec->spec;
4006 spec->gen.auto_mute_via_amp = 1;
4007 }
4008}
4009
Takashi Iwai9b745ab2014-03-07 08:37:19 +01004010static void alc_no_shutup(struct hda_codec *codec)
4011{
4012}
4013
4014static void alc_fixup_no_shutup(struct hda_codec *codec,
4015 const struct hda_fixup *fix, int action)
4016{
4017 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4018 struct alc_spec *spec = codec->spec;
4019 spec->shutup = alc_no_shutup;
4020 }
4021}
4022
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02004023static void alc_fixup_disable_aamix(struct hda_codec *codec,
4024 const struct hda_fixup *fix, int action)
4025{
4026 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4027 struct alc_spec *spec = codec->spec;
4028 /* Disable AA-loopback as it causes white noise */
4029 spec->gen.mixer_nid = 0;
4030 }
4031}
4032
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02004033static unsigned int alc_power_filter_xps13(struct hda_codec *codec,
4034 hda_nid_t nid,
4035 unsigned int power_state)
4036{
4037 struct alc_spec *spec = codec->spec;
4038
4039 /* Avoid pop noises when headphones are plugged in */
4040 if (spec->gen.hp_jack_present)
Gabriele Mazzottade3da4f2014-08-08 19:34:41 +02004041 if (nid == codec->afg || nid == 0x02 || nid == 0x15)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02004042 return AC_PWRST_D0;
4043 return power_state;
4044}
4045
4046static void alc_fixup_dell_xps13(struct hda_codec *codec,
4047 const struct hda_fixup *fix, int action)
4048{
4049 if (action == HDA_FIXUP_ACT_PROBE) {
4050 struct alc_spec *spec = codec->spec;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02004051 struct hda_input_mux *imux = &spec->gen.input_mux;
4052 int i;
4053
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02004054 spec->shutup = alc_no_shutup;
4055 codec->power_filter = alc_power_filter_xps13;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02004056
4057 /* Make the internal mic the default input source. */
4058 for (i = 0; i < imux->num_items; i++) {
4059 if (spec->gen.imux_pins[i] == 0x12) {
4060 spec->gen.cur_mux[0] = i;
4061 break;
4062 }
4063 }
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02004064 }
4065}
4066
David Henningsson73bdd592013-04-15 15:44:14 +02004067static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
4068 const struct hda_fixup *fix, int action)
4069{
4070 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02004071 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02004072 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02004073 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
4074 }
4075 alc_fixup_headset_mode(codec, fix, action);
4076}
4077
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08004078/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
4079static int find_ext_mic_pin(struct hda_codec *codec)
4080{
4081 struct alc_spec *spec = codec->spec;
4082 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4083 hda_nid_t nid;
4084 unsigned int defcfg;
4085 int i;
4086
4087 for (i = 0; i < cfg->num_inputs; i++) {
4088 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4089 continue;
4090 nid = cfg->inputs[i].pin;
4091 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4092 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
4093 continue;
4094 return nid;
4095 }
4096
4097 return 0;
4098}
4099
Dylan Reid08a978d2012-11-18 22:56:40 -08004100static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004101 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08004102 int action)
4103{
4104 struct alc_spec *spec = codec->spec;
4105
Takashi Iwai0db75792013-01-23 13:57:20 +01004106 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08004107 int mic_pin = find_ext_mic_pin(codec);
4108 int hp_pin = spec->gen.autocfg.hp_pins[0];
4109
4110 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01004111 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08004112 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01004113 }
Dylan Reid08a978d2012-11-18 22:56:40 -08004114}
David Henningsson693b6132012-06-22 19:12:10 +02004115
David Henningsson3e0d6112013-04-22 14:30:14 +02004116static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
4117 const struct hda_fixup *fix,
4118 int action)
4119{
4120 struct alc_spec *spec = codec->spec;
4121 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
4122 int i;
4123
4124 /* The mic boosts on level 2 and 3 are too noisy
4125 on the internal mic input.
4126 Therefore limit the boost to 0 or 1. */
4127
4128 if (action != HDA_FIXUP_ACT_PROBE)
4129 return;
4130
4131 for (i = 0; i < cfg->num_inputs; i++) {
4132 hda_nid_t nid = cfg->inputs[i].pin;
4133 unsigned int defcfg;
4134 if (cfg->inputs[i].type != AUTO_PIN_MIC)
4135 continue;
4136 defcfg = snd_hda_codec_get_pincfg(codec, nid);
4137 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
4138 continue;
4139
4140 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
4141 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
4142 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4143 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
4144 (0 << AC_AMPCAP_MUTE_SHIFT));
4145 }
4146}
4147
Kailang Yangcd217a62013-08-22 10:15:24 +02004148static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02004149 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02004150{
4151 struct alc_spec *spec = codec->spec;
4152 int vref;
4153
4154 msleep(200);
4155 snd_hda_gen_hp_automute(codec, jack);
4156
4157 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4158
4159 msleep(600);
4160 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4161 vref);
4162}
4163
Kailang Yangcd217a62013-08-22 10:15:24 +02004164static void alc283_fixup_chromebook(struct hda_codec *codec,
4165 const struct hda_fixup *fix, int action)
4166{
4167 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02004168
4169 switch (action) {
4170 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08004171 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01004172 /* Disable AA-loopback as it causes white noise */
4173 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08004174 break;
4175 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08004176 /* MIC2-VREF control */
4177 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02004178 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08004179 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02004180 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08004181 break;
4182 }
4183}
4184
4185static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
4186 const struct hda_fixup *fix, int action)
4187{
4188 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08004189
4190 switch (action) {
4191 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02004192 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
4193 break;
4194 case HDA_FIXUP_ACT_INIT:
4195 /* MIC2-VREF control */
4196 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02004197 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02004198 break;
4199 }
4200}
4201
Takashi Iwai7bba2152013-09-06 15:45:38 +02004202/* mute tablet speaker pin (0x14) via dock plugging in addition */
4203static void asus_tx300_automute(struct hda_codec *codec)
4204{
4205 struct alc_spec *spec = codec->spec;
4206 snd_hda_gen_update_outputs(codec);
4207 if (snd_hda_jack_detect(codec, 0x1b))
4208 spec->gen.mute_bits |= (1ULL << 0x14);
4209}
4210
4211static void alc282_fixup_asus_tx300(struct hda_codec *codec,
4212 const struct hda_fixup *fix, int action)
4213{
4214 struct alc_spec *spec = codec->spec;
4215 /* TX300 needs to set up GPIO2 for the speaker amp */
4216 static const struct hda_verb gpio2_verbs[] = {
4217 { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 },
4218 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 },
4219 { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 },
4220 {}
4221 };
4222 static const struct hda_pintbl dock_pins[] = {
4223 { 0x1b, 0x21114000 }, /* dock speaker pin */
4224 {}
4225 };
4226 struct snd_kcontrol *kctl;
4227
4228 switch (action) {
4229 case HDA_FIXUP_ACT_PRE_PROBE:
4230 snd_hda_add_verbs(codec, gpio2_verbs);
4231 snd_hda_apply_pincfgs(codec, dock_pins);
4232 spec->gen.auto_mute_via_amp = 1;
4233 spec->gen.automute_hook = asus_tx300_automute;
4234 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02004235 snd_hda_gen_hp_automute);
4236 break;
4237 case HDA_FIXUP_ACT_BUILD:
4238 /* this is a bit tricky; give more sane names for the main
4239 * (tablet) speaker and the dock speaker, respectively
4240 */
4241 kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch");
4242 if (kctl)
4243 strcpy(kctl->id.name, "Dock Speaker Playback Switch");
4244 kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch");
4245 if (kctl)
4246 strcpy(kctl->id.name, "Speaker Playback Switch");
4247 break;
4248 }
4249}
4250
David Henningsson338cae52013-10-07 10:39:59 +02004251static void alc290_fixup_mono_speakers(struct hda_codec *codec,
4252 const struct hda_fixup *fix, int action)
4253{
David Henningsson0f4881d2013-12-20 16:08:13 +01004254 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4255 /* DAC node 0x03 is giving mono output. We therefore want to
4256 make sure 0x14 (front speaker) and 0x15 (headphones) use the
4257 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
4258 hda_nid_t conn1[2] = { 0x0c };
4259 snd_hda_override_conn_list(codec, 0x14, 1, conn1);
4260 snd_hda_override_conn_list(codec, 0x15, 1, conn1);
4261 }
David Henningsson338cae52013-10-07 10:39:59 +02004262}
4263
Takashi Iwaib317b032014-01-08 11:44:21 +01004264/* for hda_fixup_thinkpad_acpi() */
4265#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01004266
Hui Wang00ef9942014-07-31 11:52:38 +08004267/* for dell wmi mic mute led */
4268#include "dell_wmi_helper.c"
4269
Takashi Iwai1d045db2011-07-07 18:23:21 +02004270enum {
4271 ALC269_FIXUP_SONY_VAIO,
4272 ALC275_FIXUP_SONY_VAIO_GPIO2,
4273 ALC269_FIXUP_DELL_M101Z,
4274 ALC269_FIXUP_SKU_IGNORE,
4275 ALC269_FIXUP_ASUS_G73JW,
4276 ALC269_FIXUP_LENOVO_EAPD,
4277 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02004278 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02004279 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02004280 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004281 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02004282 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02004283 ALC269_FIXUP_QUANTA_MUTE,
4284 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02004285 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02004286 ALC269_FIXUP_AMIC,
4287 ALC269_FIXUP_DMIC,
4288 ALC269VB_FIXUP_AMIC,
4289 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004290 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01004291 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004292 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004293 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004294 ALC269_FIXUP_HP_GPIO_MIC1_LED,
4295 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02004296 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02004297 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01004298 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02004299 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02004300 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02004301 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
4302 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02004303 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02004304 ALC269_FIXUP_HEADSET_MODE,
4305 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02004306 ALC269_FIXUP_ASUS_X101_FUNC,
4307 ALC269_FIXUP_ASUS_X101_VERB,
4308 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08004309 ALC271_FIXUP_AMIC_MIC2,
4310 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01004311 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07004312 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02004313 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01004314 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01004315 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01004316 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02004317 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02004318 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08004319 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02004320 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02004321 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02004322 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01004323 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4324 ALC290_FIXUP_SUBWOOFER,
4325 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01004326 ALC269_FIXUP_THINKPAD_ACPI,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004327 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08004328 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004329 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08004330 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08004331 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02004332 ALC292_FIXUP_TPT440_DOCK,
Daniel Drake9dc12862014-07-22 10:58:29 +01004333 ALC283_FIXUP_BXBT2807_MIC,
Hui Wang00ef9942014-07-31 11:52:38 +08004334 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02004335 ALC282_FIXUP_ASPIRE_V5_PINS,
David Henningsson7a5255f2014-10-30 08:26:01 +01004336 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004337 ALC286_FIXUP_HP_GPIO_LED,
Takashi Iwai1d045db2011-07-07 18:23:21 +02004338};
4339
Takashi Iwai1727a772013-01-10 09:52:52 +01004340static const struct hda_fixup alc269_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02004341 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01004342 .type = HDA_FIXUP_PINCTLS,
4343 .v.pins = (const struct hda_pintbl[]) {
4344 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02004345 {}
4346 }
4347 },
4348 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004349 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02004350 .v.verbs = (const struct hda_verb[]) {
4351 {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
4352 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
4353 {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
4354 { }
4355 },
4356 .chained = true,
4357 .chain_id = ALC269_FIXUP_SONY_VAIO
4358 },
4359 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004360 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02004361 .v.verbs = (const struct hda_verb[]) {
4362 /* Enables internal speaker */
4363 {0x20, AC_VERB_SET_COEF_INDEX, 13},
4364 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
4365 {}
4366 }
4367 },
4368 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004369 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02004370 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02004371 },
4372 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004373 .type = HDA_FIXUP_PINS,
4374 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02004375 { 0x17, 0x99130111 }, /* subwoofer */
4376 { }
4377 }
4378 },
4379 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004380 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02004381 .v.verbs = (const struct hda_verb[]) {
4382 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
4383 {}
4384 }
4385 },
4386 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004387 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02004388 .v.func = alc269_fixup_hweq,
4389 .chained = true,
4390 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
4391 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02004392 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
4393 .type = HDA_FIXUP_FUNC,
4394 .v.func = alc_fixup_disable_aamix,
4395 .chained = true,
4396 .chain_id = ALC269_FIXUP_SONY_VAIO
4397 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02004398 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004399 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02004400 .v.func = alc271_fixup_dmic,
4401 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02004402 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004403 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02004404 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02004405 .chained = true,
4406 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02004407 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004408 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004409 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004410 .v.func = alc269_fixup_stereo_dmic,
4411 },
David Henningsson7c478f02013-10-11 10:18:46 +02004412 [ALC269_FIXUP_HEADSET_MIC] = {
4413 .type = HDA_FIXUP_FUNC,
4414 .v.func = alc269_fixup_headset_mic,
4415 },
Takashi Iwai24519912011-08-16 15:08:49 +02004416 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004417 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02004418 .v.func = alc269_fixup_quanta_mute,
4419 },
4420 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004421 .type = HDA_FIXUP_PINS,
4422 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02004423 { 0x1a, 0x2101103f }, /* dock line-out */
4424 { 0x1b, 0x23a11040 }, /* dock mic-in */
4425 { }
4426 },
4427 .chained = true,
4428 .chain_id = ALC269_FIXUP_QUANTA_MUTE
4429 },
David Henningsson2041d562014-06-13 11:15:44 +02004430 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
4431 .type = HDA_FIXUP_PINS,
4432 .v.pins = (const struct hda_pintbl[]) {
4433 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
4434 { }
4435 },
4436 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02004437 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004438 .type = HDA_FIXUP_PINS,
4439 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02004440 { 0x14, 0x99130110 }, /* speaker */
4441 { 0x15, 0x0121401f }, /* HP out */
4442 { 0x18, 0x01a19c20 }, /* mic */
4443 { 0x19, 0x99a3092f }, /* int-mic */
4444 { }
4445 },
4446 },
4447 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004448 .type = HDA_FIXUP_PINS,
4449 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02004450 { 0x12, 0x99a3092f }, /* int-mic */
4451 { 0x14, 0x99130110 }, /* speaker */
4452 { 0x15, 0x0121401f }, /* HP out */
4453 { 0x18, 0x01a19c20 }, /* mic */
4454 { }
4455 },
4456 },
4457 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004458 .type = HDA_FIXUP_PINS,
4459 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02004460 { 0x14, 0x99130110 }, /* speaker */
4461 { 0x18, 0x01a19c20 }, /* mic */
4462 { 0x19, 0x99a3092f }, /* int-mic */
4463 { 0x21, 0x0121401f }, /* HP out */
4464 { }
4465 },
4466 },
David Henningsson2267ea92012-01-03 08:45:56 +01004467 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004468 .type = HDA_FIXUP_PINS,
4469 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02004470 { 0x12, 0x99a3092f }, /* int-mic */
4471 { 0x14, 0x99130110 }, /* speaker */
4472 { 0x18, 0x01a19c20 }, /* mic */
4473 { 0x21, 0x0121401f }, /* HP out */
4474 { }
4475 },
4476 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004477 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004478 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004479 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004480 },
David Henningssond06ac142013-02-18 11:41:55 +01004481 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
4482 .type = HDA_FIXUP_FUNC,
4483 .v.func = alc269_fixup_hp_mute_led_mic1,
4484 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004485 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004486 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004487 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004488 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004489 [ALC269_FIXUP_HP_GPIO_LED] = {
4490 .type = HDA_FIXUP_FUNC,
4491 .v.func = alc269_fixup_hp_gpio_led,
4492 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004493 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
4494 .type = HDA_FIXUP_FUNC,
4495 .v.func = alc269_fixup_hp_gpio_mic1_led,
4496 },
4497 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
4498 .type = HDA_FIXUP_FUNC,
4499 .v.func = alc269_fixup_hp_line1_mic1_led,
4500 },
David Henningsson693b6132012-06-22 19:12:10 +02004501 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004502 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02004503 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02004504 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01004505 [ALC269_FIXUP_NO_SHUTUP] = {
4506 .type = HDA_FIXUP_FUNC,
4507 .v.func = alc_fixup_no_shutup,
4508 },
David Henningsson108cc102012-07-20 10:37:25 +02004509 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004510 .type = HDA_FIXUP_PINS,
4511 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02004512 { 0x19, 0x23a11040 }, /* dock mic */
4513 { 0x1b, 0x2121103f }, /* dock headphone */
4514 { }
4515 },
4516 .chained = true,
4517 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
4518 },
4519 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004520 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02004521 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01004522 .chained = true,
4523 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02004524 },
David Henningsson73bdd592013-04-15 15:44:14 +02004525 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4526 .type = HDA_FIXUP_PINS,
4527 .v.pins = (const struct hda_pintbl[]) {
4528 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4529 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4530 { }
4531 },
4532 .chained = true,
4533 .chain_id = ALC269_FIXUP_HEADSET_MODE
4534 },
4535 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
4536 .type = HDA_FIXUP_PINS,
4537 .v.pins = (const struct hda_pintbl[]) {
4538 { 0x16, 0x21014020 }, /* dock line out */
4539 { 0x19, 0x21a19030 }, /* dock mic */
4540 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4541 { }
4542 },
4543 .chained = true,
4544 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
4545 },
David Henningsson338cae52013-10-07 10:39:59 +02004546 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
4547 .type = HDA_FIXUP_PINS,
4548 .v.pins = (const struct hda_pintbl[]) {
4549 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4550 { }
4551 },
4552 .chained = true,
4553 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
4554 },
David Henningsson73bdd592013-04-15 15:44:14 +02004555 [ALC269_FIXUP_HEADSET_MODE] = {
4556 .type = HDA_FIXUP_FUNC,
4557 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08004558 .chained = true,
4559 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02004560 },
4561 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4562 .type = HDA_FIXUP_FUNC,
4563 .v.func = alc_fixup_headset_mode_no_hp_mic,
4564 },
David Henningsson88cfcf82013-10-11 10:18:45 +02004565 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
4566 .type = HDA_FIXUP_PINS,
4567 .v.pins = (const struct hda_pintbl[]) {
4568 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4569 { }
4570 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02004571 .chained = true,
4572 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02004573 },
David Henningssond240d1d2013-04-15 12:50:02 +02004574 [ALC269_FIXUP_ASUS_X101_FUNC] = {
4575 .type = HDA_FIXUP_FUNC,
4576 .v.func = alc269_fixup_x101_headset_mic,
4577 },
4578 [ALC269_FIXUP_ASUS_X101_VERB] = {
4579 .type = HDA_FIXUP_VERBS,
4580 .v.verbs = (const struct hda_verb[]) {
4581 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
4582 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
4583 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
4584 { }
4585 },
4586 .chained = true,
4587 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
4588 },
4589 [ALC269_FIXUP_ASUS_X101] = {
4590 .type = HDA_FIXUP_PINS,
4591 .v.pins = (const struct hda_pintbl[]) {
4592 { 0x18, 0x04a1182c }, /* Headset mic */
4593 { }
4594 },
4595 .chained = true,
4596 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
4597 },
Dylan Reid08a978d2012-11-18 22:56:40 -08004598 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004599 .type = HDA_FIXUP_PINS,
4600 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08004601 { 0x14, 0x99130110 }, /* speaker */
4602 { 0x19, 0x01a19c20 }, /* mic */
4603 { 0x1b, 0x99a7012f }, /* int-mic */
4604 { 0x21, 0x0121401f }, /* HP out */
4605 { }
4606 },
4607 },
4608 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01004609 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08004610 .v.func = alc271_hp_gate_mic_jack,
4611 .chained = true,
4612 .chain_id = ALC271_FIXUP_AMIC_MIC2,
4613 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01004614 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
4615 .type = HDA_FIXUP_FUNC,
4616 .v.func = alc269_fixup_limit_int_mic_boost,
4617 .chained = true,
4618 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
4619 },
Dylan Reid42397002013-04-05 14:58:22 -07004620 [ALC269_FIXUP_ACER_AC700] = {
4621 .type = HDA_FIXUP_PINS,
4622 .v.pins = (const struct hda_pintbl[]) {
4623 { 0x12, 0x99a3092f }, /* int-mic */
4624 { 0x14, 0x99130110 }, /* speaker */
4625 { 0x18, 0x03a11c20 }, /* mic */
4626 { 0x1e, 0x0346101e }, /* SPDIF1 */
4627 { 0x21, 0x0321101f }, /* HP out */
4628 { }
4629 },
4630 .chained = true,
4631 .chain_id = ALC271_FIXUP_DMIC,
4632 },
David Henningsson3e0d6112013-04-22 14:30:14 +02004633 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
4634 .type = HDA_FIXUP_FUNC,
4635 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01004636 .chained = true,
4637 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02004638 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01004639 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
4640 .type = HDA_FIXUP_FUNC,
4641 .v.func = alc269_fixup_limit_int_mic_boost,
4642 .chained = true,
4643 .chain_id = ALC269VB_FIXUP_DMIC,
4644 },
Takashi Iwai23870832013-11-29 14:13:12 +01004645 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
4646 .type = HDA_FIXUP_VERBS,
4647 .v.verbs = (const struct hda_verb[]) {
4648 /* class-D output amp +5dB */
4649 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
4650 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
4651 {}
4652 },
4653 .chained = true,
4654 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
4655 },
David Henningsson8e35cd42013-11-06 11:20:01 +01004656 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
4657 .type = HDA_FIXUP_FUNC,
4658 .v.func = alc269_fixup_limit_int_mic_boost,
4659 .chained = true,
4660 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
4661 },
Anisse Astier02b504d2013-06-03 11:53:10 +02004662 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
4663 .type = HDA_FIXUP_PINS,
4664 .v.pins = (const struct hda_pintbl[]) {
4665 { 0x12, 0x99a3092f }, /* int-mic */
4666 { 0x18, 0x03a11d20 }, /* mic */
4667 { 0x19, 0x411111f0 }, /* Unused bogus pin */
4668 { }
4669 },
4670 },
Kailang Yangcd217a62013-08-22 10:15:24 +02004671 [ALC283_FIXUP_CHROME_BOOK] = {
4672 .type = HDA_FIXUP_FUNC,
4673 .v.func = alc283_fixup_chromebook,
4674 },
Kailang Yang0202e992013-12-02 15:20:15 +08004675 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
4676 .type = HDA_FIXUP_FUNC,
4677 .v.func = alc283_fixup_sense_combo_jack,
4678 .chained = true,
4679 .chain_id = ALC283_FIXUP_CHROME_BOOK,
4680 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02004681 [ALC282_FIXUP_ASUS_TX300] = {
4682 .type = HDA_FIXUP_FUNC,
4683 .v.func = alc282_fixup_asus_tx300,
4684 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02004685 [ALC283_FIXUP_INT_MIC] = {
4686 .type = HDA_FIXUP_VERBS,
4687 .v.verbs = (const struct hda_verb[]) {
4688 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
4689 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
4690 { }
4691 },
4692 .chained = true,
4693 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4694 },
David Henningsson0f4881d2013-12-20 16:08:13 +01004695 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
4696 .type = HDA_FIXUP_PINS,
4697 .v.pins = (const struct hda_pintbl[]) {
4698 { 0x17, 0x90170112 }, /* subwoofer */
4699 { }
4700 },
4701 .chained = true,
4702 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
4703 },
4704 [ALC290_FIXUP_SUBWOOFER] = {
4705 .type = HDA_FIXUP_PINS,
4706 .v.pins = (const struct hda_pintbl[]) {
4707 { 0x17, 0x90170112 }, /* subwoofer */
4708 { }
4709 },
4710 .chained = true,
4711 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
4712 },
David Henningsson338cae52013-10-07 10:39:59 +02004713 [ALC290_FIXUP_MONO_SPEAKERS] = {
4714 .type = HDA_FIXUP_FUNC,
4715 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01004716 },
4717 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
4718 .type = HDA_FIXUP_FUNC,
4719 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02004720 .chained = true,
4721 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
4722 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01004723 [ALC269_FIXUP_THINKPAD_ACPI] = {
4724 .type = HDA_FIXUP_FUNC,
Takashi Iwaib317b032014-01-08 11:44:21 +01004725 .v.func = hda_fixup_thinkpad_acpi,
David Henningssonb67ae3f2013-11-05 13:11:37 +01004726 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004727 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4728 .type = HDA_FIXUP_PINS,
4729 .v.pins = (const struct hda_pintbl[]) {
4730 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4731 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4732 { }
4733 },
4734 .chained = true,
4735 .chain_id = ALC255_FIXUP_HEADSET_MODE
4736 },
Kailang Yang31278992014-03-03 15:27:22 +08004737 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
4738 .type = HDA_FIXUP_PINS,
4739 .v.pins = (const struct hda_pintbl[]) {
4740 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4741 { }
4742 },
4743 .chained = true,
4744 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
4745 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004746 [ALC255_FIXUP_HEADSET_MODE] = {
4747 .type = HDA_FIXUP_FUNC,
4748 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08004749 .chained = true,
4750 .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004751 },
Kailang Yang31278992014-03-03 15:27:22 +08004752 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
4753 .type = HDA_FIXUP_FUNC,
4754 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
4755 },
Kailang Yanga22aa262014-04-23 17:34:28 +08004756 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4757 .type = HDA_FIXUP_PINS,
4758 .v.pins = (const struct hda_pintbl[]) {
4759 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
4760 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
4761 { }
4762 },
4763 .chained = true,
4764 .chain_id = ALC269_FIXUP_HEADSET_MODE
4765 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02004766 [ALC292_FIXUP_TPT440_DOCK] = {
4767 .type = HDA_FIXUP_PINS,
4768 .v.pins = (const struct hda_pintbl[]) {
4769 { 0x16, 0x21211010 }, /* dock headphone */
4770 { 0x19, 0x21a11010 }, /* dock mic */
4771 { }
4772 },
4773 .chained = true,
4774 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4775 },
Daniel Drake9dc12862014-07-22 10:58:29 +01004776 [ALC283_FIXUP_BXBT2807_MIC] = {
4777 .type = HDA_FIXUP_PINS,
4778 .v.pins = (const struct hda_pintbl[]) {
4779 { 0x19, 0x04a110f0 },
4780 { },
4781 },
4782 },
Hui Wang00ef9942014-07-31 11:52:38 +08004783 [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = {
4784 .type = HDA_FIXUP_FUNC,
4785 .v.func = alc_fixup_dell_wmi,
Hui Wang00ef9942014-07-31 11:52:38 +08004786 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02004787 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
4788 .type = HDA_FIXUP_PINS,
4789 .v.pins = (const struct hda_pintbl[]) {
4790 { 0x12, 0x90a60130 },
4791 { 0x14, 0x90170110 },
4792 { 0x17, 0x40000008 },
4793 { 0x18, 0x411111f0 },
4794 { 0x19, 0x411111f0 },
4795 { 0x1a, 0x411111f0 },
4796 { 0x1b, 0x411111f0 },
4797 { 0x1d, 0x40f89b2d },
4798 { 0x1e, 0x411111f0 },
4799 { 0x21, 0x0321101f },
4800 { },
4801 },
4802 },
David Henningsson7a5255f2014-10-30 08:26:01 +01004803 [ALC280_FIXUP_HP_GPIO4] = {
4804 .type = HDA_FIXUP_FUNC,
4805 .v.func = alc280_fixup_hp_gpio4,
4806 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004807 [ALC286_FIXUP_HP_GPIO_LED] = {
4808 .type = HDA_FIXUP_FUNC,
4809 .v.func = alc286_fixup_hp_gpio_led,
4810 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02004811};
4812
4813static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01004814 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02004815 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
4816 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02004817 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
4818 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
4819 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01004820 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02004821 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
David Henningssonaaedfb42013-08-16 14:09:02 +02004822 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
David Henningsson0f4881d2013-12-20 16:08:13 +01004823 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02004824 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4825 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4826 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01004827 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
4828 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
David Henningsson0f4881d2013-12-20 16:08:13 +01004829 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08004830 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4831 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08004832 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4833 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yanga22aa262014-04-23 17:34:28 +08004834 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
4835 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004836 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004837 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01004838 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08004839 /* ALC282 */
Kailang Yang8a02b162014-06-13 17:16:31 +08004840 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08004841 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004842 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4843 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4844 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
4845 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004846 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08004847 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08004848 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4849 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08004850 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004851 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08004852 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08004853 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4854 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4855 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08004856 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004857 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4858 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08004859 /* ALC290 */
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004860 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004861 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004862 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004863 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4864 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4865 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4866 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4867 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004868 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4869 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08004870 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08004871 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4872 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4873 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004874 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
4875 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004876 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08004877 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08004878 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08004879 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08004880 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4881 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08004882 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4883 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08004884 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08004885 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4886 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4887 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
4888 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai7bba2152013-09-06 15:45:38 +02004889 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02004890 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4891 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Oleksij Rempel2cede302013-11-27 17:12:03 +01004892 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01004893 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02004894 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai017f2a12011-07-09 14:42:25 +02004895 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
David Henningsson693b6132012-06-22 19:12:10 +02004896 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
David Henningsson3e0d6112013-04-22 14:30:14 +02004897 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004898 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
4899 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
4900 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
4901 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02004902 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwaif88abaa2014-02-07 12:07:59 +01004903 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
David Henningsson88cfcf82013-10-11 10:18:45 +02004904 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai1d045db2011-07-07 18:23:21 +02004905 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
4906 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
4907 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02004908 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwai24519912011-08-16 15:08:49 +02004909 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
David Henningsson2041d562014-06-13 11:15:44 +02004910 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
David Henningssona33cc482014-10-07 10:18:41 +02004911 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Daniel Drake9dc12862014-07-22 10:58:29 +01004912 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC),
Takashi Iwai1d045db2011-07-07 18:23:21 +02004913 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
4914 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
4915 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
4916 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
4917 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwai707fba32012-08-02 09:04:39 +02004918 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK),
Felix Kaechelec8415a42012-08-06 23:02:01 +02004919 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Stefán Freyr84f98fd2012-10-19 22:46:00 +02004920 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02004921 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02004922 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02004923 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai1c37c222014-05-06 17:34:42 +02004924 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK),
4925 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02004926 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02004927 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01004928 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02004929 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaifedb2242014-11-13 07:11:38 +01004930 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Takashi Iwai9b745ab2014-03-07 08:37:19 +01004931 SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP),
David Henningssona4a9e082013-08-16 14:09:01 +02004932 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02004933 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02004934 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02004935 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4936 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
David Henningsson012e7eb2012-08-08 08:43:37 +02004937 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
Takashi Iwai1d045db2011-07-07 18:23:21 +02004938 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Anisse Astier02b504d2013-06-03 11:53:10 +02004939 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02004940
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01004941#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02004942 /* Below is a quirk table taken from the old code.
4943 * Basically the device should work as is without the fixup table.
4944 * If BIOS doesn't give a proper info, enable the corresponding
4945 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02004946 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02004947 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
4948 ALC269_FIXUP_AMIC),
4949 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02004950 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
4951 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
4952 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
4953 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
4954 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
4955 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
4956 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
4957 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
4958 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
4959 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
4960 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
4961 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
4962 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
4963 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
4964 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
4965 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
4966 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
4967 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
4968 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
4969 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
4970 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
4971 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
4972 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
4973 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
4974 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
4975 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
4976 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
4977 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
4978 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
4979 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
4980 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
4981 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
4982 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
4983 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
4984 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
4985 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
4986 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
4987 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
4988#endif
4989 {}
4990};
4991
David Henningsson214eef72014-07-22 14:09:35 +02004992static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
4993 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
4994 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
4995 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
4996 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
4997 {}
4998};
4999
Takashi Iwai1727a772013-01-10 09:52:52 +01005000static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02005001 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
5002 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02005003 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
5004 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
5005 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02005006 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02005007 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01005008 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
David Henningssone32aa852013-06-17 11:04:02 +02005009 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
5010 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08005011 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08005012 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02005013 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02005014 {}
5015};
5016
David Henningssonfea185e2014-09-03 10:23:04 +02005017#define ALC255_STANDARD_PINS \
5018 {0x18, 0x411111f0}, \
5019 {0x19, 0x411111f0}, \
5020 {0x1a, 0x411111f0}, \
5021 {0x1b, 0x411111f0}, \
5022 {0x1e, 0x411111f0}
5023
5024#define ALC282_STANDARD_PINS \
5025 {0x14, 0x90170110}, \
5026 {0x18, 0x411111f0}, \
5027 {0x1a, 0x411111f0}, \
5028 {0x1b, 0x411111f0}, \
5029 {0x1e, 0x411111f0}
5030
5031#define ALC290_STANDARD_PINS \
5032 {0x12, 0x99a30130}, \
5033 {0x13, 0x40000000}, \
5034 {0x16, 0x411111f0}, \
5035 {0x17, 0x411111f0}, \
5036 {0x19, 0x411111f0}, \
5037 {0x1b, 0x411111f0}, \
5038 {0x1e, 0x411111f0}
5039
5040#define ALC292_STANDARD_PINS \
5041 {0x14, 0x90170110}, \
5042 {0x15, 0x0221401f}, \
5043 {0x1a, 0x411111f0}, \
5044 {0x1b, 0x411111f0}, \
5045 {0x1d, 0x40700001}, \
5046 {0x1e, 0x411111f0}
5047
Hui Wange1918932014-05-26 16:22:44 +08005048static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Hui Wangc77900e2014-09-03 11:31:07 +08005049 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005050 ALC255_STANDARD_PINS,
Hui Wangc77900e2014-09-03 11:31:07 +08005051 {0x12, 0x40300000},
5052 {0x14, 0x90170110},
5053 {0x17, 0x411111f0},
Hui Wangc77900e2014-09-03 11:31:07 +08005054 {0x1d, 0x40538029},
Hui Wangc77900e2014-09-03 11:31:07 +08005055 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02005056 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005057 ALC255_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02005058 {0x12, 0x90a60140},
5059 {0x14, 0x90170110},
5060 {0x17, 0x40000000},
David Henningsson76c21322014-06-24 14:46:54 +02005061 {0x1d, 0x40700001},
David Henningsson76c21322014-06-24 14:46:54 +02005062 {0x21, 0x02211020}),
5063 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005064 ALC255_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02005065 {0x12, 0x90a60160},
5066 {0x14, 0x90170120},
5067 {0x17, 0x40000000},
David Henningsson76c21322014-06-24 14:46:54 +02005068 {0x1d, 0x40700001},
David Henningsson76c21322014-06-24 14:46:54 +02005069 {0x21, 0x02211030}),
5070 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
5071 {0x12, 0x90a60160},
5072 {0x14, 0x90170120},
5073 {0x17, 0x90170140},
5074 {0x18, 0x40000000},
5075 {0x19, 0x411111f0},
5076 {0x1a, 0x411111f0},
5077 {0x1b, 0x411111f0},
5078 {0x1d, 0x41163b05},
5079 {0x1e, 0x411111f0},
5080 {0x21, 0x0321102f}),
5081 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005082 ALC255_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02005083 {0x12, 0x90a60160},
5084 {0x14, 0x90170130},
5085 {0x17, 0x40000000},
David Henningsson76c21322014-06-24 14:46:54 +02005086 {0x1d, 0x40700001},
David Henningsson76c21322014-06-24 14:46:54 +02005087 {0x21, 0x02211040}),
5088 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005089 ALC255_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02005090 {0x12, 0x90a60160},
5091 {0x14, 0x90170140},
5092 {0x17, 0x40000000},
David Henningsson76c21322014-06-24 14:46:54 +02005093 {0x1d, 0x40700001},
David Henningsson76c21322014-06-24 14:46:54 +02005094 {0x21, 0x02211050}),
5095 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005096 ALC255_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02005097 {0x12, 0x90a60170},
5098 {0x14, 0x90170120},
5099 {0x17, 0x40000000},
David Henningsson76c21322014-06-24 14:46:54 +02005100 {0x1d, 0x40700001},
David Henningsson76c21322014-06-24 14:46:54 +02005101 {0x21, 0x02211030}),
5102 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005103 ALC255_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02005104 {0x12, 0x90a60170},
5105 {0x14, 0x90170130},
5106 {0x17, 0x40000000},
David Henningsson76c21322014-06-24 14:46:54 +02005107 {0x1d, 0x40700001},
David Henningsson76c21322014-06-24 14:46:54 +02005108 {0x21, 0x02211040}),
David Henningssoncf51eb92014-10-30 08:26:02 +01005109 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
5110 {0x12, 0x90a60130},
5111 {0x13, 0x40000000},
5112 {0x14, 0x90170110},
5113 {0x15, 0x0421101f},
5114 {0x16, 0x411111f0},
5115 {0x17, 0x411111f0},
5116 {0x18, 0x411111f0},
5117 {0x19, 0x411111f0},
5118 {0x1a, 0x04a11020},
5119 {0x1b, 0x411111f0},
5120 {0x1d, 0x40748605},
5121 {0x1e, 0x411111f0}),
Hui Wang02796612014-09-03 11:31:11 +08005122 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
5123 {0x12, 0x90a60140},
5124 {0x13, 0x40000000},
5125 {0x14, 0x90170110},
5126 {0x15, 0x0421101f},
5127 {0x16, 0x411111f0},
5128 {0x17, 0x411111f0},
5129 {0x18, 0x02811030},
5130 {0x19, 0x411111f0},
5131 {0x1a, 0x04a1103f},
5132 {0x1b, 0x02011020},
5133 {0x1d, 0x40700001},
5134 {0x1e, 0x411111f0}),
David Henningsson42304472014-07-22 11:42:17 +02005135 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02005136 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02005137 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02005138 {0x17, 0x40000000},
David Henningsson42304472014-07-22 11:42:17 +02005139 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02005140 {0x1d, 0x40f41905},
David Henningsson42304472014-07-22 11:42:17 +02005141 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08005142 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02005143 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08005144 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08005145 {0x17, 0x40020008},
Hui Wang2c609992014-09-03 11:31:08 +08005146 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08005147 {0x1d, 0x40e00001},
Hui Wang2c609992014-09-03 11:31:08 +08005148 {0x21, 0x03211040}),
5149 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02005150 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08005151 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08005152 {0x17, 0x40000000},
Hui Wang2c609992014-09-03 11:31:08 +08005153 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08005154 {0x1d, 0x40e00001},
Hui Wang2c609992014-09-03 11:31:08 +08005155 {0x21, 0x03211020}),
5156 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02005157 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08005158 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08005159 {0x17, 0x40000000},
Hui Wang2c609992014-09-03 11:31:08 +08005160 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08005161 {0x1d, 0x40f00001},
Hui Wang2c609992014-09-03 11:31:08 +08005162 {0x21, 0x03211020}),
5163 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02005164 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08005165 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08005166 {0x17, 0x40000000},
Hui Wang2c609992014-09-03 11:31:08 +08005167 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08005168 {0x1d, 0x40f00001},
Hui Wang2c609992014-09-03 11:31:08 +08005169 {0x21, 0x0421101f}),
5170 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02005171 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08005172 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08005173 {0x17, 0x40000000},
Hui Wang2c609992014-09-03 11:31:08 +08005174 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08005175 {0x1d, 0x40f00001},
Hui Wang2c609992014-09-03 11:31:08 +08005176 {0x21, 0x04211020}),
Hui Wang200afc02014-09-03 11:31:10 +08005177 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02005178 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08005179 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08005180 {0x17, 0x40000000},
Hui Wang200afc02014-09-03 11:31:10 +08005181 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08005182 {0x1d, 0x40f00001},
Hui Wang200afc02014-09-03 11:31:10 +08005183 {0x21, 0x04211020}),
David Henningsson76c21322014-06-24 14:46:54 +02005184 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005185 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02005186 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02005187 {0x17, 0x40020008},
David Henningsson76c21322014-06-24 14:46:54 +02005188 {0x19, 0x411111f0},
David Henningsson76c21322014-06-24 14:46:54 +02005189 {0x1d, 0x40e00001},
David Henningsson76c21322014-06-24 14:46:54 +02005190 {0x21, 0x0321101f}),
5191 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
5192 {0x12, 0x90a60160},
5193 {0x14, 0x90170120},
5194 {0x17, 0x40000000},
5195 {0x18, 0x411111f0},
5196 {0x19, 0x411111f0},
5197 {0x1a, 0x411111f0},
5198 {0x1b, 0x411111f0},
5199 {0x1d, 0x40700001},
5200 {0x1e, 0x411111f0},
5201 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08005202 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005203 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08005204 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08005205 {0x17, 0x40020008},
Hui Wangbc262172014-09-03 11:31:05 +08005206 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08005207 {0x1d, 0x40e00001},
Hui Wangbc262172014-09-03 11:31:05 +08005208 {0x21, 0x0321101f}),
Hui Wange4442bc2014-09-03 11:31:09 +08005209 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02005210 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08005211 {0x14, 0x411111f0},
5212 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08005213 {0x18, 0x90170112},
Hui Wange4442bc2014-09-03 11:31:09 +08005214 {0x1a, 0x04a11020},
David Henningssonaec856d2014-09-03 10:23:05 +02005215 {0x1d, 0x4075812d}),
Hui Wange4442bc2014-09-03 11:31:09 +08005216 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02005217 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08005218 {0x14, 0x411111f0},
5219 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08005220 {0x18, 0x90170110},
Hui Wange4442bc2014-09-03 11:31:09 +08005221 {0x1a, 0x04a11020},
David Henningssonaec856d2014-09-03 10:23:05 +02005222 {0x1d, 0x4075812d}),
Hui Wange4442bc2014-09-03 11:31:09 +08005223 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02005224 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08005225 {0x14, 0x411111f0},
5226 {0x15, 0x0421101f},
Hui Wange4442bc2014-09-03 11:31:09 +08005227 {0x18, 0x411111f0},
Hui Wange4442bc2014-09-03 11:31:09 +08005228 {0x1a, 0x04a11020},
David Henningssonaec856d2014-09-03 10:23:05 +02005229 {0x1d, 0x4075812d}),
Hui Wange4442bc2014-09-03 11:31:09 +08005230 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02005231 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08005232 {0x14, 0x411111f0},
5233 {0x15, 0x04211020},
Hui Wange4442bc2014-09-03 11:31:09 +08005234 {0x18, 0x411111f0},
Hui Wange4442bc2014-09-03 11:31:09 +08005235 {0x1a, 0x04a11040},
David Henningssonaec856d2014-09-03 10:23:05 +02005236 {0x1d, 0x4076a12d}),
Hui Wange4442bc2014-09-03 11:31:09 +08005237 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02005238 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08005239 {0x14, 0x90170110},
5240 {0x15, 0x04211020},
Hui Wange4442bc2014-09-03 11:31:09 +08005241 {0x18, 0x411111f0},
Hui Wange4442bc2014-09-03 11:31:09 +08005242 {0x1a, 0x04a11040},
David Henningssonaec856d2014-09-03 10:23:05 +02005243 {0x1d, 0x4076a12d}),
Hui Wange4442bc2014-09-03 11:31:09 +08005244 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02005245 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08005246 {0x14, 0x90170110},
5247 {0x15, 0x04211020},
Hui Wange4442bc2014-09-03 11:31:09 +08005248 {0x18, 0x411111f0},
Hui Wange4442bc2014-09-03 11:31:09 +08005249 {0x1a, 0x04a11020},
David Henningssonaec856d2014-09-03 10:23:05 +02005250 {0x1d, 0x4076a12d}),
Hui Wange4442bc2014-09-03 11:31:09 +08005251 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02005252 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08005253 {0x14, 0x90170110},
5254 {0x15, 0x0421101f},
Hui Wange4442bc2014-09-03 11:31:09 +08005255 {0x18, 0x411111f0},
Hui Wange4442bc2014-09-03 11:31:09 +08005256 {0x1a, 0x04a11020},
David Henningssonaec856d2014-09-03 10:23:05 +02005257 {0x1d, 0x4075812d}),
Hui Wange8818fa2014-09-03 11:31:04 +08005258 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005259 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08005260 {0x12, 0x90a60140},
5261 {0x13, 0x411111f0},
Hui Wange8818fa2014-09-03 11:31:04 +08005262 {0x16, 0x01014020},
5263 {0x18, 0x411111f0},
David Henningssonaec856d2014-09-03 10:23:05 +02005264 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08005265 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005266 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08005267 {0x12, 0x90a60140},
5268 {0x13, 0x411111f0},
Hui Wange8818fa2014-09-03 11:31:04 +08005269 {0x16, 0x01014020},
5270 {0x18, 0x02a19031},
David Henningssonaec856d2014-09-03 10:23:05 +02005271 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02005272 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005273 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02005274 {0x12, 0x90a60140},
5275 {0x13, 0x411111f0},
David Henningsson76c21322014-06-24 14:46:54 +02005276 {0x16, 0x411111f0},
5277 {0x18, 0x411111f0},
David Henningssonaec856d2014-09-03 10:23:05 +02005278 {0x19, 0x411111f0}),
David Henningsson76c21322014-06-24 14:46:54 +02005279 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005280 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02005281 {0x12, 0x40000000},
5282 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02005283 {0x16, 0x21014020},
5284 {0x18, 0x411111f0},
David Henningssonaec856d2014-09-03 10:23:05 +02005285 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02005286 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02005287 ALC292_STANDARD_PINS,
David Henningssone03fdbd2014-06-27 08:41:59 +02005288 {0x12, 0x40000000},
5289 {0x13, 0x90a60140},
David Henningssone03fdbd2014-06-27 08:41:59 +02005290 {0x16, 0x411111f0},
5291 {0x18, 0x411111f0},
David Henningssonaec856d2014-09-03 10:23:05 +02005292 {0x19, 0x411111f0}),
Hui Wange1918932014-05-26 16:22:44 +08005293 {}
5294};
Takashi Iwai1d045db2011-07-07 18:23:21 +02005295
Takashi Iwai546bb672012-03-07 08:37:19 +01005296static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02005297{
Kailang Yang526af6e2012-03-07 08:25:20 +01005298 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005299 int val;
5300
Kailang Yang526af6e2012-03-07 08:25:20 +01005301 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01005302 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01005303
Takashi Iwai1bb7e432011-10-17 16:50:59 +02005304 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005305 alc_write_coef_idx(codec, 0xf, 0x960b);
5306 alc_write_coef_idx(codec, 0xe, 0x8817);
5307 }
5308
Takashi Iwai1bb7e432011-10-17 16:50:59 +02005309 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005310 alc_write_coef_idx(codec, 0xf, 0x960b);
5311 alc_write_coef_idx(codec, 0xe, 0x8814);
5312 }
5313
Takashi Iwai1bb7e432011-10-17 16:50:59 +02005314 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005315 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02005316 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02005317 }
5318
Takashi Iwai1bb7e432011-10-17 16:50:59 +02005319 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005320 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02005321 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005322 /* Capless ramp up clock control */
5323 alc_write_coef_idx(codec, 0xd, val | (1<<10));
5324 }
5325 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02005326 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005327 /* Class D power on reset */
5328 alc_write_coef_idx(codec, 0x17, val | (1<<7));
5329 }
5330 }
5331
Takashi Iwai98b24882014-08-18 13:47:50 +02005332 /* HP */
5333 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02005334}
5335
5336/*
5337 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02005338static int patch_alc269(struct hda_codec *codec)
5339{
5340 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02005341 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005342
Takashi Iwai3de95172012-05-07 18:03:15 +02005343 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02005344 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02005345 return err;
5346
5347 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01005348 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02005349
Takashi Iwai1727a772013-01-10 09:52:52 +01005350 snd_hda_pick_fixup(codec, alc269_fixup_models,
Herton Ronaldo Krzesinski9f720bb92012-09-27 10:38:14 -03005351 alc269_fixup_tbl, alc269_fixups);
Hui Wange1918932014-05-26 16:22:44 +08005352 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups);
David Henningsson214eef72014-07-22 14:09:35 +02005353 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
5354 alc269_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01005355 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Herton Ronaldo Krzesinski9f720bb92012-09-27 10:38:14 -03005356
5357 alc_auto_parse_customize_define(codec);
5358
Takashi Iwai7504b6c2013-03-18 11:25:51 +01005359 if (has_cdefine_beep(codec))
5360 spec->gen.beep_nid = 0x01;
5361
Kailang Yang065380f2013-01-10 10:25:48 +01005362 switch (codec->vendor_id) {
5363 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02005364 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02005365 switch (alc_get_coef0(codec) & 0x00f0) {
5366 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01005367 if (codec->bus->pci &&
5368 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02005369 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02005370 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02005371 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02005372 break;
5373 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01005374 if (codec->bus->pci &&
5375 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02005376 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02005377 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02005378 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02005379 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02005380 case 0x0030:
5381 spec->codec_variant = ALC269_TYPE_ALC269VD;
5382 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02005383 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02005384 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02005385 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02005386 if (err < 0)
5387 goto error;
Takashi Iwai546bb672012-03-07 08:37:19 +01005388 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005389 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01005390 break;
5391
5392 case 0x10ec0280:
5393 case 0x10ec0290:
5394 spec->codec_variant = ALC269_TYPE_ALC280;
5395 break;
5396 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01005397 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08005398 spec->shutup = alc282_shutup;
5399 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01005400 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02005401 case 0x10ec0233:
5402 case 0x10ec0283:
5403 spec->codec_variant = ALC269_TYPE_ALC283;
5404 spec->shutup = alc283_shutup;
5405 spec->init_hook = alc283_init;
5406 break;
Kailang Yang065380f2013-01-10 10:25:48 +01005407 case 0x10ec0284:
5408 case 0x10ec0292:
5409 spec->codec_variant = ALC269_TYPE_ALC284;
5410 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02005411 case 0x10ec0285:
5412 case 0x10ec0293:
5413 spec->codec_variant = ALC269_TYPE_ALC285;
5414 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02005415 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08005416 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02005417 spec->codec_variant = ALC269_TYPE_ALC286;
Kailang Yangf7ae9ba2014-06-30 16:10:37 +08005418 spec->shutup = alc286_shutup;
Kailang Yang7fc7d042013-04-25 11:04:43 +02005419 break;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02005420 case 0x10ec0255:
5421 spec->codec_variant = ALC269_TYPE_ALC255;
5422 break;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005423 }
5424
Kailang Yangad60d502013-06-28 12:03:01 +02005425 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -05005426 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +02005427 spec->init_hook = alc5505_dsp_init;
5428 }
5429
Takashi Iwaia4297b52011-08-23 18:40:12 +02005430 /* automatic parse from the BIOS config */
5431 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02005432 if (err < 0)
5433 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005434
Takashi Iwai7504b6c2013-03-18 11:25:51 +01005435 if (!spec->gen.no_analog && spec->gen.beep_nid)
Takashi Iwai1d045db2011-07-07 18:23:21 +02005436 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
5437
Takashi Iwai1d045db2011-07-07 18:23:21 +02005438 codec->patch_ops = alc_patch_ops;
Takashi Iwai2a439522011-07-26 09:52:50 +02005439#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02005440 codec->patch_ops.suspend = alc269_suspend;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005441 codec->patch_ops.resume = alc269_resume;
5442#endif
Kailang Yangc5177c82013-07-24 14:39:49 +02005443 if (!spec->shutup)
5444 spec->shutup = alc269_shutup;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005445
Takashi Iwai1727a772013-01-10 09:52:52 +01005446 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01005447
Takashi Iwai1d045db2011-07-07 18:23:21 +02005448 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02005449
5450 error:
5451 alc_free(codec);
5452 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005453}
5454
5455/*
5456 * ALC861
5457 */
5458
Takashi Iwai1d045db2011-07-07 18:23:21 +02005459static int alc861_parse_auto_config(struct hda_codec *codec)
5460{
Takashi Iwai1d045db2011-07-07 18:23:21 +02005461 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02005462 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
5463 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02005464}
5465
Takashi Iwai1d045db2011-07-07 18:23:21 +02005466/* Pin config fixes */
5467enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01005468 ALC861_FIXUP_FSC_AMILO_PI1505,
5469 ALC861_FIXUP_AMP_VREF_0F,
5470 ALC861_FIXUP_NO_JACK_DETECT,
5471 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01005472 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005473};
5474
Takashi Iwai31150f22012-01-30 10:54:08 +01005475/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
5476static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005477 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +01005478{
5479 struct alc_spec *spec = codec->spec;
5480 unsigned int val;
5481
Takashi Iwai1727a772013-01-10 09:52:52 +01005482 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +01005483 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01005484 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +01005485 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
5486 val |= AC_PINCTL_IN_EN;
5487 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02005488 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01005489 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +01005490}
5491
Takashi Iwaie652f4c2012-02-13 11:56:25 +01005492/* suppress the jack-detection */
5493static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005494 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01005495{
Takashi Iwai1727a772013-01-10 09:52:52 +01005496 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +01005497 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02005498}
Takashi Iwaie652f4c2012-02-13 11:56:25 +01005499
Takashi Iwai1727a772013-01-10 09:52:52 +01005500static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +01005501 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005502 .type = HDA_FIXUP_PINS,
5503 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005504 { 0x0b, 0x0221101f }, /* HP */
5505 { 0x0f, 0x90170310 }, /* speaker */
5506 { }
5507 }
5508 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01005509 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005510 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +01005511 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +01005512 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01005513 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005514 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01005515 .v.func = alc_fixup_no_jack_detect,
5516 },
5517 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005518 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +01005519 .v.func = alc861_fixup_asus_amp_vref_0f,
5520 .chained = true,
5521 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01005522 },
5523 [ALC660_FIXUP_ASUS_W7J] = {
5524 .type = HDA_FIXUP_VERBS,
5525 .v.verbs = (const struct hda_verb[]) {
5526 /* ASUS W7J needs a magic pin setup on unused NID 0x10
5527 * for enabling outputs
5528 */
5529 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
5530 { }
5531 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +01005532 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02005533};
5534
5535static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +01005536 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +01005537 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +01005538 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
5539 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
5540 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
5541 SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F),
5542 SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F),
5543 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +02005544 {}
5545};
5546
5547/*
5548 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02005549static int patch_alc861(struct hda_codec *codec)
5550{
5551 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005552 int err;
5553
Takashi Iwai3de95172012-05-07 18:03:15 +02005554 err = alc_alloc_spec(codec, 0x15);
5555 if (err < 0)
5556 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005557
Takashi Iwai3de95172012-05-07 18:03:15 +02005558 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01005559 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005560
Takashi Iwai1727a772013-01-10 09:52:52 +01005561 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
5562 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02005563
Takashi Iwaicb4e4822011-08-23 17:34:25 +02005564 /* automatic parse from the BIOS config */
5565 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02005566 if (err < 0)
5567 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005568
Takashi Iwai7504b6c2013-03-18 11:25:51 +01005569 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02005570 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02005571
Takashi Iwai1d045db2011-07-07 18:23:21 +02005572 codec->patch_ops = alc_patch_ops;
Takashi Iwai83012a72012-08-24 18:38:08 +02005573#ifdef CONFIG_PM
Takashi Iwaicb4e4822011-08-23 17:34:25 +02005574 spec->power_hook = alc_power_eapd;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005575#endif
5576
Takashi Iwai1727a772013-01-10 09:52:52 +01005577 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01005578
Takashi Iwai1d045db2011-07-07 18:23:21 +02005579 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02005580
5581 error:
5582 alc_free(codec);
5583 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005584}
5585
5586/*
5587 * ALC861-VD support
5588 *
5589 * Based on ALC882
5590 *
5591 * In addition, an independent DAC
5592 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02005593static int alc861vd_parse_auto_config(struct hda_codec *codec)
5594{
Takashi Iwai1d045db2011-07-07 18:23:21 +02005595 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02005596 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5597 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02005598}
5599
Takashi Iwai1d045db2011-07-07 18:23:21 +02005600enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02005601 ALC660VD_FIX_ASUS_GPIO1,
5602 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005603};
5604
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02005605/* exclude VREF80 */
5606static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005607 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02005608{
Takashi Iwai1727a772013-01-10 09:52:52 +01005609 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +01005610 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
5611 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02005612 }
5613}
5614
Takashi Iwai1727a772013-01-10 09:52:52 +01005615static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02005616 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005617 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02005618 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02005619 /* reset GPIO1 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02005620 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
5621 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
5622 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
5623 { }
5624 }
5625 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02005626 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005627 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02005628 .v.func = alc861vd_fixup_dallas,
5629 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02005630};
5631
5632static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02005633 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02005634 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +02005635 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +02005636 {}
5637};
5638
Takashi Iwai1d045db2011-07-07 18:23:21 +02005639/*
5640 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02005641static int patch_alc861vd(struct hda_codec *codec)
5642{
5643 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +02005644 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005645
Takashi Iwai3de95172012-05-07 18:03:15 +02005646 err = alc_alloc_spec(codec, 0x0b);
5647 if (err < 0)
5648 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005649
Takashi Iwai3de95172012-05-07 18:03:15 +02005650 spec = codec->spec;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01005651 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005652
Takashi Iwai1727a772013-01-10 09:52:52 +01005653 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
5654 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02005655
Takashi Iwaicb4e4822011-08-23 17:34:25 +02005656 /* automatic parse from the BIOS config */
5657 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02005658 if (err < 0)
5659 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005660
Takashi Iwai7504b6c2013-03-18 11:25:51 +01005661 if (!spec->gen.no_analog)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02005662 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Takashi Iwai1d045db2011-07-07 18:23:21 +02005663
Takashi Iwai1d045db2011-07-07 18:23:21 +02005664 codec->patch_ops = alc_patch_ops;
5665
Takashi Iwai1d045db2011-07-07 18:23:21 +02005666 spec->shutup = alc_eapd_shutup;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005667
Takashi Iwai1727a772013-01-10 09:52:52 +01005668 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01005669
Takashi Iwai1d045db2011-07-07 18:23:21 +02005670 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02005671
5672 error:
5673 alc_free(codec);
5674 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02005675}
5676
5677/*
5678 * ALC662 support
5679 *
5680 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
5681 * configuration. Each pin widget can choose any input DACs and a mixer.
5682 * Each ADC is connected from a mixer of all inputs. This makes possible
5683 * 6-channel independent captures.
5684 *
5685 * In addition, an independent DAC for the multi-playback (not used in this
5686 * driver yet).
5687 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02005688
5689/*
5690 * BIOS auto configuration
5691 */
5692
Kailang Yangbc9f98a2007-04-12 13:06:07 +02005693static int alc662_parse_auto_config(struct hda_codec *codec)
5694{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +02005695 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02005696 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
5697 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5698 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +02005699
Kailang Yang6227cdc2010-02-25 08:36:52 +01005700 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 ||
Rainer Koenig1d87caa2013-04-04 08:40:38 +02005701 codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 ||
5702 codec->vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +02005703 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +01005704 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +02005705 ssids = alc662_ssids;
5706 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +02005707}
5708
Todd Broch6be79482010-12-07 16:51:05 -08005709static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01005710 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01005711{
Takashi Iwai9bb1f062013-01-10 17:14:29 +01005712 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +01005713 return;
Todd Broch6be79482010-12-07 16:51:05 -08005714 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
5715 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
5716 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
5717 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
5718 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +01005719 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -08005720}
5721
Takashi Iwai8e383952013-10-30 17:41:12 +01005722static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
5723 { .channels = 2,
5724 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
5725 { .channels = 4,
5726 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
5727 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
5728 { }
5729};
5730
5731/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01005732static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +01005733 const struct hda_fixup *fix, int action)
5734{
5735 if (action == HDA_FIXUP_ACT_BUILD) {
5736 struct alc_spec *spec = codec->spec;
5737 spec->gen.pcm_rec[0].stream[0].chmap = asus_pcm_2_1_chmaps;
5738 }
5739}
5740
Takashi Iwaibf686652014-01-13 16:18:25 +01005741/* avoid D3 for keeping GPIO up */
5742static unsigned int gpio_led_power_filter(struct hda_codec *codec,
5743 hda_nid_t nid,
5744 unsigned int power_state)
5745{
5746 struct alc_spec *spec = codec->spec;
5747 if (nid == codec->afg && power_state == AC_PWRST_D3 && spec->gpio_led)
5748 return AC_PWRST_D0;
5749 return power_state;
5750}
5751
Takashi Iwai3e887f32014-01-10 17:50:58 +01005752static void alc662_fixup_led_gpio1(struct hda_codec *codec,
5753 const struct hda_fixup *fix, int action)
5754{
5755 struct alc_spec *spec = codec->spec;
5756 static const struct hda_verb gpio_init[] = {
5757 { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 },
5758 { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 },
5759 {}
5760 };
5761
5762 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +01005763 spec->gen.vmaster_mute.hook = alc_fixup_gpio_mute_hook;
Takashi Iwai3e887f32014-01-10 17:50:58 +01005764 spec->gpio_led = 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01005765 spec->mute_led_polarity = 1;
5766 spec->gpio_mute_led_mask = 0x01;
Takashi Iwai3e887f32014-01-10 17:50:58 +01005767 snd_hda_add_verbs(codec, gpio_init);
Takashi Iwaibf686652014-01-13 16:18:25 +01005768 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +01005769 }
5770}
5771
Kailang Yangf3f91852014-10-24 15:43:46 +08005772static struct coef_fw alc668_coefs[] = {
5773 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
5774 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
5775 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
5776 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
5777 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
5778 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
5779 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
5780 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
5781 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
5782 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
5783 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
5784 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
5785 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
5786 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
5787 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
5788 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
5789 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
5790 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
5791 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
5792 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
5793 {}
5794};
5795
5796static void alc668_restore_default_value(struct hda_codec *codec)
5797{
5798 alc_process_coef_fw(codec, alc668_coefs);
5799}
5800
David Henningsson6cb3b702010-09-09 08:51:44 +02005801enum {
Daniel T Chen2df03512010-10-10 22:39:28 -04005802 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +01005803 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02005804 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -08005805 ALC272_FIXUP_MARIO,
Anisse Astierd2ebd472011-01-20 12:36:21 +01005806 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +02005807 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02005808 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +02005809 ALC662_FIXUP_ASUS_MODE1,
5810 ALC662_FIXUP_ASUS_MODE2,
5811 ALC662_FIXUP_ASUS_MODE3,
5812 ALC662_FIXUP_ASUS_MODE4,
5813 ALC662_FIXUP_ASUS_MODE5,
5814 ALC662_FIXUP_ASUS_MODE6,
5815 ALC662_FIXUP_ASUS_MODE7,
5816 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +01005817 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +02005818 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +02005819 ALC662_FIXUP_INV_DMIC,
David Henningsson73bdd592013-04-15 15:44:14 +02005820 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
5821 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +01005822 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +01005823 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01005824 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +01005825 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +08005826 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005827 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005828 ALC668_FIXUP_DELL_XPS13,
David Henningsson6cb3b702010-09-09 08:51:44 +02005829};
5830
Takashi Iwai1727a772013-01-10 09:52:52 +01005831static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -04005832 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005833 .type = HDA_FIXUP_PINS,
5834 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -04005835 { 0x15, 0x99130112 }, /* subwoofer */
5836 { }
5837 }
5838 },
Takashi Iwai3e887f32014-01-10 17:50:58 +01005839 [ALC662_FIXUP_LED_GPIO1] = {
5840 .type = HDA_FIXUP_FUNC,
5841 .v.func = alc662_fixup_led_gpio1,
5842 },
David Henningsson6cb3b702010-09-09 08:51:44 +02005843 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005844 .type = HDA_FIXUP_PINS,
5845 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +02005846 { 0x17, 0x99130112 }, /* subwoofer */
5847 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +01005848 },
5849 .chained = true,
5850 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +02005851 },
Todd Broch6be79482010-12-07 16:51:05 -08005852 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005853 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +01005854 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +01005855 },
5856 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005857 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +01005858 .v.verbs = (const struct hda_verb[]) {
5859 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
5860 {}
5861 }
5862 },
David Henningsson94024cd2011-04-29 14:10:55 +02005863 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005864 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02005865 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +02005866 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02005867 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005868 .type = HDA_FIXUP_PINS,
5869 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02005870 { 0x14, 0x0221201f }, /* HP out */
5871 { }
5872 },
5873 .chained = true,
5874 .chain_id = ALC662_FIXUP_SKU_IGNORE
5875 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02005876 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005877 .type = HDA_FIXUP_PINS,
5878 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02005879 { 0x14, 0x99130110 }, /* speaker */
5880 { 0x18, 0x01a19c20 }, /* mic */
5881 { 0x19, 0x99a3092f }, /* int-mic */
5882 { 0x21, 0x0121401f }, /* HP out */
5883 { }
5884 },
5885 .chained = true,
5886 .chain_id = ALC662_FIXUP_SKU_IGNORE
5887 },
5888 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005889 .type = HDA_FIXUP_PINS,
5890 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +02005891 { 0x14, 0x99130110 }, /* speaker */
5892 { 0x18, 0x01a19820 }, /* mic */
5893 { 0x19, 0x99a3092f }, /* int-mic */
5894 { 0x1b, 0x0121401f }, /* HP out */
5895 { }
5896 },
Takashi Iwai53c334a2011-08-23 18:27:14 +02005897 .chained = true,
5898 .chain_id = ALC662_FIXUP_SKU_IGNORE
5899 },
5900 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005901 .type = HDA_FIXUP_PINS,
5902 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02005903 { 0x14, 0x99130110 }, /* speaker */
5904 { 0x15, 0x0121441f }, /* HP */
5905 { 0x18, 0x01a19840 }, /* mic */
5906 { 0x19, 0x99a3094f }, /* int-mic */
5907 { 0x21, 0x01211420 }, /* HP2 */
5908 { }
5909 },
5910 .chained = true,
5911 .chain_id = ALC662_FIXUP_SKU_IGNORE
5912 },
5913 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005914 .type = HDA_FIXUP_PINS,
5915 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02005916 { 0x14, 0x99130110 }, /* speaker */
5917 { 0x16, 0x99130111 }, /* speaker */
5918 { 0x18, 0x01a19840 }, /* mic */
5919 { 0x19, 0x99a3094f }, /* int-mic */
5920 { 0x21, 0x0121441f }, /* HP */
5921 { }
5922 },
5923 .chained = true,
5924 .chain_id = ALC662_FIXUP_SKU_IGNORE
5925 },
5926 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005927 .type = HDA_FIXUP_PINS,
5928 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02005929 { 0x14, 0x99130110 }, /* speaker */
5930 { 0x15, 0x0121441f }, /* HP */
5931 { 0x16, 0x99130111 }, /* speaker */
5932 { 0x18, 0x01a19840 }, /* mic */
5933 { 0x19, 0x99a3094f }, /* int-mic */
5934 { }
5935 },
5936 .chained = true,
5937 .chain_id = ALC662_FIXUP_SKU_IGNORE
5938 },
5939 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005940 .type = HDA_FIXUP_PINS,
5941 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02005942 { 0x14, 0x99130110 }, /* speaker */
5943 { 0x15, 0x01211420 }, /* HP2 */
5944 { 0x18, 0x01a19840 }, /* mic */
5945 { 0x19, 0x99a3094f }, /* int-mic */
5946 { 0x1b, 0x0121441f }, /* HP */
5947 { }
5948 },
5949 .chained = true,
5950 .chain_id = ALC662_FIXUP_SKU_IGNORE
5951 },
5952 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005953 .type = HDA_FIXUP_PINS,
5954 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02005955 { 0x14, 0x99130110 }, /* speaker */
5956 { 0x17, 0x99130111 }, /* speaker */
5957 { 0x18, 0x01a19840 }, /* mic */
5958 { 0x19, 0x99a3094f }, /* int-mic */
5959 { 0x1b, 0x01214020 }, /* HP */
5960 { 0x21, 0x0121401f }, /* HP */
5961 { }
5962 },
5963 .chained = true,
5964 .chain_id = ALC662_FIXUP_SKU_IGNORE
5965 },
5966 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005967 .type = HDA_FIXUP_PINS,
5968 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +02005969 { 0x14, 0x99130110 }, /* speaker */
5970 { 0x12, 0x99a30970 }, /* int-mic */
5971 { 0x15, 0x01214020 }, /* HP */
5972 { 0x17, 0x99130111 }, /* speaker */
5973 { 0x18, 0x01a19840 }, /* mic */
5974 { 0x21, 0x0121401f }, /* HP */
5975 { }
5976 },
5977 .chained = true,
5978 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +02005979 },
Takashi Iwai1565cc32012-02-13 12:03:25 +01005980 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005981 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +01005982 .v.func = alc_fixup_no_jack_detect,
5983 },
David Henningssonedfe3bf2012-06-12 13:15:12 +02005984 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005985 .type = HDA_FIXUP_PINS,
5986 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +02005987 { 0x1b, 0x02214020 }, /* Front HP */
5988 { }
5989 }
5990 },
Takashi Iwai125821a2012-06-22 14:30:29 +02005991 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01005992 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02005993 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +02005994 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005995 [ALC668_FIXUP_DELL_XPS13] = {
5996 .type = HDA_FIXUP_FUNC,
5997 .v.func = alc_fixup_dell_xps13,
5998 .chained = true,
5999 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
6000 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02006001 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
6002 .type = HDA_FIXUP_FUNC,
6003 .v.func = alc_fixup_disable_aamix,
6004 .chained = true,
6005 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
6006 },
Hui Wang493a52a2014-01-14 14:07:36 +08006007 [ALC668_FIXUP_AUTO_MUTE] = {
6008 .type = HDA_FIXUP_FUNC,
6009 .v.func = alc_fixup_auto_mute_via_amp,
6010 .chained = true,
6011 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
6012 },
David Henningsson73bdd592013-04-15 15:44:14 +02006013 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
6014 .type = HDA_FIXUP_PINS,
6015 .v.pins = (const struct hda_pintbl[]) {
6016 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
6017 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
6018 { }
6019 },
6020 .chained = true,
6021 .chain_id = ALC668_FIXUP_HEADSET_MODE
6022 },
6023 [ALC668_FIXUP_HEADSET_MODE] = {
6024 .type = HDA_FIXUP_FUNC,
6025 .v.func = alc_fixup_headset_mode_alc668,
6026 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01006027 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +01006028 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01006029 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +01006030 .chained = true,
6031 .chain_id = ALC662_FIXUP_ASUS_MODE4
6032 },
David Henningsson61a75f12014-02-07 09:31:08 +01006033 [ALC662_FIXUP_BASS_16] = {
6034 .type = HDA_FIXUP_PINS,
6035 .v.pins = (const struct hda_pintbl[]) {
6036 {0x16, 0x80106111}, /* bass speaker */
6037 {}
6038 },
6039 .chained = true,
6040 .chain_id = ALC662_FIXUP_BASS_CHMAP,
6041 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01006042 [ALC662_FIXUP_BASS_1A] = {
6043 .type = HDA_FIXUP_PINS,
6044 .v.pins = (const struct hda_pintbl[]) {
6045 {0x1a, 0x80106111}, /* bass speaker */
6046 {}
6047 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01006048 .chained = true,
6049 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01006050 },
David Henningsson8e54b4a2014-02-07 09:31:07 +01006051 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01006052 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01006053 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +01006054 },
David Henningsson6cb3b702010-09-09 08:51:44 +02006055};
6056
Takashi Iwaia9111322011-05-02 11:30:18 +02006057static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +02006058 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +02006059 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +01006060 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +02006061 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +02006062 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +02006063 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -04006064 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
David Henningsson73bdd592013-04-15 15:44:14 +02006065 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6066 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +02006067 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02006068 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +01006069 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff992013-11-07 09:28:59 +01006070 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +08006071 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
6072 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +08006073 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +02006074 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
David Henningsson8e54b4a2014-02-07 09:31:07 +01006075 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A),
6076 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +01006077 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
6078 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +01006079 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +01006080 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +02006081 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -05006082 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Valentine Sinitsynd4118582010-10-01 22:24:08 +06006083 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +02006084 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
David Henningssonedfe3bf2012-06-12 13:15:12 +02006085 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Anisse Astierd2ebd472011-01-20 12:36:21 +01006086 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +02006087
6088#if 0
6089 /* Below is a quirk table taken from the old code.
6090 * Basically the device should work as is without the fixup table.
6091 * If BIOS doesn't give a proper info, enable the corresponding
6092 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02006093 */
Takashi Iwai53c334a2011-08-23 18:27:14 +02006094 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
6095 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
6096 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
6097 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
6098 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6099 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6100 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6101 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
6102 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
6103 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6104 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
6105 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
6106 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
6107 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
6108 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
6109 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6110 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
6111 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
6112 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6113 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6114 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6115 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6116 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
6117 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
6118 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
6119 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6120 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
6121 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
6122 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6123 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
6124 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6125 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6126 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
6127 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
6128 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
6129 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
6130 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
6131 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
6132 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
6133 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
6134 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
6135 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
6136 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6137 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
6138 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
6139 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
6140 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
6141 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
6142 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
6143 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
6144#endif
David Henningsson6cb3b702010-09-09 08:51:44 +02006145 {}
6146};
6147
Takashi Iwai1727a772013-01-10 09:52:52 +01006148static const struct hda_model_fixup alc662_fixup_models[] = {
Todd Broch6be79482010-12-07 16:51:05 -08006149 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwai53c334a2011-08-23 18:27:14 +02006150 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
6151 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
6152 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
6153 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
6154 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
6155 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
6156 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
6157 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02006158 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningssone32aa852013-06-17 11:04:02 +02006159 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Todd Broch6be79482010-12-07 16:51:05 -08006160 {}
6161};
David Henningsson6cb3b702010-09-09 08:51:44 +02006162
Hui Wang532895c2014-05-29 15:59:19 +08006163static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
David Henningsson76c21322014-06-24 14:46:54 +02006164 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6165 {0x12, 0x99a30130},
6166 {0x14, 0x90170110},
6167 {0x15, 0x0321101f},
6168 {0x16, 0x03011020},
6169 {0x18, 0x40000008},
6170 {0x19, 0x411111f0},
6171 {0x1a, 0x411111f0},
6172 {0x1b, 0x411111f0},
6173 {0x1d, 0x41000001},
6174 {0x1e, 0x411111f0},
6175 {0x1f, 0x411111f0}),
6176 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6177 {0x12, 0x99a30140},
6178 {0x14, 0x90170110},
6179 {0x15, 0x0321101f},
6180 {0x16, 0x03011020},
6181 {0x18, 0x40000008},
6182 {0x19, 0x411111f0},
6183 {0x1a, 0x411111f0},
6184 {0x1b, 0x411111f0},
6185 {0x1d, 0x41000001},
6186 {0x1e, 0x411111f0},
6187 {0x1f, 0x411111f0}),
6188 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6189 {0x12, 0x99a30150},
6190 {0x14, 0x90170110},
6191 {0x15, 0x0321101f},
6192 {0x16, 0x03011020},
6193 {0x18, 0x40000008},
6194 {0x19, 0x411111f0},
6195 {0x1a, 0x411111f0},
6196 {0x1b, 0x411111f0},
6197 {0x1d, 0x41000001},
6198 {0x1e, 0x411111f0},
6199 {0x1f, 0x411111f0}),
6200 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
6201 {0x12, 0x411111f0},
6202 {0x14, 0x90170110},
6203 {0x15, 0x0321101f},
6204 {0x16, 0x03011020},
6205 {0x18, 0x40000008},
6206 {0x19, 0x411111f0},
6207 {0x1a, 0x411111f0},
6208 {0x1b, 0x411111f0},
6209 {0x1d, 0x41000001},
6210 {0x1e, 0x411111f0},
6211 {0x1f, 0x411111f0}),
6212 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
6213 {0x12, 0x90a60130},
6214 {0x14, 0x90170110},
6215 {0x15, 0x0321101f},
6216 {0x16, 0x40000000},
6217 {0x18, 0x411111f0},
6218 {0x19, 0x411111f0},
6219 {0x1a, 0x411111f0},
6220 {0x1b, 0x411111f0},
6221 {0x1d, 0x40d6832d},
6222 {0x1e, 0x411111f0},
6223 {0x1f, 0x411111f0}),
Hui Wang532895c2014-05-29 15:59:19 +08006224 {}
6225};
6226
Takashi Iwai1d045db2011-07-07 18:23:21 +02006227/*
6228 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +02006229static int patch_alc662(struct hda_codec *codec)
6230{
6231 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02006232 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02006233
Takashi Iwai3de95172012-05-07 18:03:15 +02006234 err = alc_alloc_spec(codec, 0x0b);
6235 if (err < 0)
6236 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02006237
Takashi Iwai3de95172012-05-07 18:03:15 +02006238 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02006239
Takashi Iwai53c334a2011-08-23 18:27:14 +02006240 /* handle multiple HPs as is */
6241 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
6242
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +02006243 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6244
Kailang Yangf3f91852014-10-24 15:43:46 +08006245 switch (codec->vendor_id) {
6246 case 0x10ec0668:
6247 spec->init_hook = alc668_restore_default_value;
6248 break;
Kailang Yangf3f91852014-10-24 15:43:46 +08006249 }
Kailang Yang8663ff72012-06-29 09:35:52 +02006250
Takashi Iwai1727a772013-01-10 09:52:52 +01006251 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +02006252 alc662_fixup_tbl, alc662_fixups);
Hui Wang532895c2014-05-29 15:59:19 +08006253 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01006254 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +02006255
6256 alc_auto_parse_customize_define(codec);
6257
Takashi Iwai7504b6c2013-03-18 11:25:51 +01006258 if (has_cdefine_beep(codec))
6259 spec->gen.beep_nid = 0x01;
6260
Takashi Iwai1bb7e432011-10-17 16:50:59 +02006261 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +01006262 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02006263 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +08006264 err = alc_codec_rename(codec, "ALC272X");
6265 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02006266 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +02006267 }
Kailang Yang274693f2009-12-03 10:07:50 +01006268
Takashi Iwaib9c51062011-08-24 18:08:07 +02006269 /* automatic parse from the BIOS config */
6270 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02006271 if (err < 0)
6272 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02006273
Takashi Iwai7504b6c2013-03-18 11:25:51 +01006274 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Kailang Yangda00c242010-03-19 11:23:45 +01006275 switch (codec->vendor_id) {
6276 case 0x10ec0662:
6277 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
6278 break;
6279 case 0x10ec0272:
6280 case 0x10ec0663:
6281 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +08006282 case 0x10ec0668:
Kailang Yangda00c242010-03-19 11:23:45 +01006283 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
6284 break;
6285 case 0x10ec0273:
6286 set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
6287 break;
6288 }
Kailang Yangcec27c82010-02-04 14:18:18 +01006289 }
Takashi Iwai2134ea42008-01-10 16:53:55 +01006290
Kailang Yangbc9f98a2007-04-12 13:06:07 +02006291 codec->patch_ops = alc_patch_ops;
Takashi Iwai1c7161532011-04-07 10:37:16 +02006292 spec->shutup = alc_eapd_shutup;
David Henningsson6cb3b702010-09-09 08:51:44 +02006293
Takashi Iwai1727a772013-01-10 09:52:52 +01006294 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01006295
Kailang Yangbc9f98a2007-04-12 13:06:07 +02006296 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +02006297
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02006298 error:
6299 alc_free(codec);
6300 return err;
Kailang Yangb478b992011-05-18 11:51:15 +02006301}
6302
Kailang Yangbc9f98a2007-04-12 13:06:07 +02006303/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02006304 * ALC680 support
6305 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02006306
Kailang Yangd1eb57f2010-06-23 16:25:26 +02006307static int alc680_parse_auto_config(struct hda_codec *codec)
6308{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02006309 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +02006310}
6311
Kailang Yangd1eb57f2010-06-23 16:25:26 +02006312/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +02006313 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +02006314static int patch_alc680(struct hda_codec *codec)
6315{
Kailang Yangd1eb57f2010-06-23 16:25:26 +02006316 int err;
6317
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02006318 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02006319 err = alc_alloc_spec(codec, 0);
6320 if (err < 0)
6321 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +02006322
Takashi Iwai1ebec5f2011-08-15 13:21:48 +02006323 /* automatic parse from the BIOS config */
6324 err = alc680_parse_auto_config(codec);
6325 if (err < 0) {
6326 alc_free(codec);
6327 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +02006328 }
6329
Kailang Yangd1eb57f2010-06-23 16:25:26 +02006330 codec->patch_ops = alc_patch_ops;
Kailang Yangd1eb57f2010-06-23 16:25:26 +02006331
6332 return 0;
6333}
6334
6335/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07006336 * patch entries
6337 */
Takashi Iwaia9111322011-05-02 11:30:18 +02006338static const struct hda_codec_preset snd_hda_preset_realtek[] = {
Kailang Yang296f0332011-05-18 11:52:36 +02006339 { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 },
Kailang Yangba4c4d02013-11-26 15:17:50 +08006340 { .id = 0x10ec0231, .name = "ALC231", .patch = patch_alc269 },
Kailang Yang84dfd0a2013-03-07 09:19:38 +01006341 { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 },
Kailang Yang92f974d2014-06-06 17:05:33 +08006342 { .id = 0x10ec0235, .name = "ALC233", .patch = patch_alc269 },
Kailang Yang1d04c9d2013-10-24 11:35:18 +02006343 { .id = 0x10ec0255, .name = "ALC255", .patch = patch_alc269 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07006344 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 },
Kailang Yangdf694da2005-12-05 19:42:22 +01006345 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 },
Kailang Yangf6a92242007-12-13 16:52:54 +01006346 { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 },
Kailang Yanga361d842007-06-05 12:30:55 +02006347 { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 },
Kailang Yangf6a92242007-12-13 16:52:54 +01006348 { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 },
Kailang Yangebb83ee2009-12-17 12:23:00 +01006349 { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 },
Kailang Yang01afd412008-10-15 11:22:09 +02006350 { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 },
Kailang Yangebb83ee2009-12-17 12:23:00 +01006351 { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 },
Kailang Yang296f0332011-05-18 11:52:36 +02006352 { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 },
David Henningssonbefae822012-06-25 19:49:28 +02006353 { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 },
David Henningsson4e01ec62012-07-18 07:38:46 +02006354 { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 },
Kailang Yang7ff34ad2012-10-06 17:02:30 +02006355 { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 },
Kailang Yang065380f2013-01-10 10:25:48 +01006356 { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 },
Kailang Yang161ebf22013-10-24 11:36:33 +02006357 { .id = 0x10ec0285, .name = "ALC285", .patch = patch_alc269 },
Kailang Yang7fc7d042013-04-25 11:04:43 +02006358 { .id = 0x10ec0286, .name = "ALC286", .patch = patch_alc269 },
Kailang Yang7c665932014-04-14 15:09:44 +08006359 { .id = 0x10ec0288, .name = "ALC288", .patch = patch_alc269 },
Kailang Yang7ff34ad2012-10-06 17:02:30 +02006360 { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 },
David Henningssonaf02dde2012-11-21 08:57:58 +01006361 { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 },
Kailang Yang161ebf22013-10-24 11:36:33 +02006362 { .id = 0x10ec0293, .name = "ALC293", .patch = patch_alc269 },
Jakub Schmidtkef32610e2007-02-02 18:17:27 +01006363 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
Kailang Yangbc9f98a2007-04-12 13:06:07 +02006364 .patch = patch_alc861 },
Jakub Schmidtkef32610e2007-02-02 18:17:27 +01006365 { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
6366 { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 },
6367 { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd },
Kailang Yangbc9f98a2007-04-12 13:06:07 +02006368 { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2",
Takashi Iwai4953550a2009-06-30 15:28:30 +02006369 .patch = patch_alc882 },
Kailang Yangbc9f98a2007-04-12 13:06:07 +02006370 { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",
6371 .patch = patch_alc662 },
David Henningssoncc667a72011-10-18 14:07:51 +02006372 { .id = 0x10ec0662, .rev = 0x100300, .name = "ALC662 rev3",
6373 .patch = patch_alc662 },
Kailang Yang6dda9f42008-05-27 12:05:31 +02006374 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
Kailang Yangcec27c82010-02-04 14:18:18 +01006375 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
Kailang Yang72009432014-06-06 16:51:18 +08006376 { .id = 0x10ec0667, .name = "ALC667", .patch = patch_alc662 },
Kailang Yang19a62822012-11-08 10:25:37 +01006377 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
Kailang Yang6227cdc2010-02-25 08:36:52 +01006378 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
Rainer Koenig1d87caa2013-04-04 08:40:38 +02006379 { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 },
Kailang Yangd1eb57f2010-06-23 16:25:26 +02006380 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
Kailang Yangb6c5fba2014-06-05 11:13:44 +08006381 { .id = 0x10ec0867, .name = "ALC891", .patch = patch_alc882 },
Jakub Schmidtkef32610e2007-02-02 18:17:27 +01006382 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07006383 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
Takashi Iwai4953550a2009-06-30 15:28:30 +02006384 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },
Clive Messer669faba2008-09-30 15:49:13 +02006385 { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A",
Takashi Iwai4953550a2009-06-30 15:28:30 +02006386 .patch = patch_alc882 },
Takashi Iwaicb308f92008-04-16 14:13:29 +02006387 { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A",
Takashi Iwai4953550a2009-06-30 15:28:30 +02006388 .patch = patch_alc882 },
Kailang Yangdf694da2005-12-05 19:42:22 +01006389 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02006390 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 },
Kailang Yang44426082008-10-15 11:18:05 +02006391 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
Takashi Iwai4953550a2009-06-30 15:28:30 +02006392 .patch = patch_alc882 },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02006393 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 },
Takashi Iwai4953550a2009-06-30 15:28:30 +02006394 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
Kailang Yang274693f2009-12-03 10:07:50 +01006395 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02006396 { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 },
Kailang Yang19a62822012-11-08 10:25:37 +01006397 { .id = 0x10ec0900, .name = "ALC1150", .patch = patch_alc882 },
Linus Torvalds1da177e2005-04-16 15:20:36 -07006398 {} /* terminator */
6399};
Takashi Iwai1289e9e2008-11-27 15:47:11 +01006400
6401MODULE_ALIAS("snd-hda-codec-id:10ec*");
6402
6403MODULE_LICENSE("GPL");
6404MODULE_DESCRIPTION("Realtek HD-audio codec");
6405
6406static struct hda_codec_preset_list realtek_list = {
6407 .preset = snd_hda_preset_realtek,
6408 .owner = THIS_MODULE,
6409};
6410
6411static int __init patch_realtek_init(void)
6412{
6413 return snd_hda_add_codec_preset(&realtek_list);
6414}
6415
6416static void __exit patch_realtek_exit(void)
6417{
6418 snd_hda_delete_codec_preset(&realtek_list);
6419}
6420
6421module_init(patch_realtek_init)
6422module_exit(patch_realtek_exit)