]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Universal Interface for Intel High Definition Audio Codec | |
3 | * | |
1d045db9 | 4 | * HD audio interface patch for Realtek ALC codecs |
1da177e4 | 5 | * |
df694daa KY |
6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
7 | * PeiSen Hou <pshou@realtek.com.tw> | |
1da177e4 | 8 | * Takashi Iwai <tiwai@suse.de> |
409a3e98 | 9 | * Jonathan Woithe <jwoithe@just42.net> |
1da177e4 LT |
10 | * |
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 | ||
1da177e4 LT |
26 | #include <linux/init.h> |
27 | #include <linux/delay.h> | |
28 | #include <linux/slab.h> | |
29 | #include <linux/pci.h> | |
08fb0d0e | 30 | #include <linux/dmi.h> |
da155d5b | 31 | #include <linux/module.h> |
1da177e4 | 32 | #include <sound/core.h> |
9ad0e496 | 33 | #include <sound/jack.h> |
1da177e4 LT |
34 | #include "hda_codec.h" |
35 | #include "hda_local.h" | |
23d30f28 | 36 | #include "hda_auto_parser.h" |
1835a0f9 | 37 | #include "hda_jack.h" |
08c189f2 | 38 | #include "hda_generic.h" |
1da177e4 | 39 | |
cd63a5ff TI |
40 | /* keep halting ALC5505 DSP, for power saving */ |
41 | #define HALT_REALTEK_ALC5505 | |
42 | ||
1d045db9 | 43 | /* unsol event tags */ |
08c189f2 | 44 | #define ALC_DCVOL_EVENT 0x08 |
d4a86d81 | 45 | |
df694daa KY |
46 | /* for GPIO Poll */ |
47 | #define GPIO_MASK 0x03 | |
48 | ||
4a79ba34 TI |
49 | /* extra amp-initialization sequence types */ |
50 | enum { | |
51 | ALC_INIT_NONE, | |
52 | ALC_INIT_DEFAULT, | |
53 | ALC_INIT_GPIO1, | |
54 | ALC_INIT_GPIO2, | |
55 | ALC_INIT_GPIO3, | |
56 | }; | |
57 | ||
73bdd597 DH |
58 | enum { |
59 | ALC_HEADSET_MODE_UNKNOWN, | |
60 | ALC_HEADSET_MODE_UNPLUGGED, | |
61 | ALC_HEADSET_MODE_HEADSET, | |
62 | ALC_HEADSET_MODE_MIC, | |
63 | ALC_HEADSET_MODE_HEADPHONE, | |
64 | }; | |
65 | ||
66 | enum { | |
67 | ALC_HEADSET_TYPE_UNKNOWN, | |
68 | ALC_HEADSET_TYPE_CTIA, | |
69 | ALC_HEADSET_TYPE_OMTP, | |
70 | }; | |
71 | ||
da00c244 KY |
72 | struct alc_customize_define { |
73 | unsigned int sku_cfg; | |
74 | unsigned char port_connectivity; | |
75 | unsigned char check_sum; | |
76 | unsigned char customization; | |
77 | unsigned char external_amp; | |
78 | unsigned int enable_pcbeep:1; | |
79 | unsigned int platform_type:1; | |
80 | unsigned int swap:1; | |
81 | unsigned int override:1; | |
90622917 | 82 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ |
da00c244 KY |
83 | }; |
84 | ||
1da177e4 | 85 | struct alc_spec { |
08c189f2 | 86 | struct hda_gen_spec gen; /* must be at head */ |
23d30f28 | 87 | |
1da177e4 | 88 | /* codec parameterization */ |
a9111321 | 89 | const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
1da177e4 | 90 | unsigned int num_mixers; |
45bdd1c1 | 91 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
1da177e4 | 92 | |
da00c244 | 93 | struct alc_customize_define cdefine; |
08c189f2 | 94 | unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */ |
834be88d | 95 | |
08c189f2 TI |
96 | /* inverted dmic fix */ |
97 | unsigned int inv_dmic_fixup:1; /* has inverted digital-mic workaround */ | |
98 | unsigned int inv_dmic_muted:1; /* R-ch of inv d-mic is muted? */ | |
125821ae | 99 | hda_nid_t inv_dmic_pin; |
834be88d | 100 | |
08fb0d0e TI |
101 | /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */ |
102 | int mute_led_polarity; | |
103 | hda_nid_t mute_led_nid; | |
9c5dc3bf | 104 | hda_nid_t cap_mute_led_nid; |
08fb0d0e | 105 | |
9f5c6faf TI |
106 | unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */ |
107 | ||
73bdd597 DH |
108 | hda_nid_t headset_mic_pin; |
109 | hda_nid_t headphone_mic_pin; | |
110 | int current_headset_mode; | |
111 | int current_headset_type; | |
112 | ||
ae6b813a TI |
113 | /* hooks */ |
114 | void (*init_hook)(struct hda_codec *codec); | |
83012a7c | 115 | #ifdef CONFIG_PM |
c97259df | 116 | void (*power_hook)(struct hda_codec *codec); |
f5de24b0 | 117 | #endif |
1c716153 | 118 | void (*shutup)(struct hda_codec *codec); |
d922b51d | 119 | |
4a79ba34 | 120 | int init_amp; |
d433a678 | 121 | int codec_variant; /* flag for other variants */ |
97a26570 KY |
122 | unsigned int has_alc5505_dsp:1; |
123 | unsigned int no_depop_delay:1; | |
e64f14f4 | 124 | |
2c3bf9ab TI |
125 | /* for PLL fix */ |
126 | hda_nid_t pll_nid; | |
127 | unsigned int pll_coef_idx, pll_coef_bit; | |
1bb7e43e | 128 | unsigned int coef0; |
df694daa KY |
129 | }; |
130 | ||
f2a227cd TI |
131 | /* |
132 | * COEF access helper functions | |
133 | */ | |
134 | ||
135 | static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, | |
136 | unsigned int coef_idx) | |
137 | { | |
138 | unsigned int val; | |
139 | ||
140 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); | |
141 | val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); | |
142 | return val; | |
143 | } | |
144 | ||
145 | #define alc_read_coef_idx(codec, coef_idx) \ | |
146 | alc_read_coefex_idx(codec, 0x20, coef_idx) | |
147 | ||
148 | static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, | |
149 | unsigned int coef_idx, unsigned int coef_val) | |
150 | { | |
151 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); | |
152 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); | |
153 | } | |
154 | ||
155 | #define alc_write_coef_idx(codec, coef_idx, coef_val) \ | |
156 | alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val) | |
157 | ||
98b24883 TI |
158 | static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, |
159 | unsigned int coef_idx, unsigned int mask, | |
160 | unsigned int bits_set) | |
161 | { | |
162 | unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx); | |
163 | ||
164 | if (val != -1) | |
165 | alc_write_coefex_idx(codec, nid, coef_idx, | |
166 | (val & ~mask) | bits_set); | |
167 | } | |
168 | ||
169 | #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ | |
170 | alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set) | |
171 | ||
f2a227cd TI |
172 | /* a special bypass for COEF 0; read the cached value at the second time */ |
173 | static unsigned int alc_get_coef0(struct hda_codec *codec) | |
174 | { | |
175 | struct alc_spec *spec = codec->spec; | |
176 | ||
177 | if (!spec->coef0) | |
178 | spec->coef0 = alc_read_coef_idx(codec, 0); | |
179 | return spec->coef0; | |
180 | } | |
181 | ||
54db6c39 TI |
182 | /* coef writes/updates batch */ |
183 | struct coef_fw { | |
184 | unsigned char nid; | |
185 | unsigned char idx; | |
186 | unsigned short mask; | |
187 | unsigned short val; | |
188 | }; | |
189 | ||
190 | #define UPDATE_COEFEX(_nid, _idx, _mask, _val) \ | |
191 | { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) } | |
192 | #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val) | |
193 | #define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val) | |
194 | #define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val) | |
195 | ||
196 | static void alc_process_coef_fw(struct hda_codec *codec, | |
197 | const struct coef_fw *fw) | |
198 | { | |
199 | for (; fw->nid; fw++) { | |
200 | if (fw->mask == (unsigned short)-1) | |
201 | alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); | |
202 | else | |
203 | alc_update_coefex_idx(codec, fw->nid, fw->idx, | |
204 | fw->mask, fw->val); | |
205 | } | |
206 | } | |
207 | ||
d88897ea | 208 | /* |
1d045db9 TI |
209 | * Append the given mixer and verb elements for the later use |
210 | * The mixer array is referred in build_controls(), and init_verbs are | |
211 | * called in init(). | |
d88897ea | 212 | */ |
a9111321 | 213 | static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix) |
d88897ea TI |
214 | { |
215 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) | |
216 | return; | |
217 | spec->mixers[spec->num_mixers++] = mix; | |
218 | } | |
219 | ||
df694daa | 220 | /* |
1d045db9 | 221 | * GPIO setup tables, used in initialization |
df694daa | 222 | */ |
bc9f98a9 | 223 | /* Enable GPIO mask and set output */ |
a9111321 | 224 | static const struct hda_verb alc_gpio1_init_verbs[] = { |
bc9f98a9 KY |
225 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
226 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
227 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
228 | { } | |
229 | }; | |
230 | ||
a9111321 | 231 | static const struct hda_verb alc_gpio2_init_verbs[] = { |
bc9f98a9 KY |
232 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
233 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, | |
234 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, | |
235 | { } | |
236 | }; | |
237 | ||
a9111321 | 238 | static const struct hda_verb alc_gpio3_init_verbs[] = { |
bdd148a3 KY |
239 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
240 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | |
241 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | |
242 | { } | |
243 | }; | |
244 | ||
2c3bf9ab TI |
245 | /* |
246 | * Fix hardware PLL issue | |
247 | * On some codecs, the analog PLL gating control must be off while | |
248 | * the default value is 1. | |
249 | */ | |
250 | static void alc_fix_pll(struct hda_codec *codec) | |
251 | { | |
252 | struct alc_spec *spec = codec->spec; | |
2c3bf9ab | 253 | |
98b24883 TI |
254 | if (spec->pll_nid) |
255 | alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, | |
256 | 1 << spec->pll_coef_bit, 0); | |
2c3bf9ab TI |
257 | } |
258 | ||
259 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | |
260 | unsigned int coef_idx, unsigned int coef_bit) | |
261 | { | |
262 | struct alc_spec *spec = codec->spec; | |
263 | spec->pll_nid = nid; | |
264 | spec->pll_coef_idx = coef_idx; | |
265 | spec->pll_coef_bit = coef_bit; | |
266 | alc_fix_pll(codec); | |
267 | } | |
268 | ||
cf5a2279 | 269 | /* update the master volume per volume-knob's unsol event */ |
29adc4b9 | 270 | static void alc_update_knob_master(struct hda_codec *codec, struct hda_jack_tbl *jack) |
cf5a2279 TI |
271 | { |
272 | unsigned int val; | |
273 | struct snd_kcontrol *kctl; | |
274 | struct snd_ctl_elem_value *uctl; | |
275 | ||
276 | kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); | |
277 | if (!kctl) | |
278 | return; | |
279 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); | |
280 | if (!uctl) | |
281 | return; | |
29adc4b9 | 282 | val = snd_hda_codec_read(codec, jack->nid, 0, |
cf5a2279 TI |
283 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
284 | val &= HDA_AMP_VOLMASK; | |
285 | uctl->value.integer.value[0] = val; | |
286 | uctl->value.integer.value[1] = val; | |
287 | kctl->put(kctl, uctl); | |
288 | kfree(uctl); | |
289 | } | |
290 | ||
29adc4b9 | 291 | static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) |
f21d78e2 | 292 | { |
29adc4b9 DH |
293 | /* For some reason, the res given from ALC880 is broken. |
294 | Here we adjust it properly. */ | |
295 | snd_hda_jack_unsol_event(codec, res >> 2); | |
f21d78e2 TI |
296 | } |
297 | ||
f9423e7a KY |
298 | /* additional initialization for ALC888 variants */ |
299 | static void alc888_coef_init(struct hda_codec *codec) | |
300 | { | |
f2a227cd | 301 | if (alc_get_coef0(codec) == 0x20) |
f9423e7a | 302 | /* alc888S-VC */ |
f2a227cd | 303 | alc_write_coef_idx(codec, 7, 0x830); |
f9423e7a KY |
304 | else |
305 | /* alc888-VB */ | |
f2a227cd | 306 | alc_write_coef_idx(codec, 7, 0x3030); |
f9423e7a KY |
307 | } |
308 | ||
1d045db9 | 309 | /* additional initialization for ALC889 variants */ |
87a8c370 JK |
310 | static void alc889_coef_init(struct hda_codec *codec) |
311 | { | |
98b24883 | 312 | alc_update_coef_idx(codec, 7, 0, 0x2010); |
87a8c370 JK |
313 | } |
314 | ||
3fb4a508 TI |
315 | /* turn on/off EAPD control (only if available) */ |
316 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) | |
317 | { | |
318 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) | |
319 | return; | |
320 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) | |
321 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, | |
322 | on ? 2 : 0); | |
323 | } | |
324 | ||
691f1fcc TI |
325 | /* turn on/off EAPD controls of the codec */ |
326 | static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) | |
327 | { | |
328 | /* We currently only handle front, HP */ | |
39fa84e9 TI |
329 | static hda_nid_t pins[] = { |
330 | 0x0f, 0x10, 0x14, 0x15, 0 | |
331 | }; | |
332 | hda_nid_t *p; | |
333 | for (p = pins; *p; p++) | |
334 | set_eapd(codec, *p, on); | |
691f1fcc TI |
335 | } |
336 | ||
1c716153 TI |
337 | /* generic shutup callback; |
338 | * just turning off EPAD and a little pause for avoiding pop-noise | |
339 | */ | |
340 | static void alc_eapd_shutup(struct hda_codec *codec) | |
341 | { | |
97a26570 KY |
342 | struct alc_spec *spec = codec->spec; |
343 | ||
1c716153 | 344 | alc_auto_setup_eapd(codec, false); |
97a26570 KY |
345 | if (!spec->no_depop_delay) |
346 | msleep(200); | |
9bfb2844 | 347 | snd_hda_shutup_pins(codec); |
1c716153 TI |
348 | } |
349 | ||
1d045db9 | 350 | /* generic EAPD initialization */ |
4a79ba34 | 351 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
bc9f98a9 | 352 | { |
39fa84e9 | 353 | alc_auto_setup_eapd(codec, true); |
4a79ba34 TI |
354 | switch (type) { |
355 | case ALC_INIT_GPIO1: | |
bc9f98a9 KY |
356 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
357 | break; | |
4a79ba34 | 358 | case ALC_INIT_GPIO2: |
bc9f98a9 KY |
359 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
360 | break; | |
4a79ba34 | 361 | case ALC_INIT_GPIO3: |
bdd148a3 KY |
362 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
363 | break; | |
4a79ba34 | 364 | case ALC_INIT_DEFAULT: |
c9b58006 KY |
365 | switch (codec->vendor_id) { |
366 | case 0x10ec0260: | |
98b24883 | 367 | alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); |
c9b58006 KY |
368 | break; |
369 | case 0x10ec0262: | |
370 | case 0x10ec0880: | |
371 | case 0x10ec0882: | |
372 | case 0x10ec0883: | |
373 | case 0x10ec0885: | |
4a5a4c56 | 374 | case 0x10ec0887: |
20b67ddd | 375 | /*case 0x10ec0889:*/ /* this causes an SPDIF problem */ |
acf08081 | 376 | case 0x10ec0900: |
87a8c370 | 377 | alc889_coef_init(codec); |
c9b58006 | 378 | break; |
f9423e7a | 379 | case 0x10ec0888: |
4a79ba34 | 380 | alc888_coef_init(codec); |
f9423e7a | 381 | break; |
0aea778e | 382 | #if 0 /* XXX: This may cause the silent output on speaker on some machines */ |
c9b58006 KY |
383 | case 0x10ec0267: |
384 | case 0x10ec0268: | |
98b24883 | 385 | alc_update_coef_idx(codec, 7, 0, 0x3000); |
c9b58006 | 386 | break; |
0aea778e | 387 | #endif /* XXX */ |
bc9f98a9 | 388 | } |
4a79ba34 TI |
389 | break; |
390 | } | |
391 | } | |
392 | ||
08c189f2 | 393 | |
1d045db9 | 394 | /* |
08c189f2 | 395 | * Realtek SSID verification |
1d045db9 | 396 | */ |
42cf0d01 | 397 | |
08c189f2 TI |
398 | /* Could be any non-zero and even value. When used as fixup, tells |
399 | * the driver to ignore any present sku defines. | |
400 | */ | |
401 | #define ALC_FIXUP_SKU_IGNORE (2) | |
1a1455de | 402 | |
08c189f2 TI |
403 | static void alc_fixup_sku_ignore(struct hda_codec *codec, |
404 | const struct hda_fixup *fix, int action) | |
1a1455de | 405 | { |
1a1455de | 406 | struct alc_spec *spec = codec->spec; |
08c189f2 TI |
407 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
408 | spec->cdefine.fixup = 1; | |
409 | spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE; | |
1a1455de | 410 | } |
1a1455de TI |
411 | } |
412 | ||
b5c6611f ML |
413 | static void alc_fixup_no_depop_delay(struct hda_codec *codec, |
414 | const struct hda_fixup *fix, int action) | |
415 | { | |
416 | struct alc_spec *spec = codec->spec; | |
417 | ||
84d2dc3e | 418 | if (action == HDA_FIXUP_ACT_PROBE) { |
b5c6611f | 419 | spec->no_depop_delay = 1; |
84d2dc3e ML |
420 | codec->depop_delay = 0; |
421 | } | |
b5c6611f ML |
422 | } |
423 | ||
08c189f2 | 424 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
4a79ba34 | 425 | { |
08c189f2 TI |
426 | unsigned int ass, tmp, i; |
427 | unsigned nid = 0; | |
4a79ba34 TI |
428 | struct alc_spec *spec = codec->spec; |
429 | ||
08c189f2 | 430 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
4a79ba34 | 431 | |
08c189f2 TI |
432 | if (spec->cdefine.fixup) { |
433 | ass = spec->cdefine.sku_cfg; | |
434 | if (ass == ALC_FIXUP_SKU_IGNORE) | |
435 | return -1; | |
436 | goto do_sku; | |
bb35febd TI |
437 | } |
438 | ||
5100cd07 TI |
439 | if (!codec->bus->pci) |
440 | return -1; | |
08c189f2 TI |
441 | ass = codec->subsystem_id & 0xffff; |
442 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) | |
443 | goto do_sku; | |
4a79ba34 | 444 | |
08c189f2 TI |
445 | nid = 0x1d; |
446 | if (codec->vendor_id == 0x10ec0260) | |
447 | nid = 0x17; | |
448 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
42cf0d01 | 449 | |
08c189f2 | 450 | if (!(ass & 1)) { |
4e76a883 TI |
451 | codec_info(codec, "%s: SKU not ready 0x%08x\n", |
452 | codec->chip_name, ass); | |
08c189f2 | 453 | return -1; |
42cf0d01 DH |
454 | } |
455 | ||
08c189f2 TI |
456 | /* check sum */ |
457 | tmp = 0; | |
458 | for (i = 1; i < 16; i++) { | |
459 | if ((ass >> i) & 1) | |
460 | tmp++; | |
ae8a60a5 | 461 | } |
08c189f2 TI |
462 | if (((ass >> 16) & 0xf) != tmp) |
463 | return -1; | |
ae8a60a5 | 464 | |
da00c244 KY |
465 | spec->cdefine.port_connectivity = ass >> 30; |
466 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; | |
467 | spec->cdefine.check_sum = (ass >> 16) & 0xf; | |
468 | spec->cdefine.customization = ass >> 8; | |
469 | do_sku: | |
470 | spec->cdefine.sku_cfg = ass; | |
471 | spec->cdefine.external_amp = (ass & 0x38) >> 3; | |
472 | spec->cdefine.platform_type = (ass & 0x4) >> 2; | |
473 | spec->cdefine.swap = (ass & 0x2) >> 1; | |
474 | spec->cdefine.override = ass & 0x1; | |
475 | ||
4e76a883 | 476 | codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", |
da00c244 | 477 | nid, spec->cdefine.sku_cfg); |
4e76a883 | 478 | codec_dbg(codec, "SKU: port_connectivity=0x%x\n", |
da00c244 | 479 | spec->cdefine.port_connectivity); |
4e76a883 TI |
480 | codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
481 | codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); | |
482 | codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); | |
483 | codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); | |
484 | codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); | |
485 | codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); | |
486 | codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); | |
da00c244 KY |
487 | |
488 | return 0; | |
489 | } | |
490 | ||
08c189f2 TI |
491 | /* return the position of NID in the list, or -1 if not found */ |
492 | static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums) | |
493 | { | |
494 | int i; | |
495 | for (i = 0; i < nums; i++) | |
496 | if (list[i] == nid) | |
497 | return i; | |
498 | return -1; | |
499 | } | |
1d045db9 | 500 | /* return true if the given NID is found in the list */ |
3af9ee6b TI |
501 | static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums) |
502 | { | |
21268961 | 503 | return find_idx_in_nid_list(nid, list, nums) >= 0; |
3af9ee6b TI |
504 | } |
505 | ||
4a79ba34 TI |
506 | /* check subsystem ID and set up device-specific initialization; |
507 | * return 1 if initialized, 0 if invalid SSID | |
508 | */ | |
509 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. | |
510 | * 31 ~ 16 : Manufacture ID | |
511 | * 15 ~ 8 : SKU ID | |
512 | * 7 ~ 0 : Assembly ID | |
513 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 | |
514 | */ | |
58c57cfa | 515 | static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) |
4a79ba34 TI |
516 | { |
517 | unsigned int ass, tmp, i; | |
518 | unsigned nid; | |
519 | struct alc_spec *spec = codec->spec; | |
520 | ||
90622917 DH |
521 | if (spec->cdefine.fixup) { |
522 | ass = spec->cdefine.sku_cfg; | |
523 | if (ass == ALC_FIXUP_SKU_IGNORE) | |
524 | return 0; | |
525 | goto do_sku; | |
526 | } | |
527 | ||
4a79ba34 | 528 | ass = codec->subsystem_id & 0xffff; |
5100cd07 TI |
529 | if (codec->bus->pci && |
530 | ass != codec->bus->pci->subsystem_device && (ass & 1)) | |
4a79ba34 TI |
531 | goto do_sku; |
532 | ||
533 | /* invalid SSID, check the special NID pin defcfg instead */ | |
534 | /* | |
def319f9 | 535 | * 31~30 : port connectivity |
4a79ba34 TI |
536 | * 29~21 : reserve |
537 | * 20 : PCBEEP input | |
538 | * 19~16 : Check sum (15:1) | |
539 | * 15~1 : Custom | |
540 | * 0 : override | |
541 | */ | |
542 | nid = 0x1d; | |
543 | if (codec->vendor_id == 0x10ec0260) | |
544 | nid = 0x17; | |
545 | ass = snd_hda_codec_get_pincfg(codec, nid); | |
4e76a883 TI |
546 | codec_dbg(codec, |
547 | "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n", | |
cb6605c1 | 548 | ass, nid); |
6227cdce | 549 | if (!(ass & 1)) |
4a79ba34 TI |
550 | return 0; |
551 | if ((ass >> 30) != 1) /* no physical connection */ | |
552 | return 0; | |
553 | ||
554 | /* check sum */ | |
555 | tmp = 0; | |
556 | for (i = 1; i < 16; i++) { | |
557 | if ((ass >> i) & 1) | |
558 | tmp++; | |
559 | } | |
560 | if (((ass >> 16) & 0xf) != tmp) | |
561 | return 0; | |
562 | do_sku: | |
4e76a883 | 563 | codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
4a79ba34 TI |
564 | ass & 0xffff, codec->vendor_id); |
565 | /* | |
566 | * 0 : override | |
567 | * 1 : Swap Jack | |
568 | * 2 : 0 --> Desktop, 1 --> Laptop | |
569 | * 3~5 : External Amplifier control | |
570 | * 7~6 : Reserved | |
571 | */ | |
572 | tmp = (ass & 0x38) >> 3; /* external Amp control */ | |
573 | switch (tmp) { | |
574 | case 1: | |
575 | spec->init_amp = ALC_INIT_GPIO1; | |
576 | break; | |
577 | case 3: | |
578 | spec->init_amp = ALC_INIT_GPIO2; | |
579 | break; | |
580 | case 7: | |
581 | spec->init_amp = ALC_INIT_GPIO3; | |
582 | break; | |
583 | case 5: | |
5a8cfb4e | 584 | default: |
4a79ba34 | 585 | spec->init_amp = ALC_INIT_DEFAULT; |
bc9f98a9 KY |
586 | break; |
587 | } | |
ea1fb29a | 588 | |
8c427226 | 589 | /* is laptop or Desktop and enable the function "Mute internal speaker |
c9b58006 KY |
590 | * when the external headphone out jack is plugged" |
591 | */ | |
8c427226 | 592 | if (!(ass & 0x8000)) |
4a79ba34 | 593 | return 1; |
c9b58006 KY |
594 | /* |
595 | * 10~8 : Jack location | |
596 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered | |
597 | * 14~13: Resvered | |
598 | * 15 : 1 --> enable the function "Mute internal speaker | |
599 | * when the external headphone out jack is plugged" | |
600 | */ | |
08c189f2 TI |
601 | if (!spec->gen.autocfg.hp_pins[0] && |
602 | !(spec->gen.autocfg.line_out_pins[0] && | |
603 | spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) { | |
01d4825d | 604 | hda_nid_t nid; |
c9b58006 | 605 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
58c57cfa | 606 | nid = ports[tmp]; |
08c189f2 TI |
607 | if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins, |
608 | spec->gen.autocfg.line_outs)) | |
3af9ee6b | 609 | return 1; |
08c189f2 | 610 | spec->gen.autocfg.hp_pins[0] = nid; |
c9b58006 | 611 | } |
4a79ba34 TI |
612 | return 1; |
613 | } | |
ea1fb29a | 614 | |
3e6179b8 TI |
615 | /* Check the validity of ALC subsystem-id |
616 | * ports contains an array of 4 pin NIDs for port-A, E, D and I */ | |
617 | static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) | |
4a79ba34 | 618 | { |
58c57cfa | 619 | if (!alc_subsystem_id(codec, ports)) { |
4a79ba34 | 620 | struct alc_spec *spec = codec->spec; |
4e76a883 TI |
621 | codec_dbg(codec, |
622 | "realtek: Enable default setup for auto mode as fallback\n"); | |
4a79ba34 | 623 | spec->init_amp = ALC_INIT_DEFAULT; |
4a79ba34 | 624 | } |
21268961 | 625 | } |
1a1455de | 626 | |
1d045db9 | 627 | /* |
ef8ef5fb | 628 | */ |
f9e336f6 | 629 | |
08c189f2 | 630 | static hda_nid_t get_adc_nid(struct hda_codec *codec, int adc_idx, int imux_idx) |
f9e336f6 | 631 | { |
08c189f2 TI |
632 | struct hda_gen_spec *spec = codec->spec; |
633 | if (spec->dyn_adc_switch) | |
634 | adc_idx = spec->dyn_adc_idx[imux_idx]; | |
635 | return spec->adc_nids[adc_idx]; | |
f9e336f6 TI |
636 | } |
637 | ||
666a70d4 | 638 | static void alc_inv_dmic_sync_adc(struct hda_codec *codec, int adc_idx) |
f9e336f6 | 639 | { |
f9e336f6 | 640 | struct alc_spec *spec = codec->spec; |
08c189f2 | 641 | struct hda_input_mux *imux = &spec->gen.input_mux; |
666a70d4 TI |
642 | struct nid_path *path; |
643 | hda_nid_t nid; | |
644 | int i, dir, parm; | |
645 | unsigned int val; | |
f9e336f6 | 646 | |
666a70d4 | 647 | for (i = 0; i < imux->num_items; i++) { |
08c189f2 | 648 | if (spec->gen.imux_pins[i] == spec->inv_dmic_pin) |
666a70d4 | 649 | break; |
a23b688f | 650 | } |
666a70d4 TI |
651 | if (i >= imux->num_items) |
652 | return; | |
a23b688f | 653 | |
08c189f2 TI |
654 | path = snd_hda_get_nid_path(codec, spec->inv_dmic_pin, |
655 | get_adc_nid(codec, adc_idx, i)); | |
666a70d4 TI |
656 | val = path->ctls[NID_PATH_MUTE_CTL]; |
657 | if (!val) | |
658 | return; | |
659 | nid = get_amp_nid_(val); | |
660 | dir = get_amp_direction_(val); | |
661 | parm = AC_AMP_SET_RIGHT | | |
662 | (dir == HDA_OUTPUT ? AC_AMP_SET_OUTPUT : AC_AMP_SET_INPUT); | |
a23b688f | 663 | |
c4f3ebed | 664 | /* flush all cached amps at first */ |
dc870f38 | 665 | snd_hda_codec_flush_cache(codec); |
a23b688f | 666 | |
666a70d4 TI |
667 | /* we care only right channel */ |
668 | val = snd_hda_codec_amp_read(codec, nid, 1, dir, 0); | |
669 | if (val & 0x80) /* if already muted, we don't need to touch */ | |
670 | return; | |
671 | val |= 0x80; | |
672 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | |
673 | parm | val); | |
f9e336f6 TI |
674 | } |
675 | ||
125821ae TI |
676 | /* |
677 | * Inverted digital-mic handling | |
678 | * | |
679 | * First off, it's a bit tricky. The "Inverted Internal Mic Capture Switch" | |
680 | * gives the additional mute only to the right channel of the digital mic | |
681 | * capture stream. This is a workaround for avoiding the almost silence | |
682 | * by summing the stereo stream from some (known to be ForteMedia) | |
683 | * digital mic unit. | |
684 | * | |
685 | * The logic is to call alc_inv_dmic_sync() after each action (possibly) | |
686 | * modifying ADC amp. When the mute flag is set, it mutes the R-channel | |
687 | * without caching so that the cache can still keep the original value. | |
688 | * The cached value is then restored when the flag is set off or any other | |
689 | * than d-mic is used as the current input source. | |
690 | */ | |
691 | static void alc_inv_dmic_sync(struct hda_codec *codec, bool force) | |
692 | { | |
693 | struct alc_spec *spec = codec->spec; | |
666a70d4 | 694 | int src, nums; |
125821ae TI |
695 | |
696 | if (!spec->inv_dmic_fixup) | |
697 | return; | |
698 | if (!spec->inv_dmic_muted && !force) | |
699 | return; | |
08c189f2 | 700 | nums = spec->gen.dyn_adc_switch ? 1 : spec->gen.num_adc_nids; |
666a70d4 | 701 | for (src = 0; src < nums; src++) { |
125821ae | 702 | bool dmic_fixup = false; |
125821ae TI |
703 | |
704 | if (spec->inv_dmic_muted && | |
08c189f2 | 705 | spec->gen.imux_pins[spec->gen.cur_mux[src]] == spec->inv_dmic_pin) |
125821ae TI |
706 | dmic_fixup = true; |
707 | if (!dmic_fixup && !force) | |
708 | continue; | |
666a70d4 | 709 | alc_inv_dmic_sync_adc(codec, src); |
125821ae TI |
710 | } |
711 | } | |
712 | ||
a90229e0 | 713 | static void alc_inv_dmic_hook(struct hda_codec *codec, |
7fe30711 TI |
714 | struct snd_kcontrol *kcontrol, |
715 | struct snd_ctl_elem_value *ucontrol) | |
08c189f2 TI |
716 | { |
717 | alc_inv_dmic_sync(codec, false); | |
718 | } | |
719 | ||
125821ae TI |
720 | static int alc_inv_dmic_sw_get(struct snd_kcontrol *kcontrol, |
721 | struct snd_ctl_elem_value *ucontrol) | |
722 | { | |
723 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
724 | struct alc_spec *spec = codec->spec; | |
725 | ||
726 | ucontrol->value.integer.value[0] = !spec->inv_dmic_muted; | |
727 | return 0; | |
728 | } | |
729 | ||
730 | static int alc_inv_dmic_sw_put(struct snd_kcontrol *kcontrol, | |
731 | struct snd_ctl_elem_value *ucontrol) | |
732 | { | |
733 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | |
734 | struct alc_spec *spec = codec->spec; | |
735 | unsigned int val = !ucontrol->value.integer.value[0]; | |
736 | ||
737 | if (val == spec->inv_dmic_muted) | |
738 | return 0; | |
739 | spec->inv_dmic_muted = val; | |
740 | alc_inv_dmic_sync(codec, true); | |
741 | return 0; | |
742 | } | |
743 | ||
744 | static const struct snd_kcontrol_new alc_inv_dmic_sw = { | |
745 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
bc549767 | 746 | .name = "Inverted Internal Mic Capture Switch", |
125821ae TI |
747 | .info = snd_ctl_boolean_mono_info, |
748 | .get = alc_inv_dmic_sw_get, | |
749 | .put = alc_inv_dmic_sw_put, | |
750 | }; | |
751 | ||
752 | static int alc_add_inv_dmic_mixer(struct hda_codec *codec, hda_nid_t nid) | |
753 | { | |
754 | struct alc_spec *spec = codec->spec; | |
668d1e96 | 755 | |
08c189f2 | 756 | if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &alc_inv_dmic_sw)) |
125821ae TI |
757 | return -ENOMEM; |
758 | spec->inv_dmic_fixup = 1; | |
759 | spec->inv_dmic_muted = 0; | |
760 | spec->inv_dmic_pin = nid; | |
08c189f2 | 761 | spec->gen.cap_sync_hook = alc_inv_dmic_hook; |
125821ae TI |
762 | return 0; |
763 | } | |
764 | ||
6e72aa5f TI |
765 | /* typically the digital mic is put at node 0x12 */ |
766 | static void alc_fixup_inv_dmic_0x12(struct hda_codec *codec, | |
1727a771 | 767 | const struct hda_fixup *fix, int action) |
6e72aa5f | 768 | { |
1727a771 | 769 | if (action == HDA_FIXUP_ACT_PROBE) |
6e72aa5f TI |
770 | alc_add_inv_dmic_mixer(codec, 0x12); |
771 | } | |
772 | ||
e9edcee0 | 773 | |
1d045db9 TI |
774 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
775 | /* additional beep mixers; the actual parameters are overwritten at build */ | |
776 | static const struct snd_kcontrol_new alc_beep_mixer[] = { | |
777 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), | |
778 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), | |
16ded525 TI |
779 | { } /* end */ |
780 | }; | |
1d045db9 | 781 | #endif |
16ded525 | 782 | |
08c189f2 | 783 | static int alc_build_controls(struct hda_codec *codec) |
1d045db9 TI |
784 | { |
785 | struct alc_spec *spec = codec->spec; | |
08c189f2 | 786 | int i, err; |
e9427969 | 787 | |
08c189f2 TI |
788 | err = snd_hda_gen_build_controls(codec); |
789 | if (err < 0) | |
790 | return err; | |
1da177e4 LT |
791 | |
792 | for (i = 0; i < spec->num_mixers; i++) { | |
793 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); | |
794 | if (err < 0) | |
795 | return err; | |
796 | } | |
2134ea4f | 797 | |
67d634c0 | 798 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
45bdd1c1 TI |
799 | /* create beep controls if needed */ |
800 | if (spec->beep_amp) { | |
a9111321 | 801 | const struct snd_kcontrol_new *knew; |
45bdd1c1 TI |
802 | for (knew = alc_beep_mixer; knew->name; knew++) { |
803 | struct snd_kcontrol *kctl; | |
804 | kctl = snd_ctl_new1(knew, codec); | |
805 | if (!kctl) | |
08c189f2 TI |
806 | return -ENOMEM; |
807 | kctl->private_value = spec->beep_amp; | |
808 | err = snd_hda_ctl_add(codec, 0, kctl); | |
809 | if (err < 0) | |
810 | return err; | |
1d045db9 | 811 | } |
863b4518 | 812 | } |
08c189f2 | 813 | #endif |
1c4a54b4 | 814 | |
1727a771 | 815 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); |
1c4a54b4 | 816 | return 0; |
a361d84b KY |
817 | } |
818 | ||
a361d84b | 819 | |
df694daa | 820 | /* |
08c189f2 | 821 | * Common callbacks |
df694daa | 822 | */ |
a361d84b | 823 | |
08c189f2 | 824 | static int alc_init(struct hda_codec *codec) |
1d045db9 TI |
825 | { |
826 | struct alc_spec *spec = codec->spec; | |
a361d84b | 827 | |
08c189f2 TI |
828 | if (spec->init_hook) |
829 | spec->init_hook(codec); | |
a361d84b | 830 | |
08c189f2 TI |
831 | alc_fix_pll(codec); |
832 | alc_auto_init_amp(codec, spec->init_amp); | |
3abf2f36 | 833 | |
08c189f2 | 834 | snd_hda_gen_init(codec); |
a361d84b | 835 | |
1727a771 | 836 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); |
a361d84b | 837 | |
1d045db9 TI |
838 | return 0; |
839 | } | |
a361d84b | 840 | |
08c189f2 | 841 | static inline void alc_shutup(struct hda_codec *codec) |
1d045db9 TI |
842 | { |
843 | struct alc_spec *spec = codec->spec; | |
a361d84b | 844 | |
08c189f2 TI |
845 | if (spec && spec->shutup) |
846 | spec->shutup(codec); | |
9bfb2844 TI |
847 | else |
848 | snd_hda_shutup_pins(codec); | |
1d045db9 TI |
849 | } |
850 | ||
8a02c0cc | 851 | #define alc_free snd_hda_gen_free |
2134ea4f | 852 | |
08c189f2 TI |
853 | #ifdef CONFIG_PM |
854 | static void alc_power_eapd(struct hda_codec *codec) | |
1d045db9 | 855 | { |
08c189f2 | 856 | alc_auto_setup_eapd(codec, false); |
1d045db9 | 857 | } |
2134ea4f | 858 | |
08c189f2 | 859 | static int alc_suspend(struct hda_codec *codec) |
1d045db9 TI |
860 | { |
861 | struct alc_spec *spec = codec->spec; | |
08c189f2 TI |
862 | alc_shutup(codec); |
863 | if (spec && spec->power_hook) | |
864 | spec->power_hook(codec); | |
a361d84b KY |
865 | return 0; |
866 | } | |
08c189f2 | 867 | #endif |
a361d84b | 868 | |
08c189f2 TI |
869 | #ifdef CONFIG_PM |
870 | static int alc_resume(struct hda_codec *codec) | |
1d045db9 | 871 | { |
97a26570 KY |
872 | struct alc_spec *spec = codec->spec; |
873 | ||
874 | if (!spec->no_depop_delay) | |
875 | msleep(150); /* to avoid pop noise */ | |
08c189f2 TI |
876 | codec->patch_ops.init(codec); |
877 | snd_hda_codec_resume_amp(codec); | |
878 | snd_hda_codec_resume_cache(codec); | |
879 | alc_inv_dmic_sync(codec, true); | |
880 | hda_call_check_power_status(codec, 0x01); | |
881 | return 0; | |
1d045db9 | 882 | } |
08c189f2 | 883 | #endif |
f6a92248 | 884 | |
1d045db9 | 885 | /* |
1d045db9 | 886 | */ |
08c189f2 TI |
887 | static const struct hda_codec_ops alc_patch_ops = { |
888 | .build_controls = alc_build_controls, | |
889 | .build_pcms = snd_hda_gen_build_pcms, | |
890 | .init = alc_init, | |
891 | .free = alc_free, | |
892 | .unsol_event = snd_hda_jack_unsol_event, | |
893 | #ifdef CONFIG_PM | |
894 | .resume = alc_resume, | |
08c189f2 | 895 | .suspend = alc_suspend, |
fce52a3b | 896 | .check_power_status = snd_hda_gen_check_power_status, |
08c189f2 TI |
897 | #endif |
898 | .reboot_notify = alc_shutup, | |
899 | }; | |
f6a92248 | 900 | |
f53281e6 | 901 | |
08c189f2 TI |
902 | /* replace the codec chip_name with the given string */ |
903 | static int alc_codec_rename(struct hda_codec *codec, const char *name) | |
1d045db9 | 904 | { |
08c189f2 TI |
905 | kfree(codec->chip_name); |
906 | codec->chip_name = kstrdup(name, GFP_KERNEL); | |
907 | if (!codec->chip_name) { | |
908 | alc_free(codec); | |
909 | return -ENOMEM; | |
1d045db9 | 910 | } |
a361d84b | 911 | return 0; |
1d045db9 | 912 | } |
e01bf509 | 913 | |
e4770629 | 914 | /* |
4b016931 | 915 | * Rename codecs appropriately from COEF value or subvendor id |
e4770629 | 916 | */ |
08c189f2 TI |
917 | struct alc_codec_rename_table { |
918 | unsigned int vendor_id; | |
919 | unsigned short coef_mask; | |
920 | unsigned short coef_bits; | |
921 | const char *name; | |
922 | }; | |
84898e87 | 923 | |
4b016931 KY |
924 | struct alc_codec_rename_pci_table { |
925 | unsigned int codec_vendor_id; | |
926 | unsigned short pci_subvendor; | |
927 | unsigned short pci_subdevice; | |
928 | const char *name; | |
929 | }; | |
930 | ||
08c189f2 | 931 | static struct alc_codec_rename_table rename_tbl[] = { |
e6e5f7ad | 932 | { 0x10ec0221, 0xf00f, 0x1003, "ALC231" }, |
08c189f2 TI |
933 | { 0x10ec0269, 0xfff0, 0x3010, "ALC277" }, |
934 | { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" }, | |
935 | { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" }, | |
936 | { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" }, | |
937 | { 0x10ec0269, 0xffff, 0xa023, "ALC259" }, | |
938 | { 0x10ec0269, 0xffff, 0x6023, "ALC281X" }, | |
939 | { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" }, | |
940 | { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" }, | |
e6e5f7ad | 941 | { 0x10ec0662, 0xffff, 0x4020, "ALC656" }, |
08c189f2 TI |
942 | { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" }, |
943 | { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" }, | |
944 | { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" }, | |
945 | { 0x10ec0899, 0x2000, 0x2000, "ALC899" }, | |
946 | { 0x10ec0892, 0xffff, 0x8020, "ALC661" }, | |
947 | { 0x10ec0892, 0xffff, 0x8011, "ALC661" }, | |
948 | { 0x10ec0892, 0xffff, 0x4011, "ALC656" }, | |
949 | { } /* terminator */ | |
950 | }; | |
84898e87 | 951 | |
4b016931 KY |
952 | static struct alc_codec_rename_pci_table rename_pci_tbl[] = { |
953 | { 0x10ec0280, 0x1028, 0, "ALC3220" }, | |
954 | { 0x10ec0282, 0x1028, 0, "ALC3221" }, | |
955 | { 0x10ec0283, 0x1028, 0, "ALC3223" }, | |
193177de | 956 | { 0x10ec0288, 0x1028, 0, "ALC3263" }, |
4b016931 | 957 | { 0x10ec0292, 0x1028, 0, "ALC3226" }, |
193177de | 958 | { 0x10ec0293, 0x1028, 0, "ALC3235" }, |
4b016931 KY |
959 | { 0x10ec0255, 0x1028, 0, "ALC3234" }, |
960 | { 0x10ec0668, 0x1028, 0, "ALC3661" }, | |
e6e5f7ad KY |
961 | { 0x10ec0275, 0x1028, 0, "ALC3260" }, |
962 | { 0x10ec0899, 0x1028, 0, "ALC3861" }, | |
963 | { 0x10ec0670, 0x1025, 0, "ALC669X" }, | |
964 | { 0x10ec0676, 0x1025, 0, "ALC679X" }, | |
965 | { 0x10ec0282, 0x1043, 0, "ALC3229" }, | |
966 | { 0x10ec0233, 0x1043, 0, "ALC3236" }, | |
967 | { 0x10ec0280, 0x103c, 0, "ALC3228" }, | |
968 | { 0x10ec0282, 0x103c, 0, "ALC3227" }, | |
969 | { 0x10ec0286, 0x103c, 0, "ALC3242" }, | |
970 | { 0x10ec0290, 0x103c, 0, "ALC3241" }, | |
971 | { 0x10ec0668, 0x103c, 0, "ALC3662" }, | |
972 | { 0x10ec0283, 0x17aa, 0, "ALC3239" }, | |
973 | { 0x10ec0292, 0x17aa, 0, "ALC3232" }, | |
4b016931 KY |
974 | { } /* terminator */ |
975 | }; | |
976 | ||
08c189f2 | 977 | static int alc_codec_rename_from_preset(struct hda_codec *codec) |
1d045db9 | 978 | { |
08c189f2 | 979 | const struct alc_codec_rename_table *p; |
4b016931 | 980 | const struct alc_codec_rename_pci_table *q; |
60db6b53 | 981 | |
08c189f2 TI |
982 | for (p = rename_tbl; p->vendor_id; p++) { |
983 | if (p->vendor_id != codec->vendor_id) | |
984 | continue; | |
985 | if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) | |
986 | return alc_codec_rename(codec, p->name); | |
1d045db9 | 987 | } |
4b016931 | 988 | |
5100cd07 TI |
989 | if (!codec->bus->pci) |
990 | return 0; | |
4b016931 KY |
991 | for (q = rename_pci_tbl; q->codec_vendor_id; q++) { |
992 | if (q->codec_vendor_id != codec->vendor_id) | |
993 | continue; | |
994 | if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) | |
995 | continue; | |
996 | if (!q->pci_subdevice || | |
997 | q->pci_subdevice == codec->bus->pci->subsystem_device) | |
998 | return alc_codec_rename(codec, q->name); | |
999 | } | |
1000 | ||
08c189f2 | 1001 | return 0; |
1d045db9 | 1002 | } |
f53281e6 | 1003 | |
e4770629 | 1004 | |
1d045db9 TI |
1005 | /* |
1006 | * Digital-beep handlers | |
1007 | */ | |
1008 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | |
1009 | #define set_beep_amp(spec, nid, idx, dir) \ | |
1010 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) | |
84898e87 | 1011 | |
1d045db9 | 1012 | static const struct snd_pci_quirk beep_white_list[] = { |
7110005e | 1013 | SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1), |
a4b7f21d | 1014 | SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1), |
1d045db9 | 1015 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
8554ee40 | 1016 | SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1), |
1d045db9 TI |
1017 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
1018 | SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1), | |
1019 | SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1), | |
78f8baf1 | 1020 | SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1), |
1d045db9 TI |
1021 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
1022 | {} | |
fe3eb0a7 KY |
1023 | }; |
1024 | ||
1d045db9 TI |
1025 | static inline int has_cdefine_beep(struct hda_codec *codec) |
1026 | { | |
1027 | struct alc_spec *spec = codec->spec; | |
1028 | const struct snd_pci_quirk *q; | |
1029 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); | |
1030 | if (q) | |
1031 | return q->value; | |
1032 | return spec->cdefine.enable_pcbeep; | |
1033 | } | |
1034 | #else | |
1035 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ | |
1036 | #define has_cdefine_beep(codec) 0 | |
1037 | #endif | |
84898e87 | 1038 | |
1d045db9 TI |
1039 | /* parse the BIOS configuration and set up the alc_spec */ |
1040 | /* return 1 if successful, 0 if the proper config is not found, | |
1041 | * or a negative error code | |
1042 | */ | |
3e6179b8 TI |
1043 | static int alc_parse_auto_config(struct hda_codec *codec, |
1044 | const hda_nid_t *ignore_nids, | |
1045 | const hda_nid_t *ssid_nids) | |
1d045db9 TI |
1046 | { |
1047 | struct alc_spec *spec = codec->spec; | |
08c189f2 | 1048 | struct auto_pin_cfg *cfg = &spec->gen.autocfg; |
1d045db9 | 1049 | int err; |
26f5df26 | 1050 | |
53c334ad TI |
1051 | err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, |
1052 | spec->parse_flags); | |
1d045db9 TI |
1053 | if (err < 0) |
1054 | return err; | |
3e6179b8 TI |
1055 | |
1056 | if (ssid_nids) | |
1057 | alc_ssid_check(codec, ssid_nids); | |
64154835 | 1058 | |
08c189f2 TI |
1059 | err = snd_hda_gen_parse_auto_config(codec, cfg); |
1060 | if (err < 0) | |
1061 | return err; | |
070cff4c | 1062 | |
1d045db9 | 1063 | return 1; |
60db6b53 | 1064 | } |
f6a92248 | 1065 | |
3de95173 TI |
1066 | /* common preparation job for alc_spec */ |
1067 | static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) | |
1068 | { | |
1069 | struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL); | |
1070 | int err; | |
1071 | ||
1072 | if (!spec) | |
1073 | return -ENOMEM; | |
1074 | codec->spec = spec; | |
08c189f2 TI |
1075 | snd_hda_gen_spec_init(&spec->gen); |
1076 | spec->gen.mixer_nid = mixer_nid; | |
1077 | spec->gen.own_eapd_ctl = 1; | |
1098b7c2 | 1078 | codec->single_adc_amp = 1; |
08c189f2 TI |
1079 | /* FIXME: do we need this for all Realtek codec models? */ |
1080 | codec->spdif_status_reset = 1; | |
3de95173 TI |
1081 | |
1082 | err = alc_codec_rename_from_preset(codec); | |
1083 | if (err < 0) { | |
1084 | kfree(spec); | |
1085 | return err; | |
1086 | } | |
1087 | return 0; | |
1088 | } | |
1089 | ||
3e6179b8 TI |
1090 | static int alc880_parse_auto_config(struct hda_codec *codec) |
1091 | { | |
1092 | static const hda_nid_t alc880_ignore[] = { 0x1d, 0 }; | |
7d7eb9ea | 1093 | static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
3e6179b8 TI |
1094 | return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); |
1095 | } | |
1096 | ||
ee3b2969 TI |
1097 | /* |
1098 | * ALC880 fix-ups | |
1099 | */ | |
1100 | enum { | |
411225a0 | 1101 | ALC880_FIXUP_GPIO1, |
ee3b2969 TI |
1102 | ALC880_FIXUP_GPIO2, |
1103 | ALC880_FIXUP_MEDION_RIM, | |
dc6af52d | 1104 | ALC880_FIXUP_LG, |
db8a38e5 | 1105 | ALC880_FIXUP_LG_LW25, |
f02aab5d | 1106 | ALC880_FIXUP_W810, |
27e917f8 | 1107 | ALC880_FIXUP_EAPD_COEF, |
b9368f5c | 1108 | ALC880_FIXUP_TCL_S700, |
cf5a2279 TI |
1109 | ALC880_FIXUP_VOL_KNOB, |
1110 | ALC880_FIXUP_FUJITSU, | |
ba533818 | 1111 | ALC880_FIXUP_F1734, |
817de92f | 1112 | ALC880_FIXUP_UNIWILL, |
967b88c4 | 1113 | ALC880_FIXUP_UNIWILL_DIG, |
96e225f6 | 1114 | ALC880_FIXUP_Z71V, |
487a588d | 1115 | ALC880_FIXUP_ASUS_W5A, |
67b6ec31 TI |
1116 | ALC880_FIXUP_3ST_BASE, |
1117 | ALC880_FIXUP_3ST, | |
1118 | ALC880_FIXUP_3ST_DIG, | |
1119 | ALC880_FIXUP_5ST_BASE, | |
1120 | ALC880_FIXUP_5ST, | |
1121 | ALC880_FIXUP_5ST_DIG, | |
1122 | ALC880_FIXUP_6ST_BASE, | |
1123 | ALC880_FIXUP_6ST, | |
1124 | ALC880_FIXUP_6ST_DIG, | |
5397145f | 1125 | ALC880_FIXUP_6ST_AUTOMUTE, |
ee3b2969 TI |
1126 | }; |
1127 | ||
cf5a2279 TI |
1128 | /* enable the volume-knob widget support on NID 0x21 */ |
1129 | static void alc880_fixup_vol_knob(struct hda_codec *codec, | |
1727a771 | 1130 | const struct hda_fixup *fix, int action) |
cf5a2279 | 1131 | { |
1727a771 | 1132 | if (action == HDA_FIXUP_ACT_PROBE) |
29adc4b9 | 1133 | snd_hda_jack_detect_enable_callback(codec, 0x21, ALC_DCVOL_EVENT, alc_update_knob_master); |
cf5a2279 TI |
1134 | } |
1135 | ||
1727a771 | 1136 | static const struct hda_fixup alc880_fixups[] = { |
411225a0 | 1137 | [ALC880_FIXUP_GPIO1] = { |
1727a771 | 1138 | .type = HDA_FIXUP_VERBS, |
411225a0 TI |
1139 | .v.verbs = alc_gpio1_init_verbs, |
1140 | }, | |
ee3b2969 | 1141 | [ALC880_FIXUP_GPIO2] = { |
1727a771 | 1142 | .type = HDA_FIXUP_VERBS, |
ee3b2969 TI |
1143 | .v.verbs = alc_gpio2_init_verbs, |
1144 | }, | |
1145 | [ALC880_FIXUP_MEDION_RIM] = { | |
1727a771 | 1146 | .type = HDA_FIXUP_VERBS, |
ee3b2969 TI |
1147 | .v.verbs = (const struct hda_verb[]) { |
1148 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
1149 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 }, | |
1150 | { } | |
1151 | }, | |
1152 | .chained = true, | |
1153 | .chain_id = ALC880_FIXUP_GPIO2, | |
1154 | }, | |
dc6af52d | 1155 | [ALC880_FIXUP_LG] = { |
1727a771 TI |
1156 | .type = HDA_FIXUP_PINS, |
1157 | .v.pins = (const struct hda_pintbl[]) { | |
dc6af52d TI |
1158 | /* disable bogus unused pins */ |
1159 | { 0x16, 0x411111f0 }, | |
1160 | { 0x18, 0x411111f0 }, | |
1161 | { 0x1a, 0x411111f0 }, | |
1162 | { } | |
1163 | } | |
1164 | }, | |
db8a38e5 TI |
1165 | [ALC880_FIXUP_LG_LW25] = { |
1166 | .type = HDA_FIXUP_PINS, | |
1167 | .v.pins = (const struct hda_pintbl[]) { | |
1168 | { 0x1a, 0x0181344f }, /* line-in */ | |
1169 | { 0x1b, 0x0321403f }, /* headphone */ | |
1170 | { } | |
1171 | } | |
1172 | }, | |
f02aab5d | 1173 | [ALC880_FIXUP_W810] = { |
1727a771 TI |
1174 | .type = HDA_FIXUP_PINS, |
1175 | .v.pins = (const struct hda_pintbl[]) { | |
f02aab5d TI |
1176 | /* disable bogus unused pins */ |
1177 | { 0x17, 0x411111f0 }, | |
1178 | { } | |
1179 | }, | |
1180 | .chained = true, | |
1181 | .chain_id = ALC880_FIXUP_GPIO2, | |
1182 | }, | |
27e917f8 | 1183 | [ALC880_FIXUP_EAPD_COEF] = { |
1727a771 | 1184 | .type = HDA_FIXUP_VERBS, |
27e917f8 TI |
1185 | .v.verbs = (const struct hda_verb[]) { |
1186 | /* change to EAPD mode */ | |
1187 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
1188 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 }, | |
1189 | {} | |
1190 | }, | |
1191 | }, | |
b9368f5c | 1192 | [ALC880_FIXUP_TCL_S700] = { |
1727a771 | 1193 | .type = HDA_FIXUP_VERBS, |
b9368f5c TI |
1194 | .v.verbs = (const struct hda_verb[]) { |
1195 | /* change to EAPD mode */ | |
1196 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
1197 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, | |
1198 | {} | |
1199 | }, | |
1200 | .chained = true, | |
1201 | .chain_id = ALC880_FIXUP_GPIO2, | |
1202 | }, | |
cf5a2279 | 1203 | [ALC880_FIXUP_VOL_KNOB] = { |
1727a771 | 1204 | .type = HDA_FIXUP_FUNC, |
cf5a2279 TI |
1205 | .v.func = alc880_fixup_vol_knob, |
1206 | }, | |
1207 | [ALC880_FIXUP_FUJITSU] = { | |
1208 | /* override all pins as BIOS on old Amilo is broken */ | |
1727a771 TI |
1209 | .type = HDA_FIXUP_PINS, |
1210 | .v.pins = (const struct hda_pintbl[]) { | |
cf5a2279 TI |
1211 | { 0x14, 0x0121411f }, /* HP */ |
1212 | { 0x15, 0x99030120 }, /* speaker */ | |
1213 | { 0x16, 0x99030130 }, /* bass speaker */ | |
1214 | { 0x17, 0x411111f0 }, /* N/A */ | |
1215 | { 0x18, 0x411111f0 }, /* N/A */ | |
1216 | { 0x19, 0x01a19950 }, /* mic-in */ | |
1217 | { 0x1a, 0x411111f0 }, /* N/A */ | |
1218 | { 0x1b, 0x411111f0 }, /* N/A */ | |
1219 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1220 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1221 | { 0x1e, 0x01454140 }, /* SPDIF out */ | |
1222 | { } | |
1223 | }, | |
1224 | .chained = true, | |
1225 | .chain_id = ALC880_FIXUP_VOL_KNOB, | |
1226 | }, | |
ba533818 TI |
1227 | [ALC880_FIXUP_F1734] = { |
1228 | /* almost compatible with FUJITSU, but no bass and SPDIF */ | |
1727a771 TI |
1229 | .type = HDA_FIXUP_PINS, |
1230 | .v.pins = (const struct hda_pintbl[]) { | |
ba533818 TI |
1231 | { 0x14, 0x0121411f }, /* HP */ |
1232 | { 0x15, 0x99030120 }, /* speaker */ | |
1233 | { 0x16, 0x411111f0 }, /* N/A */ | |
1234 | { 0x17, 0x411111f0 }, /* N/A */ | |
1235 | { 0x18, 0x411111f0 }, /* N/A */ | |
1236 | { 0x19, 0x01a19950 }, /* mic-in */ | |
1237 | { 0x1a, 0x411111f0 }, /* N/A */ | |
1238 | { 0x1b, 0x411111f0 }, /* N/A */ | |
1239 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1240 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1241 | { 0x1e, 0x411111f0 }, /* N/A */ | |
1242 | { } | |
1243 | }, | |
1244 | .chained = true, | |
1245 | .chain_id = ALC880_FIXUP_VOL_KNOB, | |
1246 | }, | |
817de92f TI |
1247 | [ALC880_FIXUP_UNIWILL] = { |
1248 | /* need to fix HP and speaker pins to be parsed correctly */ | |
1727a771 TI |
1249 | .type = HDA_FIXUP_PINS, |
1250 | .v.pins = (const struct hda_pintbl[]) { | |
817de92f TI |
1251 | { 0x14, 0x0121411f }, /* HP */ |
1252 | { 0x15, 0x99030120 }, /* speaker */ | |
1253 | { 0x16, 0x99030130 }, /* bass speaker */ | |
1254 | { } | |
1255 | }, | |
1256 | }, | |
967b88c4 | 1257 | [ALC880_FIXUP_UNIWILL_DIG] = { |
1727a771 TI |
1258 | .type = HDA_FIXUP_PINS, |
1259 | .v.pins = (const struct hda_pintbl[]) { | |
967b88c4 TI |
1260 | /* disable bogus unused pins */ |
1261 | { 0x17, 0x411111f0 }, | |
1262 | { 0x19, 0x411111f0 }, | |
1263 | { 0x1b, 0x411111f0 }, | |
1264 | { 0x1f, 0x411111f0 }, | |
1265 | { } | |
1266 | } | |
1267 | }, | |
96e225f6 | 1268 | [ALC880_FIXUP_Z71V] = { |
1727a771 TI |
1269 | .type = HDA_FIXUP_PINS, |
1270 | .v.pins = (const struct hda_pintbl[]) { | |
96e225f6 TI |
1271 | /* set up the whole pins as BIOS is utterly broken */ |
1272 | { 0x14, 0x99030120 }, /* speaker */ | |
1273 | { 0x15, 0x0121411f }, /* HP */ | |
1274 | { 0x16, 0x411111f0 }, /* N/A */ | |
1275 | { 0x17, 0x411111f0 }, /* N/A */ | |
1276 | { 0x18, 0x01a19950 }, /* mic-in */ | |
1277 | { 0x19, 0x411111f0 }, /* N/A */ | |
1278 | { 0x1a, 0x01813031 }, /* line-in */ | |
1279 | { 0x1b, 0x411111f0 }, /* N/A */ | |
1280 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1281 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1282 | { 0x1e, 0x0144111e }, /* SPDIF */ | |
1283 | { } | |
1284 | } | |
1285 | }, | |
487a588d TI |
1286 | [ALC880_FIXUP_ASUS_W5A] = { |
1287 | .type = HDA_FIXUP_PINS, | |
1288 | .v.pins = (const struct hda_pintbl[]) { | |
1289 | /* set up the whole pins as BIOS is utterly broken */ | |
1290 | { 0x14, 0x0121411f }, /* HP */ | |
1291 | { 0x15, 0x411111f0 }, /* N/A */ | |
1292 | { 0x16, 0x411111f0 }, /* N/A */ | |
1293 | { 0x17, 0x411111f0 }, /* N/A */ | |
1294 | { 0x18, 0x90a60160 }, /* mic */ | |
1295 | { 0x19, 0x411111f0 }, /* N/A */ | |
1296 | { 0x1a, 0x411111f0 }, /* N/A */ | |
1297 | { 0x1b, 0x411111f0 }, /* N/A */ | |
1298 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1299 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1300 | { 0x1e, 0xb743111e }, /* SPDIF out */ | |
1301 | { } | |
1302 | }, | |
1303 | .chained = true, | |
1304 | .chain_id = ALC880_FIXUP_GPIO1, | |
1305 | }, | |
67b6ec31 | 1306 | [ALC880_FIXUP_3ST_BASE] = { |
1727a771 TI |
1307 | .type = HDA_FIXUP_PINS, |
1308 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1309 | { 0x14, 0x01014010 }, /* line-out */ |
1310 | { 0x15, 0x411111f0 }, /* N/A */ | |
1311 | { 0x16, 0x411111f0 }, /* N/A */ | |
1312 | { 0x17, 0x411111f0 }, /* N/A */ | |
1313 | { 0x18, 0x01a19c30 }, /* mic-in */ | |
1314 | { 0x19, 0x0121411f }, /* HP */ | |
1315 | { 0x1a, 0x01813031 }, /* line-in */ | |
1316 | { 0x1b, 0x02a19c40 }, /* front-mic */ | |
1317 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1318 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1319 | /* 0x1e is filled in below */ | |
1320 | { 0x1f, 0x411111f0 }, /* N/A */ | |
1321 | { } | |
1322 | } | |
1323 | }, | |
1324 | [ALC880_FIXUP_3ST] = { | |
1727a771 TI |
1325 | .type = HDA_FIXUP_PINS, |
1326 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1327 | { 0x1e, 0x411111f0 }, /* N/A */ |
1328 | { } | |
1329 | }, | |
1330 | .chained = true, | |
1331 | .chain_id = ALC880_FIXUP_3ST_BASE, | |
1332 | }, | |
1333 | [ALC880_FIXUP_3ST_DIG] = { | |
1727a771 TI |
1334 | .type = HDA_FIXUP_PINS, |
1335 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1336 | { 0x1e, 0x0144111e }, /* SPDIF */ |
1337 | { } | |
1338 | }, | |
1339 | .chained = true, | |
1340 | .chain_id = ALC880_FIXUP_3ST_BASE, | |
1341 | }, | |
1342 | [ALC880_FIXUP_5ST_BASE] = { | |
1727a771 TI |
1343 | .type = HDA_FIXUP_PINS, |
1344 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1345 | { 0x14, 0x01014010 }, /* front */ |
1346 | { 0x15, 0x411111f0 }, /* N/A */ | |
1347 | { 0x16, 0x01011411 }, /* CLFE */ | |
1348 | { 0x17, 0x01016412 }, /* surr */ | |
1349 | { 0x18, 0x01a19c30 }, /* mic-in */ | |
1350 | { 0x19, 0x0121411f }, /* HP */ | |
1351 | { 0x1a, 0x01813031 }, /* line-in */ | |
1352 | { 0x1b, 0x02a19c40 }, /* front-mic */ | |
1353 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1354 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1355 | /* 0x1e is filled in below */ | |
1356 | { 0x1f, 0x411111f0 }, /* N/A */ | |
1357 | { } | |
1358 | } | |
1359 | }, | |
1360 | [ALC880_FIXUP_5ST] = { | |
1727a771 TI |
1361 | .type = HDA_FIXUP_PINS, |
1362 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1363 | { 0x1e, 0x411111f0 }, /* N/A */ |
1364 | { } | |
1365 | }, | |
1366 | .chained = true, | |
1367 | .chain_id = ALC880_FIXUP_5ST_BASE, | |
1368 | }, | |
1369 | [ALC880_FIXUP_5ST_DIG] = { | |
1727a771 TI |
1370 | .type = HDA_FIXUP_PINS, |
1371 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1372 | { 0x1e, 0x0144111e }, /* SPDIF */ |
1373 | { } | |
1374 | }, | |
1375 | .chained = true, | |
1376 | .chain_id = ALC880_FIXUP_5ST_BASE, | |
1377 | }, | |
1378 | [ALC880_FIXUP_6ST_BASE] = { | |
1727a771 TI |
1379 | .type = HDA_FIXUP_PINS, |
1380 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1381 | { 0x14, 0x01014010 }, /* front */ |
1382 | { 0x15, 0x01016412 }, /* surr */ | |
1383 | { 0x16, 0x01011411 }, /* CLFE */ | |
1384 | { 0x17, 0x01012414 }, /* side */ | |
1385 | { 0x18, 0x01a19c30 }, /* mic-in */ | |
1386 | { 0x19, 0x02a19c40 }, /* front-mic */ | |
1387 | { 0x1a, 0x01813031 }, /* line-in */ | |
1388 | { 0x1b, 0x0121411f }, /* HP */ | |
1389 | { 0x1c, 0x411111f0 }, /* N/A */ | |
1390 | { 0x1d, 0x411111f0 }, /* N/A */ | |
1391 | /* 0x1e is filled in below */ | |
1392 | { 0x1f, 0x411111f0 }, /* N/A */ | |
1393 | { } | |
1394 | } | |
1395 | }, | |
1396 | [ALC880_FIXUP_6ST] = { | |
1727a771 TI |
1397 | .type = HDA_FIXUP_PINS, |
1398 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1399 | { 0x1e, 0x411111f0 }, /* N/A */ |
1400 | { } | |
1401 | }, | |
1402 | .chained = true, | |
1403 | .chain_id = ALC880_FIXUP_6ST_BASE, | |
1404 | }, | |
1405 | [ALC880_FIXUP_6ST_DIG] = { | |
1727a771 TI |
1406 | .type = HDA_FIXUP_PINS, |
1407 | .v.pins = (const struct hda_pintbl[]) { | |
67b6ec31 TI |
1408 | { 0x1e, 0x0144111e }, /* SPDIF */ |
1409 | { } | |
1410 | }, | |
1411 | .chained = true, | |
1412 | .chain_id = ALC880_FIXUP_6ST_BASE, | |
1413 | }, | |
5397145f TI |
1414 | [ALC880_FIXUP_6ST_AUTOMUTE] = { |
1415 | .type = HDA_FIXUP_PINS, | |
1416 | .v.pins = (const struct hda_pintbl[]) { | |
1417 | { 0x1b, 0x0121401f }, /* HP with jack detect */ | |
1418 | { } | |
1419 | }, | |
1420 | .chained_before = true, | |
1421 | .chain_id = ALC880_FIXUP_6ST_BASE, | |
1422 | }, | |
ee3b2969 TI |
1423 | }; |
1424 | ||
1425 | static const struct snd_pci_quirk alc880_fixup_tbl[] = { | |
f02aab5d | 1426 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810), |
487a588d | 1427 | SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A), |
96e225f6 | 1428 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V), |
29e3fdcc | 1429 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1), |
6538de03 | 1430 | SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE), |
29e3fdcc | 1431 | SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2), |
27e917f8 | 1432 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF), |
967b88c4 | 1433 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG), |
ba533818 | 1434 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734), |
817de92f | 1435 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL), |
7833c7e8 | 1436 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB), |
f02aab5d | 1437 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810), |
ee3b2969 | 1438 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM), |
5397145f | 1439 | SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE), |
ba533818 | 1440 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734), |
cf5a2279 | 1441 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU), |
ba533818 | 1442 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734), |
cf5a2279 | 1443 | SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU), |
dc6af52d TI |
1444 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG), |
1445 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG), | |
1446 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG), | |
db8a38e5 | 1447 | SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25), |
b9368f5c | 1448 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700), |
67b6ec31 TI |
1449 | |
1450 | /* Below is the copied entries from alc880_quirks.c. | |
1451 | * It's not quite sure whether BIOS sets the correct pin-config table | |
1452 | * on these machines, thus they are kept to be compatible with | |
1453 | * the old static quirks. Once when it's confirmed to work without | |
1454 | * these overrides, it'd be better to remove. | |
1455 | */ | |
1456 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG), | |
1457 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST), | |
1458 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG), | |
1459 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG), | |
1460 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG), | |
1461 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG), | |
1462 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG), | |
1463 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST), | |
1464 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG), | |
1465 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST), | |
1466 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST), | |
1467 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST), | |
1468 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST), | |
1469 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST), | |
1470 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG), | |
1471 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG), | |
1472 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG), | |
1473 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG), | |
1474 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG), | |
1475 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG), | |
1476 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG), | |
1477 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */ | |
1478 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG), | |
1479 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1480 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1481 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1482 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG), | |
1483 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1484 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG), | |
1485 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG), | |
1486 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1487 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1488 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG), | |
1489 | /* default Intel */ | |
1490 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST), | |
1491 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG), | |
1492 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG), | |
1493 | {} | |
1494 | }; | |
1495 | ||
1727a771 | 1496 | static const struct hda_model_fixup alc880_fixup_models[] = { |
67b6ec31 TI |
1497 | {.id = ALC880_FIXUP_3ST, .name = "3stack"}, |
1498 | {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"}, | |
1499 | {.id = ALC880_FIXUP_5ST, .name = "5stack"}, | |
1500 | {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"}, | |
1501 | {.id = ALC880_FIXUP_6ST, .name = "6stack"}, | |
1502 | {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"}, | |
5397145f | 1503 | {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"}, |
ee3b2969 TI |
1504 | {} |
1505 | }; | |
1506 | ||
1507 | ||
1d045db9 TI |
1508 | /* |
1509 | * OK, here we have finally the patch for ALC880 | |
1510 | */ | |
1d045db9 | 1511 | static int patch_alc880(struct hda_codec *codec) |
60db6b53 | 1512 | { |
1d045db9 | 1513 | struct alc_spec *spec; |
1d045db9 | 1514 | int err; |
f6a92248 | 1515 | |
3de95173 TI |
1516 | err = alc_alloc_spec(codec, 0x0b); |
1517 | if (err < 0) | |
1518 | return err; | |
64154835 | 1519 | |
3de95173 | 1520 | spec = codec->spec; |
08c189f2 | 1521 | spec->gen.need_dac_fix = 1; |
7504b6cd | 1522 | spec->gen.beep_nid = 0x01; |
f53281e6 | 1523 | |
1727a771 | 1524 | snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, |
67b6ec31 | 1525 | alc880_fixups); |
1727a771 | 1526 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
ee3b2969 | 1527 | |
67b6ec31 TI |
1528 | /* automatic parse from the BIOS config */ |
1529 | err = alc880_parse_auto_config(codec); | |
1530 | if (err < 0) | |
1531 | goto error; | |
fe3eb0a7 | 1532 | |
7504b6cd | 1533 | if (!spec->gen.no_analog) |
3e6179b8 | 1534 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
f53281e6 | 1535 | |
1d045db9 | 1536 | codec->patch_ops = alc_patch_ops; |
29adc4b9 DH |
1537 | codec->patch_ops.unsol_event = alc880_unsol_event; |
1538 | ||
f53281e6 | 1539 | |
1727a771 | 1540 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 1541 | |
1d045db9 | 1542 | return 0; |
e16fb6d1 TI |
1543 | |
1544 | error: | |
1545 | alc_free(codec); | |
1546 | return err; | |
226b1ec8 KY |
1547 | } |
1548 | ||
1d045db9 | 1549 | |
60db6b53 | 1550 | /* |
1d045db9 | 1551 | * ALC260 support |
60db6b53 | 1552 | */ |
1d045db9 | 1553 | static int alc260_parse_auto_config(struct hda_codec *codec) |
f6a92248 | 1554 | { |
1d045db9 | 1555 | static const hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
3e6179b8 TI |
1556 | static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 }; |
1557 | return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); | |
f6a92248 KY |
1558 | } |
1559 | ||
1d045db9 TI |
1560 | /* |
1561 | * Pin config fixes | |
1562 | */ | |
1563 | enum { | |
ca8f0424 TI |
1564 | ALC260_FIXUP_HP_DC5750, |
1565 | ALC260_FIXUP_HP_PIN_0F, | |
1566 | ALC260_FIXUP_COEF, | |
15317ab2 | 1567 | ALC260_FIXUP_GPIO1, |
20f7d928 TI |
1568 | ALC260_FIXUP_GPIO1_TOGGLE, |
1569 | ALC260_FIXUP_REPLACER, | |
0a1c4fa2 | 1570 | ALC260_FIXUP_HP_B1900, |
118cb4a4 | 1571 | ALC260_FIXUP_KN1, |
39aedee7 | 1572 | ALC260_FIXUP_FSC_S7020, |
5ebd3bbd | 1573 | ALC260_FIXUP_FSC_S7020_JWSE, |
d08c5ef2 | 1574 | ALC260_FIXUP_VAIO_PINS, |
1d045db9 TI |
1575 | }; |
1576 | ||
20f7d928 TI |
1577 | static void alc260_gpio1_automute(struct hda_codec *codec) |
1578 | { | |
1579 | struct alc_spec *spec = codec->spec; | |
1580 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, | |
08c189f2 | 1581 | spec->gen.hp_jack_present); |
20f7d928 TI |
1582 | } |
1583 | ||
1584 | static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, | |
1727a771 | 1585 | const struct hda_fixup *fix, int action) |
20f7d928 TI |
1586 | { |
1587 | struct alc_spec *spec = codec->spec; | |
1727a771 | 1588 | if (action == HDA_FIXUP_ACT_PROBE) { |
20f7d928 TI |
1589 | /* although the machine has only one output pin, we need to |
1590 | * toggle GPIO1 according to the jack state | |
1591 | */ | |
08c189f2 TI |
1592 | spec->gen.automute_hook = alc260_gpio1_automute; |
1593 | spec->gen.detect_hp = 1; | |
1594 | spec->gen.automute_speaker = 1; | |
1595 | spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */ | |
1596 | snd_hda_jack_detect_enable_callback(codec, 0x0f, HDA_GEN_HP_EVENT, | |
1597 | snd_hda_gen_hp_automute); | |
c9ce6b26 | 1598 | snd_hda_add_verbs(codec, alc_gpio1_init_verbs); |
20f7d928 TI |
1599 | } |
1600 | } | |
1601 | ||
118cb4a4 | 1602 | static void alc260_fixup_kn1(struct hda_codec *codec, |
1727a771 | 1603 | const struct hda_fixup *fix, int action) |
118cb4a4 TI |
1604 | { |
1605 | struct alc_spec *spec = codec->spec; | |
1727a771 | 1606 | static const struct hda_pintbl pincfgs[] = { |
118cb4a4 TI |
1607 | { 0x0f, 0x02214000 }, /* HP/speaker */ |
1608 | { 0x12, 0x90a60160 }, /* int mic */ | |
1609 | { 0x13, 0x02a19000 }, /* ext mic */ | |
1610 | { 0x18, 0x01446000 }, /* SPDIF out */ | |
1611 | /* disable bogus I/O pins */ | |
1612 | { 0x10, 0x411111f0 }, | |
1613 | { 0x11, 0x411111f0 }, | |
1614 | { 0x14, 0x411111f0 }, | |
1615 | { 0x15, 0x411111f0 }, | |
1616 | { 0x16, 0x411111f0 }, | |
1617 | { 0x17, 0x411111f0 }, | |
1618 | { 0x19, 0x411111f0 }, | |
1619 | { } | |
1620 | }; | |
1621 | ||
1622 | switch (action) { | |
1727a771 TI |
1623 | case HDA_FIXUP_ACT_PRE_PROBE: |
1624 | snd_hda_apply_pincfgs(codec, pincfgs); | |
118cb4a4 | 1625 | break; |
1727a771 | 1626 | case HDA_FIXUP_ACT_PROBE: |
118cb4a4 TI |
1627 | spec->init_amp = ALC_INIT_NONE; |
1628 | break; | |
1629 | } | |
1630 | } | |
1631 | ||
39aedee7 TI |
1632 | static void alc260_fixup_fsc_s7020(struct hda_codec *codec, |
1633 | const struct hda_fixup *fix, int action) | |
1634 | { | |
1635 | struct alc_spec *spec = codec->spec; | |
5ebd3bbd TI |
1636 | if (action == HDA_FIXUP_ACT_PROBE) |
1637 | spec->init_amp = ALC_INIT_NONE; | |
1638 | } | |
39aedee7 | 1639 | |
5ebd3bbd TI |
1640 | static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, |
1641 | const struct hda_fixup *fix, int action) | |
1642 | { | |
1643 | struct alc_spec *spec = codec->spec; | |
1644 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
f811c3cf | 1645 | spec->gen.add_jack_modes = 1; |
5ebd3bbd | 1646 | spec->gen.hp_mic = 1; |
e6e0ee50 | 1647 | } |
39aedee7 TI |
1648 | } |
1649 | ||
1727a771 | 1650 | static const struct hda_fixup alc260_fixups[] = { |
ca8f0424 | 1651 | [ALC260_FIXUP_HP_DC5750] = { |
1727a771 TI |
1652 | .type = HDA_FIXUP_PINS, |
1653 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 TI |
1654 | { 0x11, 0x90130110 }, /* speaker */ |
1655 | { } | |
1656 | } | |
1657 | }, | |
ca8f0424 | 1658 | [ALC260_FIXUP_HP_PIN_0F] = { |
1727a771 TI |
1659 | .type = HDA_FIXUP_PINS, |
1660 | .v.pins = (const struct hda_pintbl[]) { | |
ca8f0424 TI |
1661 | { 0x0f, 0x01214000 }, /* HP */ |
1662 | { } | |
1663 | } | |
1664 | }, | |
1665 | [ALC260_FIXUP_COEF] = { | |
1727a771 | 1666 | .type = HDA_FIXUP_VERBS, |
ca8f0424 | 1667 | .v.verbs = (const struct hda_verb[]) { |
e30cf2d2 RM |
1668 | { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 }, |
1669 | { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 }, | |
ca8f0424 TI |
1670 | { } |
1671 | }, | |
ca8f0424 | 1672 | }, |
15317ab2 | 1673 | [ALC260_FIXUP_GPIO1] = { |
1727a771 | 1674 | .type = HDA_FIXUP_VERBS, |
15317ab2 TI |
1675 | .v.verbs = alc_gpio1_init_verbs, |
1676 | }, | |
20f7d928 | 1677 | [ALC260_FIXUP_GPIO1_TOGGLE] = { |
1727a771 | 1678 | .type = HDA_FIXUP_FUNC, |
20f7d928 TI |
1679 | .v.func = alc260_fixup_gpio1_toggle, |
1680 | .chained = true, | |
1681 | .chain_id = ALC260_FIXUP_HP_PIN_0F, | |
1682 | }, | |
1683 | [ALC260_FIXUP_REPLACER] = { | |
1727a771 | 1684 | .type = HDA_FIXUP_VERBS, |
20f7d928 | 1685 | .v.verbs = (const struct hda_verb[]) { |
192a98e2 TI |
1686 | { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 }, |
1687 | { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 }, | |
20f7d928 TI |
1688 | { } |
1689 | }, | |
1690 | .chained = true, | |
1691 | .chain_id = ALC260_FIXUP_GPIO1_TOGGLE, | |
1692 | }, | |
0a1c4fa2 | 1693 | [ALC260_FIXUP_HP_B1900] = { |
1727a771 | 1694 | .type = HDA_FIXUP_FUNC, |
0a1c4fa2 TI |
1695 | .v.func = alc260_fixup_gpio1_toggle, |
1696 | .chained = true, | |
1697 | .chain_id = ALC260_FIXUP_COEF, | |
118cb4a4 TI |
1698 | }, |
1699 | [ALC260_FIXUP_KN1] = { | |
1727a771 | 1700 | .type = HDA_FIXUP_FUNC, |
118cb4a4 TI |
1701 | .v.func = alc260_fixup_kn1, |
1702 | }, | |
39aedee7 TI |
1703 | [ALC260_FIXUP_FSC_S7020] = { |
1704 | .type = HDA_FIXUP_FUNC, | |
1705 | .v.func = alc260_fixup_fsc_s7020, | |
1706 | }, | |
5ebd3bbd TI |
1707 | [ALC260_FIXUP_FSC_S7020_JWSE] = { |
1708 | .type = HDA_FIXUP_FUNC, | |
1709 | .v.func = alc260_fixup_fsc_s7020_jwse, | |
1710 | .chained = true, | |
1711 | .chain_id = ALC260_FIXUP_FSC_S7020, | |
1712 | }, | |
d08c5ef2 TI |
1713 | [ALC260_FIXUP_VAIO_PINS] = { |
1714 | .type = HDA_FIXUP_PINS, | |
1715 | .v.pins = (const struct hda_pintbl[]) { | |
1716 | /* Pin configs are missing completely on some VAIOs */ | |
1717 | { 0x0f, 0x01211020 }, | |
1718 | { 0x10, 0x0001003f }, | |
1719 | { 0x11, 0x411111f0 }, | |
1720 | { 0x12, 0x01a15930 }, | |
1721 | { 0x13, 0x411111f0 }, | |
1722 | { 0x14, 0x411111f0 }, | |
1723 | { 0x15, 0x411111f0 }, | |
1724 | { 0x16, 0x411111f0 }, | |
1725 | { 0x17, 0x411111f0 }, | |
1726 | { 0x18, 0x411111f0 }, | |
1727 | { 0x19, 0x411111f0 }, | |
1728 | { } | |
1729 | } | |
1730 | }, | |
1d045db9 TI |
1731 | }; |
1732 | ||
1733 | static const struct snd_pci_quirk alc260_fixup_tbl[] = { | |
15317ab2 | 1734 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1), |
ca8f0424 | 1735 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF), |
15317ab2 | 1736 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1), |
ca8f0424 | 1737 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750), |
0a1c4fa2 | 1738 | SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900), |
d08c5ef2 | 1739 | SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS), |
0f5a5b85 | 1740 | SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F), |
39aedee7 | 1741 | SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020), |
b1f58085 | 1742 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1), |
118cb4a4 | 1743 | SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1), |
20f7d928 | 1744 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER), |
ca8f0424 | 1745 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF), |
1d045db9 TI |
1746 | {} |
1747 | }; | |
1748 | ||
5ebd3bbd TI |
1749 | static const struct hda_model_fixup alc260_fixup_models[] = { |
1750 | {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"}, | |
1751 | {.id = ALC260_FIXUP_COEF, .name = "coef"}, | |
1752 | {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"}, | |
1753 | {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"}, | |
1754 | {} | |
1755 | }; | |
1756 | ||
1d045db9 TI |
1757 | /* |
1758 | */ | |
1d045db9 | 1759 | static int patch_alc260(struct hda_codec *codec) |
977ddd6b | 1760 | { |
1d045db9 | 1761 | struct alc_spec *spec; |
c3c2c9e7 | 1762 | int err; |
1d045db9 | 1763 | |
3de95173 TI |
1764 | err = alc_alloc_spec(codec, 0x07); |
1765 | if (err < 0) | |
1766 | return err; | |
1d045db9 | 1767 | |
3de95173 | 1768 | spec = codec->spec; |
ea46c3c8 TI |
1769 | /* as quite a few machines require HP amp for speaker outputs, |
1770 | * it's easier to enable it unconditionally; even if it's unneeded, | |
1771 | * it's almost harmless. | |
1772 | */ | |
1773 | spec->gen.prefer_hp_amp = 1; | |
7504b6cd | 1774 | spec->gen.beep_nid = 0x01; |
1d045db9 | 1775 | |
5ebd3bbd TI |
1776 | snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, |
1777 | alc260_fixups); | |
1727a771 | 1778 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
977ddd6b | 1779 | |
c3c2c9e7 TI |
1780 | /* automatic parse from the BIOS config */ |
1781 | err = alc260_parse_auto_config(codec); | |
1782 | if (err < 0) | |
1783 | goto error; | |
977ddd6b | 1784 | |
7504b6cd | 1785 | if (!spec->gen.no_analog) |
3e6179b8 | 1786 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
977ddd6b | 1787 | |
1d045db9 | 1788 | codec->patch_ops = alc_patch_ops; |
1d045db9 | 1789 | spec->shutup = alc_eapd_shutup; |
6981d184 | 1790 | |
1727a771 | 1791 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 1792 | |
1d045db9 | 1793 | return 0; |
e16fb6d1 TI |
1794 | |
1795 | error: | |
1796 | alc_free(codec); | |
1797 | return err; | |
6981d184 TI |
1798 | } |
1799 | ||
1d045db9 TI |
1800 | |
1801 | /* | |
1802 | * ALC882/883/885/888/889 support | |
1803 | * | |
1804 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible | |
1805 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
1806 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
1807 | * 6-channel independent captures. | |
1808 | * | |
1809 | * In addition, an independent DAC for the multi-playback (not used in this | |
1810 | * driver yet). | |
1811 | */ | |
1d045db9 TI |
1812 | |
1813 | /* | |
1814 | * Pin config fixes | |
1815 | */ | |
ff818c24 | 1816 | enum { |
5c0ebfbe TI |
1817 | ALC882_FIXUP_ABIT_AW9D_MAX, |
1818 | ALC882_FIXUP_LENOVO_Y530, | |
1819 | ALC882_FIXUP_PB_M5210, | |
1820 | ALC882_FIXUP_ACER_ASPIRE_7736, | |
1821 | ALC882_FIXUP_ASUS_W90V, | |
8f239214 | 1822 | ALC889_FIXUP_CD, |
b2c53e20 | 1823 | ALC889_FIXUP_FRONT_HP_NO_PRESENCE, |
5c0ebfbe | 1824 | ALC889_FIXUP_VAIO_TT, |
0e7cc2e7 | 1825 | ALC888_FIXUP_EEE1601, |
177943a3 | 1826 | ALC882_FIXUP_EAPD, |
7a6069bf | 1827 | ALC883_FIXUP_EAPD, |
8812c4f9 | 1828 | ALC883_FIXUP_ACER_EAPD, |
1a97b7f2 TI |
1829 | ALC882_FIXUP_GPIO1, |
1830 | ALC882_FIXUP_GPIO2, | |
eb844d51 | 1831 | ALC882_FIXUP_GPIO3, |
68ef0561 TI |
1832 | ALC889_FIXUP_COEF, |
1833 | ALC882_FIXUP_ASUS_W2JC, | |
c3e837bb TI |
1834 | ALC882_FIXUP_ACER_ASPIRE_4930G, |
1835 | ALC882_FIXUP_ACER_ASPIRE_8930G, | |
1836 | ALC882_FIXUP_ASPIRE_8930G_VERBS, | |
5671087f | 1837 | ALC885_FIXUP_MACPRO_GPIO, |
02a237b2 | 1838 | ALC889_FIXUP_DAC_ROUTE, |
1a97b7f2 TI |
1839 | ALC889_FIXUP_MBP_VREF, |
1840 | ALC889_FIXUP_IMAC91_VREF, | |
e7729a41 | 1841 | ALC889_FIXUP_MBA11_VREF, |
0756f09c | 1842 | ALC889_FIXUP_MBA21_VREF, |
c20f31ec | 1843 | ALC889_FIXUP_MP11_VREF, |
6e72aa5f | 1844 | ALC882_FIXUP_INV_DMIC, |
e427c237 | 1845 | ALC882_FIXUP_NO_PRIMARY_HP, |
1f0bbf03 | 1846 | ALC887_FIXUP_ASUS_BASS, |
eb9ca3ab | 1847 | ALC887_FIXUP_BASS_CHMAP, |
ff818c24 TI |
1848 | }; |
1849 | ||
68ef0561 | 1850 | static void alc889_fixup_coef(struct hda_codec *codec, |
1727a771 | 1851 | const struct hda_fixup *fix, int action) |
68ef0561 | 1852 | { |
1727a771 | 1853 | if (action != HDA_FIXUP_ACT_INIT) |
68ef0561 TI |
1854 | return; |
1855 | alc889_coef_init(codec); | |
1856 | } | |
1857 | ||
5671087f TI |
1858 | /* toggle speaker-output according to the hp-jack state */ |
1859 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) | |
1860 | { | |
1861 | unsigned int gpiostate, gpiomask, gpiodir; | |
1862 | ||
1863 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, | |
1864 | AC_VERB_GET_GPIO_DATA, 0); | |
1865 | ||
1866 | if (!muted) | |
1867 | gpiostate |= (1 << pin); | |
1868 | else | |
1869 | gpiostate &= ~(1 << pin); | |
1870 | ||
1871 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, | |
1872 | AC_VERB_GET_GPIO_MASK, 0); | |
1873 | gpiomask |= (1 << pin); | |
1874 | ||
1875 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, | |
1876 | AC_VERB_GET_GPIO_DIRECTION, 0); | |
1877 | gpiodir |= (1 << pin); | |
1878 | ||
1879 | ||
1880 | snd_hda_codec_write(codec, codec->afg, 0, | |
1881 | AC_VERB_SET_GPIO_MASK, gpiomask); | |
1882 | snd_hda_codec_write(codec, codec->afg, 0, | |
1883 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); | |
1884 | ||
1885 | msleep(1); | |
1886 | ||
1887 | snd_hda_codec_write(codec, codec->afg, 0, | |
1888 | AC_VERB_SET_GPIO_DATA, gpiostate); | |
1889 | } | |
1890 | ||
1891 | /* set up GPIO at initialization */ | |
1892 | static void alc885_fixup_macpro_gpio(struct hda_codec *codec, | |
1727a771 | 1893 | const struct hda_fixup *fix, int action) |
5671087f | 1894 | { |
1727a771 | 1895 | if (action != HDA_FIXUP_ACT_INIT) |
5671087f TI |
1896 | return; |
1897 | alc882_gpio_mute(codec, 0, 0); | |
1898 | alc882_gpio_mute(codec, 1, 0); | |
1899 | } | |
1900 | ||
02a237b2 TI |
1901 | /* Fix the connection of some pins for ALC889: |
1902 | * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't | |
1903 | * work correctly (bko#42740) | |
1904 | */ | |
1905 | static void alc889_fixup_dac_route(struct hda_codec *codec, | |
1727a771 | 1906 | const struct hda_fixup *fix, int action) |
02a237b2 | 1907 | { |
1727a771 | 1908 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
ef8d60fb | 1909 | /* fake the connections during parsing the tree */ |
02a237b2 TI |
1910 | hda_nid_t conn1[2] = { 0x0c, 0x0d }; |
1911 | hda_nid_t conn2[2] = { 0x0e, 0x0f }; | |
1912 | snd_hda_override_conn_list(codec, 0x14, 2, conn1); | |
1913 | snd_hda_override_conn_list(codec, 0x15, 2, conn1); | |
1914 | snd_hda_override_conn_list(codec, 0x18, 2, conn2); | |
1915 | snd_hda_override_conn_list(codec, 0x1a, 2, conn2); | |
1727a771 | 1916 | } else if (action == HDA_FIXUP_ACT_PROBE) { |
ef8d60fb TI |
1917 | /* restore the connections */ |
1918 | hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 }; | |
1919 | snd_hda_override_conn_list(codec, 0x14, 5, conn); | |
1920 | snd_hda_override_conn_list(codec, 0x15, 5, conn); | |
1921 | snd_hda_override_conn_list(codec, 0x18, 5, conn); | |
1922 | snd_hda_override_conn_list(codec, 0x1a, 5, conn); | |
02a237b2 TI |
1923 | } |
1924 | } | |
1925 | ||
1a97b7f2 TI |
1926 | /* Set VREF on HP pin */ |
1927 | static void alc889_fixup_mbp_vref(struct hda_codec *codec, | |
1727a771 | 1928 | const struct hda_fixup *fix, int action) |
1a97b7f2 TI |
1929 | { |
1930 | struct alc_spec *spec = codec->spec; | |
1931 | static hda_nid_t nids[2] = { 0x14, 0x15 }; | |
1932 | int i; | |
1933 | ||
1727a771 | 1934 | if (action != HDA_FIXUP_ACT_INIT) |
1a97b7f2 TI |
1935 | return; |
1936 | for (i = 0; i < ARRAY_SIZE(nids); i++) { | |
1937 | unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); | |
1938 | if (get_defcfg_device(val) != AC_JACK_HP_OUT) | |
1939 | continue; | |
d3f02d60 | 1940 | val = snd_hda_codec_get_pin_target(codec, nids[i]); |
1a97b7f2 | 1941 | val |= AC_PINCTL_VREF_80; |
cdd03ced | 1942 | snd_hda_set_pin_ctl(codec, nids[i], val); |
08c189f2 | 1943 | spec->gen.keep_vref_in_automute = 1; |
1a97b7f2 TI |
1944 | break; |
1945 | } | |
1946 | } | |
1947 | ||
0756f09c TI |
1948 | static void alc889_fixup_mac_pins(struct hda_codec *codec, |
1949 | const hda_nid_t *nids, int num_nids) | |
1a97b7f2 TI |
1950 | { |
1951 | struct alc_spec *spec = codec->spec; | |
1a97b7f2 TI |
1952 | int i; |
1953 | ||
0756f09c | 1954 | for (i = 0; i < num_nids; i++) { |
1a97b7f2 | 1955 | unsigned int val; |
d3f02d60 | 1956 | val = snd_hda_codec_get_pin_target(codec, nids[i]); |
1a97b7f2 | 1957 | val |= AC_PINCTL_VREF_50; |
cdd03ced | 1958 | snd_hda_set_pin_ctl(codec, nids[i], val); |
1a97b7f2 | 1959 | } |
08c189f2 | 1960 | spec->gen.keep_vref_in_automute = 1; |
1a97b7f2 TI |
1961 | } |
1962 | ||
0756f09c TI |
1963 | /* Set VREF on speaker pins on imac91 */ |
1964 | static void alc889_fixup_imac91_vref(struct hda_codec *codec, | |
1965 | const struct hda_fixup *fix, int action) | |
1966 | { | |
1967 | static hda_nid_t nids[2] = { 0x18, 0x1a }; | |
1968 | ||
1969 | if (action == HDA_FIXUP_ACT_INIT) | |
1970 | alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); | |
1971 | } | |
1972 | ||
e7729a41 AV |
1973 | /* Set VREF on speaker pins on mba11 */ |
1974 | static void alc889_fixup_mba11_vref(struct hda_codec *codec, | |
1975 | const struct hda_fixup *fix, int action) | |
1976 | { | |
1977 | static hda_nid_t nids[1] = { 0x18 }; | |
1978 | ||
1979 | if (action == HDA_FIXUP_ACT_INIT) | |
1980 | alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); | |
1981 | } | |
1982 | ||
0756f09c TI |
1983 | /* Set VREF on speaker pins on mba21 */ |
1984 | static void alc889_fixup_mba21_vref(struct hda_codec *codec, | |
1985 | const struct hda_fixup *fix, int action) | |
1986 | { | |
1987 | static hda_nid_t nids[2] = { 0x18, 0x19 }; | |
1988 | ||
1989 | if (action == HDA_FIXUP_ACT_INIT) | |
1990 | alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); | |
1991 | } | |
1992 | ||
e427c237 | 1993 | /* Don't take HP output as primary |
d9111496 FLVC |
1994 | * Strangely, the speaker output doesn't work on Vaio Z and some Vaio |
1995 | * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05 | |
e427c237 TI |
1996 | */ |
1997 | static void alc882_fixup_no_primary_hp(struct hda_codec *codec, | |
1727a771 | 1998 | const struct hda_fixup *fix, int action) |
e427c237 TI |
1999 | { |
2000 | struct alc_spec *spec = codec->spec; | |
da96fb5b | 2001 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
08c189f2 | 2002 | spec->gen.no_primary_hp = 1; |
da96fb5b TI |
2003 | spec->gen.no_multi_io = 1; |
2004 | } | |
e427c237 TI |
2005 | } |
2006 | ||
eb9ca3ab TI |
2007 | static void alc_fixup_bass_chmap(struct hda_codec *codec, |
2008 | const struct hda_fixup *fix, int action); | |
2009 | ||
1727a771 | 2010 | static const struct hda_fixup alc882_fixups[] = { |
5c0ebfbe | 2011 | [ALC882_FIXUP_ABIT_AW9D_MAX] = { |
1727a771 TI |
2012 | .type = HDA_FIXUP_PINS, |
2013 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 TI |
2014 | { 0x15, 0x01080104 }, /* side */ |
2015 | { 0x16, 0x01011012 }, /* rear */ | |
2016 | { 0x17, 0x01016011 }, /* clfe */ | |
2785591a | 2017 | { } |
145a902b DH |
2018 | } |
2019 | }, | |
5c0ebfbe | 2020 | [ALC882_FIXUP_LENOVO_Y530] = { |
1727a771 TI |
2021 | .type = HDA_FIXUP_PINS, |
2022 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 TI |
2023 | { 0x15, 0x99130112 }, /* rear int speakers */ |
2024 | { 0x16, 0x99130111 }, /* subwoofer */ | |
ac612407 DH |
2025 | { } |
2026 | } | |
2027 | }, | |
5c0ebfbe | 2028 | [ALC882_FIXUP_PB_M5210] = { |
fd108215 TI |
2029 | .type = HDA_FIXUP_PINCTLS, |
2030 | .v.pins = (const struct hda_pintbl[]) { | |
2031 | { 0x19, PIN_VREF50 }, | |
357f915e KY |
2032 | {} |
2033 | } | |
2034 | }, | |
5c0ebfbe | 2035 | [ALC882_FIXUP_ACER_ASPIRE_7736] = { |
1727a771 | 2036 | .type = HDA_FIXUP_FUNC, |
23d30f28 | 2037 | .v.func = alc_fixup_sku_ignore, |
6981d184 | 2038 | }, |
5c0ebfbe | 2039 | [ALC882_FIXUP_ASUS_W90V] = { |
1727a771 TI |
2040 | .type = HDA_FIXUP_PINS, |
2041 | .v.pins = (const struct hda_pintbl[]) { | |
5cdf745e TI |
2042 | { 0x16, 0x99130110 }, /* fix sequence for CLFE */ |
2043 | { } | |
2044 | } | |
2045 | }, | |
8f239214 | 2046 | [ALC889_FIXUP_CD] = { |
1727a771 TI |
2047 | .type = HDA_FIXUP_PINS, |
2048 | .v.pins = (const struct hda_pintbl[]) { | |
8f239214 MB |
2049 | { 0x1c, 0x993301f0 }, /* CD */ |
2050 | { } | |
2051 | } | |
2052 | }, | |
b2c53e20 DH |
2053 | [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = { |
2054 | .type = HDA_FIXUP_PINS, | |
2055 | .v.pins = (const struct hda_pintbl[]) { | |
2056 | { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */ | |
2057 | { } | |
2058 | }, | |
2059 | .chained = true, | |
2060 | .chain_id = ALC889_FIXUP_CD, | |
2061 | }, | |
5c0ebfbe | 2062 | [ALC889_FIXUP_VAIO_TT] = { |
1727a771 TI |
2063 | .type = HDA_FIXUP_PINS, |
2064 | .v.pins = (const struct hda_pintbl[]) { | |
5c0ebfbe TI |
2065 | { 0x17, 0x90170111 }, /* hidden surround speaker */ |
2066 | { } | |
2067 | } | |
2068 | }, | |
0e7cc2e7 | 2069 | [ALC888_FIXUP_EEE1601] = { |
1727a771 | 2070 | .type = HDA_FIXUP_VERBS, |
0e7cc2e7 TI |
2071 | .v.verbs = (const struct hda_verb[]) { |
2072 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b }, | |
2073 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 }, | |
2074 | { } | |
2075 | } | |
177943a3 TI |
2076 | }, |
2077 | [ALC882_FIXUP_EAPD] = { | |
1727a771 | 2078 | .type = HDA_FIXUP_VERBS, |
177943a3 TI |
2079 | .v.verbs = (const struct hda_verb[]) { |
2080 | /* change to EAPD mode */ | |
2081 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
2082 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 }, | |
2083 | { } | |
2084 | } | |
2085 | }, | |
7a6069bf | 2086 | [ALC883_FIXUP_EAPD] = { |
1727a771 | 2087 | .type = HDA_FIXUP_VERBS, |
7a6069bf TI |
2088 | .v.verbs = (const struct hda_verb[]) { |
2089 | /* change to EAPD mode */ | |
2090 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
2091 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, | |
2092 | { } | |
2093 | } | |
2094 | }, | |
8812c4f9 | 2095 | [ALC883_FIXUP_ACER_EAPD] = { |
1727a771 | 2096 | .type = HDA_FIXUP_VERBS, |
8812c4f9 TI |
2097 | .v.verbs = (const struct hda_verb[]) { |
2098 | /* eanable EAPD on Acer laptops */ | |
2099 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
2100 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, | |
2101 | { } | |
2102 | } | |
2103 | }, | |
1a97b7f2 | 2104 | [ALC882_FIXUP_GPIO1] = { |
1727a771 | 2105 | .type = HDA_FIXUP_VERBS, |
1a97b7f2 TI |
2106 | .v.verbs = alc_gpio1_init_verbs, |
2107 | }, | |
2108 | [ALC882_FIXUP_GPIO2] = { | |
1727a771 | 2109 | .type = HDA_FIXUP_VERBS, |
1a97b7f2 TI |
2110 | .v.verbs = alc_gpio2_init_verbs, |
2111 | }, | |
eb844d51 | 2112 | [ALC882_FIXUP_GPIO3] = { |
1727a771 | 2113 | .type = HDA_FIXUP_VERBS, |
eb844d51 TI |
2114 | .v.verbs = alc_gpio3_init_verbs, |
2115 | }, | |
68ef0561 | 2116 | [ALC882_FIXUP_ASUS_W2JC] = { |
1727a771 | 2117 | .type = HDA_FIXUP_VERBS, |
68ef0561 TI |
2118 | .v.verbs = alc_gpio1_init_verbs, |
2119 | .chained = true, | |
2120 | .chain_id = ALC882_FIXUP_EAPD, | |
2121 | }, | |
2122 | [ALC889_FIXUP_COEF] = { | |
1727a771 | 2123 | .type = HDA_FIXUP_FUNC, |
68ef0561 TI |
2124 | .v.func = alc889_fixup_coef, |
2125 | }, | |
c3e837bb | 2126 | [ALC882_FIXUP_ACER_ASPIRE_4930G] = { |
1727a771 TI |
2127 | .type = HDA_FIXUP_PINS, |
2128 | .v.pins = (const struct hda_pintbl[]) { | |
c3e837bb TI |
2129 | { 0x16, 0x99130111 }, /* CLFE speaker */ |
2130 | { 0x17, 0x99130112 }, /* surround speaker */ | |
2131 | { } | |
038d4fef TI |
2132 | }, |
2133 | .chained = true, | |
2134 | .chain_id = ALC882_FIXUP_GPIO1, | |
c3e837bb TI |
2135 | }, |
2136 | [ALC882_FIXUP_ACER_ASPIRE_8930G] = { | |
1727a771 TI |
2137 | .type = HDA_FIXUP_PINS, |
2138 | .v.pins = (const struct hda_pintbl[]) { | |
c3e837bb TI |
2139 | { 0x16, 0x99130111 }, /* CLFE speaker */ |
2140 | { 0x1b, 0x99130112 }, /* surround speaker */ | |
2141 | { } | |
2142 | }, | |
2143 | .chained = true, | |
2144 | .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS, | |
2145 | }, | |
2146 | [ALC882_FIXUP_ASPIRE_8930G_VERBS] = { | |
2147 | /* additional init verbs for Acer Aspire 8930G */ | |
1727a771 | 2148 | .type = HDA_FIXUP_VERBS, |
c3e837bb TI |
2149 | .v.verbs = (const struct hda_verb[]) { |
2150 | /* Enable all DACs */ | |
2151 | /* DAC DISABLE/MUTE 1? */ | |
2152 | /* setting bits 1-5 disables DAC nids 0x02-0x06 | |
2153 | * apparently. Init=0x38 */ | |
2154 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 }, | |
2155 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 }, | |
2156 | /* DAC DISABLE/MUTE 2? */ | |
2157 | /* some bit here disables the other DACs. | |
2158 | * Init=0x4900 */ | |
2159 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 }, | |
2160 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 }, | |
2161 | /* DMIC fix | |
2162 | * This laptop has a stereo digital microphone. | |
2163 | * The mics are only 1cm apart which makes the stereo | |
2164 | * useless. However, either the mic or the ALC889 | |
2165 | * makes the signal become a difference/sum signal | |
2166 | * instead of standard stereo, which is annoying. | |
2167 | * So instead we flip this bit which makes the | |
2168 | * codec replicate the sum signal to both channels, | |
2169 | * turning it into a normal mono mic. | |
2170 | */ | |
2171 | /* DMIC_CONTROL? Init value = 0x0001 */ | |
2172 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b }, | |
2173 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 }, | |
2174 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
2175 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, | |
2176 | { } | |
038d4fef TI |
2177 | }, |
2178 | .chained = true, | |
2179 | .chain_id = ALC882_FIXUP_GPIO1, | |
c3e837bb | 2180 | }, |
5671087f | 2181 | [ALC885_FIXUP_MACPRO_GPIO] = { |
1727a771 | 2182 | .type = HDA_FIXUP_FUNC, |
5671087f TI |
2183 | .v.func = alc885_fixup_macpro_gpio, |
2184 | }, | |
02a237b2 | 2185 | [ALC889_FIXUP_DAC_ROUTE] = { |
1727a771 | 2186 | .type = HDA_FIXUP_FUNC, |
02a237b2 TI |
2187 | .v.func = alc889_fixup_dac_route, |
2188 | }, | |
1a97b7f2 | 2189 | [ALC889_FIXUP_MBP_VREF] = { |
1727a771 | 2190 | .type = HDA_FIXUP_FUNC, |
1a97b7f2 TI |
2191 | .v.func = alc889_fixup_mbp_vref, |
2192 | .chained = true, | |
2193 | .chain_id = ALC882_FIXUP_GPIO1, | |
2194 | }, | |
2195 | [ALC889_FIXUP_IMAC91_VREF] = { | |
1727a771 | 2196 | .type = HDA_FIXUP_FUNC, |
1a97b7f2 TI |
2197 | .v.func = alc889_fixup_imac91_vref, |
2198 | .chained = true, | |
2199 | .chain_id = ALC882_FIXUP_GPIO1, | |
2200 | }, | |
e7729a41 AV |
2201 | [ALC889_FIXUP_MBA11_VREF] = { |
2202 | .type = HDA_FIXUP_FUNC, | |
2203 | .v.func = alc889_fixup_mba11_vref, | |
2204 | .chained = true, | |
2205 | .chain_id = ALC889_FIXUP_MBP_VREF, | |
2206 | }, | |
0756f09c TI |
2207 | [ALC889_FIXUP_MBA21_VREF] = { |
2208 | .type = HDA_FIXUP_FUNC, | |
2209 | .v.func = alc889_fixup_mba21_vref, | |
2210 | .chained = true, | |
2211 | .chain_id = ALC889_FIXUP_MBP_VREF, | |
2212 | }, | |
c20f31ec TI |
2213 | [ALC889_FIXUP_MP11_VREF] = { |
2214 | .type = HDA_FIXUP_FUNC, | |
2215 | .v.func = alc889_fixup_mba11_vref, | |
2216 | .chained = true, | |
2217 | .chain_id = ALC885_FIXUP_MACPRO_GPIO, | |
2218 | }, | |
6e72aa5f | 2219 | [ALC882_FIXUP_INV_DMIC] = { |
1727a771 | 2220 | .type = HDA_FIXUP_FUNC, |
6e72aa5f TI |
2221 | .v.func = alc_fixup_inv_dmic_0x12, |
2222 | }, | |
e427c237 | 2223 | [ALC882_FIXUP_NO_PRIMARY_HP] = { |
1727a771 | 2224 | .type = HDA_FIXUP_FUNC, |
e427c237 TI |
2225 | .v.func = alc882_fixup_no_primary_hp, |
2226 | }, | |
1f0bbf03 TI |
2227 | [ALC887_FIXUP_ASUS_BASS] = { |
2228 | .type = HDA_FIXUP_PINS, | |
2229 | .v.pins = (const struct hda_pintbl[]) { | |
2230 | {0x16, 0x99130130}, /* bass speaker */ | |
2231 | {} | |
2232 | }, | |
eb9ca3ab TI |
2233 | .chained = true, |
2234 | .chain_id = ALC887_FIXUP_BASS_CHMAP, | |
2235 | }, | |
2236 | [ALC887_FIXUP_BASS_CHMAP] = { | |
2237 | .type = HDA_FIXUP_FUNC, | |
2238 | .v.func = alc_fixup_bass_chmap, | |
1f0bbf03 | 2239 | }, |
ff818c24 TI |
2240 | }; |
2241 | ||
1d045db9 | 2242 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
8812c4f9 TI |
2243 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD), |
2244 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), | |
2245 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD), | |
2246 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), | |
2247 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD), | |
2248 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD), | |
c3e837bb TI |
2249 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
2250 | ALC882_FIXUP_ACER_ASPIRE_4930G), | |
2251 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", | |
2252 | ALC882_FIXUP_ACER_ASPIRE_4930G), | |
2253 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", | |
2254 | ALC882_FIXUP_ACER_ASPIRE_8930G), | |
2255 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", | |
2256 | ALC882_FIXUP_ACER_ASPIRE_8930G), | |
2257 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | |
2258 | ALC882_FIXUP_ACER_ASPIRE_4930G), | |
2259 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", | |
2260 | ALC882_FIXUP_ACER_ASPIRE_4930G), | |
2261 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", | |
2262 | ALC882_FIXUP_ACER_ASPIRE_4930G), | |
5c0ebfbe | 2263 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), |
f5c53d89 TI |
2264 | SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G", |
2265 | ALC882_FIXUP_ACER_ASPIRE_4930G), | |
02a237b2 | 2266 | SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE), |
fe97da1f | 2267 | SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G), |
ac9b1cdd | 2268 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), |
177943a3 | 2269 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), |
5c0ebfbe | 2270 | SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), |
68ef0561 | 2271 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), |
0e7cc2e7 | 2272 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), |
1f0bbf03 | 2273 | SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS), |
ac9b1cdd | 2274 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), |
e427c237 | 2275 | SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), |
12e31a78 | 2276 | SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), |
5671087f TI |
2277 | |
2278 | /* All Apple entries are in codec SSIDs */ | |
1a97b7f2 TI |
2279 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF), |
2280 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF), | |
2281 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF), | |
c20f31ec | 2282 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF), |
5671087f TI |
2283 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO), |
2284 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO), | |
1a97b7f2 TI |
2285 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF), |
2286 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF), | |
5671087f | 2287 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), |
e7729a41 | 2288 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF), |
0756f09c | 2289 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF), |
1a97b7f2 TI |
2290 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF), |
2291 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF), | |
5671087f | 2292 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO), |
1a97b7f2 TI |
2293 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF), |
2294 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF), | |
2295 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF), | |
29ebe402 | 2296 | SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO), |
05193639 | 2297 | SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF), |
1a97b7f2 TI |
2298 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF), |
2299 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF), | |
2300 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF), | |
5671087f | 2301 | |
7a6069bf | 2302 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), |
bca40138 | 2303 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), |
eb844d51 | 2304 | SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), |
b2c53e20 | 2305 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE), |
5c0ebfbe | 2306 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), |
7a6069bf TI |
2307 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), |
2308 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), | |
ac9b1cdd | 2309 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), |
68ef0561 | 2310 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF), |
ff818c24 TI |
2311 | {} |
2312 | }; | |
2313 | ||
1727a771 | 2314 | static const struct hda_model_fixup alc882_fixup_models[] = { |
912093bc TI |
2315 | {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"}, |
2316 | {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"}, | |
2317 | {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"}, | |
6e72aa5f | 2318 | {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
e427c237 | 2319 | {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"}, |
912093bc TI |
2320 | {} |
2321 | }; | |
2322 | ||
f6a92248 | 2323 | /* |
1d045db9 | 2324 | * BIOS auto configuration |
f6a92248 | 2325 | */ |
1d045db9 TI |
2326 | /* almost identical with ALC880 parser... */ |
2327 | static int alc882_parse_auto_config(struct hda_codec *codec) | |
2328 | { | |
1d045db9 | 2329 | static const hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
3e6179b8 TI |
2330 | static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
2331 | return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); | |
1d045db9 | 2332 | } |
b896b4eb | 2333 | |
1d045db9 TI |
2334 | /* |
2335 | */ | |
1d045db9 | 2336 | static int patch_alc882(struct hda_codec *codec) |
f6a92248 KY |
2337 | { |
2338 | struct alc_spec *spec; | |
1a97b7f2 | 2339 | int err; |
f6a92248 | 2340 | |
3de95173 TI |
2341 | err = alc_alloc_spec(codec, 0x0b); |
2342 | if (err < 0) | |
2343 | return err; | |
f6a92248 | 2344 | |
3de95173 | 2345 | spec = codec->spec; |
1f0f4b80 | 2346 | |
1d045db9 TI |
2347 | switch (codec->vendor_id) { |
2348 | case 0x10ec0882: | |
2349 | case 0x10ec0885: | |
acf08081 | 2350 | case 0x10ec0900: |
1d045db9 TI |
2351 | break; |
2352 | default: | |
2353 | /* ALC883 and variants */ | |
2354 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); | |
2355 | break; | |
c793bec5 | 2356 | } |
977ddd6b | 2357 | |
1727a771 | 2358 | snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, |
912093bc | 2359 | alc882_fixups); |
1727a771 | 2360 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
ff818c24 | 2361 | |
1d045db9 TI |
2362 | alc_auto_parse_customize_define(codec); |
2363 | ||
7504b6cd TI |
2364 | if (has_cdefine_beep(codec)) |
2365 | spec->gen.beep_nid = 0x01; | |
2366 | ||
1a97b7f2 TI |
2367 | /* automatic parse from the BIOS config */ |
2368 | err = alc882_parse_auto_config(codec); | |
2369 | if (err < 0) | |
2370 | goto error; | |
f6a92248 | 2371 | |
7504b6cd | 2372 | if (!spec->gen.no_analog && spec->gen.beep_nid) |
1d045db9 | 2373 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
f6a92248 KY |
2374 | |
2375 | codec->patch_ops = alc_patch_ops; | |
bf1b0225 | 2376 | |
1727a771 | 2377 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 2378 | |
f6a92248 | 2379 | return 0; |
e16fb6d1 TI |
2380 | |
2381 | error: | |
2382 | alc_free(codec); | |
2383 | return err; | |
f6a92248 KY |
2384 | } |
2385 | ||
df694daa | 2386 | |
df694daa | 2387 | /* |
1d045db9 | 2388 | * ALC262 support |
df694daa | 2389 | */ |
1d045db9 | 2390 | static int alc262_parse_auto_config(struct hda_codec *codec) |
df694daa | 2391 | { |
1d045db9 | 2392 | static const hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
3e6179b8 TI |
2393 | static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
2394 | return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); | |
df694daa KY |
2395 | } |
2396 | ||
df694daa | 2397 | /* |
1d045db9 | 2398 | * Pin config fixes |
df694daa | 2399 | */ |
cfc9b06f | 2400 | enum { |
ea4e7af1 | 2401 | ALC262_FIXUP_FSC_H270, |
7513e6da | 2402 | ALC262_FIXUP_FSC_S7110, |
ea4e7af1 TI |
2403 | ALC262_FIXUP_HP_Z200, |
2404 | ALC262_FIXUP_TYAN, | |
c470150c | 2405 | ALC262_FIXUP_LENOVO_3000, |
b42590b8 TI |
2406 | ALC262_FIXUP_BENQ, |
2407 | ALC262_FIXUP_BENQ_T31, | |
6e72aa5f | 2408 | ALC262_FIXUP_INV_DMIC, |
b5c6611f | 2409 | ALC262_FIXUP_INTEL_BAYLEYBAY, |
cfc9b06f TI |
2410 | }; |
2411 | ||
1727a771 | 2412 | static const struct hda_fixup alc262_fixups[] = { |
ea4e7af1 | 2413 | [ALC262_FIXUP_FSC_H270] = { |
1727a771 TI |
2414 | .type = HDA_FIXUP_PINS, |
2415 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 TI |
2416 | { 0x14, 0x99130110 }, /* speaker */ |
2417 | { 0x15, 0x0221142f }, /* front HP */ | |
2418 | { 0x1b, 0x0121141f }, /* rear HP */ | |
2419 | { } | |
2420 | } | |
2421 | }, | |
7513e6da TI |
2422 | [ALC262_FIXUP_FSC_S7110] = { |
2423 | .type = HDA_FIXUP_PINS, | |
2424 | .v.pins = (const struct hda_pintbl[]) { | |
2425 | { 0x15, 0x90170110 }, /* speaker */ | |
2426 | { } | |
2427 | }, | |
2428 | .chained = true, | |
2429 | .chain_id = ALC262_FIXUP_BENQ, | |
2430 | }, | |
ea4e7af1 | 2431 | [ALC262_FIXUP_HP_Z200] = { |
1727a771 TI |
2432 | .type = HDA_FIXUP_PINS, |
2433 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 | 2434 | { 0x16, 0x99130120 }, /* internal speaker */ |
73413b12 TI |
2435 | { } |
2436 | } | |
cfc9b06f | 2437 | }, |
ea4e7af1 | 2438 | [ALC262_FIXUP_TYAN] = { |
1727a771 TI |
2439 | .type = HDA_FIXUP_PINS, |
2440 | .v.pins = (const struct hda_pintbl[]) { | |
ea4e7af1 TI |
2441 | { 0x14, 0x1993e1f0 }, /* int AUX */ |
2442 | { } | |
2443 | } | |
2444 | }, | |
c470150c | 2445 | [ALC262_FIXUP_LENOVO_3000] = { |
fd108215 TI |
2446 | .type = HDA_FIXUP_PINCTLS, |
2447 | .v.pins = (const struct hda_pintbl[]) { | |
2448 | { 0x19, PIN_VREF50 }, | |
b42590b8 TI |
2449 | {} |
2450 | }, | |
2451 | .chained = true, | |
2452 | .chain_id = ALC262_FIXUP_BENQ, | |
2453 | }, | |
2454 | [ALC262_FIXUP_BENQ] = { | |
1727a771 | 2455 | .type = HDA_FIXUP_VERBS, |
b42590b8 | 2456 | .v.verbs = (const struct hda_verb[]) { |
c470150c TI |
2457 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
2458 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, | |
2459 | {} | |
2460 | } | |
2461 | }, | |
b42590b8 | 2462 | [ALC262_FIXUP_BENQ_T31] = { |
1727a771 | 2463 | .type = HDA_FIXUP_VERBS, |
b42590b8 TI |
2464 | .v.verbs = (const struct hda_verb[]) { |
2465 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, | |
2466 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, | |
2467 | {} | |
2468 | } | |
2469 | }, | |
6e72aa5f | 2470 | [ALC262_FIXUP_INV_DMIC] = { |
1727a771 | 2471 | .type = HDA_FIXUP_FUNC, |
6e72aa5f TI |
2472 | .v.func = alc_fixup_inv_dmic_0x12, |
2473 | }, | |
b5c6611f ML |
2474 | [ALC262_FIXUP_INTEL_BAYLEYBAY] = { |
2475 | .type = HDA_FIXUP_FUNC, | |
2476 | .v.func = alc_fixup_no_depop_delay, | |
2477 | }, | |
cfc9b06f TI |
2478 | }; |
2479 | ||
1d045db9 | 2480 | static const struct snd_pci_quirk alc262_fixup_tbl[] = { |
ea4e7af1 | 2481 | SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200), |
7513e6da | 2482 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110), |
3dcd3be3 | 2483 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ), |
ea4e7af1 TI |
2484 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN), |
2485 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270), | |
c470150c | 2486 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000), |
b42590b8 TI |
2487 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ), |
2488 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31), | |
b5c6611f | 2489 | SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY), |
cfc9b06f TI |
2490 | {} |
2491 | }; | |
df694daa | 2492 | |
1727a771 | 2493 | static const struct hda_model_fixup alc262_fixup_models[] = { |
6e72aa5f TI |
2494 | {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
2495 | {} | |
2496 | }; | |
1d045db9 | 2497 | |
1d045db9 TI |
2498 | /* |
2499 | */ | |
1d045db9 | 2500 | static int patch_alc262(struct hda_codec *codec) |
df694daa KY |
2501 | { |
2502 | struct alc_spec *spec; | |
df694daa KY |
2503 | int err; |
2504 | ||
3de95173 TI |
2505 | err = alc_alloc_spec(codec, 0x0b); |
2506 | if (err < 0) | |
2507 | return err; | |
df694daa | 2508 | |
3de95173 | 2509 | spec = codec->spec; |
08c189f2 | 2510 | spec->gen.shared_mic_vref_pin = 0x18; |
1d045db9 TI |
2511 | |
2512 | #if 0 | |
2513 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is | |
2514 | * under-run | |
2515 | */ | |
98b24883 | 2516 | alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); |
1d045db9 | 2517 | #endif |
1d045db9 TI |
2518 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
2519 | ||
1727a771 | 2520 | snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, |
6e72aa5f | 2521 | alc262_fixups); |
1727a771 | 2522 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
9c7f852e | 2523 | |
af741c15 TI |
2524 | alc_auto_parse_customize_define(codec); |
2525 | ||
7504b6cd TI |
2526 | if (has_cdefine_beep(codec)) |
2527 | spec->gen.beep_nid = 0x01; | |
2528 | ||
42399f7a TI |
2529 | /* automatic parse from the BIOS config */ |
2530 | err = alc262_parse_auto_config(codec); | |
2531 | if (err < 0) | |
2532 | goto error; | |
df694daa | 2533 | |
7504b6cd | 2534 | if (!spec->gen.no_analog && spec->gen.beep_nid) |
1d045db9 | 2535 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
2134ea4f | 2536 | |
df694daa | 2537 | codec->patch_ops = alc_patch_ops; |
1d045db9 TI |
2538 | spec->shutup = alc_eapd_shutup; |
2539 | ||
1727a771 | 2540 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 2541 | |
1da177e4 | 2542 | return 0; |
e16fb6d1 TI |
2543 | |
2544 | error: | |
2545 | alc_free(codec); | |
2546 | return err; | |
1da177e4 LT |
2547 | } |
2548 | ||
f32610ed | 2549 | /* |
1d045db9 | 2550 | * ALC268 |
f32610ed | 2551 | */ |
1d045db9 TI |
2552 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
2553 | static const struct hda_bind_ctls alc268_bind_beep_sw = { | |
2554 | .ops = &snd_hda_bind_sw, | |
2555 | .values = { | |
2556 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), | |
2557 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), | |
2558 | 0 | |
2559 | }, | |
f32610ed JS |
2560 | }; |
2561 | ||
1d045db9 TI |
2562 | static const struct snd_kcontrol_new alc268_beep_mixer[] = { |
2563 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), | |
2564 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), | |
2565 | { } | |
f32610ed JS |
2566 | }; |
2567 | ||
1d045db9 TI |
2568 | /* set PCBEEP vol = 0, mute connections */ |
2569 | static const struct hda_verb alc268_beep_init_verbs[] = { | |
2570 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | |
2571 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2572 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | |
2573 | { } | |
f32610ed JS |
2574 | }; |
2575 | ||
6e72aa5f TI |
2576 | enum { |
2577 | ALC268_FIXUP_INV_DMIC, | |
cb766404 | 2578 | ALC268_FIXUP_HP_EAPD, |
24eff328 | 2579 | ALC268_FIXUP_SPDIF, |
6e72aa5f TI |
2580 | }; |
2581 | ||
1727a771 | 2582 | static const struct hda_fixup alc268_fixups[] = { |
6e72aa5f | 2583 | [ALC268_FIXUP_INV_DMIC] = { |
1727a771 | 2584 | .type = HDA_FIXUP_FUNC, |
6e72aa5f TI |
2585 | .v.func = alc_fixup_inv_dmic_0x12, |
2586 | }, | |
cb766404 | 2587 | [ALC268_FIXUP_HP_EAPD] = { |
1727a771 | 2588 | .type = HDA_FIXUP_VERBS, |
cb766404 TI |
2589 | .v.verbs = (const struct hda_verb[]) { |
2590 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0}, | |
2591 | {} | |
2592 | } | |
2593 | }, | |
24eff328 TI |
2594 | [ALC268_FIXUP_SPDIF] = { |
2595 | .type = HDA_FIXUP_PINS, | |
2596 | .v.pins = (const struct hda_pintbl[]) { | |
2597 | { 0x1e, 0x014b1180 }, /* enable SPDIF out */ | |
2598 | {} | |
2599 | } | |
2600 | }, | |
6e72aa5f TI |
2601 | }; |
2602 | ||
1727a771 | 2603 | static const struct hda_model_fixup alc268_fixup_models[] = { |
6e72aa5f | 2604 | {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
cb766404 TI |
2605 | {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"}, |
2606 | {} | |
2607 | }; | |
2608 | ||
2609 | static const struct snd_pci_quirk alc268_fixup_tbl[] = { | |
24eff328 | 2610 | SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF), |
fcd8f3b1 | 2611 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC), |
cb766404 TI |
2612 | /* below is codec SSID since multiple Toshiba laptops have the |
2613 | * same PCI SSID 1179:ff00 | |
2614 | */ | |
2615 | SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD), | |
6e72aa5f TI |
2616 | {} |
2617 | }; | |
2618 | ||
f32610ed JS |
2619 | /* |
2620 | * BIOS auto configuration | |
2621 | */ | |
1d045db9 | 2622 | static int alc268_parse_auto_config(struct hda_codec *codec) |
f32610ed | 2623 | { |
3e6179b8 | 2624 | static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
7504b6cd | 2625 | return alc_parse_auto_config(codec, NULL, alc268_ssids); |
f32610ed JS |
2626 | } |
2627 | ||
1d045db9 TI |
2628 | /* |
2629 | */ | |
1d045db9 | 2630 | static int patch_alc268(struct hda_codec *codec) |
f32610ed JS |
2631 | { |
2632 | struct alc_spec *spec; | |
7504b6cd | 2633 | int err; |
f32610ed | 2634 | |
1d045db9 | 2635 | /* ALC268 has no aa-loopback mixer */ |
3de95173 TI |
2636 | err = alc_alloc_spec(codec, 0); |
2637 | if (err < 0) | |
2638 | return err; | |
2639 | ||
2640 | spec = codec->spec; | |
7504b6cd | 2641 | spec->gen.beep_nid = 0x01; |
1f0f4b80 | 2642 | |
1727a771 TI |
2643 | snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); |
2644 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | |
6e72aa5f | 2645 | |
6ebb8053 TI |
2646 | /* automatic parse from the BIOS config */ |
2647 | err = alc268_parse_auto_config(codec); | |
e16fb6d1 TI |
2648 | if (err < 0) |
2649 | goto error; | |
f32610ed | 2650 | |
7504b6cd TI |
2651 | if (err > 0 && !spec->gen.no_analog && |
2652 | spec->gen.autocfg.speaker_pins[0] != 0x1d) { | |
2653 | add_mixer(spec, alc268_beep_mixer); | |
2654 | snd_hda_add_verbs(codec, alc268_beep_init_verbs); | |
1d045db9 TI |
2655 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
2656 | /* override the amp caps for beep generator */ | |
2657 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | |
2658 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | | |
2659 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
2660 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
2661 | (0 << AC_AMPCAP_MUTE_SHIFT)); | |
2f893286 KY |
2662 | } |
2663 | ||
f32610ed | 2664 | codec->patch_ops = alc_patch_ops; |
1c716153 | 2665 | spec->shutup = alc_eapd_shutup; |
1d045db9 | 2666 | |
1727a771 | 2667 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
6e72aa5f | 2668 | |
f32610ed | 2669 | return 0; |
e16fb6d1 TI |
2670 | |
2671 | error: | |
2672 | alc_free(codec); | |
2673 | return err; | |
f32610ed JS |
2674 | } |
2675 | ||
bc9f98a9 | 2676 | /* |
1d045db9 | 2677 | * ALC269 |
bc9f98a9 | 2678 | */ |
08c189f2 TI |
2679 | |
2680 | static int playback_pcm_open(struct hda_pcm_stream *hinfo, | |
2681 | struct hda_codec *codec, | |
2682 | struct snd_pcm_substream *substream) | |
2683 | { | |
2684 | struct hda_gen_spec *spec = codec->spec; | |
2685 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, | |
2686 | hinfo); | |
2687 | } | |
2688 | ||
2689 | static int playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |
2690 | struct hda_codec *codec, | |
2691 | unsigned int stream_tag, | |
2692 | unsigned int format, | |
2693 | struct snd_pcm_substream *substream) | |
2694 | { | |
2695 | struct hda_gen_spec *spec = codec->spec; | |
2696 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, | |
2697 | stream_tag, format, substream); | |
2698 | } | |
2699 | ||
2700 | static int playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |
2701 | struct hda_codec *codec, | |
2702 | struct snd_pcm_substream *substream) | |
2703 | { | |
2704 | struct hda_gen_spec *spec = codec->spec; | |
2705 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); | |
2706 | } | |
2707 | ||
1d045db9 TI |
2708 | static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
2709 | .substreams = 1, | |
2710 | .channels_min = 2, | |
2711 | .channels_max = 8, | |
2712 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
2713 | /* NID is set in alc_build_pcms */ | |
2714 | .ops = { | |
08c189f2 TI |
2715 | .open = playback_pcm_open, |
2716 | .prepare = playback_pcm_prepare, | |
2717 | .cleanup = playback_pcm_cleanup | |
bc9f98a9 KY |
2718 | }, |
2719 | }; | |
2720 | ||
1d045db9 TI |
2721 | static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
2722 | .substreams = 1, | |
2723 | .channels_min = 2, | |
2724 | .channels_max = 2, | |
2725 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | |
2726 | /* NID is set in alc_build_pcms */ | |
bc9f98a9 | 2727 | }; |
291702f0 | 2728 | |
1d045db9 TI |
2729 | /* different alc269-variants */ |
2730 | enum { | |
2731 | ALC269_TYPE_ALC269VA, | |
2732 | ALC269_TYPE_ALC269VB, | |
2733 | ALC269_TYPE_ALC269VC, | |
adcc70b2 | 2734 | ALC269_TYPE_ALC269VD, |
065380f0 KY |
2735 | ALC269_TYPE_ALC280, |
2736 | ALC269_TYPE_ALC282, | |
2af02be7 | 2737 | ALC269_TYPE_ALC283, |
065380f0 | 2738 | ALC269_TYPE_ALC284, |
161ebf29 | 2739 | ALC269_TYPE_ALC285, |
7fc7d047 | 2740 | ALC269_TYPE_ALC286, |
1d04c9de | 2741 | ALC269_TYPE_ALC255, |
bc9f98a9 KY |
2742 | }; |
2743 | ||
2744 | /* | |
1d045db9 | 2745 | * BIOS auto configuration |
bc9f98a9 | 2746 | */ |
1d045db9 TI |
2747 | static int alc269_parse_auto_config(struct hda_codec *codec) |
2748 | { | |
1d045db9 | 2749 | static const hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
3e6179b8 TI |
2750 | static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 }; |
2751 | static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 }; | |
2752 | struct alc_spec *spec = codec->spec; | |
adcc70b2 KY |
2753 | const hda_nid_t *ssids; |
2754 | ||
2755 | switch (spec->codec_variant) { | |
2756 | case ALC269_TYPE_ALC269VA: | |
2757 | case ALC269_TYPE_ALC269VC: | |
065380f0 KY |
2758 | case ALC269_TYPE_ALC280: |
2759 | case ALC269_TYPE_ALC284: | |
161ebf29 | 2760 | case ALC269_TYPE_ALC285: |
adcc70b2 KY |
2761 | ssids = alc269va_ssids; |
2762 | break; | |
2763 | case ALC269_TYPE_ALC269VB: | |
2764 | case ALC269_TYPE_ALC269VD: | |
065380f0 | 2765 | case ALC269_TYPE_ALC282: |
2af02be7 | 2766 | case ALC269_TYPE_ALC283: |
7fc7d047 | 2767 | case ALC269_TYPE_ALC286: |
1d04c9de | 2768 | case ALC269_TYPE_ALC255: |
adcc70b2 KY |
2769 | ssids = alc269_ssids; |
2770 | break; | |
2771 | default: | |
2772 | ssids = alc269_ssids; | |
2773 | break; | |
2774 | } | |
bc9f98a9 | 2775 | |
3e6179b8 | 2776 | return alc_parse_auto_config(codec, alc269_ignore, ssids); |
1d045db9 | 2777 | } |
bc9f98a9 | 2778 | |
f7ae9ba0 KY |
2779 | static int find_ext_mic_pin(struct hda_codec *codec); |
2780 | ||
2781 | static void alc286_shutup(struct hda_codec *codec) | |
2782 | { | |
2783 | int i; | |
2784 | int mic_pin = find_ext_mic_pin(codec); | |
2785 | /* don't shut up pins when unloading the driver; otherwise it breaks | |
2786 | * the default pin setup at the next load of the driver | |
2787 | */ | |
2788 | if (codec->bus->shutdown) | |
2789 | return; | |
2790 | for (i = 0; i < codec->init_pins.used; i++) { | |
2791 | struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); | |
2792 | /* use read here for syncing after issuing each verb */ | |
2793 | if (pin->nid != mic_pin) | |
2794 | snd_hda_codec_read(codec, pin->nid, 0, | |
2795 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | |
2796 | } | |
2797 | codec->pins_shutup = 1; | |
2798 | } | |
2799 | ||
1387e2d1 | 2800 | static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) |
1d045db9 | 2801 | { |
98b24883 | 2802 | alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); |
1d045db9 | 2803 | } |
291702f0 | 2804 | |
1d045db9 TI |
2805 | static void alc269_shutup(struct hda_codec *codec) |
2806 | { | |
adcc70b2 KY |
2807 | struct alc_spec *spec = codec->spec; |
2808 | ||
1387e2d1 KY |
2809 | if (spec->codec_variant == ALC269_TYPE_ALC269VB) |
2810 | alc269vb_toggle_power_output(codec, 0); | |
2811 | if (spec->codec_variant == ALC269_TYPE_ALC269VB && | |
2812 | (alc_get_coef0(codec) & 0x00ff) == 0x018) { | |
1d045db9 TI |
2813 | msleep(150); |
2814 | } | |
9bfb2844 | 2815 | snd_hda_shutup_pins(codec); |
1d045db9 | 2816 | } |
291702f0 | 2817 | |
54db6c39 TI |
2818 | static struct coef_fw alc282_coefs[] = { |
2819 | WRITE_COEF(0x03, 0x0002), /* Power Down Control */ | |
2820 | WRITE_COEF(0x05, 0x0700), /* FIFO and filter clock */ | |
2821 | WRITE_COEF(0x07, 0x0200), /* DMIC control */ | |
2822 | UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */ | |
2823 | UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */ | |
2824 | WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */ | |
2825 | WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */ | |
2826 | WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */ | |
2827 | UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */ | |
2828 | UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */ | |
2829 | WRITE_COEF(0x6f, 0x0), /* Class D test 4 */ | |
2830 | UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */ | |
2831 | WRITE_COEF(0x34, 0xa0c0), /* ANC */ | |
2832 | UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */ | |
2833 | UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */ | |
2834 | UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */ | |
2835 | WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */ | |
2836 | WRITE_COEF(0x63, 0x2902), /* PLL */ | |
2837 | WRITE_COEF(0x68, 0xa080), /* capless control 2 */ | |
2838 | WRITE_COEF(0x69, 0x3400), /* capless control 3 */ | |
2839 | WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */ | |
2840 | WRITE_COEF(0x6b, 0x0), /* capless control 5 */ | |
2841 | UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */ | |
2842 | WRITE_COEF(0x6e, 0x110a), /* class D test 3 */ | |
2843 | UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */ | |
2844 | WRITE_COEF(0x71, 0x0014), /* class D test 6 */ | |
2845 | WRITE_COEF(0x72, 0xc2ba), /* classD OCP */ | |
2846 | UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */ | |
2847 | WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */ | |
2848 | {} | |
2849 | }; | |
2850 | ||
cb149cb3 KY |
2851 | static void alc282_restore_default_value(struct hda_codec *codec) |
2852 | { | |
54db6c39 | 2853 | alc_process_coef_fw(codec, alc282_coefs); |
cb149cb3 KY |
2854 | } |
2855 | ||
7b5c7a02 KY |
2856 | static void alc282_init(struct hda_codec *codec) |
2857 | { | |
2858 | struct alc_spec *spec = codec->spec; | |
2859 | hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; | |
2860 | bool hp_pin_sense; | |
2861 | int coef78; | |
2862 | ||
cb149cb3 KY |
2863 | alc282_restore_default_value(codec); |
2864 | ||
7b5c7a02 KY |
2865 | if (!hp_pin) |
2866 | return; | |
2867 | hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); | |
2868 | coef78 = alc_read_coef_idx(codec, 0x78); | |
2869 | ||
2870 | /* Index 0x78 Direct Drive HP AMP LPM Control 1 */ | |
2871 | /* Headphone capless set to high power mode */ | |
2872 | alc_write_coef_idx(codec, 0x78, 0x9004); | |
2873 | ||
2874 | if (hp_pin_sense) | |
2875 | msleep(2); | |
2876 | ||
2877 | snd_hda_codec_write(codec, hp_pin, 0, | |
2878 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | |
2879 | ||
2880 | if (hp_pin_sense) | |
2881 | msleep(85); | |
2882 | ||
2883 | snd_hda_codec_write(codec, hp_pin, 0, | |
2884 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
2885 | ||
2886 | if (hp_pin_sense) | |
2887 | msleep(100); | |
2888 | ||
2889 | /* Headphone capless set to normal mode */ | |
2890 | alc_write_coef_idx(codec, 0x78, coef78); | |
2891 | } | |
2892 | ||
2893 | static void alc282_shutup(struct hda_codec *codec) | |
2894 | { | |
2895 | struct alc_spec *spec = codec->spec; | |
2896 | hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; | |
2897 | bool hp_pin_sense; | |
2898 | int coef78; | |
2899 | ||
2900 | if (!hp_pin) { | |
2901 | alc269_shutup(codec); | |
2902 | return; | |
2903 | } | |
2904 | ||
2905 | hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); | |
2906 | coef78 = alc_read_coef_idx(codec, 0x78); | |
2907 | alc_write_coef_idx(codec, 0x78, 0x9004); | |
2908 | ||
2909 | if (hp_pin_sense) | |
2910 | msleep(2); | |
2911 | ||
2912 | snd_hda_codec_write(codec, hp_pin, 0, | |
2913 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | |
2914 | ||
2915 | if (hp_pin_sense) | |
2916 | msleep(85); | |
2917 | ||
2918 | snd_hda_codec_write(codec, hp_pin, 0, | |
2919 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | |
2920 | ||
2921 | if (hp_pin_sense) | |
2922 | msleep(100); | |
2923 | ||
2924 | alc_auto_setup_eapd(codec, false); | |
2925 | snd_hda_shutup_pins(codec); | |
2926 | alc_write_coef_idx(codec, 0x78, coef78); | |
2927 | } | |
2928 | ||
54db6c39 TI |
2929 | static struct coef_fw alc283_coefs[] = { |
2930 | WRITE_COEF(0x03, 0x0002), /* Power Down Control */ | |
2931 | WRITE_COEF(0x05, 0x0700), /* FIFO and filter clock */ | |
2932 | WRITE_COEF(0x07, 0x0200), /* DMIC control */ | |
2933 | UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */ | |
2934 | UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */ | |
2935 | WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */ | |
2936 | WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */ | |
2937 | WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */ | |
2938 | UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */ | |
2939 | UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */ | |
2940 | WRITE_COEF(0x3a, 0x0), /* Class D test 4 */ | |
2941 | UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */ | |
2942 | WRITE_COEF(0x22, 0xa0c0), /* ANC */ | |
2943 | UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */ | |
2944 | UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */ | |
2945 | UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */ | |
2946 | WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */ | |
2947 | WRITE_COEF(0x2e, 0x2902), /* PLL */ | |
2948 | WRITE_COEF(0x33, 0xa080), /* capless control 2 */ | |
2949 | WRITE_COEF(0x34, 0x3400), /* capless control 3 */ | |
2950 | WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */ | |
2951 | WRITE_COEF(0x36, 0x0), /* capless control 5 */ | |
2952 | UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */ | |
2953 | WRITE_COEF(0x39, 0x110a), /* class D test 3 */ | |
2954 | UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */ | |
2955 | WRITE_COEF(0x3c, 0x0014), /* class D test 6 */ | |
2956 | WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */ | |
2957 | UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */ | |
2958 | WRITE_COEF(0x49, 0x0), /* test mode */ | |
2959 | UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */ | |
2960 | UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */ | |
2961 | WRITE_COEF(0x37, 0xfc06), /* Class D amp control */ | |
2962 | {} | |
2963 | }; | |
2964 | ||
6bd55b04 KY |
2965 | static void alc283_restore_default_value(struct hda_codec *codec) |
2966 | { | |
54db6c39 | 2967 | alc_process_coef_fw(codec, alc283_coefs); |
6bd55b04 KY |
2968 | } |
2969 | ||
2af02be7 KY |
2970 | static void alc283_init(struct hda_codec *codec) |
2971 | { | |
2972 | struct alc_spec *spec = codec->spec; | |
2973 | hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; | |
2974 | bool hp_pin_sense; | |
2af02be7 | 2975 | |
8314f225 KY |
2976 | if (!spec->gen.autocfg.hp_outs) { |
2977 | if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT) | |
2978 | hp_pin = spec->gen.autocfg.line_out_pins[0]; | |
2979 | } | |
2980 | ||
6bd55b04 KY |
2981 | alc283_restore_default_value(codec); |
2982 | ||
2af02be7 KY |
2983 | if (!hp_pin) |
2984 | return; | |
2985 | hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); | |
2986 | ||
2987 | /* Index 0x43 Direct Drive HP AMP LPM Control 1 */ | |
2988 | /* Headphone capless set to high power mode */ | |
2989 | alc_write_coef_idx(codec, 0x43, 0x9004); | |
2990 | ||
2991 | snd_hda_codec_write(codec, hp_pin, 0, | |
2992 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | |
2993 | ||
2994 | if (hp_pin_sense) | |
2995 | msleep(85); | |
2996 | ||
2997 | snd_hda_codec_write(codec, hp_pin, 0, | |
2998 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | |
2999 | ||
3000 | if (hp_pin_sense) | |
3001 | msleep(85); | |
3002 | /* Index 0x46 Combo jack auto switch control 2 */ | |
3003 | /* 3k pull low control for Headset jack. */ | |
98b24883 | 3004 | alc_update_coef_idx(codec, 0x46, 3 << 12, 0); |
2af02be7 KY |
3005 | /* Headphone capless set to normal mode */ |
3006 | alc_write_coef_idx(codec, 0x43, 0x9614); | |
3007 | } | |
3008 | ||
3009 | static void alc283_shutup(struct hda_codec *codec) | |
3010 | { | |
3011 | struct alc_spec *spec = codec->spec; | |
3012 | hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; | |
3013 | bool hp_pin_sense; | |
2af02be7 | 3014 | |
8314f225 KY |
3015 | if (!spec->gen.autocfg.hp_outs) { |
3016 | if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT) | |
3017 | hp_pin = spec->gen.autocfg.line_out_pins[0]; | |
3018 | } | |
3019 | ||
2af02be7 KY |
3020 | if (!hp_pin) { |
3021 | alc269_shutup(codec); | |
3022 | return; | |
3023 | } | |
3024 | ||
3025 | hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); | |
3026 | ||
3027 | alc_write_coef_idx(codec, 0x43, 0x9004); | |
3028 | ||
3029 | snd_hda_codec_write(codec, hp_pin, 0, | |
3030 | AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); | |
3031 | ||
3032 | if (hp_pin_sense) | |
88011c09 | 3033 | msleep(100); |
2af02be7 KY |
3034 | |
3035 | snd_hda_codec_write(codec, hp_pin, 0, | |
3036 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0); | |
3037 | ||
98b24883 | 3038 | alc_update_coef_idx(codec, 0x46, 0, 3 << 12); |
2af02be7 KY |
3039 | |
3040 | if (hp_pin_sense) | |
88011c09 | 3041 | msleep(100); |
0435b3ff | 3042 | alc_auto_setup_eapd(codec, false); |
2af02be7 KY |
3043 | snd_hda_shutup_pins(codec); |
3044 | alc_write_coef_idx(codec, 0x43, 0x9614); | |
3045 | } | |
3046 | ||
ad60d502 KY |
3047 | static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, |
3048 | unsigned int val) | |
3049 | { | |
3050 | snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); | |
3051 | snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ | |
3052 | snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ | |
3053 | } | |
3054 | ||
3055 | static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) | |
3056 | { | |
3057 | unsigned int val; | |
3058 | ||
3059 | snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); | |
3060 | val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) | |
3061 | & 0xffff; | |
3062 | val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) | |
3063 | << 16; | |
3064 | return val; | |
3065 | } | |
3066 | ||
3067 | static void alc5505_dsp_halt(struct hda_codec *codec) | |
3068 | { | |
3069 | unsigned int val; | |
3070 | ||
3071 | alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ | |
3072 | alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ | |
3073 | alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ | |
3074 | alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ | |
3075 | alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ | |
3076 | alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ | |
3077 | alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ | |
3078 | val = alc5505_coef_get(codec, 0x6220); | |
3079 | alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ | |
3080 | } | |
3081 | ||
3082 | static void alc5505_dsp_back_from_halt(struct hda_codec *codec) | |
3083 | { | |
3084 | alc5505_coef_set(codec, 0x61b8, 0x04133302); | |
3085 | alc5505_coef_set(codec, 0x61b0, 0x00005b16); | |
3086 | alc5505_coef_set(codec, 0x61b4, 0x040a2b02); | |
3087 | alc5505_coef_set(codec, 0x6230, 0xf80d4011); | |
3088 | alc5505_coef_set(codec, 0x6220, 0x2002010f); | |
3089 | alc5505_coef_set(codec, 0x880c, 0x00000004); | |
3090 | } | |
3091 | ||
3092 | static void alc5505_dsp_init(struct hda_codec *codec) | |
3093 | { | |
3094 | unsigned int val; | |
3095 | ||
3096 | alc5505_dsp_halt(codec); | |
3097 | alc5505_dsp_back_from_halt(codec); | |
3098 | alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ | |
3099 | alc5505_coef_set(codec, 0x61b0, 0x5b16); | |
3100 | alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ | |
3101 | alc5505_coef_set(codec, 0x61b4, 0x04132b02); | |
3102 | alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ | |
3103 | alc5505_coef_set(codec, 0x61b8, 0x041f3302); | |
3104 | snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ | |
3105 | alc5505_coef_set(codec, 0x61b8, 0x041b3302); | |
3106 | alc5505_coef_set(codec, 0x61b8, 0x04173302); | |
3107 | alc5505_coef_set(codec, 0x61b8, 0x04163302); | |
3108 | alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ | |
3109 | alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ | |
3110 | alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ | |
3111 | ||
3112 | val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ | |
3113 | if (val <= 3) | |
3114 | alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ | |
3115 | else | |
3116 | alc5505_coef_set(codec, 0x6220, 0x6002018f); | |
3117 | ||
3118 | alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ | |
3119 | alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ | |
3120 | alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ | |
3121 | alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ | |
3122 | alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ | |
3123 | alc5505_coef_set(codec, 0x880c, 0x00000003); | |
3124 | alc5505_coef_set(codec, 0x880c, 0x00000010); | |
cd63a5ff TI |
3125 | |
3126 | #ifdef HALT_REALTEK_ALC5505 | |
3127 | alc5505_dsp_halt(codec); | |
3128 | #endif | |
ad60d502 KY |
3129 | } |
3130 | ||
cd63a5ff TI |
3131 | #ifdef HALT_REALTEK_ALC5505 |
3132 | #define alc5505_dsp_suspend(codec) /* NOP */ | |
3133 | #define alc5505_dsp_resume(codec) /* NOP */ | |
3134 | #else | |
3135 | #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) | |
3136 | #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) | |
3137 | #endif | |
3138 | ||
2a43952a | 3139 | #ifdef CONFIG_PM |
ad60d502 KY |
3140 | static int alc269_suspend(struct hda_codec *codec) |
3141 | { | |
3142 | struct alc_spec *spec = codec->spec; | |
3143 | ||
3144 | if (spec->has_alc5505_dsp) | |
cd63a5ff | 3145 | alc5505_dsp_suspend(codec); |
ad60d502 KY |
3146 | return alc_suspend(codec); |
3147 | } | |
3148 | ||
1d045db9 TI |
3149 | static int alc269_resume(struct hda_codec *codec) |
3150 | { | |
adcc70b2 KY |
3151 | struct alc_spec *spec = codec->spec; |
3152 | ||
1387e2d1 KY |
3153 | if (spec->codec_variant == ALC269_TYPE_ALC269VB) |
3154 | alc269vb_toggle_power_output(codec, 0); | |
3155 | if (spec->codec_variant == ALC269_TYPE_ALC269VB && | |
adcc70b2 | 3156 | (alc_get_coef0(codec) & 0x00ff) == 0x018) { |
1d045db9 TI |
3157 | msleep(150); |
3158 | } | |
8c427226 | 3159 | |
1d045db9 | 3160 | codec->patch_ops.init(codec); |
f1d4e28b | 3161 | |
1387e2d1 KY |
3162 | if (spec->codec_variant == ALC269_TYPE_ALC269VB) |
3163 | alc269vb_toggle_power_output(codec, 1); | |
3164 | if (spec->codec_variant == ALC269_TYPE_ALC269VB && | |
adcc70b2 | 3165 | (alc_get_coef0(codec) & 0x00ff) == 0x017) { |
1d045db9 TI |
3166 | msleep(200); |
3167 | } | |
f1d4e28b | 3168 | |
1d045db9 TI |
3169 | snd_hda_codec_resume_amp(codec); |
3170 | snd_hda_codec_resume_cache(codec); | |
0623a889 | 3171 | alc_inv_dmic_sync(codec, true); |
1d045db9 | 3172 | hda_call_check_power_status(codec, 0x01); |
f475371a HW |
3173 | |
3174 | /* on some machine, the BIOS will clear the codec gpio data when enter | |
3175 | * suspend, and won't restore the data after resume, so we restore it | |
3176 | * in the driver. | |
3177 | */ | |
3178 | if (spec->gpio_led) | |
3179 | snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA, | |
3180 | spec->gpio_led); | |
3181 | ||
ad60d502 | 3182 | if (spec->has_alc5505_dsp) |
cd63a5ff | 3183 | alc5505_dsp_resume(codec); |
c5177c86 | 3184 | |
1d045db9 TI |
3185 | return 0; |
3186 | } | |
2a43952a | 3187 | #endif /* CONFIG_PM */ |
f1d4e28b | 3188 | |
108cc108 | 3189 | static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, |
1727a771 | 3190 | const struct hda_fixup *fix, int action) |
108cc108 DH |
3191 | { |
3192 | struct alc_spec *spec = codec->spec; | |
3193 | ||
1727a771 | 3194 | if (action == HDA_FIXUP_ACT_PRE_PROBE) |
108cc108 DH |
3195 | spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; |
3196 | } | |
3197 | ||
1d045db9 | 3198 | static void alc269_fixup_hweq(struct hda_codec *codec, |
1727a771 | 3199 | const struct hda_fixup *fix, int action) |
1d045db9 | 3200 | { |
98b24883 TI |
3201 | if (action == HDA_FIXUP_ACT_INIT) |
3202 | alc_update_coef_idx(codec, 0x1e, 0, 0x80); | |
1d045db9 | 3203 | } |
f1d4e28b | 3204 | |
7c478f03 DH |
3205 | static void alc269_fixup_headset_mic(struct hda_codec *codec, |
3206 | const struct hda_fixup *fix, int action) | |
3207 | { | |
3208 | struct alc_spec *spec = codec->spec; | |
3209 | ||
3210 | if (action == HDA_FIXUP_ACT_PRE_PROBE) | |
3211 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; | |
3212 | } | |
3213 | ||
1d045db9 | 3214 | static void alc271_fixup_dmic(struct hda_codec *codec, |
1727a771 | 3215 | const struct hda_fixup *fix, int action) |
1d045db9 TI |
3216 | { |
3217 | static const struct hda_verb verbs[] = { | |
3218 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, | |
3219 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, | |
3220 | {} | |
3221 | }; | |
3222 | unsigned int cfg; | |
f1d4e28b | 3223 | |
42397004 DR |
3224 | if (strcmp(codec->chip_name, "ALC271X") && |
3225 | strcmp(codec->chip_name, "ALC269VB")) | |
1d045db9 TI |
3226 | return; |
3227 | cfg = snd_hda_codec_get_pincfg(codec, 0x12); | |
3228 | if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED) | |
3229 | snd_hda_sequence_write(codec, verbs); | |
3230 | } | |
f1d4e28b | 3231 | |
017f2a10 | 3232 | static void alc269_fixup_pcm_44k(struct hda_codec *codec, |
1727a771 | 3233 | const struct hda_fixup *fix, int action) |
017f2a10 TI |
3234 | { |
3235 | struct alc_spec *spec = codec->spec; | |
3236 | ||
1727a771 | 3237 | if (action != HDA_FIXUP_ACT_PROBE) |
017f2a10 TI |
3238 | return; |
3239 | ||
3240 | /* Due to a hardware problem on Lenovo Ideadpad, we need to | |
3241 | * fix the sample rate of analog I/O to 44.1kHz | |
3242 | */ | |
08c189f2 TI |
3243 | spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback; |
3244 | spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture; | |
017f2a10 TI |
3245 | } |
3246 | ||
adabb3ec | 3247 | static void alc269_fixup_stereo_dmic(struct hda_codec *codec, |
1727a771 | 3248 | const struct hda_fixup *fix, int action) |
adabb3ec | 3249 | { |
adabb3ec TI |
3250 | /* The digital-mic unit sends PDM (differential signal) instead of |
3251 | * the standard PCM, thus you can't record a valid mono stream as is. | |
3252 | * Below is a workaround specific to ALC269 to control the dmic | |
3253 | * signal source as mono. | |
3254 | */ | |
98b24883 TI |
3255 | if (action == HDA_FIXUP_ACT_INIT) |
3256 | alc_update_coef_idx(codec, 0x07, 0, 0x80); | |
adabb3ec TI |
3257 | } |
3258 | ||
24519911 TI |
3259 | static void alc269_quanta_automute(struct hda_codec *codec) |
3260 | { | |
08c189f2 | 3261 | snd_hda_gen_update_outputs(codec); |
24519911 | 3262 | |
1687ccc8 TI |
3263 | alc_write_coef_idx(codec, 0x0c, 0x680); |
3264 | alc_write_coef_idx(codec, 0x0c, 0x480); | |
24519911 TI |
3265 | } |
3266 | ||
3267 | static void alc269_fixup_quanta_mute(struct hda_codec *codec, | |
1727a771 | 3268 | const struct hda_fixup *fix, int action) |
24519911 TI |
3269 | { |
3270 | struct alc_spec *spec = codec->spec; | |
1727a771 | 3271 | if (action != HDA_FIXUP_ACT_PROBE) |
24519911 | 3272 | return; |
08c189f2 | 3273 | spec->gen.automute_hook = alc269_quanta_automute; |
24519911 TI |
3274 | } |
3275 | ||
d240d1dc DH |
3276 | static void alc269_x101_hp_automute_hook(struct hda_codec *codec, |
3277 | struct hda_jack_tbl *jack) | |
3278 | { | |
3279 | struct alc_spec *spec = codec->spec; | |
3280 | int vref; | |
3281 | msleep(200); | |
3282 | snd_hda_gen_hp_automute(codec, jack); | |
3283 | ||
3284 | vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0; | |
3285 | msleep(100); | |
3286 | snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3287 | vref); | |
3288 | msleep(500); | |
3289 | snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
3290 | vref); | |
3291 | } | |
3292 | ||
3293 | static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, | |
3294 | const struct hda_fixup *fix, int action) | |
3295 | { | |
3296 | struct alc_spec *spec = codec->spec; | |
3297 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
3298 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; | |
3299 | spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook; | |
3300 | } | |
3301 | } | |
3302 | ||
3303 | ||
08fb0d0e TI |
3304 | /* update mute-LED according to the speaker mute state via mic VREF pin */ |
3305 | static void alc269_fixup_mic_mute_hook(void *private_data, int enabled) | |
6d3cd5d4 DH |
3306 | { |
3307 | struct hda_codec *codec = private_data; | |
08fb0d0e TI |
3308 | struct alc_spec *spec = codec->spec; |
3309 | unsigned int pinval; | |
3310 | ||
3311 | if (spec->mute_led_polarity) | |
3312 | enabled = !enabled; | |
415d555e TI |
3313 | pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid); |
3314 | pinval &= ~AC_PINCTL_VREFEN; | |
3315 | pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80; | |
08fb0d0e TI |
3316 | if (spec->mute_led_nid) |
3317 | snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval); | |
6d3cd5d4 DH |
3318 | } |
3319 | ||
d5b6b65e DH |
3320 | /* Make sure the led works even in runtime suspend */ |
3321 | static unsigned int led_power_filter(struct hda_codec *codec, | |
3322 | hda_nid_t nid, | |
3323 | unsigned int power_state) | |
3324 | { | |
3325 | struct alc_spec *spec = codec->spec; | |
3326 | ||
50dd9050 HW |
3327 | if (power_state != AC_PWRST_D3 || nid == 0 || |
3328 | (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid)) | |
d5b6b65e DH |
3329 | return power_state; |
3330 | ||
3331 | /* Set pin ctl again, it might have just been set to 0 */ | |
3332 | snd_hda_set_pin_ctl(codec, nid, | |
3333 | snd_hda_codec_get_pin_target(codec, nid)); | |
3334 | ||
3335 | return AC_PWRST_D0; | |
3336 | } | |
3337 | ||
08fb0d0e TI |
3338 | static void alc269_fixup_hp_mute_led(struct hda_codec *codec, |
3339 | const struct hda_fixup *fix, int action) | |
6d3cd5d4 DH |
3340 | { |
3341 | struct alc_spec *spec = codec->spec; | |
08fb0d0e TI |
3342 | const struct dmi_device *dev = NULL; |
3343 | ||
3344 | if (action != HDA_FIXUP_ACT_PRE_PROBE) | |
3345 | return; | |
3346 | ||
3347 | while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) { | |
3348 | int pol, pin; | |
3349 | if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2) | |
3350 | continue; | |
3351 | if (pin < 0x0a || pin >= 0x10) | |
3352 | break; | |
3353 | spec->mute_led_polarity = pol; | |
3354 | spec->mute_led_nid = pin - 0x0a + 0x18; | |
3355 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; | |
fd25a97a | 3356 | spec->gen.vmaster_mute_enum = 1; |
d5b6b65e | 3357 | codec->power_filter = led_power_filter; |
4e76a883 TI |
3358 | codec_dbg(codec, |
3359 | "Detected mute LED for %x:%d\n", spec->mute_led_nid, | |
08fb0d0e | 3360 | spec->mute_led_polarity); |
6d3cd5d4 DH |
3361 | break; |
3362 | } | |
3363 | } | |
3364 | ||
d06ac143 DH |
3365 | static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, |
3366 | const struct hda_fixup *fix, int action) | |
3367 | { | |
3368 | struct alc_spec *spec = codec->spec; | |
3369 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
3370 | spec->mute_led_polarity = 0; | |
3371 | spec->mute_led_nid = 0x18; | |
3372 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; | |
3373 | spec->gen.vmaster_mute_enum = 1; | |
d5b6b65e | 3374 | codec->power_filter = led_power_filter; |
d06ac143 DH |
3375 | } |
3376 | } | |
3377 | ||
08fb0d0e TI |
3378 | static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, |
3379 | const struct hda_fixup *fix, int action) | |
420b0feb TI |
3380 | { |
3381 | struct alc_spec *spec = codec->spec; | |
9bb1f06f | 3382 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
08fb0d0e TI |
3383 | spec->mute_led_polarity = 0; |
3384 | spec->mute_led_nid = 0x19; | |
3385 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; | |
fd25a97a | 3386 | spec->gen.vmaster_mute_enum = 1; |
d5b6b65e | 3387 | codec->power_filter = led_power_filter; |
420b0feb TI |
3388 | } |
3389 | } | |
3390 | ||
9f5c6faf TI |
3391 | /* turn on/off mute LED per vmaster hook */ |
3392 | static void alc269_fixup_hp_gpio_mute_hook(void *private_data, int enabled) | |
3393 | { | |
3394 | struct hda_codec *codec = private_data; | |
3395 | struct alc_spec *spec = codec->spec; | |
3396 | unsigned int oldval = spec->gpio_led; | |
3397 | ||
3398 | if (enabled) | |
3399 | spec->gpio_led &= ~0x08; | |
3400 | else | |
3401 | spec->gpio_led |= 0x08; | |
3402 | if (spec->gpio_led != oldval) | |
3403 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, | |
3404 | spec->gpio_led); | |
3405 | } | |
3406 | ||
3407 | /* turn on/off mic-mute LED per capture hook */ | |
3408 | static void alc269_fixup_hp_gpio_mic_mute_hook(struct hda_codec *codec, | |
7fe30711 TI |
3409 | struct snd_kcontrol *kcontrol, |
3410 | struct snd_ctl_elem_value *ucontrol) | |
9f5c6faf TI |
3411 | { |
3412 | struct alc_spec *spec = codec->spec; | |
3413 | unsigned int oldval = spec->gpio_led; | |
3414 | ||
3415 | if (!ucontrol) | |
3416 | return; | |
3417 | ||
3418 | if (ucontrol->value.integer.value[0] || | |
3419 | ucontrol->value.integer.value[1]) | |
3420 | spec->gpio_led &= ~0x10; | |
3421 | else | |
3422 | spec->gpio_led |= 0x10; | |
3423 | if (spec->gpio_led != oldval) | |
3424 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, | |
3425 | spec->gpio_led); | |
3426 | } | |
3427 | ||
3428 | static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, | |
3429 | const struct hda_fixup *fix, int action) | |
3430 | { | |
3431 | struct alc_spec *spec = codec->spec; | |
3432 | static const struct hda_verb gpio_init[] = { | |
3433 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 }, | |
3434 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 }, | |
3435 | {} | |
3436 | }; | |
3437 | ||
3438 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
3439 | spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook; | |
3440 | spec->gen.cap_sync_hook = alc269_fixup_hp_gpio_mic_mute_hook; | |
3441 | spec->gpio_led = 0; | |
3442 | snd_hda_add_verbs(codec, gpio_init); | |
3443 | } | |
3444 | } | |
3445 | ||
9c5dc3bf KY |
3446 | /* turn on/off mic-mute LED per capture hook */ |
3447 | static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec, | |
3448 | struct snd_kcontrol *kcontrol, | |
3449 | struct snd_ctl_elem_value *ucontrol) | |
3450 | { | |
3451 | struct alc_spec *spec = codec->spec; | |
3452 | unsigned int pinval, enable, disable; | |
3453 | ||
fc1fad93 | 3454 | pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid); |
9c5dc3bf KY |
3455 | pinval &= ~AC_PINCTL_VREFEN; |
3456 | enable = pinval | AC_PINCTL_VREF_80; | |
3457 | disable = pinval | AC_PINCTL_VREF_HIZ; | |
3458 | ||
3459 | if (!ucontrol) | |
3460 | return; | |
3461 | ||
3462 | if (ucontrol->value.integer.value[0] || | |
3463 | ucontrol->value.integer.value[1]) | |
3464 | pinval = disable; | |
3465 | else | |
3466 | pinval = enable; | |
3467 | ||
3468 | if (spec->cap_mute_led_nid) | |
3469 | snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval); | |
3470 | } | |
3471 | ||
3472 | static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, | |
3473 | const struct hda_fixup *fix, int action) | |
3474 | { | |
3475 | struct alc_spec *spec = codec->spec; | |
3476 | static const struct hda_verb gpio_init[] = { | |
3477 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x08 }, | |
3478 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x08 }, | |
3479 | {} | |
3480 | }; | |
3481 | ||
3482 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
3483 | spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook; | |
3484 | spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook; | |
3485 | spec->gpio_led = 0; | |
3486 | spec->cap_mute_led_nid = 0x18; | |
3487 | snd_hda_add_verbs(codec, gpio_init); | |
50dd9050 | 3488 | codec->power_filter = led_power_filter; |
9c5dc3bf KY |
3489 | } |
3490 | } | |
3491 | ||
3492 | static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, | |
3493 | const struct hda_fixup *fix, int action) | |
3494 | { | |
3495 | struct alc_spec *spec = codec->spec; | |
3496 | ||
3497 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
3498 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; | |
3499 | spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook; | |
3500 | spec->mute_led_polarity = 0; | |
3501 | spec->mute_led_nid = 0x1a; | |
3502 | spec->cap_mute_led_nid = 0x18; | |
3503 | spec->gen.vmaster_mute_enum = 1; | |
3504 | codec->power_filter = led_power_filter; | |
3505 | } | |
3506 | } | |
3507 | ||
73bdd597 DH |
3508 | static void alc_headset_mode_unplugged(struct hda_codec *codec) |
3509 | { | |
54db6c39 TI |
3510 | static struct coef_fw coef0255[] = { |
3511 | WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */ | |
3512 | WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */ | |
3513 | UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/ | |
3514 | WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */ | |
3515 | WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */ | |
3516 | {} | |
3517 | }; | |
3518 | static struct coef_fw coef0233[] = { | |
3519 | WRITE_COEF(0x1b, 0x0c0b), | |
3520 | WRITE_COEF(0x45, 0xc429), | |
3521 | UPDATE_COEF(0x35, 0x4000, 0), | |
3522 | WRITE_COEF(0x06, 0x2104), | |
3523 | WRITE_COEF(0x1a, 0x0001), | |
3524 | WRITE_COEF(0x26, 0x0004), | |
3525 | WRITE_COEF(0x32, 0x42a3), | |
3526 | {} | |
3527 | }; | |
3528 | static struct coef_fw coef0292[] = { | |
3529 | WRITE_COEF(0x76, 0x000e), | |
3530 | WRITE_COEF(0x6c, 0x2400), | |
3531 | WRITE_COEF(0x18, 0x7308), | |
3532 | WRITE_COEF(0x6b, 0xc429), | |
3533 | {} | |
3534 | }; | |
3535 | static struct coef_fw coef0293[] = { | |
3536 | UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */ | |
3537 | UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */ | |
3538 | UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */ | |
3539 | UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */ | |
3540 | WRITE_COEF(0x45, 0xc429), /* Set to TRS type */ | |
3541 | UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */ | |
3542 | {} | |
3543 | }; | |
3544 | static struct coef_fw coef0668[] = { | |
3545 | WRITE_COEF(0x15, 0x0d40), | |
3546 | WRITE_COEF(0xb7, 0x802b), | |
3547 | {} | |
3548 | }; | |
3549 | ||
73bdd597 | 3550 | switch (codec->vendor_id) { |
9a22a8f5 | 3551 | case 0x10ec0255: |
54db6c39 | 3552 | alc_process_coef_fw(codec, coef0255); |
9a22a8f5 | 3553 | break; |
13fd08a3 | 3554 | case 0x10ec0233: |
73bdd597 | 3555 | case 0x10ec0283: |
54db6c39 | 3556 | alc_process_coef_fw(codec, coef0233); |
73bdd597 DH |
3557 | break; |
3558 | case 0x10ec0292: | |
54db6c39 | 3559 | alc_process_coef_fw(codec, coef0292); |
73bdd597 | 3560 | break; |
a22aa26f | 3561 | case 0x10ec0293: |
54db6c39 | 3562 | alc_process_coef_fw(codec, coef0293); |
a22aa26f | 3563 | break; |
73bdd597 | 3564 | case 0x10ec0668: |
54db6c39 | 3565 | alc_process_coef_fw(codec, coef0668); |
73bdd597 DH |
3566 | break; |
3567 | } | |
4e76a883 | 3568 | codec_dbg(codec, "Headset jack set to unplugged mode.\n"); |
73bdd597 DH |
3569 | } |
3570 | ||
3571 | ||
3572 | static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, | |
3573 | hda_nid_t mic_pin) | |
3574 | { | |
54db6c39 TI |
3575 | static struct coef_fw coef0255[] = { |
3576 | WRITE_COEFEX(0x57, 0x03, 0x8aa6), | |
3577 | WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */ | |
3578 | {} | |
3579 | }; | |
3580 | static struct coef_fw coef0233[] = { | |
3581 | UPDATE_COEF(0x35, 0, 1<<14), | |
3582 | WRITE_COEF(0x06, 0x2100), | |
3583 | WRITE_COEF(0x1a, 0x0021), | |
3584 | WRITE_COEF(0x26, 0x008c), | |
3585 | {} | |
3586 | }; | |
3587 | static struct coef_fw coef0292[] = { | |
3588 | WRITE_COEF(0x19, 0xa208), | |
3589 | WRITE_COEF(0x2e, 0xacf0), | |
3590 | {} | |
3591 | }; | |
3592 | static struct coef_fw coef0293[] = { | |
3593 | UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */ | |
3594 | UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */ | |
3595 | UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ | |
3596 | {} | |
3597 | }; | |
3598 | static struct coef_fw coef0688[] = { | |
3599 | WRITE_COEF(0xb7, 0x802b), | |
3600 | WRITE_COEF(0xb5, 0x1040), | |
3601 | UPDATE_COEF(0xc3, 0, 1<<12), | |
3602 | {} | |
3603 | }; | |
3604 | ||
73bdd597 | 3605 | switch (codec->vendor_id) { |
9a22a8f5 KY |
3606 | case 0x10ec0255: |
3607 | alc_write_coef_idx(codec, 0x45, 0xc489); | |
3608 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | |
54db6c39 | 3609 | alc_process_coef_fw(codec, coef0255); |
9a22a8f5 KY |
3610 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); |
3611 | break; | |
13fd08a3 | 3612 | case 0x10ec0233: |
73bdd597 DH |
3613 | case 0x10ec0283: |
3614 | alc_write_coef_idx(codec, 0x45, 0xc429); | |
3615 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | |
54db6c39 | 3616 | alc_process_coef_fw(codec, coef0233); |
73bdd597 DH |
3617 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); |
3618 | break; | |
3619 | case 0x10ec0292: | |
3620 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | |
54db6c39 | 3621 | alc_process_coef_fw(codec, coef0292); |
73bdd597 | 3622 | break; |
a22aa26f KY |
3623 | case 0x10ec0293: |
3624 | /* Set to TRS mode */ | |
3625 | alc_write_coef_idx(codec, 0x45, 0xc429); | |
3626 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | |
54db6c39 | 3627 | alc_process_coef_fw(codec, coef0293); |
a22aa26f KY |
3628 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); |
3629 | break; | |
73bdd597 DH |
3630 | case 0x10ec0668: |
3631 | alc_write_coef_idx(codec, 0x11, 0x0001); | |
3632 | snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); | |
54db6c39 | 3633 | alc_process_coef_fw(codec, coef0688); |
73bdd597 DH |
3634 | snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); |
3635 | break; | |
3636 | } | |
4e76a883 | 3637 | codec_dbg(codec, "Headset jack set to mic-in mode.\n"); |
73bdd597 DH |
3638 | } |
3639 | ||
3640 | static void alc_headset_mode_default(struct hda_codec *codec) | |
3641 | { | |
54db6c39 TI |
3642 | static struct coef_fw coef0255[] = { |
3643 | WRITE_COEF(0x45, 0xc089), | |
3644 | WRITE_COEF(0x45, 0xc489), | |
3645 | WRITE_COEFEX(0x57, 0x03, 0x8ea6), | |
3646 | WRITE_COEF(0x49, 0x0049), | |
3647 | {} | |
3648 | }; | |
3649 | static struct coef_fw coef0233[] = { | |
3650 | WRITE_COEF(0x06, 0x2100), | |
3651 | WRITE_COEF(0x32, 0x4ea3), | |
3652 | {} | |
3653 | }; | |
3654 | static struct coef_fw coef0292[] = { | |
3655 | WRITE_COEF(0x76, 0x000e), | |
3656 | WRITE_COEF(0x6c, 0x2400), | |
3657 | WRITE_COEF(0x6b, 0xc429), | |
3658 | WRITE_COEF(0x18, 0x7308), | |
3659 | {} | |
3660 | }; | |
3661 | static struct coef_fw coef0293[] = { | |
3662 | UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */ | |
3663 | WRITE_COEF(0x45, 0xC429), /* Set to TRS type */ | |
3664 | UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ | |
3665 | {} | |
3666 | }; | |
3667 | static struct coef_fw coef0688[] = { | |
3668 | WRITE_COEF(0x11, 0x0041), | |
3669 | WRITE_COEF(0x15, 0x0d40), | |
3670 | WRITE_COEF(0xb7, 0x802b), | |
3671 | {} | |
3672 | }; | |
3673 | ||
73bdd597 | 3674 | switch (codec->vendor_id) { |
9a22a8f5 | 3675 | case 0x10ec0255: |
54db6c39 | 3676 | alc_process_coef_fw(codec, coef0255); |
9a22a8f5 | 3677 | break; |
13fd08a3 | 3678 | case 0x10ec0233: |
73bdd597 | 3679 | case 0x10ec0283: |
54db6c39 | 3680 | alc_process_coef_fw(codec, coef0233); |
73bdd597 DH |
3681 | break; |
3682 | case 0x10ec0292: | |
54db6c39 | 3683 | alc_process_coef_fw(codec, coef0292); |
73bdd597 | 3684 | break; |
a22aa26f | 3685 | case 0x10ec0293: |
54db6c39 | 3686 | alc_process_coef_fw(codec, coef0293); |
a22aa26f | 3687 | break; |
73bdd597 | 3688 | case 0x10ec0668: |
54db6c39 | 3689 | alc_process_coef_fw(codec, coef0688); |
73bdd597 DH |
3690 | break; |
3691 | } | |
4e76a883 | 3692 | codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); |
73bdd597 DH |
3693 | } |
3694 | ||
3695 | /* Iphone type */ | |
3696 | static void alc_headset_mode_ctia(struct hda_codec *codec) | |
3697 | { | |
54db6c39 TI |
3698 | static struct coef_fw coef0255[] = { |
3699 | WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */ | |
3700 | WRITE_COEF(0x1b, 0x0c2b), | |
3701 | WRITE_COEFEX(0x57, 0x03, 0x8ea6), | |
3702 | {} | |
3703 | }; | |
3704 | static struct coef_fw coef0233[] = { | |
3705 | WRITE_COEF(0x45, 0xd429), | |
3706 | WRITE_COEF(0x1b, 0x0c2b), | |
3707 | WRITE_COEF(0x32, 0x4ea3), | |
3708 | {} | |
3709 | }; | |
3710 | static struct coef_fw coef0292[] = { | |
3711 | WRITE_COEF(0x6b, 0xd429), | |
3712 | WRITE_COEF(0x76, 0x0008), | |
3713 | WRITE_COEF(0x18, 0x7388), | |
3714 | {} | |
3715 | }; | |
3716 | static struct coef_fw coef0293[] = { | |
3717 | WRITE_COEF(0x45, 0xd429), /* Set to ctia type */ | |
3718 | UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */ | |
3719 | {} | |
3720 | }; | |
3721 | static struct coef_fw coef0688[] = { | |
3722 | WRITE_COEF(0x11, 0x0001), | |
3723 | WRITE_COEF(0x15, 0x0d60), | |
3724 | WRITE_COEF(0xc3, 0x0000), | |
3725 | {} | |
3726 | }; | |
3727 | ||
73bdd597 | 3728 | switch (codec->vendor_id) { |
9a22a8f5 | 3729 | case 0x10ec0255: |
54db6c39 | 3730 | alc_process_coef_fw(codec, coef0255); |
9a22a8f5 | 3731 | break; |
13fd08a3 | 3732 | case 0x10ec0233: |
73bdd597 | 3733 | case 0x10ec0283: |
54db6c39 | 3734 | alc_process_coef_fw(codec, coef0233); |
73bdd597 DH |
3735 | break; |
3736 | case 0x10ec0292: | |
54db6c39 | 3737 | alc_process_coef_fw(codec, coef0292); |
73bdd597 | 3738 | break; |
a22aa26f | 3739 | case 0x10ec0293: |
54db6c39 | 3740 | alc_process_coef_fw(codec, coef0293); |
a22aa26f | 3741 | break; |
73bdd597 | 3742 | case 0x10ec0668: |
54db6c39 | 3743 | alc_process_coef_fw(codec, coef0688); |
73bdd597 DH |
3744 | break; |
3745 | } | |
4e76a883 | 3746 | codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); |
73bdd597 DH |
3747 | } |
3748 | ||
3749 | /* Nokia type */ | |
3750 | static void alc_headset_mode_omtp(struct hda_codec *codec) | |
3751 | { | |
54db6c39 TI |
3752 | static struct coef_fw coef0255[] = { |
3753 | WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */ | |
3754 | WRITE_COEF(0x1b, 0x0c2b), | |
3755 | WRITE_COEFEX(0x57, 0x03, 0x8ea6), | |
3756 | {} | |
3757 | }; | |
3758 | static struct coef_fw coef0233[] = { | |
3759 | WRITE_COEF(0x45, 0xe429), | |
3760 | WRITE_COEF(0x1b, 0x0c2b), | |
3761 | WRITE_COEF(0x32, 0x4ea3), | |
3762 | {} | |
3763 | }; | |
3764 | static struct coef_fw coef0292[] = { | |
3765 | WRITE_COEF(0x6b, 0xe429), | |
3766 | WRITE_COEF(0x76, 0x0008), | |
3767 | WRITE_COEF(0x18, 0x7388), | |
3768 | {} | |
3769 | }; | |
3770 | static struct coef_fw coef0293[] = { | |
3771 | WRITE_COEF(0x45, 0xe429), /* Set to omtp type */ | |
3772 | UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */ | |
3773 | {} | |
3774 | }; | |
3775 | static struct coef_fw coef0688[] = { | |
3776 | WRITE_COEF(0x11, 0x0001), | |
3777 | WRITE_COEF(0x15, 0x0d50), | |
3778 | WRITE_COEF(0xc3, 0x0000), | |
3779 | {} | |
3780 | }; | |
3781 | ||
73bdd597 | 3782 | switch (codec->vendor_id) { |
9a22a8f5 | 3783 | case 0x10ec0255: |
54db6c39 | 3784 | alc_process_coef_fw(codec, coef0255); |
9a22a8f5 | 3785 | break; |
13fd08a3 | 3786 | case 0x10ec0233: |
73bdd597 | 3787 | case 0x10ec0283: |
54db6c39 | 3788 | alc_process_coef_fw(codec, coef0233); |
73bdd597 DH |
3789 | break; |
3790 | case 0x10ec0292: | |
54db6c39 | 3791 | alc_process_coef_fw(codec, coef0292); |
73bdd597 | 3792 | break; |
a22aa26f | 3793 | case 0x10ec0293: |
54db6c39 | 3794 | alc_process_coef_fw(codec, coef0293); |
a22aa26f | 3795 | break; |
73bdd597 | 3796 | case 0x10ec0668: |
54db6c39 | 3797 | alc_process_coef_fw(codec, coef0688); |
73bdd597 DH |
3798 | break; |
3799 | } | |
4e76a883 | 3800 | codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); |
73bdd597 DH |
3801 | } |
3802 | ||
3803 | static void alc_determine_headset_type(struct hda_codec *codec) | |
3804 | { | |
3805 | int val; | |
3806 | bool is_ctia = false; | |
3807 | struct alc_spec *spec = codec->spec; | |
54db6c39 TI |
3808 | static struct coef_fw coef0255[] = { |
3809 | WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/ | |
3810 | WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref | |
3811 | conteol) */ | |
3812 | {} | |
3813 | }; | |
3814 | static struct coef_fw coef0293[] = { | |
3815 | UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */ | |
3816 | WRITE_COEF(0x45, 0xD429), /* Set to ctia type */ | |
3817 | {} | |
3818 | }; | |
3819 | static struct coef_fw coef0688[] = { | |
3820 | WRITE_COEF(0x11, 0x0001), | |
3821 | WRITE_COEF(0xb7, 0x802b), | |
3822 | WRITE_COEF(0x15, 0x0d60), | |
3823 | WRITE_COEF(0xc3, 0x0c00), | |
3824 | {} | |
3825 | }; | |
73bdd597 DH |
3826 | |
3827 | switch (codec->vendor_id) { | |
9a22a8f5 | 3828 | case 0x10ec0255: |
54db6c39 | 3829 | alc_process_coef_fw(codec, coef0255); |
9a22a8f5 KY |
3830 | msleep(300); |
3831 | val = alc_read_coef_idx(codec, 0x46); | |
3832 | is_ctia = (val & 0x0070) == 0x0070; | |
3833 | break; | |
13fd08a3 | 3834 | case 0x10ec0233: |
73bdd597 DH |
3835 | case 0x10ec0283: |
3836 | alc_write_coef_idx(codec, 0x45, 0xd029); | |
3837 | msleep(300); | |
3838 | val = alc_read_coef_idx(codec, 0x46); | |
3839 | is_ctia = (val & 0x0070) == 0x0070; | |
3840 | break; | |
3841 | case 0x10ec0292: | |
3842 | alc_write_coef_idx(codec, 0x6b, 0xd429); | |
3843 | msleep(300); | |
3844 | val = alc_read_coef_idx(codec, 0x6c); | |
3845 | is_ctia = (val & 0x001c) == 0x001c; | |
3846 | break; | |
a22aa26f | 3847 | case 0x10ec0293: |
54db6c39 | 3848 | alc_process_coef_fw(codec, coef0293); |
a22aa26f KY |
3849 | msleep(300); |
3850 | val = alc_read_coef_idx(codec, 0x46); | |
3851 | is_ctia = (val & 0x0070) == 0x0070; | |
3852 | break; | |
73bdd597 | 3853 | case 0x10ec0668: |
54db6c39 | 3854 | alc_process_coef_fw(codec, coef0688); |
73bdd597 DH |
3855 | msleep(300); |
3856 | val = alc_read_coef_idx(codec, 0xbe); | |
3857 | is_ctia = (val & 0x1c02) == 0x1c02; | |
3858 | break; | |
3859 | } | |
3860 | ||
4e76a883 | 3861 | codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", |
73bdd597 DH |
3862 | is_ctia ? "yes" : "no"); |
3863 | spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP; | |
3864 | } | |
3865 | ||
3866 | static void alc_update_headset_mode(struct hda_codec *codec) | |
3867 | { | |
3868 | struct alc_spec *spec = codec->spec; | |
3869 | ||
3870 | hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; | |
3871 | hda_nid_t hp_pin = spec->gen.autocfg.hp_pins[0]; | |
3872 | ||
3873 | int new_headset_mode; | |
3874 | ||
3875 | if (!snd_hda_jack_detect(codec, hp_pin)) | |
3876 | new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED; | |
3877 | else if (mux_pin == spec->headset_mic_pin) | |
3878 | new_headset_mode = ALC_HEADSET_MODE_HEADSET; | |
3879 | else if (mux_pin == spec->headphone_mic_pin) | |
3880 | new_headset_mode = ALC_HEADSET_MODE_MIC; | |
3881 | else | |
3882 | new_headset_mode = ALC_HEADSET_MODE_HEADPHONE; | |
3883 | ||
5959a6bc DH |
3884 | if (new_headset_mode == spec->current_headset_mode) { |
3885 | snd_hda_gen_update_outputs(codec); | |
73bdd597 | 3886 | return; |
5959a6bc | 3887 | } |
73bdd597 DH |
3888 | |
3889 | switch (new_headset_mode) { | |
3890 | case ALC_HEADSET_MODE_UNPLUGGED: | |
3891 | alc_headset_mode_unplugged(codec); | |
3892 | spec->gen.hp_jack_present = false; | |
3893 | break; | |
3894 | case ALC_HEADSET_MODE_HEADSET: | |
3895 | if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN) | |
3896 | alc_determine_headset_type(codec); | |
3897 | if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA) | |
3898 | alc_headset_mode_ctia(codec); | |
3899 | else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP) | |
3900 | alc_headset_mode_omtp(codec); | |
3901 | spec->gen.hp_jack_present = true; | |
3902 | break; | |
3903 | case ALC_HEADSET_MODE_MIC: | |
3904 | alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); | |
3905 | spec->gen.hp_jack_present = false; | |
3906 | break; | |
3907 | case ALC_HEADSET_MODE_HEADPHONE: | |
3908 | alc_headset_mode_default(codec); | |
3909 | spec->gen.hp_jack_present = true; | |
3910 | break; | |
3911 | } | |
3912 | if (new_headset_mode != ALC_HEADSET_MODE_MIC) { | |
3913 | snd_hda_set_pin_ctl_cache(codec, hp_pin, | |
3914 | AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); | |
3915 | if (spec->headphone_mic_pin) | |
3916 | snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, | |
3917 | PIN_VREFHIZ); | |
3918 | } | |
3919 | spec->current_headset_mode = new_headset_mode; | |
3920 | ||
3921 | snd_hda_gen_update_outputs(codec); | |
3922 | } | |
3923 | ||
3924 | static void alc_update_headset_mode_hook(struct hda_codec *codec, | |
7fe30711 TI |
3925 | struct snd_kcontrol *kcontrol, |
3926 | struct snd_ctl_elem_value *ucontrol) | |
73bdd597 DH |
3927 | { |
3928 | alc_update_headset_mode(codec); | |
3929 | } | |
3930 | ||
3931 | static void alc_update_headset_jack_cb(struct hda_codec *codec, struct hda_jack_tbl *jack) | |
3932 | { | |
3933 | struct alc_spec *spec = codec->spec; | |
5db4d34b | 3934 | spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN; |
73bdd597 DH |
3935 | snd_hda_gen_hp_automute(codec, jack); |
3936 | } | |
3937 | ||
3938 | static void alc_probe_headset_mode(struct hda_codec *codec) | |
3939 | { | |
3940 | int i; | |
3941 | struct alc_spec *spec = codec->spec; | |
3942 | struct auto_pin_cfg *cfg = &spec->gen.autocfg; | |
3943 | ||
3944 | /* Find mic pins */ | |
3945 | for (i = 0; i < cfg->num_inputs; i++) { | |
3946 | if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin) | |
3947 | spec->headset_mic_pin = cfg->inputs[i].pin; | |
3948 | if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin) | |
3949 | spec->headphone_mic_pin = cfg->inputs[i].pin; | |
3950 | } | |
3951 | ||
3952 | spec->gen.cap_sync_hook = alc_update_headset_mode_hook; | |
3953 | spec->gen.automute_hook = alc_update_headset_mode; | |
3954 | spec->gen.hp_automute_hook = alc_update_headset_jack_cb; | |
3955 | } | |
3956 | ||
3957 | static void alc_fixup_headset_mode(struct hda_codec *codec, | |
3958 | const struct hda_fixup *fix, int action) | |
3959 | { | |
3960 | struct alc_spec *spec = codec->spec; | |
3961 | ||
3962 | switch (action) { | |
3963 | case HDA_FIXUP_ACT_PRE_PROBE: | |
3964 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC; | |
3965 | break; | |
3966 | case HDA_FIXUP_ACT_PROBE: | |
3967 | alc_probe_headset_mode(codec); | |
3968 | break; | |
3969 | case HDA_FIXUP_ACT_INIT: | |
3970 | spec->current_headset_mode = 0; | |
3971 | alc_update_headset_mode(codec); | |
3972 | break; | |
3973 | } | |
3974 | } | |
3975 | ||
3976 | static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, | |
3977 | const struct hda_fixup *fix, int action) | |
3978 | { | |
3979 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
3980 | struct alc_spec *spec = codec->spec; | |
3981 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; | |
3982 | } | |
3983 | else | |
3984 | alc_fixup_headset_mode(codec, fix, action); | |
3985 | } | |
3986 | ||
31278997 KY |
3987 | static void alc255_set_default_jack_type(struct hda_codec *codec) |
3988 | { | |
3989 | /* Set to iphone type */ | |
54db6c39 TI |
3990 | static struct coef_fw fw[] = { |
3991 | WRITE_COEF(0x1b, 0x880b), | |
3992 | WRITE_COEF(0x45, 0xd089), | |
3993 | WRITE_COEF(0x1b, 0x080b), | |
3994 | WRITE_COEF(0x46, 0x0004), | |
3995 | WRITE_COEF(0x1b, 0x0c0b), | |
3996 | {} | |
3997 | }; | |
3998 | alc_process_coef_fw(codec, fw); | |
31278997 KY |
3999 | msleep(30); |
4000 | } | |
4001 | ||
9a22a8f5 KY |
4002 | static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, |
4003 | const struct hda_fixup *fix, int action) | |
4004 | { | |
4005 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
31278997 | 4006 | alc255_set_default_jack_type(codec); |
9a22a8f5 KY |
4007 | } |
4008 | alc_fixup_headset_mode(codec, fix, action); | |
4009 | } | |
4010 | ||
31278997 KY |
4011 | static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, |
4012 | const struct hda_fixup *fix, int action) | |
4013 | { | |
4014 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
4015 | struct alc_spec *spec = codec->spec; | |
4016 | spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; | |
4017 | alc255_set_default_jack_type(codec); | |
4018 | } | |
4019 | else | |
4020 | alc_fixup_headset_mode(codec, fix, action); | |
4021 | } | |
4022 | ||
493a52a9 HW |
4023 | static void alc_fixup_auto_mute_via_amp(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 | spec->gen.auto_mute_via_amp = 1; | |
4029 | } | |
4030 | } | |
4031 | ||
9b745ab8 TI |
4032 | static void alc_no_shutup(struct hda_codec *codec) |
4033 | { | |
4034 | } | |
4035 | ||
4036 | static void alc_fixup_no_shutup(struct hda_codec *codec, | |
4037 | const struct hda_fixup *fix, int action) | |
4038 | { | |
4039 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
4040 | struct alc_spec *spec = codec->spec; | |
4041 | spec->shutup = alc_no_shutup; | |
4042 | } | |
4043 | } | |
4044 | ||
5e6db669 GM |
4045 | static void alc_fixup_disable_aamix(struct hda_codec *codec, |
4046 | const struct hda_fixup *fix, int action) | |
4047 | { | |
4048 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
4049 | struct alc_spec *spec = codec->spec; | |
4050 | /* Disable AA-loopback as it causes white noise */ | |
4051 | spec->gen.mixer_nid = 0; | |
4052 | } | |
4053 | } | |
4054 | ||
033b0a7c GM |
4055 | static unsigned int alc_power_filter_xps13(struct hda_codec *codec, |
4056 | hda_nid_t nid, | |
4057 | unsigned int power_state) | |
4058 | { | |
4059 | struct alc_spec *spec = codec->spec; | |
4060 | ||
4061 | /* Avoid pop noises when headphones are plugged in */ | |
4062 | if (spec->gen.hp_jack_present) | |
de3da4f6 | 4063 | if (nid == codec->afg || nid == 0x02 || nid == 0x15) |
033b0a7c GM |
4064 | return AC_PWRST_D0; |
4065 | return power_state; | |
4066 | } | |
4067 | ||
4068 | static void alc_fixup_dell_xps13(struct hda_codec *codec, | |
4069 | const struct hda_fixup *fix, int action) | |
4070 | { | |
4071 | if (action == HDA_FIXUP_ACT_PROBE) { | |
4072 | struct alc_spec *spec = codec->spec; | |
f38663ab GM |
4073 | struct hda_input_mux *imux = &spec->gen.input_mux; |
4074 | int i; | |
4075 | ||
033b0a7c GM |
4076 | spec->shutup = alc_no_shutup; |
4077 | codec->power_filter = alc_power_filter_xps13; | |
f38663ab GM |
4078 | |
4079 | /* Make the internal mic the default input source. */ | |
4080 | for (i = 0; i < imux->num_items; i++) { | |
4081 | if (spec->gen.imux_pins[i] == 0x12) { | |
4082 | spec->gen.cur_mux[0] = i; | |
4083 | break; | |
4084 | } | |
4085 | } | |
033b0a7c GM |
4086 | } |
4087 | } | |
4088 | ||
73bdd597 DH |
4089 | static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, |
4090 | const struct hda_fixup *fix, int action) | |
4091 | { | |
4092 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
73bdd597 | 4093 | alc_write_coef_idx(codec, 0xc4, 0x8000); |
98b24883 | 4094 | alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); |
73bdd597 DH |
4095 | snd_hda_set_pin_ctl_cache(codec, 0x18, 0); |
4096 | } | |
4097 | alc_fixup_headset_mode(codec, fix, action); | |
4098 | } | |
4099 | ||
bde7bc60 CCC |
4100 | /* Returns the nid of the external mic input pin, or 0 if it cannot be found. */ |
4101 | static int find_ext_mic_pin(struct hda_codec *codec) | |
4102 | { | |
4103 | struct alc_spec *spec = codec->spec; | |
4104 | struct auto_pin_cfg *cfg = &spec->gen.autocfg; | |
4105 | hda_nid_t nid; | |
4106 | unsigned int defcfg; | |
4107 | int i; | |
4108 | ||
4109 | for (i = 0; i < cfg->num_inputs; i++) { | |
4110 | if (cfg->inputs[i].type != AUTO_PIN_MIC) | |
4111 | continue; | |
4112 | nid = cfg->inputs[i].pin; | |
4113 | defcfg = snd_hda_codec_get_pincfg(codec, nid); | |
4114 | if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT) | |
4115 | continue; | |
4116 | return nid; | |
4117 | } | |
4118 | ||
4119 | return 0; | |
4120 | } | |
4121 | ||
08a978db | 4122 | static void alc271_hp_gate_mic_jack(struct hda_codec *codec, |
1727a771 | 4123 | const struct hda_fixup *fix, |
08a978db DR |
4124 | int action) |
4125 | { | |
4126 | struct alc_spec *spec = codec->spec; | |
4127 | ||
0db75790 | 4128 | if (action == HDA_FIXUP_ACT_PROBE) { |
bde7bc60 CCC |
4129 | int mic_pin = find_ext_mic_pin(codec); |
4130 | int hp_pin = spec->gen.autocfg.hp_pins[0]; | |
4131 | ||
4132 | if (snd_BUG_ON(!mic_pin || !hp_pin)) | |
0db75790 | 4133 | return; |
bde7bc60 | 4134 | snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); |
0db75790 | 4135 | } |
08a978db | 4136 | } |
693b613d | 4137 | |
3e0d611b DH |
4138 | static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, |
4139 | const struct hda_fixup *fix, | |
4140 | int action) | |
4141 | { | |
4142 | struct alc_spec *spec = codec->spec; | |
4143 | struct auto_pin_cfg *cfg = &spec->gen.autocfg; | |
4144 | int i; | |
4145 | ||
4146 | /* The mic boosts on level 2 and 3 are too noisy | |
4147 | on the internal mic input. | |
4148 | Therefore limit the boost to 0 or 1. */ | |
4149 | ||
4150 | if (action != HDA_FIXUP_ACT_PROBE) | |
4151 | return; | |
4152 | ||
4153 | for (i = 0; i < cfg->num_inputs; i++) { | |
4154 | hda_nid_t nid = cfg->inputs[i].pin; | |
4155 | unsigned int defcfg; | |
4156 | if (cfg->inputs[i].type != AUTO_PIN_MIC) | |
4157 | continue; | |
4158 | defcfg = snd_hda_codec_get_pincfg(codec, nid); | |
4159 | if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT) | |
4160 | continue; | |
4161 | ||
4162 | snd_hda_override_amp_caps(codec, nid, HDA_INPUT, | |
4163 | (0x00 << AC_AMPCAP_OFFSET_SHIFT) | | |
4164 | (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
4165 | (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
4166 | (0 << AC_AMPCAP_MUTE_SHIFT)); | |
4167 | } | |
4168 | } | |
4169 | ||
cd217a63 KY |
4170 | static void alc283_hp_automute_hook(struct hda_codec *codec, |
4171 | struct hda_jack_tbl *jack) | |
4172 | { | |
4173 | struct alc_spec *spec = codec->spec; | |
4174 | int vref; | |
4175 | ||
4176 | msleep(200); | |
4177 | snd_hda_gen_hp_automute(codec, jack); | |
4178 | ||
4179 | vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0; | |
4180 | ||
4181 | msleep(600); | |
4182 | snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | |
4183 | vref); | |
4184 | } | |
4185 | ||
cd217a63 KY |
4186 | static void alc283_fixup_chromebook(struct hda_codec *codec, |
4187 | const struct hda_fixup *fix, int action) | |
4188 | { | |
4189 | struct alc_spec *spec = codec->spec; | |
cd217a63 KY |
4190 | |
4191 | switch (action) { | |
4192 | case HDA_FIXUP_ACT_PRE_PROBE: | |
0202e99c | 4193 | snd_hda_override_wcaps(codec, 0x03, 0); |
d2e92709 TI |
4194 | /* Disable AA-loopback as it causes white noise */ |
4195 | spec->gen.mixer_nid = 0; | |
38070219 | 4196 | break; |
0202e99c | 4197 | case HDA_FIXUP_ACT_INIT: |
de9481cb KY |
4198 | /* MIC2-VREF control */ |
4199 | /* Set to manual mode */ | |
98b24883 | 4200 | alc_update_coef_idx(codec, 0x06, 0x000c, 0); |
0202e99c | 4201 | /* Enable Line1 input control by verb */ |
98b24883 | 4202 | alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); |
0202e99c KY |
4203 | break; |
4204 | } | |
4205 | } | |
4206 | ||
4207 | static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, | |
4208 | const struct hda_fixup *fix, int action) | |
4209 | { | |
4210 | struct alc_spec *spec = codec->spec; | |
0202e99c KY |
4211 | |
4212 | switch (action) { | |
4213 | case HDA_FIXUP_ACT_PRE_PROBE: | |
cd217a63 | 4214 | spec->gen.hp_automute_hook = alc283_hp_automute_hook; |
38070219 KY |
4215 | break; |
4216 | case HDA_FIXUP_ACT_INIT: | |
cd217a63 KY |
4217 | /* MIC2-VREF control */ |
4218 | /* Set to manual mode */ | |
98b24883 | 4219 | alc_update_coef_idx(codec, 0x06, 0x000c, 0); |
cd217a63 KY |
4220 | break; |
4221 | } | |
4222 | } | |
4223 | ||
7bba2157 TI |
4224 | /* mute tablet speaker pin (0x14) via dock plugging in addition */ |
4225 | static void asus_tx300_automute(struct hda_codec *codec) | |
4226 | { | |
4227 | struct alc_spec *spec = codec->spec; | |
4228 | snd_hda_gen_update_outputs(codec); | |
4229 | if (snd_hda_jack_detect(codec, 0x1b)) | |
4230 | spec->gen.mute_bits |= (1ULL << 0x14); | |
4231 | } | |
4232 | ||
4233 | static void alc282_fixup_asus_tx300(struct hda_codec *codec, | |
4234 | const struct hda_fixup *fix, int action) | |
4235 | { | |
4236 | struct alc_spec *spec = codec->spec; | |
4237 | /* TX300 needs to set up GPIO2 for the speaker amp */ | |
4238 | static const struct hda_verb gpio2_verbs[] = { | |
4239 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x04 }, | |
4240 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04 }, | |
4241 | { 0x01, AC_VERB_SET_GPIO_DATA, 0x04 }, | |
4242 | {} | |
4243 | }; | |
4244 | static const struct hda_pintbl dock_pins[] = { | |
4245 | { 0x1b, 0x21114000 }, /* dock speaker pin */ | |
4246 | {} | |
4247 | }; | |
4248 | struct snd_kcontrol *kctl; | |
4249 | ||
4250 | switch (action) { | |
4251 | case HDA_FIXUP_ACT_PRE_PROBE: | |
4252 | snd_hda_add_verbs(codec, gpio2_verbs); | |
4253 | snd_hda_apply_pincfgs(codec, dock_pins); | |
4254 | spec->gen.auto_mute_via_amp = 1; | |
4255 | spec->gen.automute_hook = asus_tx300_automute; | |
4256 | snd_hda_jack_detect_enable_callback(codec, 0x1b, | |
4257 | HDA_GEN_HP_EVENT, | |
4258 | snd_hda_gen_hp_automute); | |
4259 | break; | |
4260 | case HDA_FIXUP_ACT_BUILD: | |
4261 | /* this is a bit tricky; give more sane names for the main | |
4262 | * (tablet) speaker and the dock speaker, respectively | |
4263 | */ | |
4264 | kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch"); | |
4265 | if (kctl) | |
4266 | strcpy(kctl->id.name, "Dock Speaker Playback Switch"); | |
4267 | kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch"); | |
4268 | if (kctl) | |
4269 | strcpy(kctl->id.name, "Speaker Playback Switch"); | |
4270 | break; | |
4271 | } | |
4272 | } | |
4273 | ||
338cae56 DH |
4274 | static void alc290_fixup_mono_speakers(struct hda_codec *codec, |
4275 | const struct hda_fixup *fix, int action) | |
4276 | { | |
0f4881dc DH |
4277 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
4278 | /* DAC node 0x03 is giving mono output. We therefore want to | |
4279 | make sure 0x14 (front speaker) and 0x15 (headphones) use the | |
4280 | stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */ | |
4281 | hda_nid_t conn1[2] = { 0x0c }; | |
4282 | snd_hda_override_conn_list(codec, 0x14, 1, conn1); | |
4283 | snd_hda_override_conn_list(codec, 0x15, 1, conn1); | |
4284 | } | |
338cae56 DH |
4285 | } |
4286 | ||
b317b032 TI |
4287 | /* for hda_fixup_thinkpad_acpi() */ |
4288 | #include "thinkpad_helper.c" | |
b67ae3f1 | 4289 | |
00ef9940 HW |
4290 | /* for dell wmi mic mute led */ |
4291 | #include "dell_wmi_helper.c" | |
4292 | ||
1d045db9 TI |
4293 | enum { |
4294 | ALC269_FIXUP_SONY_VAIO, | |
4295 | ALC275_FIXUP_SONY_VAIO_GPIO2, | |
4296 | ALC269_FIXUP_DELL_M101Z, | |
4297 | ALC269_FIXUP_SKU_IGNORE, | |
4298 | ALC269_FIXUP_ASUS_G73JW, | |
4299 | ALC269_FIXUP_LENOVO_EAPD, | |
4300 | ALC275_FIXUP_SONY_HWEQ, | |
e9bd7d5c | 4301 | ALC275_FIXUP_SONY_DISABLE_AAMIX, |
1d045db9 | 4302 | ALC271_FIXUP_DMIC, |
017f2a10 | 4303 | ALC269_FIXUP_PCM_44K, |
adabb3ec | 4304 | ALC269_FIXUP_STEREO_DMIC, |
7c478f03 | 4305 | ALC269_FIXUP_HEADSET_MIC, |
24519911 TI |
4306 | ALC269_FIXUP_QUANTA_MUTE, |
4307 | ALC269_FIXUP_LIFEBOOK, | |
2041d564 | 4308 | ALC269_FIXUP_LIFEBOOK_EXTMIC, |
a4297b5d TI |
4309 | ALC269_FIXUP_AMIC, |
4310 | ALC269_FIXUP_DMIC, | |
4311 | ALC269VB_FIXUP_AMIC, | |
4312 | ALC269VB_FIXUP_DMIC, | |
08fb0d0e | 4313 | ALC269_FIXUP_HP_MUTE_LED, |
d06ac143 | 4314 | ALC269_FIXUP_HP_MUTE_LED_MIC1, |
08fb0d0e | 4315 | ALC269_FIXUP_HP_MUTE_LED_MIC2, |
9f5c6faf | 4316 | ALC269_FIXUP_HP_GPIO_LED, |
9c5dc3bf KY |
4317 | ALC269_FIXUP_HP_GPIO_MIC1_LED, |
4318 | ALC269_FIXUP_HP_LINE1_MIC1_LED, | |
693b613d | 4319 | ALC269_FIXUP_INV_DMIC, |
108cc108 | 4320 | ALC269_FIXUP_LENOVO_DOCK, |
9b745ab8 | 4321 | ALC269_FIXUP_NO_SHUTUP, |
88cfcf86 | 4322 | ALC286_FIXUP_SONY_MIC_NO_PRESENCE, |
108cc108 | 4323 | ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT, |
73bdd597 DH |
4324 | ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
4325 | ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, | |
338cae56 | 4326 | ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, |
73bdd597 DH |
4327 | ALC269_FIXUP_HEADSET_MODE, |
4328 | ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, | |
d240d1dc DH |
4329 | ALC269_FIXUP_ASUS_X101_FUNC, |
4330 | ALC269_FIXUP_ASUS_X101_VERB, | |
4331 | ALC269_FIXUP_ASUS_X101, | |
08a978db DR |
4332 | ALC271_FIXUP_AMIC_MIC2, |
4333 | ALC271_FIXUP_HP_GATE_MIC_JACK, | |
b1e8972e | 4334 | ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, |
42397004 | 4335 | ALC269_FIXUP_ACER_AC700, |
3e0d611b | 4336 | ALC269_FIXUP_LIMIT_INT_MIC_BOOST, |
2cede303 | 4337 | ALC269VB_FIXUP_ASUS_ZENBOOK, |
23870831 | 4338 | ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, |
8e35cd4a | 4339 | ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED, |
02b504d9 | 4340 | ALC269VB_FIXUP_ORDISSIMO_EVE2, |
cd217a63 | 4341 | ALC283_FIXUP_CHROME_BOOK, |
0202e99c | 4342 | ALC283_FIXUP_SENSE_COMBO_JACK, |
7bba2157 | 4343 | ALC282_FIXUP_ASUS_TX300, |
1bb3e062 | 4344 | ALC283_FIXUP_INT_MIC, |
338cae56 | 4345 | ALC290_FIXUP_MONO_SPEAKERS, |
0f4881dc DH |
4346 | ALC290_FIXUP_MONO_SPEAKERS_HSJACK, |
4347 | ALC290_FIXUP_SUBWOOFER, | |
4348 | ALC290_FIXUP_SUBWOOFER_HSJACK, | |
b67ae3f1 | 4349 | ALC269_FIXUP_THINKPAD_ACPI, |
9a22a8f5 | 4350 | ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
31278997 | 4351 | ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, |
9a22a8f5 | 4352 | ALC255_FIXUP_HEADSET_MODE, |
31278997 | 4353 | ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC, |
a22aa26f | 4354 | ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, |
1c37c223 | 4355 | ALC292_FIXUP_TPT440_DOCK, |
9dc12862 | 4356 | ALC283_FIXUP_BXBT2807_MIC, |
00ef9940 | 4357 | ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, |
1a22e775 | 4358 | ALC282_FIXUP_ASPIRE_V5_PINS, |
f1d4e28b KY |
4359 | }; |
4360 | ||
1727a771 | 4361 | static const struct hda_fixup alc269_fixups[] = { |
1d045db9 | 4362 | [ALC269_FIXUP_SONY_VAIO] = { |
fd108215 TI |
4363 | .type = HDA_FIXUP_PINCTLS, |
4364 | .v.pins = (const struct hda_pintbl[]) { | |
4365 | {0x19, PIN_VREFGRD}, | |
1d045db9 TI |
4366 | {} |
4367 | } | |
f1d4e28b | 4368 | }, |
1d045db9 | 4369 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
1727a771 | 4370 | .type = HDA_FIXUP_VERBS, |
1d045db9 TI |
4371 | .v.verbs = (const struct hda_verb[]) { |
4372 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, | |
4373 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, | |
4374 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, | |
4375 | { } | |
4376 | }, | |
4377 | .chained = true, | |
4378 | .chain_id = ALC269_FIXUP_SONY_VAIO | |
4379 | }, | |
4380 | [ALC269_FIXUP_DELL_M101Z] = { | |
1727a771 | 4381 | .type = HDA_FIXUP_VERBS, |
1d045db9 TI |
4382 | .v.verbs = (const struct hda_verb[]) { |
4383 | /* Enables internal speaker */ | |
4384 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, | |
4385 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, | |
4386 | {} | |
4387 | } | |
4388 | }, | |
4389 | [ALC269_FIXUP_SKU_IGNORE] = { | |
1727a771 | 4390 | .type = HDA_FIXUP_FUNC, |
23d30f28 | 4391 | .v.func = alc_fixup_sku_ignore, |
1d045db9 TI |
4392 | }, |
4393 | [ALC269_FIXUP_ASUS_G73JW] = { | |
1727a771 TI |
4394 | .type = HDA_FIXUP_PINS, |
4395 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 TI |
4396 | { 0x17, 0x99130111 }, /* subwoofer */ |
4397 | { } | |
4398 | } | |
4399 | }, | |
4400 | [ALC269_FIXUP_LENOVO_EAPD] = { | |
1727a771 | 4401 | .type = HDA_FIXUP_VERBS, |
1d045db9 TI |
4402 | .v.verbs = (const struct hda_verb[]) { |
4403 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, | |
4404 | {} | |
4405 | } | |
4406 | }, | |
4407 | [ALC275_FIXUP_SONY_HWEQ] = { | |
1727a771 | 4408 | .type = HDA_FIXUP_FUNC, |
1d045db9 TI |
4409 | .v.func = alc269_fixup_hweq, |
4410 | .chained = true, | |
4411 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 | |
4412 | }, | |
e9bd7d5c TI |
4413 | [ALC275_FIXUP_SONY_DISABLE_AAMIX] = { |
4414 | .type = HDA_FIXUP_FUNC, | |
4415 | .v.func = alc_fixup_disable_aamix, | |
4416 | .chained = true, | |
4417 | .chain_id = ALC269_FIXUP_SONY_VAIO | |
4418 | }, | |
1d045db9 | 4419 | [ALC271_FIXUP_DMIC] = { |
1727a771 | 4420 | .type = HDA_FIXUP_FUNC, |
1d045db9 | 4421 | .v.func = alc271_fixup_dmic, |
f1d4e28b | 4422 | }, |
017f2a10 | 4423 | [ALC269_FIXUP_PCM_44K] = { |
1727a771 | 4424 | .type = HDA_FIXUP_FUNC, |
017f2a10 | 4425 | .v.func = alc269_fixup_pcm_44k, |
012e7eb1 DH |
4426 | .chained = true, |
4427 | .chain_id = ALC269_FIXUP_QUANTA_MUTE | |
017f2a10 | 4428 | }, |
adabb3ec | 4429 | [ALC269_FIXUP_STEREO_DMIC] = { |
1727a771 | 4430 | .type = HDA_FIXUP_FUNC, |
adabb3ec TI |
4431 | .v.func = alc269_fixup_stereo_dmic, |
4432 | }, | |
7c478f03 DH |
4433 | [ALC269_FIXUP_HEADSET_MIC] = { |
4434 | .type = HDA_FIXUP_FUNC, | |
4435 | .v.func = alc269_fixup_headset_mic, | |
4436 | }, | |
24519911 | 4437 | [ALC269_FIXUP_QUANTA_MUTE] = { |
1727a771 | 4438 | .type = HDA_FIXUP_FUNC, |
24519911 TI |
4439 | .v.func = alc269_fixup_quanta_mute, |
4440 | }, | |
4441 | [ALC269_FIXUP_LIFEBOOK] = { | |
1727a771 TI |
4442 | .type = HDA_FIXUP_PINS, |
4443 | .v.pins = (const struct hda_pintbl[]) { | |
24519911 TI |
4444 | { 0x1a, 0x2101103f }, /* dock line-out */ |
4445 | { 0x1b, 0x23a11040 }, /* dock mic-in */ | |
4446 | { } | |
4447 | }, | |
4448 | .chained = true, | |
4449 | .chain_id = ALC269_FIXUP_QUANTA_MUTE | |
4450 | }, | |
2041d564 DH |
4451 | [ALC269_FIXUP_LIFEBOOK_EXTMIC] = { |
4452 | .type = HDA_FIXUP_PINS, | |
4453 | .v.pins = (const struct hda_pintbl[]) { | |
4454 | { 0x19, 0x01a1903c }, /* headset mic, with jack detect */ | |
4455 | { } | |
4456 | }, | |
4457 | }, | |
a4297b5d | 4458 | [ALC269_FIXUP_AMIC] = { |
1727a771 TI |
4459 | .type = HDA_FIXUP_PINS, |
4460 | .v.pins = (const struct hda_pintbl[]) { | |
a4297b5d TI |
4461 | { 0x14, 0x99130110 }, /* speaker */ |
4462 | { 0x15, 0x0121401f }, /* HP out */ | |
4463 | { 0x18, 0x01a19c20 }, /* mic */ | |
4464 | { 0x19, 0x99a3092f }, /* int-mic */ | |
4465 | { } | |
4466 | }, | |
4467 | }, | |
4468 | [ALC269_FIXUP_DMIC] = { | |
1727a771 TI |
4469 | .type = HDA_FIXUP_PINS, |
4470 | .v.pins = (const struct hda_pintbl[]) { | |
a4297b5d TI |
4471 | { 0x12, 0x99a3092f }, /* int-mic */ |
4472 | { 0x14, 0x99130110 }, /* speaker */ | |
4473 | { 0x15, 0x0121401f }, /* HP out */ | |
4474 | { 0x18, 0x01a19c20 }, /* mic */ | |
4475 | { } | |
4476 | }, | |
4477 | }, | |
4478 | [ALC269VB_FIXUP_AMIC] = { | |
1727a771 TI |
4479 | .type = HDA_FIXUP_PINS, |
4480 | .v.pins = (const struct hda_pintbl[]) { | |
a4297b5d TI |
4481 | { 0x14, 0x99130110 }, /* speaker */ |
4482 | { 0x18, 0x01a19c20 }, /* mic */ | |
4483 | { 0x19, 0x99a3092f }, /* int-mic */ | |
4484 | { 0x21, 0x0121401f }, /* HP out */ | |
4485 | { } | |
4486 | }, | |
4487 | }, | |
2267ea97 | 4488 | [ALC269VB_FIXUP_DMIC] = { |
1727a771 TI |
4489 | .type = HDA_FIXUP_PINS, |
4490 | .v.pins = (const struct hda_pintbl[]) { | |
a4297b5d TI |
4491 | { 0x12, 0x99a3092f }, /* int-mic */ |
4492 | { 0x14, 0x99130110 }, /* speaker */ | |
4493 | { 0x18, 0x01a19c20 }, /* mic */ | |
4494 | { 0x21, 0x0121401f }, /* HP out */ | |
4495 | { } | |
4496 | }, | |
4497 | }, | |
08fb0d0e | 4498 | [ALC269_FIXUP_HP_MUTE_LED] = { |
1727a771 | 4499 | .type = HDA_FIXUP_FUNC, |
08fb0d0e | 4500 | .v.func = alc269_fixup_hp_mute_led, |
6d3cd5d4 | 4501 | }, |
d06ac143 DH |
4502 | [ALC269_FIXUP_HP_MUTE_LED_MIC1] = { |
4503 | .type = HDA_FIXUP_FUNC, | |
4504 | .v.func = alc269_fixup_hp_mute_led_mic1, | |
4505 | }, | |
08fb0d0e | 4506 | [ALC269_FIXUP_HP_MUTE_LED_MIC2] = { |
1727a771 | 4507 | .type = HDA_FIXUP_FUNC, |
08fb0d0e | 4508 | .v.func = alc269_fixup_hp_mute_led_mic2, |
420b0feb | 4509 | }, |
9f5c6faf TI |
4510 | [ALC269_FIXUP_HP_GPIO_LED] = { |
4511 | .type = HDA_FIXUP_FUNC, | |
4512 | .v.func = alc269_fixup_hp_gpio_led, | |
4513 | }, | |
9c5dc3bf KY |
4514 | [ALC269_FIXUP_HP_GPIO_MIC1_LED] = { |
4515 | .type = HDA_FIXUP_FUNC, | |
4516 | .v.func = alc269_fixup_hp_gpio_mic1_led, | |
4517 | }, | |
4518 | [ALC269_FIXUP_HP_LINE1_MIC1_LED] = { | |
4519 | .type = HDA_FIXUP_FUNC, | |
4520 | .v.func = alc269_fixup_hp_line1_mic1_led, | |
4521 | }, | |
693b613d | 4522 | [ALC269_FIXUP_INV_DMIC] = { |
1727a771 | 4523 | .type = HDA_FIXUP_FUNC, |
6e72aa5f | 4524 | .v.func = alc_fixup_inv_dmic_0x12, |
693b613d | 4525 | }, |
9b745ab8 TI |
4526 | [ALC269_FIXUP_NO_SHUTUP] = { |
4527 | .type = HDA_FIXUP_FUNC, | |
4528 | .v.func = alc_fixup_no_shutup, | |
4529 | }, | |
108cc108 | 4530 | [ALC269_FIXUP_LENOVO_DOCK] = { |
1727a771 TI |
4531 | .type = HDA_FIXUP_PINS, |
4532 | .v.pins = (const struct hda_pintbl[]) { | |
108cc108 DH |
4533 | { 0x19, 0x23a11040 }, /* dock mic */ |
4534 | { 0x1b, 0x2121103f }, /* dock headphone */ | |
4535 | { } | |
4536 | }, | |
4537 | .chained = true, | |
4538 | .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT | |
4539 | }, | |
4540 | [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = { | |
1727a771 | 4541 | .type = HDA_FIXUP_FUNC, |
108cc108 | 4542 | .v.func = alc269_fixup_pincfg_no_hp_to_lineout, |
52129000 DH |
4543 | .chained = true, |
4544 | .chain_id = ALC269_FIXUP_THINKPAD_ACPI, | |
108cc108 | 4545 | }, |
73bdd597 DH |
4546 | [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = { |
4547 | .type = HDA_FIXUP_PINS, | |
4548 | .v.pins = (const struct hda_pintbl[]) { | |
4549 | { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4550 | { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */ | |
4551 | { } | |
4552 | }, | |
4553 | .chained = true, | |
4554 | .chain_id = ALC269_FIXUP_HEADSET_MODE | |
4555 | }, | |
4556 | [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = { | |
4557 | .type = HDA_FIXUP_PINS, | |
4558 | .v.pins = (const struct hda_pintbl[]) { | |
4559 | { 0x16, 0x21014020 }, /* dock line out */ | |
4560 | { 0x19, 0x21a19030 }, /* dock mic */ | |
4561 | { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4562 | { } | |
4563 | }, | |
4564 | .chained = true, | |
4565 | .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC | |
4566 | }, | |
338cae56 DH |
4567 | [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = { |
4568 | .type = HDA_FIXUP_PINS, | |
4569 | .v.pins = (const struct hda_pintbl[]) { | |
4570 | { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4571 | { } | |
4572 | }, | |
4573 | .chained = true, | |
4574 | .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC | |
4575 | }, | |
73bdd597 DH |
4576 | [ALC269_FIXUP_HEADSET_MODE] = { |
4577 | .type = HDA_FIXUP_FUNC, | |
4578 | .v.func = alc_fixup_headset_mode, | |
4579 | }, | |
4580 | [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = { | |
4581 | .type = HDA_FIXUP_FUNC, | |
4582 | .v.func = alc_fixup_headset_mode_no_hp_mic, | |
4583 | }, | |
88cfcf86 DH |
4584 | [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = { |
4585 | .type = HDA_FIXUP_PINS, | |
4586 | .v.pins = (const struct hda_pintbl[]) { | |
4587 | { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4588 | { } | |
4589 | }, | |
fbc78ad6 DH |
4590 | .chained = true, |
4591 | .chain_id = ALC269_FIXUP_HEADSET_MIC | |
88cfcf86 | 4592 | }, |
d240d1dc DH |
4593 | [ALC269_FIXUP_ASUS_X101_FUNC] = { |
4594 | .type = HDA_FIXUP_FUNC, | |
4595 | .v.func = alc269_fixup_x101_headset_mic, | |
4596 | }, | |
4597 | [ALC269_FIXUP_ASUS_X101_VERB] = { | |
4598 | .type = HDA_FIXUP_VERBS, | |
4599 | .v.verbs = (const struct hda_verb[]) { | |
4600 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | |
4601 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | |
4602 | {0x20, AC_VERB_SET_PROC_COEF, 0x0310}, | |
4603 | { } | |
4604 | }, | |
4605 | .chained = true, | |
4606 | .chain_id = ALC269_FIXUP_ASUS_X101_FUNC | |
4607 | }, | |
4608 | [ALC269_FIXUP_ASUS_X101] = { | |
4609 | .type = HDA_FIXUP_PINS, | |
4610 | .v.pins = (const struct hda_pintbl[]) { | |
4611 | { 0x18, 0x04a1182c }, /* Headset mic */ | |
4612 | { } | |
4613 | }, | |
4614 | .chained = true, | |
4615 | .chain_id = ALC269_FIXUP_ASUS_X101_VERB | |
4616 | }, | |
08a978db | 4617 | [ALC271_FIXUP_AMIC_MIC2] = { |
1727a771 TI |
4618 | .type = HDA_FIXUP_PINS, |
4619 | .v.pins = (const struct hda_pintbl[]) { | |
08a978db DR |
4620 | { 0x14, 0x99130110 }, /* speaker */ |
4621 | { 0x19, 0x01a19c20 }, /* mic */ | |
4622 | { 0x1b, 0x99a7012f }, /* int-mic */ | |
4623 | { 0x21, 0x0121401f }, /* HP out */ | |
4624 | { } | |
4625 | }, | |
4626 | }, | |
4627 | [ALC271_FIXUP_HP_GATE_MIC_JACK] = { | |
1727a771 | 4628 | .type = HDA_FIXUP_FUNC, |
08a978db DR |
4629 | .v.func = alc271_hp_gate_mic_jack, |
4630 | .chained = true, | |
4631 | .chain_id = ALC271_FIXUP_AMIC_MIC2, | |
4632 | }, | |
b1e8972e OR |
4633 | [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = { |
4634 | .type = HDA_FIXUP_FUNC, | |
4635 | .v.func = alc269_fixup_limit_int_mic_boost, | |
4636 | .chained = true, | |
4637 | .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK, | |
4638 | }, | |
42397004 DR |
4639 | [ALC269_FIXUP_ACER_AC700] = { |
4640 | .type = HDA_FIXUP_PINS, | |
4641 | .v.pins = (const struct hda_pintbl[]) { | |
4642 | { 0x12, 0x99a3092f }, /* int-mic */ | |
4643 | { 0x14, 0x99130110 }, /* speaker */ | |
4644 | { 0x18, 0x03a11c20 }, /* mic */ | |
4645 | { 0x1e, 0x0346101e }, /* SPDIF1 */ | |
4646 | { 0x21, 0x0321101f }, /* HP out */ | |
4647 | { } | |
4648 | }, | |
4649 | .chained = true, | |
4650 | .chain_id = ALC271_FIXUP_DMIC, | |
4651 | }, | |
3e0d611b DH |
4652 | [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = { |
4653 | .type = HDA_FIXUP_FUNC, | |
4654 | .v.func = alc269_fixup_limit_int_mic_boost, | |
2793769f DH |
4655 | .chained = true, |
4656 | .chain_id = ALC269_FIXUP_THINKPAD_ACPI, | |
3e0d611b | 4657 | }, |
2cede303 OR |
4658 | [ALC269VB_FIXUP_ASUS_ZENBOOK] = { |
4659 | .type = HDA_FIXUP_FUNC, | |
4660 | .v.func = alc269_fixup_limit_int_mic_boost, | |
4661 | .chained = true, | |
4662 | .chain_id = ALC269VB_FIXUP_DMIC, | |
4663 | }, | |
23870831 TI |
4664 | [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = { |
4665 | .type = HDA_FIXUP_VERBS, | |
4666 | .v.verbs = (const struct hda_verb[]) { | |
4667 | /* class-D output amp +5dB */ | |
4668 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 }, | |
4669 | { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 }, | |
4670 | {} | |
4671 | }, | |
4672 | .chained = true, | |
4673 | .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK, | |
4674 | }, | |
8e35cd4a DH |
4675 | [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = { |
4676 | .type = HDA_FIXUP_FUNC, | |
4677 | .v.func = alc269_fixup_limit_int_mic_boost, | |
4678 | .chained = true, | |
4679 | .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1, | |
4680 | }, | |
02b504d9 AA |
4681 | [ALC269VB_FIXUP_ORDISSIMO_EVE2] = { |
4682 | .type = HDA_FIXUP_PINS, | |
4683 | .v.pins = (const struct hda_pintbl[]) { | |
4684 | { 0x12, 0x99a3092f }, /* int-mic */ | |
4685 | { 0x18, 0x03a11d20 }, /* mic */ | |
4686 | { 0x19, 0x411111f0 }, /* Unused bogus pin */ | |
4687 | { } | |
4688 | }, | |
4689 | }, | |
cd217a63 KY |
4690 | [ALC283_FIXUP_CHROME_BOOK] = { |
4691 | .type = HDA_FIXUP_FUNC, | |
4692 | .v.func = alc283_fixup_chromebook, | |
4693 | }, | |
0202e99c KY |
4694 | [ALC283_FIXUP_SENSE_COMBO_JACK] = { |
4695 | .type = HDA_FIXUP_FUNC, | |
4696 | .v.func = alc283_fixup_sense_combo_jack, | |
4697 | .chained = true, | |
4698 | .chain_id = ALC283_FIXUP_CHROME_BOOK, | |
4699 | }, | |
7bba2157 TI |
4700 | [ALC282_FIXUP_ASUS_TX300] = { |
4701 | .type = HDA_FIXUP_FUNC, | |
4702 | .v.func = alc282_fixup_asus_tx300, | |
4703 | }, | |
1bb3e062 KY |
4704 | [ALC283_FIXUP_INT_MIC] = { |
4705 | .type = HDA_FIXUP_VERBS, | |
4706 | .v.verbs = (const struct hda_verb[]) { | |
4707 | {0x20, AC_VERB_SET_COEF_INDEX, 0x1a}, | |
4708 | {0x20, AC_VERB_SET_PROC_COEF, 0x0011}, | |
4709 | { } | |
4710 | }, | |
4711 | .chained = true, | |
4712 | .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST | |
4713 | }, | |
0f4881dc DH |
4714 | [ALC290_FIXUP_SUBWOOFER_HSJACK] = { |
4715 | .type = HDA_FIXUP_PINS, | |
4716 | .v.pins = (const struct hda_pintbl[]) { | |
4717 | { 0x17, 0x90170112 }, /* subwoofer */ | |
4718 | { } | |
4719 | }, | |
4720 | .chained = true, | |
4721 | .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, | |
4722 | }, | |
4723 | [ALC290_FIXUP_SUBWOOFER] = { | |
4724 | .type = HDA_FIXUP_PINS, | |
4725 | .v.pins = (const struct hda_pintbl[]) { | |
4726 | { 0x17, 0x90170112 }, /* subwoofer */ | |
4727 | { } | |
4728 | }, | |
4729 | .chained = true, | |
4730 | .chain_id = ALC290_FIXUP_MONO_SPEAKERS, | |
4731 | }, | |
338cae56 DH |
4732 | [ALC290_FIXUP_MONO_SPEAKERS] = { |
4733 | .type = HDA_FIXUP_FUNC, | |
4734 | .v.func = alc290_fixup_mono_speakers, | |
0f4881dc DH |
4735 | }, |
4736 | [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = { | |
4737 | .type = HDA_FIXUP_FUNC, | |
4738 | .v.func = alc290_fixup_mono_speakers, | |
338cae56 DH |
4739 | .chained = true, |
4740 | .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, | |
4741 | }, | |
b67ae3f1 DH |
4742 | [ALC269_FIXUP_THINKPAD_ACPI] = { |
4743 | .type = HDA_FIXUP_FUNC, | |
b317b032 | 4744 | .v.func = hda_fixup_thinkpad_acpi, |
b67ae3f1 | 4745 | }, |
9a22a8f5 KY |
4746 | [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = { |
4747 | .type = HDA_FIXUP_PINS, | |
4748 | .v.pins = (const struct hda_pintbl[]) { | |
4749 | { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4750 | { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */ | |
4751 | { } | |
4752 | }, | |
4753 | .chained = true, | |
4754 | .chain_id = ALC255_FIXUP_HEADSET_MODE | |
4755 | }, | |
31278997 KY |
4756 | [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = { |
4757 | .type = HDA_FIXUP_PINS, | |
4758 | .v.pins = (const struct hda_pintbl[]) { | |
4759 | { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4760 | { } | |
4761 | }, | |
4762 | .chained = true, | |
4763 | .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC | |
4764 | }, | |
9a22a8f5 KY |
4765 | [ALC255_FIXUP_HEADSET_MODE] = { |
4766 | .type = HDA_FIXUP_FUNC, | |
4767 | .v.func = alc_fixup_headset_mode_alc255, | |
4768 | }, | |
31278997 KY |
4769 | [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = { |
4770 | .type = HDA_FIXUP_FUNC, | |
4771 | .v.func = alc_fixup_headset_mode_alc255_no_hp_mic, | |
4772 | }, | |
a22aa26f KY |
4773 | [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = { |
4774 | .type = HDA_FIXUP_PINS, | |
4775 | .v.pins = (const struct hda_pintbl[]) { | |
4776 | { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */ | |
4777 | { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */ | |
4778 | { } | |
4779 | }, | |
4780 | .chained = true, | |
4781 | .chain_id = ALC269_FIXUP_HEADSET_MODE | |
4782 | }, | |
1c37c223 TI |
4783 | [ALC292_FIXUP_TPT440_DOCK] = { |
4784 | .type = HDA_FIXUP_PINS, | |
4785 | .v.pins = (const struct hda_pintbl[]) { | |
4786 | { 0x16, 0x21211010 }, /* dock headphone */ | |
4787 | { 0x19, 0x21a11010 }, /* dock mic */ | |
4788 | { } | |
4789 | }, | |
4790 | .chained = true, | |
4791 | .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST | |
4792 | }, | |
9dc12862 DD |
4793 | [ALC283_FIXUP_BXBT2807_MIC] = { |
4794 | .type = HDA_FIXUP_PINS, | |
4795 | .v.pins = (const struct hda_pintbl[]) { | |
4796 | { 0x19, 0x04a110f0 }, | |
4797 | { }, | |
4798 | }, | |
4799 | }, | |
00ef9940 HW |
4800 | [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = { |
4801 | .type = HDA_FIXUP_FUNC, | |
4802 | .v.func = alc_fixup_dell_wmi, | |
4803 | .chained_before = true, | |
4804 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE | |
4805 | }, | |
1a22e775 TI |
4806 | [ALC282_FIXUP_ASPIRE_V5_PINS] = { |
4807 | .type = HDA_FIXUP_PINS, | |
4808 | .v.pins = (const struct hda_pintbl[]) { | |
4809 | { 0x12, 0x90a60130 }, | |
4810 | { 0x14, 0x90170110 }, | |
4811 | { 0x17, 0x40000008 }, | |
4812 | { 0x18, 0x411111f0 }, | |
4813 | { 0x19, 0x411111f0 }, | |
4814 | { 0x1a, 0x411111f0 }, | |
4815 | { 0x1b, 0x411111f0 }, | |
4816 | { 0x1d, 0x40f89b2d }, | |
4817 | { 0x1e, 0x411111f0 }, | |
4818 | { 0x21, 0x0321101f }, | |
4819 | { }, | |
4820 | }, | |
4821 | }, | |
00ef9940 | 4822 | |
f1d4e28b KY |
4823 | }; |
4824 | ||
1d045db9 | 4825 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
a6b92b66 | 4826 | SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC), |
693b613d DH |
4827 | SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC), |
4828 | SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), | |
aaedfb47 DH |
4829 | SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700), |
4830 | SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK), | |
4831 | SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), | |
b1e8972e | 4832 | SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), |
1a22e775 | 4833 | SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS), |
aaedfb47 | 4834 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
0f4881dc | 4835 | SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER), |
73bdd597 DH |
4836 | SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4837 | SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | |
4838 | SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | |
00ef9940 | 4839 | SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED), |
0f4881dc DH |
4840 | SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), |
4841 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), | |
00ef9940 | 4842 | SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED), |
0f4881dc | 4843 | SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK), |
a22aa26f KY |
4844 | SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4845 | SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | |
a22aa26f KY |
4846 | SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4847 | SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | |
08fb0d0e | 4848 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), |
9f5c6faf | 4849 | SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED), |
8e35cd4a | 4850 | SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED), |
c60666bd | 4851 | /* ALC282 */ |
8a02b164 | 4852 | SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
8a02b164 | 4853 | SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
9c5dc3bf KY |
4854 | SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), |
4855 | SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), | |
4856 | SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), | |
4857 | SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), | |
9c5dc3bf | 4858 | SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED), |
c60666bd | 4859 | SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
c60666bd KY |
4860 | SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4861 | SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
8a02b164 | 4862 | SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
c60666bd | 4863 | SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
c60666bd KY |
4864 | SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4865 | SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
4866 | SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
c60666bd | 4867 | SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
9c5dc3bf KY |
4868 | SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4869 | SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4870 | SND_PCI_QUIRK(0x103c, 0x8004, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
c60666bd | 4871 | /* ALC290 */ |
9c5dc3bf | 4872 | SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
9c5dc3bf | 4873 | SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
9c5dc3bf KY |
4874 | SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4875 | SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4876 | SND_PCI_QUIRK(0x103c, 0x2247, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4877 | SND_PCI_QUIRK(0x103c, 0x2248, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4878 | SND_PCI_QUIRK(0x103c, 0x2249, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4879 | SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4880 | SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4881 | SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4882 | SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4883 | SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4884 | SND_PCI_QUIRK(0x103c, 0x2258, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4885 | SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4886 | SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
c60666bd | 4887 | SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
c60666bd KY |
4888 | SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4889 | SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
4890 | SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
9c5dc3bf KY |
4891 | SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4892 | SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4893 | SND_PCI_QUIRK(0x103c, 0x2277, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
4894 | SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | |
c60666bd | 4895 | SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
c60666bd | 4896 | SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
c60666bd | 4897 | SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
c60666bd KY |
4898 | SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4899 | SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
c60666bd KY |
4900 | SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4901 | SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
c60666bd | 4902 | SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
8a02b164 KY |
4903 | SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4904 | SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
4905 | SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
4906 | SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | |
7bba2157 | 4907 | SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300), |
3e0d611b DH |
4908 | SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4909 | SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | |
2cede303 | 4910 | SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK), |
23870831 | 4911 | SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A), |
3e0d611b | 4912 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), |
017f2a10 | 4913 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
693b613d | 4914 | SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), |
3e0d611b | 4915 | SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
adabb3ec TI |
4916 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), |
4917 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), | |
4918 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), | |
4919 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), | |
d240d1dc | 4920 | SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101), |
f88abaa0 | 4921 | SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE), |
88cfcf86 | 4922 | SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE), |
1d045db9 TI |
4923 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
4924 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), | |
4925 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), | |
e9bd7d5c | 4926 | SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX), |
24519911 | 4927 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), |
2041d564 | 4928 | SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC), |
9dc12862 | 4929 | SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_BXBT2807_MIC), |
1d045db9 TI |
4930 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
4931 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), | |
4932 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), | |
4933 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), | |
4934 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), | |
707fba3f | 4935 | SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK), |
c8415a48 | 4936 | SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK), |
84f98fdf | 4937 | SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK), |
4407be6b | 4938 | SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK), |
108cc108 | 4939 | SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), |
aaedfb47 | 4940 | SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), |
1c37c223 TI |
4941 | SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK), |
4942 | SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), | |
a12137e7 | 4943 | SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK), |
cd5302c0 | 4944 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
2793769f | 4945 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
a4a9e082 | 4946 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
9b745ab8 | 4947 | SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), |
a4a9e082 | 4948 | SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
1bb3e062 | 4949 | SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC), |
cd5302c0 DH |
4950 | SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4951 | SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | |
012e7eb1 | 4952 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), |
1d045db9 | 4953 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
02b504d9 | 4954 | SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ |
a4297b5d | 4955 | |
a7f3eedc | 4956 | #if 0 |
a4297b5d TI |
4957 | /* Below is a quirk table taken from the old code. |
4958 | * Basically the device should work as is without the fixup table. | |
4959 | * If BIOS doesn't give a proper info, enable the corresponding | |
4960 | * fixup entry. | |
7d7eb9ea | 4961 | */ |
a4297b5d TI |
4962 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
4963 | ALC269_FIXUP_AMIC), | |
4964 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC), | |
a4297b5d TI |
4965 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC), |
4966 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC), | |
4967 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC), | |
4968 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC), | |
4969 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC), | |
4970 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC), | |
4971 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC), | |
4972 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC), | |
4973 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC), | |
4974 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC), | |
4975 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC), | |
4976 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC), | |
4977 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC), | |
4978 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC), | |
4979 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC), | |
4980 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC), | |
4981 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC), | |
4982 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC), | |
4983 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC), | |
4984 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC), | |
4985 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC), | |
4986 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC), | |
4987 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC), | |
4988 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC), | |
4989 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC), | |
4990 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC), | |
4991 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC), | |
4992 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC), | |
4993 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC), | |
4994 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC), | |
4995 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC), | |
4996 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC), | |
4997 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC), | |
4998 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC), | |
4999 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC), | |
5000 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC), | |
5001 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC), | |
5002 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC), | |
5003 | #endif | |
5004 | {} | |
5005 | }; | |
5006 | ||
214eef76 DH |
5007 | static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = { |
5008 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), | |
5009 | SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED), | |
5010 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | |
5011 | SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI), | |
5012 | {} | |
5013 | }; | |
5014 | ||
1727a771 | 5015 | static const struct hda_model_fixup alc269_fixup_models[] = { |
a4297b5d TI |
5016 | {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"}, |
5017 | {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"}, | |
6e72aa5f TI |
5018 | {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"}, |
5019 | {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"}, | |
5020 | {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"}, | |
7c478f03 | 5021 | {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"}, |
108cc108 | 5022 | {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"}, |
9f5c6faf | 5023 | {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, |
e32aa85a DH |
5024 | {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"}, |
5025 | {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"}, | |
be8ef16a | 5026 | {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"}, |
0202e99c | 5027 | {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"}, |
1c37c223 | 5028 | {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"}, |
1d045db9 | 5029 | {} |
6dda9f4a KY |
5030 | }; |
5031 | ||
fea185e2 DH |
5032 | #define ALC255_STANDARD_PINS \ |
5033 | {0x18, 0x411111f0}, \ | |
5034 | {0x19, 0x411111f0}, \ | |
5035 | {0x1a, 0x411111f0}, \ | |
5036 | {0x1b, 0x411111f0}, \ | |
5037 | {0x1e, 0x411111f0} | |
5038 | ||
5039 | #define ALC282_STANDARD_PINS \ | |
5040 | {0x14, 0x90170110}, \ | |
5041 | {0x18, 0x411111f0}, \ | |
5042 | {0x1a, 0x411111f0}, \ | |
5043 | {0x1b, 0x411111f0}, \ | |
5044 | {0x1e, 0x411111f0} | |
5045 | ||
5046 | #define ALC290_STANDARD_PINS \ | |
5047 | {0x12, 0x99a30130}, \ | |
5048 | {0x13, 0x40000000}, \ | |
5049 | {0x16, 0x411111f0}, \ | |
5050 | {0x17, 0x411111f0}, \ | |
5051 | {0x19, 0x411111f0}, \ | |
5052 | {0x1b, 0x411111f0}, \ | |
5053 | {0x1e, 0x411111f0} | |
5054 | ||
5055 | #define ALC292_STANDARD_PINS \ | |
5056 | {0x14, 0x90170110}, \ | |
5057 | {0x15, 0x0221401f}, \ | |
5058 | {0x1a, 0x411111f0}, \ | |
5059 | {0x1b, 0x411111f0}, \ | |
5060 | {0x1d, 0x40700001}, \ | |
5061 | {0x1e, 0x411111f0} | |
5062 | ||
e1918938 | 5063 | static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { |
c77900e6 | 5064 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, |
aec856d0 | 5065 | ALC255_STANDARD_PINS, |
c77900e6 HW |
5066 | {0x12, 0x40300000}, |
5067 | {0x14, 0x90170110}, | |
5068 | {0x17, 0x411111f0}, | |
c77900e6 | 5069 | {0x1d, 0x40538029}, |
c77900e6 | 5070 | {0x21, 0x02211020}), |
76c2132e | 5071 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, |
aec856d0 | 5072 | ALC255_STANDARD_PINS, |
76c2132e DH |
5073 | {0x12, 0x90a60140}, |
5074 | {0x14, 0x90170110}, | |
5075 | {0x17, 0x40000000}, | |
76c2132e | 5076 | {0x1d, 0x40700001}, |
76c2132e DH |
5077 | {0x21, 0x02211020}), |
5078 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | |
aec856d0 | 5079 | ALC255_STANDARD_PINS, |
76c2132e DH |
5080 | {0x12, 0x90a60160}, |
5081 | {0x14, 0x90170120}, | |
5082 | {0x17, 0x40000000}, | |
76c2132e | 5083 | {0x1d, 0x40700001}, |
76c2132e DH |
5084 | {0x21, 0x02211030}), |
5085 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | |
5086 | {0x12, 0x90a60160}, | |
5087 | {0x14, 0x90170120}, | |
5088 | {0x17, 0x90170140}, | |
5089 | {0x18, 0x40000000}, | |
5090 | {0x19, 0x411111f0}, | |
5091 | {0x1a, 0x411111f0}, | |
5092 | {0x1b, 0x411111f0}, | |
5093 | {0x1d, 0x41163b05}, | |
5094 | {0x1e, 0x411111f0}, | |
5095 | {0x21, 0x0321102f}), | |
5096 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | |
aec856d0 | 5097 | ALC255_STANDARD_PINS, |
76c2132e DH |
5098 | {0x12, 0x90a60160}, |
5099 | {0x14, 0x90170130}, | |
5100 | {0x17, 0x40000000}, | |
76c2132e | 5101 | {0x1d, 0x40700001}, |
76c2132e DH |
5102 | {0x21, 0x02211040}), |
5103 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | |
aec856d0 | 5104 | ALC255_STANDARD_PINS, |
76c2132e DH |
5105 | {0x12, 0x90a60160}, |
5106 | {0x14, 0x90170140}, | |
5107 | {0x17, 0x40000000}, | |
76c2132e | 5108 | {0x1d, 0x40700001}, |
76c2132e DH |
5109 | {0x21, 0x02211050}), |
5110 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | |
aec856d0 | 5111 | ALC255_STANDARD_PINS, |
76c2132e DH |
5112 | {0x12, 0x90a60170}, |
5113 | {0x14, 0x90170120}, | |
5114 | {0x17, 0x40000000}, | |
76c2132e | 5115 | {0x1d, 0x40700001}, |
76c2132e DH |
5116 | {0x21, 0x02211030}), |
5117 | SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, | |
aec856d0 | 5118 | ALC255_STANDARD_PINS, |
76c2132e DH |
5119 | {0x12, 0x90a60170}, |
5120 | {0x14, 0x90170130}, | |
5121 | {0x17, 0x40000000}, | |
76c2132e | 5122 | {0x1d, 0x40700001}, |
76c2132e | 5123 | {0x21, 0x02211040}), |
0279661b HW |
5124 | SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED, |
5125 | {0x12, 0x90a60140}, | |
5126 | {0x13, 0x40000000}, | |
5127 | {0x14, 0x90170110}, | |
5128 | {0x15, 0x0421101f}, | |
5129 | {0x16, 0x411111f0}, | |
5130 | {0x17, 0x411111f0}, | |
5131 | {0x18, 0x02811030}, | |
5132 | {0x19, 0x411111f0}, | |
5133 | {0x1a, 0x04a1103f}, | |
5134 | {0x1b, 0x02011020}, | |
5135 | {0x1d, 0x40700001}, | |
5136 | {0x1e, 0x411111f0}), | |
42304474 | 5137 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5138 | ALC282_STANDARD_PINS, |
42304474 | 5139 | {0x12, 0x99a30130}, |
42304474 | 5140 | {0x17, 0x40000000}, |
42304474 | 5141 | {0x19, 0x03a11020}, |
42304474 | 5142 | {0x1d, 0x40f41905}, |
42304474 | 5143 | {0x21, 0x0321101f}), |
2c609999 | 5144 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5145 | ALC282_STANDARD_PINS, |
2c609999 | 5146 | {0x12, 0x99a30130}, |
2c609999 | 5147 | {0x17, 0x40020008}, |
2c609999 | 5148 | {0x19, 0x03a11020}, |
2c609999 | 5149 | {0x1d, 0x40e00001}, |
2c609999 HW |
5150 | {0x21, 0x03211040}), |
5151 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, | |
aec856d0 | 5152 | ALC282_STANDARD_PINS, |
2c609999 | 5153 | {0x12, 0x99a30130}, |
2c609999 | 5154 | {0x17, 0x40000000}, |
2c609999 | 5155 | {0x19, 0x03a11030}, |
2c609999 | 5156 | {0x1d, 0x40e00001}, |
2c609999 HW |
5157 | {0x21, 0x03211020}), |
5158 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, | |
aec856d0 | 5159 | ALC282_STANDARD_PINS, |
2c609999 | 5160 | {0x12, 0x99a30130}, |
2c609999 | 5161 | {0x17, 0x40000000}, |
2c609999 | 5162 | {0x19, 0x03a11030}, |
2c609999 | 5163 | {0x1d, 0x40f00001}, |
2c609999 HW |
5164 | {0x21, 0x03211020}), |
5165 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, | |
aec856d0 | 5166 | ALC282_STANDARD_PINS, |
2c609999 | 5167 | {0x12, 0x99a30130}, |
2c609999 | 5168 | {0x17, 0x40000000}, |
2c609999 | 5169 | {0x19, 0x04a11020}, |
2c609999 | 5170 | {0x1d, 0x40f00001}, |
2c609999 HW |
5171 | {0x21, 0x0421101f}), |
5172 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, | |
aec856d0 | 5173 | ALC282_STANDARD_PINS, |
2c609999 | 5174 | {0x12, 0x99a30130}, |
2c609999 | 5175 | {0x17, 0x40000000}, |
2c609999 | 5176 | {0x19, 0x03a11030}, |
2c609999 | 5177 | {0x1d, 0x40f00001}, |
2c609999 | 5178 | {0x21, 0x04211020}), |
200afc09 | 5179 | SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED, |
aec856d0 | 5180 | ALC282_STANDARD_PINS, |
200afc09 | 5181 | {0x12, 0x90a60140}, |
200afc09 | 5182 | {0x17, 0x40000000}, |
200afc09 | 5183 | {0x19, 0x04a11030}, |
200afc09 | 5184 | {0x1d, 0x40f00001}, |
200afc09 | 5185 | {0x21, 0x04211020}), |
76c2132e | 5186 | SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
aec856d0 | 5187 | ALC282_STANDARD_PINS, |
76c2132e | 5188 | {0x12, 0x90a60130}, |
76c2132e | 5189 | {0x17, 0x40020008}, |
76c2132e | 5190 | {0x19, 0x411111f0}, |
76c2132e | 5191 | {0x1d, 0x40e00001}, |
76c2132e DH |
5192 | {0x21, 0x0321101f}), |
5193 | SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, | |
5194 | {0x12, 0x90a60160}, | |
5195 | {0x14, 0x90170120}, | |
5196 | {0x17, 0x40000000}, | |
5197 | {0x18, 0x411111f0}, | |
5198 | {0x19, 0x411111f0}, | |
5199 | {0x1a, 0x411111f0}, | |
5200 | {0x1b, 0x411111f0}, | |
5201 | {0x1d, 0x40700001}, | |
5202 | {0x1e, 0x411111f0}, | |
5203 | {0x21, 0x02211030}), | |
bc262179 | 5204 | SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, |
aec856d0 | 5205 | ALC282_STANDARD_PINS, |
bc262179 | 5206 | {0x12, 0x90a60130}, |
bc262179 | 5207 | {0x17, 0x40020008}, |
bc262179 | 5208 | {0x19, 0x03a11020}, |
bc262179 | 5209 | {0x1d, 0x40e00001}, |
bc262179 | 5210 | {0x21, 0x0321101f}), |
e4442bcf | 5211 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5212 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5213 | {0x14, 0x411111f0}, |
5214 | {0x15, 0x04211040}, | |
e4442bcf | 5215 | {0x18, 0x90170112}, |
e4442bcf | 5216 | {0x1a, 0x04a11020}, |
aec856d0 | 5217 | {0x1d, 0x4075812d}), |
e4442bcf | 5218 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5219 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5220 | {0x14, 0x411111f0}, |
5221 | {0x15, 0x04211040}, | |
e4442bcf | 5222 | {0x18, 0x90170110}, |
e4442bcf | 5223 | {0x1a, 0x04a11020}, |
aec856d0 | 5224 | {0x1d, 0x4075812d}), |
e4442bcf | 5225 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5226 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5227 | {0x14, 0x411111f0}, |
5228 | {0x15, 0x0421101f}, | |
e4442bcf | 5229 | {0x18, 0x411111f0}, |
e4442bcf | 5230 | {0x1a, 0x04a11020}, |
aec856d0 | 5231 | {0x1d, 0x4075812d}), |
e4442bcf | 5232 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5233 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5234 | {0x14, 0x411111f0}, |
5235 | {0x15, 0x04211020}, | |
e4442bcf | 5236 | {0x18, 0x411111f0}, |
e4442bcf | 5237 | {0x1a, 0x04a11040}, |
aec856d0 | 5238 | {0x1d, 0x4076a12d}), |
e4442bcf | 5239 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5240 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5241 | {0x14, 0x90170110}, |
5242 | {0x15, 0x04211020}, | |
e4442bcf | 5243 | {0x18, 0x411111f0}, |
e4442bcf | 5244 | {0x1a, 0x04a11040}, |
aec856d0 | 5245 | {0x1d, 0x4076a12d}), |
e4442bcf | 5246 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5247 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5248 | {0x14, 0x90170110}, |
5249 | {0x15, 0x04211020}, | |
e4442bcf | 5250 | {0x18, 0x411111f0}, |
e4442bcf | 5251 | {0x1a, 0x04a11020}, |
aec856d0 | 5252 | {0x1d, 0x4076a12d}), |
e4442bcf | 5253 | SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1, |
aec856d0 | 5254 | ALC290_STANDARD_PINS, |
e4442bcf HW |
5255 | {0x14, 0x90170110}, |
5256 | {0x15, 0x0421101f}, | |
e4442bcf | 5257 | {0x18, 0x411111f0}, |
e4442bcf | 5258 | {0x1a, 0x04a11020}, |
aec856d0 | 5259 | {0x1d, 0x4075812d}), |
e8818fa8 | 5260 | SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, |
aec856d0 | 5261 | ALC292_STANDARD_PINS, |
e8818fa8 HW |
5262 | {0x12, 0x90a60140}, |
5263 | {0x13, 0x411111f0}, | |
e8818fa8 HW |
5264 | {0x16, 0x01014020}, |
5265 | {0x18, 0x411111f0}, | |
aec856d0 | 5266 | {0x19, 0x01a19030}), |
e8818fa8 | 5267 | SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, |
aec856d0 | 5268 | ALC292_STANDARD_PINS, |
e8818fa8 HW |
5269 | {0x12, 0x90a60140}, |
5270 | {0x13, 0x411111f0}, | |
e8818fa8 HW |
5271 | {0x16, 0x01014020}, |
5272 | {0x18, 0x02a19031}, | |
aec856d0 | 5273 | {0x19, 0x01a1903e}), |
76c2132e | 5274 | SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, |
aec856d0 | 5275 | ALC292_STANDARD_PINS, |
76c2132e DH |
5276 | {0x12, 0x90a60140}, |
5277 | {0x13, 0x411111f0}, | |
76c2132e DH |
5278 | {0x16, 0x411111f0}, |
5279 | {0x18, 0x411111f0}, | |
aec856d0 | 5280 | {0x19, 0x411111f0}), |
76c2132e | 5281 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, |
aec856d0 | 5282 | ALC292_STANDARD_PINS, |
76c2132e DH |
5283 | {0x12, 0x40000000}, |
5284 | {0x13, 0x90a60140}, | |
76c2132e DH |
5285 | {0x16, 0x21014020}, |
5286 | {0x18, 0x411111f0}, | |
aec856d0 | 5287 | {0x19, 0x21a19030}), |
e03fdbde | 5288 | SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, |
aec856d0 | 5289 | ALC292_STANDARD_PINS, |
e03fdbde DH |
5290 | {0x12, 0x40000000}, |
5291 | {0x13, 0x90a60140}, | |
e03fdbde DH |
5292 | {0x16, 0x411111f0}, |
5293 | {0x18, 0x411111f0}, | |
aec856d0 | 5294 | {0x19, 0x411111f0}), |
e1918938 HW |
5295 | {} |
5296 | }; | |
6dda9f4a | 5297 | |
546bb678 | 5298 | static void alc269_fill_coef(struct hda_codec *codec) |
1d045db9 | 5299 | { |
526af6eb | 5300 | struct alc_spec *spec = codec->spec; |
1d045db9 | 5301 | int val; |
ebb83eeb | 5302 | |
526af6eb | 5303 | if (spec->codec_variant != ALC269_TYPE_ALC269VB) |
546bb678 | 5304 | return; |
526af6eb | 5305 | |
1bb7e43e | 5306 | if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { |
1d045db9 TI |
5307 | alc_write_coef_idx(codec, 0xf, 0x960b); |
5308 | alc_write_coef_idx(codec, 0xe, 0x8817); | |
5309 | } | |
ebb83eeb | 5310 | |
1bb7e43e | 5311 | if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { |
1d045db9 TI |
5312 | alc_write_coef_idx(codec, 0xf, 0x960b); |
5313 | alc_write_coef_idx(codec, 0xe, 0x8814); | |
5314 | } | |
ebb83eeb | 5315 | |
1bb7e43e | 5316 | if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { |
1d045db9 | 5317 | /* Power up output pin */ |
98b24883 | 5318 | alc_update_coef_idx(codec, 0x04, 0, 1<<11); |
1d045db9 | 5319 | } |
ebb83eeb | 5320 | |
1bb7e43e | 5321 | if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { |
1d045db9 | 5322 | val = alc_read_coef_idx(codec, 0xd); |
f3ee07d8 | 5323 | if (val != -1 && (val & 0x0c00) >> 10 != 0x1) { |
1d045db9 TI |
5324 | /* Capless ramp up clock control */ |
5325 | alc_write_coef_idx(codec, 0xd, val | (1<<10)); | |
5326 | } | |
5327 | val = alc_read_coef_idx(codec, 0x17); | |
f3ee07d8 | 5328 | if (val != -1 && (val & 0x01c0) >> 6 != 0x4) { |
1d045db9 TI |
5329 | /* Class D power on reset */ |
5330 | alc_write_coef_idx(codec, 0x17, val | (1<<7)); | |
5331 | } | |
5332 | } | |
ebb83eeb | 5333 | |
98b24883 TI |
5334 | /* Class D */ |
5335 | alc_update_coef_idx(codec, 0xd, 0, 1<<14); | |
bc9f98a9 | 5336 | |
98b24883 TI |
5337 | /* HP */ |
5338 | alc_update_coef_idx(codec, 0x4, 0, 1<<11); | |
1d045db9 | 5339 | } |
a7f2371f | 5340 | |
1d045db9 TI |
5341 | /* |
5342 | */ | |
1d045db9 TI |
5343 | static int patch_alc269(struct hda_codec *codec) |
5344 | { | |
5345 | struct alc_spec *spec; | |
3de95173 | 5346 | int err; |
f1d4e28b | 5347 | |
3de95173 | 5348 | err = alc_alloc_spec(codec, 0x0b); |
e16fb6d1 | 5349 | if (err < 0) |
3de95173 TI |
5350 | return err; |
5351 | ||
5352 | spec = codec->spec; | |
08c189f2 | 5353 | spec->gen.shared_mic_vref_pin = 0x18; |
e16fb6d1 | 5354 | |
1727a771 | 5355 | snd_hda_pick_fixup(codec, alc269_fixup_models, |
9f720bb9 | 5356 | alc269_fixup_tbl, alc269_fixups); |
e1918938 | 5357 | snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups); |
214eef76 DH |
5358 | snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, |
5359 | alc269_fixups); | |
1727a771 | 5360 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
9f720bb9 HRK |
5361 | |
5362 | alc_auto_parse_customize_define(codec); | |
5363 | ||
7504b6cd TI |
5364 | if (has_cdefine_beep(codec)) |
5365 | spec->gen.beep_nid = 0x01; | |
5366 | ||
065380f0 KY |
5367 | switch (codec->vendor_id) { |
5368 | case 0x10ec0269: | |
1d045db9 | 5369 | spec->codec_variant = ALC269_TYPE_ALC269VA; |
1bb7e43e TI |
5370 | switch (alc_get_coef0(codec) & 0x00f0) { |
5371 | case 0x0010: | |
5100cd07 TI |
5372 | if (codec->bus->pci && |
5373 | codec->bus->pci->subsystem_vendor == 0x1025 && | |
e16fb6d1 | 5374 | spec->cdefine.platform_type == 1) |
20ca0c35 | 5375 | err = alc_codec_rename(codec, "ALC271X"); |
1d045db9 | 5376 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
1bb7e43e TI |
5377 | break; |
5378 | case 0x0020: | |
5100cd07 TI |
5379 | if (codec->bus->pci && |
5380 | codec->bus->pci->subsystem_vendor == 0x17aa && | |
e16fb6d1 | 5381 | codec->bus->pci->subsystem_device == 0x21f3) |
20ca0c35 | 5382 | err = alc_codec_rename(codec, "ALC3202"); |
1d045db9 | 5383 | spec->codec_variant = ALC269_TYPE_ALC269VC; |
1bb7e43e | 5384 | break; |
adcc70b2 KY |
5385 | case 0x0030: |
5386 | spec->codec_variant = ALC269_TYPE_ALC269VD; | |
5387 | break; | |
1bb7e43e | 5388 | default: |
1d045db9 | 5389 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
1bb7e43e | 5390 | } |
e16fb6d1 TI |
5391 | if (err < 0) |
5392 | goto error; | |
546bb678 | 5393 | spec->init_hook = alc269_fill_coef; |
1d045db9 | 5394 | alc269_fill_coef(codec); |
065380f0 KY |
5395 | break; |
5396 | ||
5397 | case 0x10ec0280: | |
5398 | case 0x10ec0290: | |
5399 | spec->codec_variant = ALC269_TYPE_ALC280; | |
5400 | break; | |
5401 | case 0x10ec0282: | |
065380f0 | 5402 | spec->codec_variant = ALC269_TYPE_ALC282; |
7b5c7a02 KY |
5403 | spec->shutup = alc282_shutup; |
5404 | spec->init_hook = alc282_init; | |
065380f0 | 5405 | break; |
2af02be7 KY |
5406 | case 0x10ec0233: |
5407 | case 0x10ec0283: | |
5408 | spec->codec_variant = ALC269_TYPE_ALC283; | |
5409 | spec->shutup = alc283_shutup; | |
5410 | spec->init_hook = alc283_init; | |
5411 | break; | |
065380f0 KY |
5412 | case 0x10ec0284: |
5413 | case 0x10ec0292: | |
5414 | spec->codec_variant = ALC269_TYPE_ALC284; | |
5415 | break; | |
161ebf29 KY |
5416 | case 0x10ec0285: |
5417 | case 0x10ec0293: | |
5418 | spec->codec_variant = ALC269_TYPE_ALC285; | |
5419 | break; | |
7fc7d047 | 5420 | case 0x10ec0286: |
7c665932 | 5421 | case 0x10ec0288: |
7fc7d047 | 5422 | spec->codec_variant = ALC269_TYPE_ALC286; |
f7ae9ba0 | 5423 | spec->shutup = alc286_shutup; |
7fc7d047 | 5424 | break; |
1d04c9de KY |
5425 | case 0x10ec0255: |
5426 | spec->codec_variant = ALC269_TYPE_ALC255; | |
5427 | break; | |
1d045db9 | 5428 | } |
6dda9f4a | 5429 | |
ad60d502 | 5430 | if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { |
97a26570 | 5431 | spec->has_alc5505_dsp = 1; |
ad60d502 KY |
5432 | spec->init_hook = alc5505_dsp_init; |
5433 | } | |
5434 | ||
a4297b5d TI |
5435 | /* automatic parse from the BIOS config */ |
5436 | err = alc269_parse_auto_config(codec); | |
e16fb6d1 TI |
5437 | if (err < 0) |
5438 | goto error; | |
6dda9f4a | 5439 | |
7504b6cd | 5440 | if (!spec->gen.no_analog && spec->gen.beep_nid) |
1d045db9 | 5441 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
f1d4e28b | 5442 | |
1d045db9 | 5443 | codec->patch_ops = alc_patch_ops; |
2a43952a | 5444 | #ifdef CONFIG_PM |
ad60d502 | 5445 | codec->patch_ops.suspend = alc269_suspend; |
1d045db9 TI |
5446 | codec->patch_ops.resume = alc269_resume; |
5447 | #endif | |
c5177c86 KY |
5448 | if (!spec->shutup) |
5449 | spec->shutup = alc269_shutup; | |
ebb83eeb | 5450 | |
1727a771 | 5451 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 5452 | |
1d045db9 | 5453 | return 0; |
e16fb6d1 TI |
5454 | |
5455 | error: | |
5456 | alc_free(codec); | |
5457 | return err; | |
1d045db9 | 5458 | } |
f1d4e28b | 5459 | |
1d045db9 TI |
5460 | /* |
5461 | * ALC861 | |
5462 | */ | |
622e84cd | 5463 | |
1d045db9 | 5464 | static int alc861_parse_auto_config(struct hda_codec *codec) |
6dda9f4a | 5465 | { |
1d045db9 | 5466 | static const hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
3e6179b8 TI |
5467 | static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 }; |
5468 | return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); | |
604401a9 TI |
5469 | } |
5470 | ||
1d045db9 TI |
5471 | /* Pin config fixes */ |
5472 | enum { | |
e652f4c8 TI |
5473 | ALC861_FIXUP_FSC_AMILO_PI1505, |
5474 | ALC861_FIXUP_AMP_VREF_0F, | |
5475 | ALC861_FIXUP_NO_JACK_DETECT, | |
5476 | ALC861_FIXUP_ASUS_A6RP, | |
6ddf0fd1 | 5477 | ALC660_FIXUP_ASUS_W7J, |
1d045db9 | 5478 | }; |
7085ec12 | 5479 | |
31150f23 TI |
5480 | /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */ |
5481 | static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, | |
1727a771 | 5482 | const struct hda_fixup *fix, int action) |
31150f23 TI |
5483 | { |
5484 | struct alc_spec *spec = codec->spec; | |
5485 | unsigned int val; | |
5486 | ||
1727a771 | 5487 | if (action != HDA_FIXUP_ACT_INIT) |
31150f23 | 5488 | return; |
d3f02d60 | 5489 | val = snd_hda_codec_get_pin_target(codec, 0x0f); |
31150f23 TI |
5490 | if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))) |
5491 | val |= AC_PINCTL_IN_EN; | |
5492 | val |= AC_PINCTL_VREF_50; | |
cdd03ced | 5493 | snd_hda_set_pin_ctl(codec, 0x0f, val); |
08c189f2 | 5494 | spec->gen.keep_vref_in_automute = 1; |
31150f23 TI |
5495 | } |
5496 | ||
e652f4c8 TI |
5497 | /* suppress the jack-detection */ |
5498 | static void alc_fixup_no_jack_detect(struct hda_codec *codec, | |
1727a771 | 5499 | const struct hda_fixup *fix, int action) |
e652f4c8 | 5500 | { |
1727a771 | 5501 | if (action == HDA_FIXUP_ACT_PRE_PROBE) |
e652f4c8 | 5502 | codec->no_jack_detect = 1; |
7d7eb9ea | 5503 | } |
e652f4c8 | 5504 | |
1727a771 | 5505 | static const struct hda_fixup alc861_fixups[] = { |
e652f4c8 | 5506 | [ALC861_FIXUP_FSC_AMILO_PI1505] = { |
1727a771 TI |
5507 | .type = HDA_FIXUP_PINS, |
5508 | .v.pins = (const struct hda_pintbl[]) { | |
1d045db9 TI |
5509 | { 0x0b, 0x0221101f }, /* HP */ |
5510 | { 0x0f, 0x90170310 }, /* speaker */ | |
5511 | { } | |
5512 | } | |
5513 | }, | |
e652f4c8 | 5514 | [ALC861_FIXUP_AMP_VREF_0F] = { |
1727a771 | 5515 | .type = HDA_FIXUP_FUNC, |
31150f23 | 5516 | .v.func = alc861_fixup_asus_amp_vref_0f, |
3b25eb69 | 5517 | }, |
e652f4c8 | 5518 | [ALC861_FIXUP_NO_JACK_DETECT] = { |
1727a771 | 5519 | .type = HDA_FIXUP_FUNC, |
e652f4c8 TI |
5520 | .v.func = alc_fixup_no_jack_detect, |
5521 | }, | |
5522 | [ALC861_FIXUP_ASUS_A6RP] = { | |
1727a771 | 5523 | .type = HDA_FIXUP_FUNC, |
e652f4c8 TI |
5524 | .v.func = alc861_fixup_asus_amp_vref_0f, |
5525 | .chained = true, | |
5526 | .chain_id = ALC861_FIXUP_NO_JACK_DETECT, | |
6ddf0fd1 TI |
5527 | }, |
5528 | [ALC660_FIXUP_ASUS_W7J] = { | |
5529 | .type = HDA_FIXUP_VERBS, | |
5530 | .v.verbs = (const struct hda_verb[]) { | |
5531 | /* ASUS W7J needs a magic pin setup on unused NID 0x10 | |
5532 | * for enabling outputs | |
5533 | */ | |
5534 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | |
5535 | { } | |
5536 | }, | |
e652f4c8 | 5537 | } |
1d045db9 | 5538 | }; |
7085ec12 | 5539 | |
1d045db9 | 5540 | static const struct snd_pci_quirk alc861_fixup_tbl[] = { |
6ddf0fd1 | 5541 | SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J), |
e7ca237b | 5542 | SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J), |
e652f4c8 TI |
5543 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP), |
5544 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F), | |
5545 | SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT), | |
5546 | SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F), | |
5547 | SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F), | |
5548 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505), | |
1d045db9 TI |
5549 | {} |
5550 | }; | |
3af9ee6b | 5551 | |
1d045db9 TI |
5552 | /* |
5553 | */ | |
1d045db9 | 5554 | static int patch_alc861(struct hda_codec *codec) |
7085ec12 | 5555 | { |
1d045db9 | 5556 | struct alc_spec *spec; |
1d045db9 | 5557 | int err; |
7085ec12 | 5558 | |
3de95173 TI |
5559 | err = alc_alloc_spec(codec, 0x15); |
5560 | if (err < 0) | |
5561 | return err; | |
1d045db9 | 5562 | |
3de95173 | 5563 | spec = codec->spec; |
7504b6cd | 5564 | spec->gen.beep_nid = 0x23; |
1d045db9 | 5565 | |
1727a771 TI |
5566 | snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
5567 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | |
3af9ee6b | 5568 | |
cb4e4824 TI |
5569 | /* automatic parse from the BIOS config */ |
5570 | err = alc861_parse_auto_config(codec); | |
e16fb6d1 TI |
5571 | if (err < 0) |
5572 | goto error; | |
3af9ee6b | 5573 | |
7504b6cd | 5574 | if (!spec->gen.no_analog) |
3e6179b8 | 5575 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
7085ec12 | 5576 | |
1d045db9 | 5577 | codec->patch_ops = alc_patch_ops; |
83012a7c | 5578 | #ifdef CONFIG_PM |
cb4e4824 | 5579 | spec->power_hook = alc_power_eapd; |
1d045db9 TI |
5580 | #endif |
5581 | ||
1727a771 | 5582 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 5583 | |
1d045db9 | 5584 | return 0; |
e16fb6d1 TI |
5585 | |
5586 | error: | |
5587 | alc_free(codec); | |
5588 | return err; | |
7085ec12 TI |
5589 | } |
5590 | ||
1d045db9 TI |
5591 | /* |
5592 | * ALC861-VD support | |
5593 | * | |
5594 | * Based on ALC882 | |
5595 | * | |
5596 | * In addition, an independent DAC | |
5597 | */ | |
1d045db9 | 5598 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
bc9f98a9 | 5599 | { |
1d045db9 | 5600 | static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
3e6179b8 TI |
5601 | static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
5602 | return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); | |
ce764ab2 TI |
5603 | } |
5604 | ||
1d045db9 | 5605 | enum { |
8fdcb6fe TI |
5606 | ALC660VD_FIX_ASUS_GPIO1, |
5607 | ALC861VD_FIX_DALLAS, | |
1d045db9 | 5608 | }; |
ce764ab2 | 5609 | |
8fdcb6fe TI |
5610 | /* exclude VREF80 */ |
5611 | static void alc861vd_fixup_dallas(struct hda_codec *codec, | |
1727a771 | 5612 | const struct hda_fixup *fix, int action) |
8fdcb6fe | 5613 | { |
1727a771 | 5614 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
b78562b1 TI |
5615 | snd_hda_override_pin_caps(codec, 0x18, 0x00000734); |
5616 | snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); | |
8fdcb6fe TI |
5617 | } |
5618 | } | |
5619 | ||
1727a771 | 5620 | static const struct hda_fixup alc861vd_fixups[] = { |
1d045db9 | 5621 | [ALC660VD_FIX_ASUS_GPIO1] = { |
1727a771 | 5622 | .type = HDA_FIXUP_VERBS, |
1d045db9 | 5623 | .v.verbs = (const struct hda_verb[]) { |
8fdcb6fe | 5624 | /* reset GPIO1 */ |
1d045db9 TI |
5625 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
5626 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | |
5627 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | |
5628 | { } | |
5629 | } | |
5630 | }, | |
8fdcb6fe | 5631 | [ALC861VD_FIX_DALLAS] = { |
1727a771 | 5632 | .type = HDA_FIXUP_FUNC, |
8fdcb6fe TI |
5633 | .v.func = alc861vd_fixup_dallas, |
5634 | }, | |
1d045db9 | 5635 | }; |
ce764ab2 | 5636 | |
1d045db9 | 5637 | static const struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
8fdcb6fe | 5638 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS), |
1d045db9 | 5639 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
8fdcb6fe | 5640 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS), |
1d045db9 TI |
5641 | {} |
5642 | }; | |
ce764ab2 | 5643 | |
1d045db9 TI |
5644 | /* |
5645 | */ | |
1d045db9 | 5646 | static int patch_alc861vd(struct hda_codec *codec) |
ce764ab2 | 5647 | { |
1d045db9 | 5648 | struct alc_spec *spec; |
cb4e4824 | 5649 | int err; |
ce764ab2 | 5650 | |
3de95173 TI |
5651 | err = alc_alloc_spec(codec, 0x0b); |
5652 | if (err < 0) | |
5653 | return err; | |
1d045db9 | 5654 | |
3de95173 | 5655 | spec = codec->spec; |
7504b6cd | 5656 | spec->gen.beep_nid = 0x23; |
1d045db9 | 5657 | |
1727a771 TI |
5658 | snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
5659 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); | |
1d045db9 | 5660 | |
cb4e4824 TI |
5661 | /* automatic parse from the BIOS config */ |
5662 | err = alc861vd_parse_auto_config(codec); | |
e16fb6d1 TI |
5663 | if (err < 0) |
5664 | goto error; | |
ce764ab2 | 5665 | |
7504b6cd | 5666 | if (!spec->gen.no_analog) |
3e6179b8 | 5667 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
1d045db9 | 5668 | |
1d045db9 TI |
5669 | codec->patch_ops = alc_patch_ops; |
5670 | ||
1d045db9 | 5671 | spec->shutup = alc_eapd_shutup; |
1d045db9 | 5672 | |
1727a771 | 5673 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 5674 | |
ce764ab2 | 5675 | return 0; |
e16fb6d1 TI |
5676 | |
5677 | error: | |
5678 | alc_free(codec); | |
5679 | return err; | |
ce764ab2 TI |
5680 | } |
5681 | ||
1d045db9 TI |
5682 | /* |
5683 | * ALC662 support | |
5684 | * | |
5685 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible | |
5686 | * configuration. Each pin widget can choose any input DACs and a mixer. | |
5687 | * Each ADC is connected from a mixer of all inputs. This makes possible | |
5688 | * 6-channel independent captures. | |
5689 | * | |
5690 | * In addition, an independent DAC for the multi-playback (not used in this | |
5691 | * driver yet). | |
5692 | */ | |
1d045db9 TI |
5693 | |
5694 | /* | |
5695 | * BIOS auto configuration | |
5696 | */ | |
5697 | ||
bc9f98a9 KY |
5698 | static int alc662_parse_auto_config(struct hda_codec *codec) |
5699 | { | |
4c6d72d1 | 5700 | static const hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
3e6179b8 TI |
5701 | static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 }; |
5702 | static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 }; | |
5703 | const hda_nid_t *ssids; | |
ee979a14 | 5704 | |
6227cdce | 5705 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
1d87caa6 RK |
5706 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 || |
5707 | codec->vendor_id == 0x10ec0671) | |
3e6179b8 | 5708 | ssids = alc663_ssids; |
6227cdce | 5709 | else |
3e6179b8 TI |
5710 | ssids = alc662_ssids; |
5711 | return alc_parse_auto_config(codec, alc662_ignore, ssids); | |
bc9f98a9 KY |
5712 | } |
5713 | ||
6be7948f | 5714 | static void alc272_fixup_mario(struct hda_codec *codec, |
1727a771 | 5715 | const struct hda_fixup *fix, int action) |
6fc398cb | 5716 | { |
9bb1f06f | 5717 | if (action != HDA_FIXUP_ACT_PRE_PROBE) |
6fc398cb | 5718 | return; |
6be7948f TB |
5719 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
5720 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | | |
5721 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | | |
5722 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | | |
5723 | (0 << AC_AMPCAP_MUTE_SHIFT))) | |
4e76a883 | 5724 | codec_warn(codec, "failed to override amp caps for NID 0x2\n"); |
6be7948f TB |
5725 | } |
5726 | ||
8e383953 TI |
5727 | static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = { |
5728 | { .channels = 2, | |
5729 | .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } }, | |
5730 | { .channels = 4, | |
5731 | .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, | |
5732 | SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */ | |
5733 | { } | |
5734 | }; | |
5735 | ||
5736 | /* override the 2.1 chmap */ | |
eb9ca3ab | 5737 | static void alc_fixup_bass_chmap(struct hda_codec *codec, |
8e383953 TI |
5738 | const struct hda_fixup *fix, int action) |
5739 | { | |
5740 | if (action == HDA_FIXUP_ACT_BUILD) { | |
5741 | struct alc_spec *spec = codec->spec; | |
5742 | spec->gen.pcm_rec[0].stream[0].chmap = asus_pcm_2_1_chmaps; | |
5743 | } | |
5744 | } | |
5745 | ||
3e887f37 TI |
5746 | /* turn on/off mute LED per vmaster hook */ |
5747 | static void alc662_led_gpio1_mute_hook(void *private_data, int enabled) | |
5748 | { | |
5749 | struct hda_codec *codec = private_data; | |
5750 | struct alc_spec *spec = codec->spec; | |
5751 | unsigned int oldval = spec->gpio_led; | |
5752 | ||
5753 | if (enabled) | |
5754 | spec->gpio_led &= ~0x01; | |
5755 | else | |
5756 | spec->gpio_led |= 0x01; | |
5757 | if (spec->gpio_led != oldval) | |
5758 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, | |
5759 | spec->gpio_led); | |
5760 | } | |
5761 | ||
bf68665d TI |
5762 | /* avoid D3 for keeping GPIO up */ |
5763 | static unsigned int gpio_led_power_filter(struct hda_codec *codec, | |
5764 | hda_nid_t nid, | |
5765 | unsigned int power_state) | |
5766 | { | |
5767 | struct alc_spec *spec = codec->spec; | |
5768 | if (nid == codec->afg && power_state == AC_PWRST_D3 && spec->gpio_led) | |
5769 | return AC_PWRST_D0; | |
5770 | return power_state; | |
5771 | } | |
5772 | ||
3e887f37 TI |
5773 | static void alc662_fixup_led_gpio1(struct hda_codec *codec, |
5774 | const struct hda_fixup *fix, int action) | |
5775 | { | |
5776 | struct alc_spec *spec = codec->spec; | |
5777 | static const struct hda_verb gpio_init[] = { | |
5778 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x01 }, | |
5779 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01 }, | |
5780 | {} | |
5781 | }; | |
5782 | ||
5783 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | |
5784 | spec->gen.vmaster_mute.hook = alc662_led_gpio1_mute_hook; | |
5785 | spec->gpio_led = 0; | |
5786 | snd_hda_add_verbs(codec, gpio_init); | |
bf68665d | 5787 | codec->power_filter = gpio_led_power_filter; |
3e887f37 TI |
5788 | } |
5789 | } | |
5790 | ||
6cb3b707 | 5791 | enum { |
2df03514 | 5792 | ALC662_FIXUP_ASPIRE, |
3e887f37 | 5793 | ALC662_FIXUP_LED_GPIO1, |
6cb3b707 | 5794 | ALC662_FIXUP_IDEAPAD, |
6be7948f | 5795 | ALC272_FIXUP_MARIO, |
d2ebd479 | 5796 | ALC662_FIXUP_CZC_P10T, |
94024cd1 | 5797 | ALC662_FIXUP_SKU_IGNORE, |
e59ea3ed | 5798 | ALC662_FIXUP_HP_RP5800, |
53c334ad TI |
5799 | ALC662_FIXUP_ASUS_MODE1, |
5800 | ALC662_FIXUP_ASUS_MODE2, | |
5801 | ALC662_FIXUP_ASUS_MODE3, | |
5802 | ALC662_FIXUP_ASUS_MODE4, | |
5803 | ALC662_FIXUP_ASUS_MODE5, | |
5804 | ALC662_FIXUP_ASUS_MODE6, | |
5805 | ALC662_FIXUP_ASUS_MODE7, | |
5806 | ALC662_FIXUP_ASUS_MODE8, | |
1565cc35 | 5807 | ALC662_FIXUP_NO_JACK_DETECT, |
edfe3bfc | 5808 | ALC662_FIXUP_ZOTAC_Z68, |
125821ae | 5809 | ALC662_FIXUP_INV_DMIC, |
73bdd597 DH |
5810 | ALC668_FIXUP_DELL_MIC_NO_PRESENCE, |
5811 | ALC668_FIXUP_HEADSET_MODE, | |
8e54b4ac | 5812 | ALC662_FIXUP_BASS_MODE4_CHMAP, |
61a75f13 | 5813 | ALC662_FIXUP_BASS_16, |
a30c9aaa | 5814 | ALC662_FIXUP_BASS_1A, |
8e54b4ac | 5815 | ALC662_FIXUP_BASS_CHMAP, |
493a52a9 | 5816 | ALC668_FIXUP_AUTO_MUTE, |
5e6db669 | 5817 | ALC668_FIXUP_DELL_DISABLE_AAMIX, |
033b0a7c | 5818 | ALC668_FIXUP_DELL_XPS13, |
6cb3b707 DH |
5819 | }; |
5820 | ||
1727a771 | 5821 | static const struct hda_fixup alc662_fixups[] = { |
2df03514 | 5822 | [ALC662_FIXUP_ASPIRE] = { |
1727a771 TI |
5823 | .type = HDA_FIXUP_PINS, |
5824 | .v.pins = (const struct hda_pintbl[]) { | |
2df03514 DC |
5825 | { 0x15, 0x99130112 }, /* subwoofer */ |
5826 | { } | |
5827 | } | |
5828 | }, | |
3e887f37 TI |
5829 | [ALC662_FIXUP_LED_GPIO1] = { |
5830 | .type = HDA_FIXUP_FUNC, | |
5831 | .v.func = alc662_fixup_led_gpio1, | |
5832 | }, | |
6cb3b707 | 5833 | [ALC662_FIXUP_IDEAPAD] = { |
1727a771 TI |
5834 | .type = HDA_FIXUP_PINS, |
5835 | .v.pins = (const struct hda_pintbl[]) { | |
6cb3b707 DH |
5836 | { 0x17, 0x99130112 }, /* subwoofer */ |
5837 | { } | |
3e887f37 TI |
5838 | }, |
5839 | .chained = true, | |
5840 | .chain_id = ALC662_FIXUP_LED_GPIO1, | |
6cb3b707 | 5841 | }, |
6be7948f | 5842 | [ALC272_FIXUP_MARIO] = { |
1727a771 | 5843 | .type = HDA_FIXUP_FUNC, |
b5bfbc67 | 5844 | .v.func = alc272_fixup_mario, |
d2ebd479 AA |
5845 | }, |
5846 | [ALC662_FIXUP_CZC_P10T] = { | |
1727a771 | 5847 | .type = HDA_FIXUP_VERBS, |
d2ebd479 AA |
5848 | .v.verbs = (const struct hda_verb[]) { |
5849 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, | |
5850 | {} | |
5851 | } | |
5852 | }, | |
94024cd1 | 5853 | [ALC662_FIXUP_SKU_IGNORE] = { |
1727a771 | 5854 | .type = HDA_FIXUP_FUNC, |
23d30f28 | 5855 | .v.func = alc_fixup_sku_ignore, |
c6b35874 | 5856 | }, |
e59ea3ed | 5857 | [ALC662_FIXUP_HP_RP5800] = { |
1727a771 TI |
5858 | .type = HDA_FIXUP_PINS, |
5859 | .v.pins = (const struct hda_pintbl[]) { | |
e59ea3ed TI |
5860 | { 0x14, 0x0221201f }, /* HP out */ |
5861 | { } | |
5862 | }, | |
5863 | .chained = true, | |
5864 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5865 | }, | |
53c334ad | 5866 | [ALC662_FIXUP_ASUS_MODE1] = { |
1727a771 TI |
5867 | .type = HDA_FIXUP_PINS, |
5868 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5869 | { 0x14, 0x99130110 }, /* speaker */ |
5870 | { 0x18, 0x01a19c20 }, /* mic */ | |
5871 | { 0x19, 0x99a3092f }, /* int-mic */ | |
5872 | { 0x21, 0x0121401f }, /* HP out */ | |
5873 | { } | |
5874 | }, | |
5875 | .chained = true, | |
5876 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5877 | }, | |
5878 | [ALC662_FIXUP_ASUS_MODE2] = { | |
1727a771 TI |
5879 | .type = HDA_FIXUP_PINS, |
5880 | .v.pins = (const struct hda_pintbl[]) { | |
2996bdba TI |
5881 | { 0x14, 0x99130110 }, /* speaker */ |
5882 | { 0x18, 0x01a19820 }, /* mic */ | |
5883 | { 0x19, 0x99a3092f }, /* int-mic */ | |
5884 | { 0x1b, 0x0121401f }, /* HP out */ | |
5885 | { } | |
5886 | }, | |
53c334ad TI |
5887 | .chained = true, |
5888 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5889 | }, | |
5890 | [ALC662_FIXUP_ASUS_MODE3] = { | |
1727a771 TI |
5891 | .type = HDA_FIXUP_PINS, |
5892 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5893 | { 0x14, 0x99130110 }, /* speaker */ |
5894 | { 0x15, 0x0121441f }, /* HP */ | |
5895 | { 0x18, 0x01a19840 }, /* mic */ | |
5896 | { 0x19, 0x99a3094f }, /* int-mic */ | |
5897 | { 0x21, 0x01211420 }, /* HP2 */ | |
5898 | { } | |
5899 | }, | |
5900 | .chained = true, | |
5901 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5902 | }, | |
5903 | [ALC662_FIXUP_ASUS_MODE4] = { | |
1727a771 TI |
5904 | .type = HDA_FIXUP_PINS, |
5905 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5906 | { 0x14, 0x99130110 }, /* speaker */ |
5907 | { 0x16, 0x99130111 }, /* speaker */ | |
5908 | { 0x18, 0x01a19840 }, /* mic */ | |
5909 | { 0x19, 0x99a3094f }, /* int-mic */ | |
5910 | { 0x21, 0x0121441f }, /* HP */ | |
5911 | { } | |
5912 | }, | |
5913 | .chained = true, | |
5914 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5915 | }, | |
5916 | [ALC662_FIXUP_ASUS_MODE5] = { | |
1727a771 TI |
5917 | .type = HDA_FIXUP_PINS, |
5918 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5919 | { 0x14, 0x99130110 }, /* speaker */ |
5920 | { 0x15, 0x0121441f }, /* HP */ | |
5921 | { 0x16, 0x99130111 }, /* speaker */ | |
5922 | { 0x18, 0x01a19840 }, /* mic */ | |
5923 | { 0x19, 0x99a3094f }, /* int-mic */ | |
5924 | { } | |
5925 | }, | |
5926 | .chained = true, | |
5927 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5928 | }, | |
5929 | [ALC662_FIXUP_ASUS_MODE6] = { | |
1727a771 TI |
5930 | .type = HDA_FIXUP_PINS, |
5931 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5932 | { 0x14, 0x99130110 }, /* speaker */ |
5933 | { 0x15, 0x01211420 }, /* HP2 */ | |
5934 | { 0x18, 0x01a19840 }, /* mic */ | |
5935 | { 0x19, 0x99a3094f }, /* int-mic */ | |
5936 | { 0x1b, 0x0121441f }, /* HP */ | |
5937 | { } | |
5938 | }, | |
5939 | .chained = true, | |
5940 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5941 | }, | |
5942 | [ALC662_FIXUP_ASUS_MODE7] = { | |
1727a771 TI |
5943 | .type = HDA_FIXUP_PINS, |
5944 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5945 | { 0x14, 0x99130110 }, /* speaker */ |
5946 | { 0x17, 0x99130111 }, /* speaker */ | |
5947 | { 0x18, 0x01a19840 }, /* mic */ | |
5948 | { 0x19, 0x99a3094f }, /* int-mic */ | |
5949 | { 0x1b, 0x01214020 }, /* HP */ | |
5950 | { 0x21, 0x0121401f }, /* HP */ | |
5951 | { } | |
5952 | }, | |
5953 | .chained = true, | |
5954 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
5955 | }, | |
5956 | [ALC662_FIXUP_ASUS_MODE8] = { | |
1727a771 TI |
5957 | .type = HDA_FIXUP_PINS, |
5958 | .v.pins = (const struct hda_pintbl[]) { | |
53c334ad TI |
5959 | { 0x14, 0x99130110 }, /* speaker */ |
5960 | { 0x12, 0x99a30970 }, /* int-mic */ | |
5961 | { 0x15, 0x01214020 }, /* HP */ | |
5962 | { 0x17, 0x99130111 }, /* speaker */ | |
5963 | { 0x18, 0x01a19840 }, /* mic */ | |
5964 | { 0x21, 0x0121401f }, /* HP */ | |
5965 | { } | |
5966 | }, | |
5967 | .chained = true, | |
5968 | .chain_id = ALC662_FIXUP_SKU_IGNORE | |
2996bdba | 5969 | }, |
1565cc35 | 5970 | [ALC662_FIXUP_NO_JACK_DETECT] = { |
1727a771 | 5971 | .type = HDA_FIXUP_FUNC, |
1565cc35 TI |
5972 | .v.func = alc_fixup_no_jack_detect, |
5973 | }, | |
edfe3bfc | 5974 | [ALC662_FIXUP_ZOTAC_Z68] = { |
1727a771 TI |
5975 | .type = HDA_FIXUP_PINS, |
5976 | .v.pins = (const struct hda_pintbl[]) { | |
edfe3bfc DH |
5977 | { 0x1b, 0x02214020 }, /* Front HP */ |
5978 | { } | |
5979 | } | |
5980 | }, | |
125821ae | 5981 | [ALC662_FIXUP_INV_DMIC] = { |
1727a771 | 5982 | .type = HDA_FIXUP_FUNC, |
6e72aa5f | 5983 | .v.func = alc_fixup_inv_dmic_0x12, |
125821ae | 5984 | }, |
033b0a7c GM |
5985 | [ALC668_FIXUP_DELL_XPS13] = { |
5986 | .type = HDA_FIXUP_FUNC, | |
5987 | .v.func = alc_fixup_dell_xps13, | |
5988 | .chained = true, | |
5989 | .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX | |
5990 | }, | |
5e6db669 GM |
5991 | [ALC668_FIXUP_DELL_DISABLE_AAMIX] = { |
5992 | .type = HDA_FIXUP_FUNC, | |
5993 | .v.func = alc_fixup_disable_aamix, | |
5994 | .chained = true, | |
5995 | .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE | |
5996 | }, | |
493a52a9 HW |
5997 | [ALC668_FIXUP_AUTO_MUTE] = { |
5998 | .type = HDA_FIXUP_FUNC, | |
5999 | .v.func = alc_fixup_auto_mute_via_amp, | |
6000 | .chained = true, | |
6001 | .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE | |
6002 | }, | |
73bdd597 DH |
6003 | [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = { |
6004 | .type = HDA_FIXUP_PINS, | |
6005 | .v.pins = (const struct hda_pintbl[]) { | |
6006 | { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */ | |
6007 | { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */ | |
6008 | { } | |
6009 | }, | |
6010 | .chained = true, | |
6011 | .chain_id = ALC668_FIXUP_HEADSET_MODE | |
6012 | }, | |
6013 | [ALC668_FIXUP_HEADSET_MODE] = { | |
6014 | .type = HDA_FIXUP_FUNC, | |
6015 | .v.func = alc_fixup_headset_mode_alc668, | |
6016 | }, | |
8e54b4ac | 6017 | [ALC662_FIXUP_BASS_MODE4_CHMAP] = { |
8e383953 | 6018 | .type = HDA_FIXUP_FUNC, |
eb9ca3ab | 6019 | .v.func = alc_fixup_bass_chmap, |
8e383953 TI |
6020 | .chained = true, |
6021 | .chain_id = ALC662_FIXUP_ASUS_MODE4 | |
6022 | }, | |
61a75f13 DH |
6023 | [ALC662_FIXUP_BASS_16] = { |
6024 | .type = HDA_FIXUP_PINS, | |
6025 | .v.pins = (const struct hda_pintbl[]) { | |
6026 | {0x16, 0x80106111}, /* bass speaker */ | |
6027 | {} | |
6028 | }, | |
6029 | .chained = true, | |
6030 | .chain_id = ALC662_FIXUP_BASS_CHMAP, | |
6031 | }, | |
a30c9aaa TI |
6032 | [ALC662_FIXUP_BASS_1A] = { |
6033 | .type = HDA_FIXUP_PINS, | |
6034 | .v.pins = (const struct hda_pintbl[]) { | |
6035 | {0x1a, 0x80106111}, /* bass speaker */ | |
6036 | {} | |
6037 | }, | |
8e54b4ac DH |
6038 | .chained = true, |
6039 | .chain_id = ALC662_FIXUP_BASS_CHMAP, | |
a30c9aaa | 6040 | }, |
8e54b4ac | 6041 | [ALC662_FIXUP_BASS_CHMAP] = { |
a30c9aaa | 6042 | .type = HDA_FIXUP_FUNC, |
eb9ca3ab | 6043 | .v.func = alc_fixup_bass_chmap, |
a30c9aaa | 6044 | }, |
6cb3b707 DH |
6045 | }; |
6046 | ||
a9111321 | 6047 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
53c334ad | 6048 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2), |
d3d3835c | 6049 | SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC), |
a6c47a85 | 6050 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
94024cd1 | 6051 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), |
125821ae | 6052 | SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), |
1801928e | 6053 | SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC), |
2df03514 | 6054 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
73bdd597 DH |
6055 | SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
6056 | SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | |
c5d019c3 | 6057 | SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13), |
033b0a7c | 6058 | SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13), |
09d2014f | 6059 | SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
ad8ff99e | 6060 | SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
8dc9abb9 KY |
6061 | SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
6062 | SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | |
e59ea3ed | 6063 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), |
8e54b4ac DH |
6064 | SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A), |
6065 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), | |
61a75f13 DH |
6066 | SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16), |
6067 | SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16), | |
8e54b4ac | 6068 | SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), |
1565cc35 | 6069 | SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT), |
53c334ad | 6070 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2), |
a0e90acc | 6071 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
d4118588 | 6072 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
6cb3b707 | 6073 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
edfe3bfc | 6074 | SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68), |
d2ebd479 | 6075 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
53c334ad TI |
6076 | |
6077 | #if 0 | |
6078 | /* Below is a quirk table taken from the old code. | |
6079 | * Basically the device should work as is without the fixup table. | |
6080 | * If BIOS doesn't give a proper info, enable the corresponding | |
6081 | * fixup entry. | |
7d7eb9ea | 6082 | */ |
53c334ad TI |
6083 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1), |
6084 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3), | |
6085 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1), | |
6086 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3), | |
6087 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), | |
6088 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6089 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), | |
6090 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1), | |
6091 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1), | |
6092 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6093 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7), | |
6094 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7), | |
6095 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8), | |
6096 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3), | |
6097 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1), | |
6098 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6099 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2), | |
6100 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1), | |
6101 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6102 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6), | |
6103 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6), | |
6104 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6105 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1), | |
6106 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3), | |
6107 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2), | |
6108 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6109 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5), | |
6110 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6), | |
6111 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6112 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1), | |
6113 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6114 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6115 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3), | |
6116 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3), | |
6117 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1), | |
6118 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1), | |
6119 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1), | |
6120 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1), | |
6121 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1), | |
6122 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), | |
6123 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2), | |
6124 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1), | |
6125 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), | |
6126 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3), | |
6127 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1), | |
6128 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1), | |
6129 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1), | |
6130 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2), | |
6131 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), | |
6132 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4), | |
6133 | #endif | |
6cb3b707 DH |
6134 | {} |
6135 | }; | |
6136 | ||
1727a771 | 6137 | static const struct hda_model_fixup alc662_fixup_models[] = { |
6be7948f | 6138 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
53c334ad TI |
6139 | {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"}, |
6140 | {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"}, | |
6141 | {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"}, | |
6142 | {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"}, | |
6143 | {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"}, | |
6144 | {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"}, | |
6145 | {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"}, | |
6146 | {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"}, | |
6e72aa5f | 6147 | {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
e32aa85a | 6148 | {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"}, |
6be7948f TB |
6149 | {} |
6150 | }; | |
6cb3b707 | 6151 | |
532895c5 | 6152 | static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { |
76c2132e DH |
6153 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, |
6154 | {0x12, 0x99a30130}, | |
6155 | {0x14, 0x90170110}, | |
6156 | {0x15, 0x0321101f}, | |
6157 | {0x16, 0x03011020}, | |
6158 | {0x18, 0x40000008}, | |
6159 | {0x19, 0x411111f0}, | |
6160 | {0x1a, 0x411111f0}, | |
6161 | {0x1b, 0x411111f0}, | |
6162 | {0x1d, 0x41000001}, | |
6163 | {0x1e, 0x411111f0}, | |
6164 | {0x1f, 0x411111f0}), | |
6165 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, | |
6166 | {0x12, 0x99a30140}, | |
6167 | {0x14, 0x90170110}, | |
6168 | {0x15, 0x0321101f}, | |
6169 | {0x16, 0x03011020}, | |
6170 | {0x18, 0x40000008}, | |
6171 | {0x19, 0x411111f0}, | |
6172 | {0x1a, 0x411111f0}, | |
6173 | {0x1b, 0x411111f0}, | |
6174 | {0x1d, 0x41000001}, | |
6175 | {0x1e, 0x411111f0}, | |
6176 | {0x1f, 0x411111f0}), | |
6177 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, | |
6178 | {0x12, 0x99a30150}, | |
6179 | {0x14, 0x90170110}, | |
6180 | {0x15, 0x0321101f}, | |
6181 | {0x16, 0x03011020}, | |
6182 | {0x18, 0x40000008}, | |
6183 | {0x19, 0x411111f0}, | |
6184 | {0x1a, 0x411111f0}, | |
6185 | {0x1b, 0x411111f0}, | |
6186 | {0x1d, 0x41000001}, | |
6187 | {0x1e, 0x411111f0}, | |
6188 | {0x1f, 0x411111f0}), | |
6189 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE, | |
6190 | {0x12, 0x411111f0}, | |
6191 | {0x14, 0x90170110}, | |
6192 | {0x15, 0x0321101f}, | |
6193 | {0x16, 0x03011020}, | |
6194 | {0x18, 0x40000008}, | |
6195 | {0x19, 0x411111f0}, | |
6196 | {0x1a, 0x411111f0}, | |
6197 | {0x1b, 0x411111f0}, | |
6198 | {0x1d, 0x41000001}, | |
6199 | {0x1e, 0x411111f0}, | |
6200 | {0x1f, 0x411111f0}), | |
6201 | SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE, | |
6202 | {0x12, 0x90a60130}, | |
6203 | {0x14, 0x90170110}, | |
6204 | {0x15, 0x0321101f}, | |
6205 | {0x16, 0x40000000}, | |
6206 | {0x18, 0x411111f0}, | |
6207 | {0x19, 0x411111f0}, | |
6208 | {0x1a, 0x411111f0}, | |
6209 | {0x1b, 0x411111f0}, | |
6210 | {0x1d, 0x40d6832d}, | |
6211 | {0x1e, 0x411111f0}, | |
6212 | {0x1f, 0x411111f0}), | |
532895c5 HW |
6213 | {} |
6214 | }; | |
6215 | ||
8663ff75 KY |
6216 | static void alc662_fill_coef(struct hda_codec *codec) |
6217 | { | |
98b24883 | 6218 | int coef; |
8663ff75 KY |
6219 | |
6220 | coef = alc_get_coef0(codec); | |
6221 | ||
6222 | switch (codec->vendor_id) { | |
6223 | case 0x10ec0662: | |
98b24883 TI |
6224 | if ((coef & 0x00f0) == 0x0030) |
6225 | alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ | |
8663ff75 KY |
6226 | break; |
6227 | case 0x10ec0272: | |
6228 | case 0x10ec0273: | |
6229 | case 0x10ec0663: | |
6230 | case 0x10ec0665: | |
6231 | case 0x10ec0670: | |
6232 | case 0x10ec0671: | |
6233 | case 0x10ec0672: | |
98b24883 | 6234 | alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ |
8663ff75 KY |
6235 | break; |
6236 | } | |
6237 | } | |
6cb3b707 | 6238 | |
1d045db9 TI |
6239 | /* |
6240 | */ | |
bc9f98a9 KY |
6241 | static int patch_alc662(struct hda_codec *codec) |
6242 | { | |
6243 | struct alc_spec *spec; | |
3de95173 | 6244 | int err; |
bc9f98a9 | 6245 | |
3de95173 TI |
6246 | err = alc_alloc_spec(codec, 0x0b); |
6247 | if (err < 0) | |
6248 | return err; | |
bc9f98a9 | 6249 | |
3de95173 | 6250 | spec = codec->spec; |
1f0f4b80 | 6251 | |
53c334ad TI |
6252 | /* handle multiple HPs as is */ |
6253 | spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; | |
6254 | ||
2c3bf9ab TI |
6255 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
6256 | ||
8663ff75 KY |
6257 | spec->init_hook = alc662_fill_coef; |
6258 | alc662_fill_coef(codec); | |
6259 | ||
1727a771 | 6260 | snd_hda_pick_fixup(codec, alc662_fixup_models, |
8e5a0509 | 6261 | alc662_fixup_tbl, alc662_fixups); |
532895c5 | 6262 | snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups); |
1727a771 | 6263 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
8e5a0509 TI |
6264 | |
6265 | alc_auto_parse_customize_define(codec); | |
6266 | ||
7504b6cd TI |
6267 | if (has_cdefine_beep(codec)) |
6268 | spec->gen.beep_nid = 0x01; | |
6269 | ||
1bb7e43e | 6270 | if ((alc_get_coef0(codec) & (1 << 14)) && |
5100cd07 | 6271 | codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && |
e16fb6d1 | 6272 | spec->cdefine.platform_type == 1) { |
6134b1a2 WY |
6273 | err = alc_codec_rename(codec, "ALC272X"); |
6274 | if (err < 0) | |
e16fb6d1 | 6275 | goto error; |
20ca0c35 | 6276 | } |
274693f3 | 6277 | |
b9c5106c TI |
6278 | /* automatic parse from the BIOS config */ |
6279 | err = alc662_parse_auto_config(codec); | |
e16fb6d1 TI |
6280 | if (err < 0) |
6281 | goto error; | |
bc9f98a9 | 6282 | |
7504b6cd | 6283 | if (!spec->gen.no_analog && spec->gen.beep_nid) { |
da00c244 KY |
6284 | switch (codec->vendor_id) { |
6285 | case 0x10ec0662: | |
6286 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | |
6287 | break; | |
6288 | case 0x10ec0272: | |
6289 | case 0x10ec0663: | |
6290 | case 0x10ec0665: | |
9ad54547 | 6291 | case 0x10ec0668: |
da00c244 KY |
6292 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
6293 | break; | |
6294 | case 0x10ec0273: | |
6295 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); | |
6296 | break; | |
6297 | } | |
cec27c89 | 6298 | } |
2134ea4f | 6299 | |
bc9f98a9 | 6300 | codec->patch_ops = alc_patch_ops; |
1c716153 | 6301 | spec->shutup = alc_eapd_shutup; |
6cb3b707 | 6302 | |
1727a771 | 6303 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
589876e2 | 6304 | |
bc9f98a9 | 6305 | return 0; |
801f49d3 | 6306 | |
e16fb6d1 TI |
6307 | error: |
6308 | alc_free(codec); | |
6309 | return err; | |
b478b998 KY |
6310 | } |
6311 | ||
d1eb57f4 KY |
6312 | /* |
6313 | * ALC680 support | |
6314 | */ | |
d1eb57f4 | 6315 | |
d1eb57f4 KY |
6316 | static int alc680_parse_auto_config(struct hda_codec *codec) |
6317 | { | |
3e6179b8 | 6318 | return alc_parse_auto_config(codec, NULL, NULL); |
d1eb57f4 KY |
6319 | } |
6320 | ||
d1eb57f4 | 6321 | /* |
d1eb57f4 | 6322 | */ |
d1eb57f4 KY |
6323 | static int patch_alc680(struct hda_codec *codec) |
6324 | { | |
d1eb57f4 KY |
6325 | int err; |
6326 | ||
1f0f4b80 | 6327 | /* ALC680 has no aa-loopback mixer */ |
3de95173 TI |
6328 | err = alc_alloc_spec(codec, 0); |
6329 | if (err < 0) | |
6330 | return err; | |
1f0f4b80 | 6331 | |
1ebec5f2 TI |
6332 | /* automatic parse from the BIOS config */ |
6333 | err = alc680_parse_auto_config(codec); | |
6334 | if (err < 0) { | |
6335 | alc_free(codec); | |
6336 | return err; | |
d1eb57f4 KY |
6337 | } |
6338 | ||
d1eb57f4 | 6339 | codec->patch_ops = alc_patch_ops; |
d1eb57f4 KY |
6340 | |
6341 | return 0; | |
6342 | } | |
6343 | ||
1da177e4 LT |
6344 | /* |
6345 | * patch entries | |
6346 | */ | |
a9111321 | 6347 | static const struct hda_codec_preset snd_hda_preset_realtek[] = { |
296f0338 | 6348 | { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 }, |
ba4c4d0a | 6349 | { .id = 0x10ec0231, .name = "ALC231", .patch = patch_alc269 }, |
84dfd0ac | 6350 | { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 }, |
92f974df | 6351 | { .id = 0x10ec0235, .name = "ALC233", .patch = patch_alc269 }, |
1d04c9de | 6352 | { .id = 0x10ec0255, .name = "ALC255", .patch = patch_alc269 }, |
1da177e4 | 6353 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
df694daa | 6354 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
f6a92248 | 6355 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
a361d84b | 6356 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
f6a92248 | 6357 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
ebb83eeb | 6358 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
01afd41f | 6359 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
ebb83eeb | 6360 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
296f0338 | 6361 | { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 }, |
befae82e | 6362 | { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 }, |
4e01ec63 | 6363 | { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 }, |
7ff34ad8 | 6364 | { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 }, |
065380f0 | 6365 | { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 }, |
161ebf29 | 6366 | { .id = 0x10ec0285, .name = "ALC285", .patch = patch_alc269 }, |
7fc7d047 | 6367 | { .id = 0x10ec0286, .name = "ALC286", .patch = patch_alc269 }, |
7c665932 | 6368 | { .id = 0x10ec0288, .name = "ALC288", .patch = patch_alc269 }, |
7ff34ad8 | 6369 | { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 }, |
af02dde8 | 6370 | { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 }, |
161ebf29 | 6371 | { .id = 0x10ec0293, .name = "ALC293", .patch = patch_alc269 }, |
f32610ed | 6372 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
bc9f98a9 | 6373 | .patch = patch_alc861 }, |
f32610ed JS |
6374 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
6375 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, | |
6376 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, | |
bc9f98a9 | 6377 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
4953550a | 6378 | .patch = patch_alc882 }, |
bc9f98a9 KY |
6379 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
6380 | .patch = patch_alc662 }, | |
cc667a72 DH |
6381 | { .id = 0x10ec0662, .rev = 0x100300, .name = "ALC662 rev3", |
6382 | .patch = patch_alc662 }, | |
6dda9f4a | 6383 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
cec27c89 | 6384 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
72009433 | 6385 | { .id = 0x10ec0667, .name = "ALC667", .patch = patch_alc662 }, |
19a62823 | 6386 | { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 }, |
6227cdce | 6387 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
1d87caa6 | 6388 | { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 }, |
d1eb57f4 | 6389 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
b6c5fbad | 6390 | { .id = 0x10ec0867, .name = "ALC891", .patch = patch_alc882 }, |
f32610ed | 6391 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
1da177e4 | 6392 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
4953550a | 6393 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
669faba2 | 6394 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
4953550a | 6395 | .patch = patch_alc882 }, |
cb308f97 | 6396 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
4953550a | 6397 | .patch = patch_alc882 }, |
df694daa | 6398 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
e16fb6d1 | 6399 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
4442608d | 6400 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
4953550a | 6401 | .patch = patch_alc882 }, |
e16fb6d1 | 6402 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
4953550a | 6403 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
274693f3 | 6404 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
e16fb6d1 | 6405 | { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 }, |
19a62823 | 6406 | { .id = 0x10ec0900, .name = "ALC1150", .patch = patch_alc882 }, |
1da177e4 LT |
6407 | {} /* terminator */ |
6408 | }; | |
1289e9e8 TI |
6409 | |
6410 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); | |
6411 | ||
6412 | MODULE_LICENSE("GPL"); | |
6413 | MODULE_DESCRIPTION("Realtek HD-audio codec"); | |
6414 | ||
6415 | static struct hda_codec_preset_list realtek_list = { | |
6416 | .preset = snd_hda_preset_realtek, | |
6417 | .owner = THIS_MODULE, | |
6418 | }; | |
6419 | ||
6420 | static int __init patch_realtek_init(void) | |
6421 | { | |
6422 | return snd_hda_add_codec_preset(&realtek_list); | |
6423 | } | |
6424 | ||
6425 | static void __exit patch_realtek_exit(void) | |
6426 | { | |
6427 | snd_hda_delete_codec_preset(&realtek_list); | |
6428 | } | |
6429 | ||
6430 | module_init(patch_realtek_init) | |
6431 | module_exit(patch_realtek_exit) |