1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * HD audio codec driver for AD1882, AD1884, AD1981HD, AD1983, AD1984,
4 * AD1986A, AD1988
5 *
6 * Copyright (c) 2005-2007 Takashi Iwai <tiwai@suse.de>
7 */
8
9 #include <linux/init.h>
10 #include <linux/slab.h>
11 #include <linux/module.h>
12
13 #include <sound/core.h>
14 #include <sound/hda_codec.h>
15 #include "hda_local.h"
16 #include "hda_auto_parser.h"
17 #include "hda_beep.h"
18 #include "hda_jack.h"
19 #include "generic.h"
20
21 enum {
22 MODEL_AD1882,
23 MODEL_AD1884,
24 MODEL_AD1981,
25 MODEL_AD1983,
26 MODEL_AD1986A,
27 MODEL_AD1988,
28 };
29
30 struct ad198x_spec {
31 struct hda_gen_spec gen;
32 int model;
33
34 /* for auto parser */
35 int smux_paths[4];
36 unsigned int cur_smux;
37 hda_nid_t eapd_nid;
38
39 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
40 int num_smux_conns;
41 };
42
43
44 #ifdef CONFIG_SND_HDA_INPUT_BEEP
45 /* additional beep mixers; the actual parameters are overwritten at build */
46 static const struct snd_kcontrol_new ad_beep_mixer[] = {
47 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_OUTPUT),
48 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_OUTPUT),
49 { } /* end */
50 };
51
52 #define set_beep_amp(spec, nid, idx, dir) \
53 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir)) /* mono */
54 #else
55 #define set_beep_amp(spec, nid, idx, dir) /* NOP */
56 #endif
57
58 #ifdef CONFIG_SND_HDA_INPUT_BEEP
create_beep_ctls(struct hda_codec * codec)59 static int create_beep_ctls(struct hda_codec *codec)
60 {
61 struct ad198x_spec *spec = codec->spec;
62 const struct snd_kcontrol_new *knew;
63
64 if (!spec->beep_amp)
65 return 0;
66
67 for (knew = ad_beep_mixer ; knew->name; knew++) {
68 int err;
69 struct snd_kcontrol *kctl;
70 kctl = snd_ctl_new1(knew, codec);
71 if (!kctl)
72 return -ENOMEM;
73 kctl->private_value = spec->beep_amp;
74 err = snd_hda_ctl_add(codec, 0, kctl);
75 if (err < 0)
76 return err;
77 }
78 return 0;
79 }
80 #else
81 #define create_beep_ctls(codec) 0
82 #endif
83
ad198x_power_eapd_write(struct hda_codec * codec,hda_nid_t front,hda_nid_t hp)84 static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front,
85 hda_nid_t hp)
86 {
87 if (snd_hda_query_pin_caps(codec, front) & AC_PINCAP_EAPD)
88 snd_hda_codec_write(codec, front, 0, AC_VERB_SET_EAPD_BTLENABLE,
89 !codec->inv_eapd ? 0x00 : 0x02);
90 if (snd_hda_query_pin_caps(codec, hp) & AC_PINCAP_EAPD)
91 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_EAPD_BTLENABLE,
92 !codec->inv_eapd ? 0x00 : 0x02);
93 }
94
ad198x_power_eapd(struct hda_codec * codec)95 static void ad198x_power_eapd(struct hda_codec *codec)
96 {
97 /* We currently only handle front, HP */
98 switch (codec->core.vendor_id) {
99 case 0x11d41882:
100 case 0x11d4882a:
101 case 0x11d41884:
102 case 0x11d41984:
103 case 0x11d41883:
104 case 0x11d4184a:
105 case 0x11d4194a:
106 case 0x11d4194b:
107 case 0x11d41988:
108 case 0x11d4198b:
109 case 0x11d4989a:
110 case 0x11d4989b:
111 ad198x_power_eapd_write(codec, 0x12, 0x11);
112 break;
113 case 0x11d41981:
114 case 0x11d41983:
115 ad198x_power_eapd_write(codec, 0x05, 0x06);
116 break;
117 case 0x11d41986:
118 ad198x_power_eapd_write(codec, 0x1b, 0x1a);
119 break;
120 }
121 }
122
ad_codec_suspend(struct hda_codec * codec)123 static int ad_codec_suspend(struct hda_codec *codec)
124 {
125 snd_hda_shutup_pins(codec);
126 ad198x_power_eapd(codec);
127 return 0;
128 }
129
130 /* follow EAPD via vmaster hook */
ad_vmaster_eapd_hook(void * private_data,int enabled)131 static void ad_vmaster_eapd_hook(void *private_data, int enabled)
132 {
133 struct hda_codec *codec = private_data;
134 struct ad198x_spec *spec = codec->spec;
135
136 if (!spec->eapd_nid)
137 return;
138 if (codec->inv_eapd)
139 enabled = !enabled;
140 snd_hda_codec_write_cache(codec, spec->eapd_nid, 0,
141 AC_VERB_SET_EAPD_BTLENABLE,
142 enabled ? 0x02 : 0x00);
143 }
144
145 /*
146 * Automatic parse of I/O pins from the BIOS configuration
147 */
148
ad_codec_build_controls(struct hda_codec * codec)149 static int ad_codec_build_controls(struct hda_codec *codec)
150 {
151 int err;
152
153 err = snd_hda_gen_build_controls(codec);
154 if (err < 0)
155 return err;
156 err = create_beep_ctls(codec);
157 if (err < 0)
158 return err;
159 return 0;
160 }
161
ad198x_parse_auto_config(struct hda_codec * codec,bool indep_hp)162 static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp)
163 {
164 struct ad198x_spec *spec = codec->spec;
165 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
166 int err;
167
168 codec->spdif_status_reset = 1;
169 codec->no_trigger_sense = 1;
170 codec->no_sticky_stream = 1;
171
172 spec->gen.indep_hp = indep_hp;
173 if (!spec->gen.add_stereo_mix_input)
174 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
175
176 err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0);
177 if (err < 0)
178 return err;
179 err = snd_hda_gen_parse_auto_config(codec, cfg);
180 if (err < 0)
181 return err;
182
183 return 0;
184 }
185
186 /*
187 * AD1986A specific
188 */
189
alloc_ad_spec(struct hda_codec * codec)190 static int alloc_ad_spec(struct hda_codec *codec)
191 {
192 struct ad198x_spec *spec;
193
194 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
195 if (!spec)
196 return -ENOMEM;
197 codec->spec = spec;
198 snd_hda_gen_spec_init(&spec->gen);
199 return 0;
200 }
201
202 /*
203 * AD1986A fixup codes
204 */
205
206 /* Lenovo N100 seems to report the reversed bit for HP jack-sensing */
ad_fixup_inv_jack_detect(struct hda_codec * codec,const struct hda_fixup * fix,int action)207 static void ad_fixup_inv_jack_detect(struct hda_codec *codec,
208 const struct hda_fixup *fix, int action)
209 {
210 struct ad198x_spec *spec = codec->spec;
211
212 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
213 codec->inv_jack_detect = 1;
214 spec->gen.keep_eapd_on = 1;
215 spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
216 spec->eapd_nid = 0x1b;
217 }
218 }
219
220 /* Toshiba Satellite L40 implements EAPD in a standard way unlike others */
ad1986a_fixup_eapd(struct hda_codec * codec,const struct hda_fixup * fix,int action)221 static void ad1986a_fixup_eapd(struct hda_codec *codec,
222 const struct hda_fixup *fix, int action)
223 {
224 struct ad198x_spec *spec = codec->spec;
225
226 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
227 codec->inv_eapd = 0;
228 spec->gen.keep_eapd_on = 1;
229 spec->eapd_nid = 0x1b;
230 }
231 }
232
233 /* enable stereo-mix input for avoiding regression on KDE (bko#88251) */
ad1986a_fixup_eapd_mix_in(struct hda_codec * codec,const struct hda_fixup * fix,int action)234 static void ad1986a_fixup_eapd_mix_in(struct hda_codec *codec,
235 const struct hda_fixup *fix, int action)
236 {
237 struct ad198x_spec *spec = codec->spec;
238
239 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
240 ad1986a_fixup_eapd(codec, fix, action);
241 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_ENABLE;
242 }
243 }
244
245 enum {
246 AD1986A_FIXUP_INV_JACK_DETECT,
247 AD1986A_FIXUP_ULTRA,
248 AD1986A_FIXUP_SAMSUNG,
249 AD1986A_FIXUP_3STACK,
250 AD1986A_FIXUP_LAPTOP,
251 AD1986A_FIXUP_LAPTOP_IMIC,
252 AD1986A_FIXUP_EAPD,
253 AD1986A_FIXUP_EAPD_MIX_IN,
254 AD1986A_FIXUP_EASYNOTE,
255 };
256
257 static const struct hda_fixup ad1986a_fixups[] = {
258 [AD1986A_FIXUP_INV_JACK_DETECT] = {
259 .type = HDA_FIXUP_FUNC,
260 .v.func = ad_fixup_inv_jack_detect,
261 },
262 [AD1986A_FIXUP_ULTRA] = {
263 .type = HDA_FIXUP_PINS,
264 .v.pins = (const struct hda_pintbl[]) {
265 { 0x1b, 0x90170110 }, /* speaker */
266 { 0x1d, 0x90a7013e }, /* int mic */
267 {}
268 },
269 },
270 [AD1986A_FIXUP_SAMSUNG] = {
271 .type = HDA_FIXUP_PINS,
272 .v.pins = (const struct hda_pintbl[]) {
273 { 0x1b, 0x90170110 }, /* speaker */
274 { 0x1d, 0x90a7013e }, /* int mic */
275 { 0x20, 0x411111f0 }, /* N/A */
276 { 0x24, 0x411111f0 }, /* N/A */
277 {}
278 },
279 },
280 [AD1986A_FIXUP_3STACK] = {
281 .type = HDA_FIXUP_PINS,
282 .v.pins = (const struct hda_pintbl[]) {
283 { 0x1a, 0x02214021 }, /* headphone */
284 { 0x1b, 0x01014011 }, /* front */
285 { 0x1c, 0x01813030 }, /* line-in */
286 { 0x1d, 0x01a19020 }, /* rear mic */
287 { 0x1e, 0x411111f0 }, /* N/A */
288 { 0x1f, 0x02a190f0 }, /* mic */
289 { 0x20, 0x411111f0 }, /* N/A */
290 {}
291 },
292 },
293 [AD1986A_FIXUP_LAPTOP] = {
294 .type = HDA_FIXUP_PINS,
295 .v.pins = (const struct hda_pintbl[]) {
296 { 0x1a, 0x02214021 }, /* headphone */
297 { 0x1b, 0x90170110 }, /* speaker */
298 { 0x1c, 0x411111f0 }, /* N/A */
299 { 0x1d, 0x411111f0 }, /* N/A */
300 { 0x1e, 0x411111f0 }, /* N/A */
301 { 0x1f, 0x02a191f0 }, /* mic */
302 { 0x20, 0x411111f0 }, /* N/A */
303 {}
304 },
305 },
306 [AD1986A_FIXUP_LAPTOP_IMIC] = {
307 .type = HDA_FIXUP_PINS,
308 .v.pins = (const struct hda_pintbl[]) {
309 { 0x1d, 0x90a7013e }, /* int mic */
310 {}
311 },
312 .chained_before = 1,
313 .chain_id = AD1986A_FIXUP_LAPTOP,
314 },
315 [AD1986A_FIXUP_EAPD] = {
316 .type = HDA_FIXUP_FUNC,
317 .v.func = ad1986a_fixup_eapd,
318 },
319 [AD1986A_FIXUP_EAPD_MIX_IN] = {
320 .type = HDA_FIXUP_FUNC,
321 .v.func = ad1986a_fixup_eapd_mix_in,
322 },
323 [AD1986A_FIXUP_EASYNOTE] = {
324 .type = HDA_FIXUP_PINS,
325 .v.pins = (const struct hda_pintbl[]) {
326 { 0x1a, 0x0421402f }, /* headphone */
327 { 0x1b, 0x90170110 }, /* speaker */
328 { 0x1c, 0x411111f0 }, /* N/A */
329 { 0x1d, 0x90a70130 }, /* int mic */
330 { 0x1e, 0x411111f0 }, /* N/A */
331 { 0x1f, 0x04a19040 }, /* mic */
332 { 0x20, 0x411111f0 }, /* N/A */
333 { 0x21, 0x411111f0 }, /* N/A */
334 { 0x22, 0x411111f0 }, /* N/A */
335 { 0x23, 0x411111f0 }, /* N/A */
336 { 0x24, 0x411111f0 }, /* N/A */
337 { 0x25, 0x411111f0 }, /* N/A */
338 {}
339 },
340 .chained = true,
341 .chain_id = AD1986A_FIXUP_EAPD_MIX_IN,
342 },
343 };
344
345 static const struct hda_quirk ad1986a_fixup_tbl[] = {
346 SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC),
347 SND_PCI_QUIRK(0x1043, 0x1153, "ASUS M9V", AD1986A_FIXUP_LAPTOP_IMIC),
348 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS Z99He", AD1986A_FIXUP_EAPD),
349 SND_PCI_QUIRK(0x1043, 0x1447, "ASUS A8JN", AD1986A_FIXUP_EAPD),
350 SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK),
351 SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK),
352 SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK),
353 SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba Satellite L40", AD1986A_FIXUP_EAPD),
354 SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_FIXUP_LAPTOP),
355 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_FIXUP_SAMSUNG),
356 SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_FIXUP_ULTRA),
357 SND_PCI_QUIRK(0x1631, 0xc022, "PackardBell EasyNote MX65", AD1986A_FIXUP_EASYNOTE),
358 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo N100", AD1986A_FIXUP_INV_JACK_DETECT),
359 SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_FIXUP_3STACK),
360 SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_FIXUP_3STACK),
361 {}
362 };
363
364 static const struct hda_model_fixup ad1986a_fixup_models[] = {
365 { .id = AD1986A_FIXUP_3STACK, .name = "3stack" },
366 { .id = AD1986A_FIXUP_LAPTOP, .name = "laptop" },
367 { .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-imic" },
368 { .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-eapd" }, /* alias */
369 { .id = AD1986A_FIXUP_EAPD, .name = "eapd" },
370 {}
371 };
372
373 /*
374 */
ad1986a_probe(struct hda_codec * codec)375 static int ad1986a_probe(struct hda_codec *codec)
376 {
377 int err;
378 struct ad198x_spec *spec = codec->spec;
379 static const hda_nid_t preferred_pairs[] = {
380 0x1a, 0x03,
381 0x1b, 0x03,
382 0x1c, 0x04,
383 0x1d, 0x05,
384 0x1e, 0x03,
385 0
386 };
387
388 /* AD1986A has the inverted EAPD implementation */
389 codec->inv_eapd = 1;
390
391 spec->gen.mixer_nid = 0x07;
392 spec->gen.beep_nid = 0x19;
393 set_beep_amp(spec, 0x18, 0, HDA_OUTPUT);
394
395 /* AD1986A has a hardware problem that it can't share a stream
396 * with multiple output pins. The copy of front to surrounds
397 * causes noisy or silent outputs at a certain timing, e.g.
398 * changing the volume.
399 * So, let's disable the shared stream.
400 */
401 spec->gen.multiout.no_share_stream = 1;
402 /* give fixed DAC/pin pairs */
403 spec->gen.preferred_dacs = preferred_pairs;
404
405 /* AD1986A can't manage the dynamic pin on/off smoothly */
406 spec->gen.auto_mute_via_amp = 1;
407
408 snd_hda_pick_fixup(codec, ad1986a_fixup_models, ad1986a_fixup_tbl,
409 ad1986a_fixups);
410 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
411
412 err = ad198x_parse_auto_config(codec, false);
413 if (err < 0)
414 return err;
415
416 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
417
418 return 0;
419 }
420
421
422 /*
423 * AD1983 specific
424 */
425
426 /*
427 * SPDIF mux control for AD1983 auto-parser
428 */
ad1983_auto_smux_enum_info(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_info * uinfo)429 static int ad1983_auto_smux_enum_info(struct snd_kcontrol *kcontrol,
430 struct snd_ctl_elem_info *uinfo)
431 {
432 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
433 struct ad198x_spec *spec = codec->spec;
434 static const char * const texts2[] = { "PCM", "ADC" };
435 static const char * const texts3[] = { "PCM", "ADC1", "ADC2" };
436 int num_conns = spec->num_smux_conns;
437
438 if (num_conns == 2)
439 return snd_hda_enum_helper_info(kcontrol, uinfo, 2, texts2);
440 else if (num_conns == 3)
441 return snd_hda_enum_helper_info(kcontrol, uinfo, 3, texts3);
442 else
443 return -EINVAL;
444 }
445
ad1983_auto_smux_enum_get(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)446 static int ad1983_auto_smux_enum_get(struct snd_kcontrol *kcontrol,
447 struct snd_ctl_elem_value *ucontrol)
448 {
449 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
450 struct ad198x_spec *spec = codec->spec;
451
452 ucontrol->value.enumerated.item[0] = spec->cur_smux;
453 return 0;
454 }
455
ad1983_auto_smux_enum_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)456 static int ad1983_auto_smux_enum_put(struct snd_kcontrol *kcontrol,
457 struct snd_ctl_elem_value *ucontrol)
458 {
459 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
460 struct ad198x_spec *spec = codec->spec;
461 unsigned int val = ucontrol->value.enumerated.item[0];
462 hda_nid_t dig_out = spec->gen.multiout.dig_out_nid;
463 int num_conns = spec->num_smux_conns;
464
465 if (val >= num_conns)
466 return -EINVAL;
467 if (spec->cur_smux == val)
468 return 0;
469 spec->cur_smux = val;
470 snd_hda_codec_write_cache(codec, dig_out, 0,
471 AC_VERB_SET_CONNECT_SEL, val);
472 return 1;
473 }
474
475 static const struct snd_kcontrol_new ad1983_auto_smux_mixer = {
476 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
477 .name = "IEC958 Playback Source",
478 .info = ad1983_auto_smux_enum_info,
479 .get = ad1983_auto_smux_enum_get,
480 .put = ad1983_auto_smux_enum_put,
481 };
482
ad1983_add_spdif_mux_ctl(struct hda_codec * codec)483 static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec)
484 {
485 struct ad198x_spec *spec = codec->spec;
486 hda_nid_t dig_out = spec->gen.multiout.dig_out_nid;
487 int num_conns;
488
489 if (!dig_out)
490 return 0;
491 num_conns = snd_hda_get_num_conns(codec, dig_out);
492 if (num_conns != 2 && num_conns != 3)
493 return 0;
494 spec->num_smux_conns = num_conns;
495 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &ad1983_auto_smux_mixer))
496 return -ENOMEM;
497 return 0;
498 }
499
ad1983_probe(struct hda_codec * codec)500 static int ad1983_probe(struct hda_codec *codec)
501 {
502 static const hda_nid_t conn_0c[] = { 0x08 };
503 static const hda_nid_t conn_0d[] = { 0x09 };
504 struct ad198x_spec *spec = codec->spec;
505 int err;
506
507 spec->gen.mixer_nid = 0x0e;
508 spec->gen.beep_nid = 0x10;
509 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
510
511 /* limit the loopback routes not to confuse the parser */
512 snd_hda_override_conn_list(codec, 0x0c, ARRAY_SIZE(conn_0c), conn_0c);
513 snd_hda_override_conn_list(codec, 0x0d, ARRAY_SIZE(conn_0d), conn_0d);
514
515 err = ad198x_parse_auto_config(codec, false);
516 if (err < 0)
517 return err;
518 err = ad1983_add_spdif_mux_ctl(codec);
519 if (err < 0)
520 return err;
521 return 0;
522 }
523
524
525 /*
526 * AD1981 HD specific
527 */
528
ad1981_fixup_hp_eapd(struct hda_codec * codec,const struct hda_fixup * fix,int action)529 static void ad1981_fixup_hp_eapd(struct hda_codec *codec,
530 const struct hda_fixup *fix, int action)
531 {
532 struct ad198x_spec *spec = codec->spec;
533
534 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
535 spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
536 spec->eapd_nid = 0x05;
537 }
538 }
539
540 /* set the upper-limit for mixer amp to 0dB for avoiding the possible
541 * damage by overloading
542 */
ad1981_fixup_amp_override(struct hda_codec * codec,const struct hda_fixup * fix,int action)543 static void ad1981_fixup_amp_override(struct hda_codec *codec,
544 const struct hda_fixup *fix, int action)
545 {
546 if (action == HDA_FIXUP_ACT_PRE_PROBE)
547 snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT,
548 (0x17 << AC_AMPCAP_OFFSET_SHIFT) |
549 (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) |
550 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
551 (1 << AC_AMPCAP_MUTE_SHIFT));
552 }
553
554 enum {
555 AD1981_FIXUP_AMP_OVERRIDE,
556 AD1981_FIXUP_HP_EAPD,
557 };
558
559 static const struct hda_fixup ad1981_fixups[] = {
560 [AD1981_FIXUP_AMP_OVERRIDE] = {
561 .type = HDA_FIXUP_FUNC,
562 .v.func = ad1981_fixup_amp_override,
563 },
564 [AD1981_FIXUP_HP_EAPD] = {
565 .type = HDA_FIXUP_FUNC,
566 .v.func = ad1981_fixup_hp_eapd,
567 .chained = true,
568 .chain_id = AD1981_FIXUP_AMP_OVERRIDE,
569 },
570 };
571
572 static const struct hda_quirk ad1981_fixup_tbl[] = {
573 SND_PCI_QUIRK_VENDOR(0x1014, "Lenovo", AD1981_FIXUP_AMP_OVERRIDE),
574 SND_PCI_QUIRK_VENDOR(0x103c, "HP", AD1981_FIXUP_HP_EAPD),
575 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", AD1981_FIXUP_AMP_OVERRIDE),
576 /* HP nx6320 (reversed SSID, H/W bug) */
577 SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_FIXUP_HP_EAPD),
578 {}
579 };
580
ad1981_probe(struct hda_codec * codec)581 static int ad1981_probe(struct hda_codec *codec)
582 {
583 struct ad198x_spec *spec = codec->spec;
584 int err;
585
586 spec->gen.mixer_nid = 0x0e;
587 spec->gen.beep_nid = 0x10;
588 set_beep_amp(spec, 0x0d, 0, HDA_OUTPUT);
589
590 snd_hda_pick_fixup(codec, NULL, ad1981_fixup_tbl, ad1981_fixups);
591 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
592
593 err = ad198x_parse_auto_config(codec, false);
594 if (err < 0)
595 return err;
596 err = ad1983_add_spdif_mux_ctl(codec);
597 if (err < 0)
598 return err;
599
600 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
601
602 return 0;
603 }
604
605
606 /*
607 * AD1988
608 *
609 * Output pins and routes
610 *
611 * Pin Mix Sel DAC (*)
612 * port-A 0x11 (mute/hp) <- 0x22 <- 0x37 <- 03/04/06
613 * port-B 0x14 (mute/hp) <- 0x2b <- 0x30 <- 03/04/06
614 * port-C 0x15 (mute) <- 0x2c <- 0x31 <- 05/0a
615 * port-D 0x12 (mute/hp) <- 0x29 <- 04
616 * port-E 0x17 (mute/hp) <- 0x26 <- 0x32 <- 05/0a
617 * port-F 0x16 (mute) <- 0x2a <- 06
618 * port-G 0x24 (mute) <- 0x27 <- 05
619 * port-H 0x25 (mute) <- 0x28 <- 0a
620 * mono 0x13 (mute/amp)<- 0x1e <- 0x36 <- 03/04/06
621 *
622 * DAC0 = 03h, DAC1 = 04h, DAC2 = 05h, DAC3 = 06h, DAC4 = 0ah
623 * (*) DAC2/3/4 are swapped to DAC3/4/2 on AD198A rev.2 due to a h/w bug.
624 *
625 * Input pins and routes
626 *
627 * pin boost mix input # / adc input #
628 * port-A 0x11 -> 0x38 -> mix 2, ADC 0
629 * port-B 0x14 -> 0x39 -> mix 0, ADC 1
630 * port-C 0x15 -> 0x3a -> 33:0 - mix 1, ADC 2
631 * port-D 0x12 -> 0x3d -> mix 3, ADC 8
632 * port-E 0x17 -> 0x3c -> 34:0 - mix 4, ADC 4
633 * port-F 0x16 -> 0x3b -> mix 5, ADC 3
634 * port-G 0x24 -> N/A -> 33:1 - mix 1, 34:1 - mix 4, ADC 6
635 * port-H 0x25 -> N/A -> 33:2 - mix 1, 34:2 - mix 4, ADC 7
636 *
637 *
638 * DAC assignment
639 * 6stack - front/surr/CLFE/side/opt DACs - 04/06/05/0a/03
640 * 3stack - front/surr/CLFE/opt DACs - 04/05/0a/03
641 *
642 * Inputs of Analog Mix (0x20)
643 * 0:Port-B (front mic)
644 * 1:Port-C/G/H (line-in)
645 * 2:Port-A
646 * 3:Port-D (line-in/2)
647 * 4:Port-E/G/H (mic-in)
648 * 5:Port-F (mic2-in)
649 * 6:CD
650 * 7:Beep
651 *
652 * ADC selection
653 * 0:Port-A
654 * 1:Port-B (front mic-in)
655 * 2:Port-C (line-in)
656 * 3:Port-F (mic2-in)
657 * 4:Port-E (mic-in)
658 * 5:CD
659 * 6:Port-G
660 * 7:Port-H
661 * 8:Port-D (line-in/2)
662 * 9:Mix
663 *
664 * Proposed pin assignments by the datasheet
665 *
666 * 6-stack
667 * Port-A front headphone
668 * B front mic-in
669 * C rear line-in
670 * D rear front-out
671 * E rear mic-in
672 * F rear surround
673 * G rear CLFE
674 * H rear side
675 *
676 * 3-stack
677 * Port-A front headphone
678 * B front mic
679 * C rear line-in/surround
680 * D rear front-out
681 * E rear mic-in/CLFE
682 *
683 * laptop
684 * Port-A headphone
685 * B mic-in
686 * C docking station
687 * D internal speaker (with EAPD)
688 * E/F quad mic array
689 */
690
ad1988_auto_smux_enum_info(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_info * uinfo)691 static int ad1988_auto_smux_enum_info(struct snd_kcontrol *kcontrol,
692 struct snd_ctl_elem_info *uinfo)
693 {
694 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
695 struct ad198x_spec *spec = codec->spec;
696 static const char * const texts[] = {
697 "PCM", "ADC1", "ADC2", "ADC3",
698 };
699 int num_conns = spec->num_smux_conns;
700
701 if (num_conns > 4)
702 num_conns = 4;
703 return snd_hda_enum_helper_info(kcontrol, uinfo, num_conns, texts);
704 }
705
ad1988_auto_smux_enum_get(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)706 static int ad1988_auto_smux_enum_get(struct snd_kcontrol *kcontrol,
707 struct snd_ctl_elem_value *ucontrol)
708 {
709 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
710 struct ad198x_spec *spec = codec->spec;
711
712 ucontrol->value.enumerated.item[0] = spec->cur_smux;
713 return 0;
714 }
715
ad1988_auto_smux_enum_put(struct snd_kcontrol * kcontrol,struct snd_ctl_elem_value * ucontrol)716 static int ad1988_auto_smux_enum_put(struct snd_kcontrol *kcontrol,
717 struct snd_ctl_elem_value *ucontrol)
718 {
719 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
720 struct ad198x_spec *spec = codec->spec;
721 unsigned int val = ucontrol->value.enumerated.item[0];
722 struct nid_path *path;
723 int num_conns = spec->num_smux_conns;
724
725 if (val >= num_conns)
726 return -EINVAL;
727 if (spec->cur_smux == val)
728 return 0;
729
730 mutex_lock(&codec->control_mutex);
731 path = snd_hda_get_path_from_idx(codec,
732 spec->smux_paths[spec->cur_smux]);
733 if (path)
734 snd_hda_activate_path(codec, path, false, true);
735 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[val]);
736 if (path)
737 snd_hda_activate_path(codec, path, true, true);
738 spec->cur_smux = val;
739 mutex_unlock(&codec->control_mutex);
740 return 1;
741 }
742
743 static const struct snd_kcontrol_new ad1988_auto_smux_mixer = {
744 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
745 .name = "IEC958 Playback Source",
746 .info = ad1988_auto_smux_enum_info,
747 .get = ad1988_auto_smux_enum_get,
748 .put = ad1988_auto_smux_enum_put,
749 };
750
ad_codec_init(struct hda_codec * codec)751 static int ad_codec_init(struct hda_codec *codec)
752 {
753 struct ad198x_spec *spec = codec->spec;
754 int i, err;
755
756 err = snd_hda_gen_init(codec);
757 if (err < 0)
758 return err;
759 if (spec->model != MODEL_AD1988)
760 return 0;
761 if (!spec->gen.autocfg.dig_outs)
762 return 0;
763
764 for (i = 0; i < 4; i++) {
765 struct nid_path *path;
766 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[i]);
767 if (path)
768 snd_hda_activate_path(codec, path, path->active, false);
769 }
770
771 return 0;
772 }
773
ad1988_add_spdif_mux_ctl(struct hda_codec * codec)774 static int ad1988_add_spdif_mux_ctl(struct hda_codec *codec)
775 {
776 struct ad198x_spec *spec = codec->spec;
777 int i, num_conns;
778 /* we create four static faked paths, since AD codecs have odd
779 * widget connections regarding the SPDIF out source
780 */
781 static const struct nid_path fake_paths[4] = {
782 {
783 .depth = 3,
784 .path = { 0x02, 0x1d, 0x1b },
785 .idx = { 0, 0, 0 },
786 .multi = { 0, 0, 0 },
787 },
788 {
789 .depth = 4,
790 .path = { 0x08, 0x0b, 0x1d, 0x1b },
791 .idx = { 0, 0, 1, 0 },
792 .multi = { 0, 1, 0, 0 },
793 },
794 {
795 .depth = 4,
796 .path = { 0x09, 0x0b, 0x1d, 0x1b },
797 .idx = { 0, 1, 1, 0 },
798 .multi = { 0, 1, 0, 0 },
799 },
800 {
801 .depth = 4,
802 .path = { 0x0f, 0x0b, 0x1d, 0x1b },
803 .idx = { 0, 2, 1, 0 },
804 .multi = { 0, 1, 0, 0 },
805 },
806 };
807
808 /* SPDIF source mux appears to be present only on AD1988A */
809 if (!spec->gen.autocfg.dig_outs ||
810 get_wcaps_type(get_wcaps(codec, 0x1d)) != AC_WID_AUD_MIX)
811 return 0;
812
813 num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1;
814 if (num_conns != 3 && num_conns != 4)
815 return 0;
816 spec->num_smux_conns = num_conns;
817
818 for (i = 0; i < num_conns; i++) {
819 struct nid_path *path = snd_array_new(&spec->gen.paths);
820 if (!path)
821 return -ENOMEM;
822 *path = fake_paths[i];
823 if (!i)
824 path->active = 1;
825 spec->smux_paths[i] = snd_hda_get_path_idx(codec, path);
826 }
827
828 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &ad1988_auto_smux_mixer))
829 return -ENOMEM;
830
831 return 0;
832 }
833
834 /*
835 */
836
837 enum {
838 AD1988_FIXUP_6STACK_DIG,
839 };
840
841 static const struct hda_fixup ad1988_fixups[] = {
842 [AD1988_FIXUP_6STACK_DIG] = {
843 .type = HDA_FIXUP_PINS,
844 .v.pins = (const struct hda_pintbl[]) {
845 { 0x11, 0x02214130 }, /* front-hp */
846 { 0x12, 0x01014010 }, /* line-out */
847 { 0x14, 0x02a19122 }, /* front-mic */
848 { 0x15, 0x01813021 }, /* line-in */
849 { 0x16, 0x01011012 }, /* line-out */
850 { 0x17, 0x01a19020 }, /* mic */
851 { 0x1b, 0x0145f1f0 }, /* SPDIF */
852 { 0x24, 0x01016011 }, /* line-out */
853 { 0x25, 0x01012013 }, /* line-out */
854 { }
855 }
856 },
857 };
858
859 static const struct hda_model_fixup ad1988_fixup_models[] = {
860 { .id = AD1988_FIXUP_6STACK_DIG, .name = "6stack-dig" },
861 {}
862 };
863
ad1988_probe(struct hda_codec * codec)864 static int ad1988_probe(struct hda_codec *codec)
865 {
866 struct ad198x_spec *spec = codec->spec;
867 int err;
868
869 spec->gen.mixer_nid = 0x20;
870 spec->gen.mixer_merge_nid = 0x21;
871 spec->gen.beep_nid = 0x10;
872 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
873
874 snd_hda_pick_fixup(codec, ad1988_fixup_models, NULL, ad1988_fixups);
875 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
876
877 err = ad198x_parse_auto_config(codec, true);
878 if (err < 0)
879 return err;
880 err = ad1988_add_spdif_mux_ctl(codec);
881 if (err < 0)
882 return err;
883
884 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
885
886 return 0;
887 }
888
889
890 /*
891 * AD1884 / AD1984
892 *
893 * port-B - front line/mic-in
894 * port-E - aux in/out
895 * port-F - aux in/out
896 * port-C - rear line/mic-in
897 * port-D - rear line/hp-out
898 * port-A - front line/hp-out
899 *
900 * AD1984 = AD1884 + two digital mic-ins
901 *
902 * AD1883 / AD1884A / AD1984A / AD1984B
903 *
904 * port-B (0x14) - front mic-in
905 * port-E (0x1c) - rear mic-in
906 * port-F (0x16) - CD / ext out
907 * port-C (0x15) - rear line-in
908 * port-D (0x12) - rear line-out
909 * port-A (0x11) - front hp-out
910 *
911 * AD1984A = AD1884A + digital-mic
912 * AD1883 = equivalent with AD1984A
913 * AD1984B = AD1984A + extra SPDIF-out
914 */
915
916 /* set the upper-limit for mixer amp to 0dB for avoiding the possible
917 * damage by overloading
918 */
ad1884_fixup_amp_override(struct hda_codec * codec,const struct hda_fixup * fix,int action)919 static void ad1884_fixup_amp_override(struct hda_codec *codec,
920 const struct hda_fixup *fix, int action)
921 {
922 if (action == HDA_FIXUP_ACT_PRE_PROBE)
923 snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT,
924 (0x17 << AC_AMPCAP_OFFSET_SHIFT) |
925 (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) |
926 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
927 (1 << AC_AMPCAP_MUTE_SHIFT));
928 }
929
930 /* toggle GPIO1 according to the mute state */
ad1884_vmaster_hp_gpio_hook(void * private_data,int enabled)931 static void ad1884_vmaster_hp_gpio_hook(void *private_data, int enabled)
932 {
933 struct hda_codec *codec = private_data;
934 struct ad198x_spec *spec = codec->spec;
935
936 if (spec->eapd_nid)
937 ad_vmaster_eapd_hook(private_data, enabled);
938 snd_hda_codec_write_cache(codec, 0x01, 0,
939 AC_VERB_SET_GPIO_DATA,
940 enabled ? 0x00 : 0x02);
941 }
942
ad1884_fixup_hp_eapd(struct hda_codec * codec,const struct hda_fixup * fix,int action)943 static void ad1884_fixup_hp_eapd(struct hda_codec *codec,
944 const struct hda_fixup *fix, int action)
945 {
946 struct ad198x_spec *spec = codec->spec;
947
948 switch (action) {
949 case HDA_FIXUP_ACT_PRE_PROBE:
950 spec->gen.vmaster_mute.hook = ad1884_vmaster_hp_gpio_hook;
951 spec->gen.own_eapd_ctl = 1;
952 snd_hda_codec_write_cache(codec, 0x01, 0,
953 AC_VERB_SET_GPIO_MASK, 0x02);
954 snd_hda_codec_write_cache(codec, 0x01, 0,
955 AC_VERB_SET_GPIO_DIRECTION, 0x02);
956 snd_hda_codec_write_cache(codec, 0x01, 0,
957 AC_VERB_SET_GPIO_DATA, 0x02);
958 break;
959 case HDA_FIXUP_ACT_PROBE:
960 if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
961 spec->eapd_nid = spec->gen.autocfg.line_out_pins[0];
962 else
963 spec->eapd_nid = spec->gen.autocfg.speaker_pins[0];
964 break;
965 }
966 }
967
ad1884_fixup_thinkpad(struct hda_codec * codec,const struct hda_fixup * fix,int action)968 static void ad1884_fixup_thinkpad(struct hda_codec *codec,
969 const struct hda_fixup *fix, int action)
970 {
971 struct ad198x_spec *spec = codec->spec;
972
973 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
974 spec->gen.keep_eapd_on = 1;
975 spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
976 spec->eapd_nid = 0x12;
977 /* Analog PC Beeper - allow firmware/ACPI beeps */
978 spec->beep_amp = HDA_COMPOSE_AMP_VAL(0x20, 3, 3, HDA_INPUT);
979 spec->gen.beep_nid = 0; /* no digital beep */
980 }
981 }
982
983 /* set magic COEFs for dmic */
984 static const struct hda_verb ad1884_dmic_init_verbs[] = {
985 {0x01, AC_VERB_SET_COEF_INDEX, 0x13f7},
986 {0x01, AC_VERB_SET_PROC_COEF, 0x08},
987 {}
988 };
989
990 enum {
991 AD1884_FIXUP_AMP_OVERRIDE,
992 AD1884_FIXUP_HP_EAPD,
993 AD1884_FIXUP_DMIC_COEF,
994 AD1884_FIXUP_THINKPAD,
995 AD1884_FIXUP_HP_TOUCHSMART,
996 };
997
998 static const struct hda_fixup ad1884_fixups[] = {
999 [AD1884_FIXUP_AMP_OVERRIDE] = {
1000 .type = HDA_FIXUP_FUNC,
1001 .v.func = ad1884_fixup_amp_override,
1002 },
1003 [AD1884_FIXUP_HP_EAPD] = {
1004 .type = HDA_FIXUP_FUNC,
1005 .v.func = ad1884_fixup_hp_eapd,
1006 .chained = true,
1007 .chain_id = AD1884_FIXUP_AMP_OVERRIDE,
1008 },
1009 [AD1884_FIXUP_DMIC_COEF] = {
1010 .type = HDA_FIXUP_VERBS,
1011 .v.verbs = ad1884_dmic_init_verbs,
1012 },
1013 [AD1884_FIXUP_THINKPAD] = {
1014 .type = HDA_FIXUP_FUNC,
1015 .v.func = ad1884_fixup_thinkpad,
1016 .chained = true,
1017 .chain_id = AD1884_FIXUP_DMIC_COEF,
1018 },
1019 [AD1884_FIXUP_HP_TOUCHSMART] = {
1020 .type = HDA_FIXUP_VERBS,
1021 .v.verbs = ad1884_dmic_init_verbs,
1022 .chained = true,
1023 .chain_id = AD1884_FIXUP_HP_EAPD,
1024 },
1025 };
1026
1027 static const struct hda_quirk ad1884_fixup_tbl[] = {
1028 SND_PCI_QUIRK(0x103c, 0x2a82, "HP Touchsmart", AD1884_FIXUP_HP_TOUCHSMART),
1029 SND_PCI_QUIRK_VENDOR(0x103c, "HP", AD1884_FIXUP_HP_EAPD),
1030 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1884_FIXUP_THINKPAD),
1031 {}
1032 };
1033
1034
ad1884_probe(struct hda_codec * codec)1035 static int ad1884_probe(struct hda_codec *codec)
1036 {
1037 struct ad198x_spec *spec = codec->spec;
1038 int err;
1039
1040 spec->gen.mixer_nid = 0x20;
1041 spec->gen.mixer_merge_nid = 0x21;
1042 spec->gen.beep_nid = 0x10;
1043 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
1044
1045 snd_hda_pick_fixup(codec, NULL, ad1884_fixup_tbl, ad1884_fixups);
1046 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1047
1048 err = ad198x_parse_auto_config(codec, true);
1049 if (err < 0)
1050 return err;
1051 err = ad1983_add_spdif_mux_ctl(codec);
1052 if (err < 0)
1053 return err;
1054
1055 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1056
1057 return 0;
1058 }
1059
1060 /*
1061 * AD1882 / AD1882A
1062 *
1063 * port-A - front hp-out
1064 * port-B - front mic-in
1065 * port-C - rear line-in, shared surr-out (3stack)
1066 * port-D - rear line-out
1067 * port-E - rear mic-in, shared clfe-out (3stack)
1068 * port-F - rear surr-out (6stack)
1069 * port-G - rear clfe-out (6stack)
1070 */
1071
ad1882_probe(struct hda_codec * codec)1072 static int ad1882_probe(struct hda_codec *codec)
1073 {
1074 struct ad198x_spec *spec = codec->spec;
1075 int err;
1076
1077 spec->gen.mixer_nid = 0x20;
1078 spec->gen.mixer_merge_nid = 0x21;
1079 spec->gen.beep_nid = 0x10;
1080 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
1081 err = ad198x_parse_auto_config(codec, true);
1082 if (err < 0)
1083 return err;
1084 err = ad1988_add_spdif_mux_ctl(codec);
1085 if (err < 0)
1086 return err;
1087 return 0;
1088 }
1089
1090 /*
1091 * driver entries
1092 */
ad_codec_probe(struct hda_codec * codec,const struct hda_device_id * id)1093 static int ad_codec_probe(struct hda_codec *codec,
1094 const struct hda_device_id *id)
1095 {
1096 struct ad198x_spec *spec;
1097 int err;
1098
1099 err = alloc_ad_spec(codec);
1100 if (err < 0)
1101 return -ENOMEM;
1102 spec = codec->spec;
1103 spec->model = id->driver_data;
1104
1105 switch (spec->model) {
1106 case MODEL_AD1882:
1107 err = ad1882_probe(codec);
1108 break;
1109 case MODEL_AD1884:
1110 err = ad1884_probe(codec);
1111 break;
1112 case MODEL_AD1981:
1113 err = ad1981_probe(codec);
1114 break;
1115 case MODEL_AD1983:
1116 err = ad1983_probe(codec);
1117 break;
1118 case MODEL_AD1986A:
1119 err = ad1986a_probe(codec);
1120 break;
1121 case MODEL_AD1988:
1122 err = ad1988_probe(codec);
1123 break;
1124 default:
1125 err = -EINVAL;
1126 break;
1127 }
1128
1129 if (err < 0) {
1130 snd_hda_gen_remove(codec);
1131 return err;
1132 }
1133
1134 return 0;
1135 }
1136
1137 static const struct hda_codec_ops ad_codec_ops = {
1138 .probe = ad_codec_probe,
1139 .remove = snd_hda_gen_remove,
1140 .build_controls = ad_codec_build_controls,
1141 .build_pcms = snd_hda_gen_build_pcms,
1142 .init = ad_codec_init,
1143 .unsol_event = snd_hda_jack_unsol_event,
1144 .suspend = ad_codec_suspend,
1145 .check_power_status = snd_hda_gen_check_power_status,
1146 .stream_pm = snd_hda_gen_stream_pm,
1147 };
1148
1149 static const struct hda_device_id snd_hda_id_analog[] = {
1150 HDA_CODEC_ID_MODEL(0x11d4184a, "AD1884A", MODEL_AD1884),
1151 HDA_CODEC_ID_MODEL(0x11d41882, "AD1882", MODEL_AD1882),
1152 HDA_CODEC_ID_MODEL(0x11d41883, "AD1883", MODEL_AD1884),
1153 HDA_CODEC_ID_MODEL(0x11d41884, "AD1884", MODEL_AD1884),
1154 HDA_CODEC_ID_MODEL(0x11d4194a, "AD1984A", MODEL_AD1884),
1155 HDA_CODEC_ID_MODEL(0x11d4194b, "AD1984B", MODEL_AD1884),
1156 HDA_CODEC_ID_MODEL(0x11d41981, "AD1981", MODEL_AD1981),
1157 HDA_CODEC_ID_MODEL(0x11d41983, "AD1983", MODEL_AD1983),
1158 HDA_CODEC_ID_MODEL(0x11d41984, "AD1984", MODEL_AD1884),
1159 HDA_CODEC_ID_MODEL(0x11d41986, "AD1986A", MODEL_AD1986A),
1160 HDA_CODEC_ID_MODEL(0x11d41988, "AD1988", MODEL_AD1988),
1161 HDA_CODEC_ID_MODEL(0x11d4198b, "AD1988B", MODEL_AD1988),
1162 HDA_CODEC_ID_MODEL(0x11d4882a, "AD1882A", MODEL_AD1882),
1163 HDA_CODEC_ID_MODEL(0x11d4989a, "AD1989A", MODEL_AD1988),
1164 HDA_CODEC_ID_MODEL(0x11d4989b, "AD1989B", MODEL_AD1988),
1165 {} /* terminator */
1166 };
1167 MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_analog);
1168
1169 MODULE_LICENSE("GPL");
1170 MODULE_DESCRIPTION("Analog Devices HD-audio codec");
1171
1172 static struct hda_codec_driver analog_driver = {
1173 .id = snd_hda_id_analog,
1174 .ops = &ad_codec_ops,
1175 };
1176
1177 module_hda_codec_driver(analog_driver);
1178