Lines Matching +full:codec +full:- +full:0
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright (c) 2005-2007 Takashi Iwai <[email protected]>
38 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_OUTPUT),
39 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_OUTPUT),
44 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir)) /* mono */
50 static int create_beep_ctls(struct hda_codec *codec) in create_beep_ctls() argument
52 struct ad198x_spec *spec = codec->spec; in create_beep_ctls()
55 if (!spec->beep_amp) in create_beep_ctls()
56 return 0; in create_beep_ctls()
58 for (knew = ad_beep_mixer ; knew->name; knew++) { in create_beep_ctls()
61 kctl = snd_ctl_new1(knew, codec); in create_beep_ctls()
63 return -ENOMEM; in create_beep_ctls()
64 kctl->private_value = spec->beep_amp; in create_beep_ctls()
65 err = snd_hda_ctl_add(codec, 0, kctl); in create_beep_ctls()
66 if (err < 0) in create_beep_ctls()
69 return 0; in create_beep_ctls()
72 #define create_beep_ctls(codec) 0 argument
75 static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front, in ad198x_power_eapd_write() argument
78 if (snd_hda_query_pin_caps(codec, front) & AC_PINCAP_EAPD) in ad198x_power_eapd_write()
79 snd_hda_codec_write(codec, front, 0, AC_VERB_SET_EAPD_BTLENABLE, in ad198x_power_eapd_write()
80 !codec->inv_eapd ? 0x00 : 0x02); in ad198x_power_eapd_write()
81 if (snd_hda_query_pin_caps(codec, hp) & AC_PINCAP_EAPD) in ad198x_power_eapd_write()
82 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_EAPD_BTLENABLE, in ad198x_power_eapd_write()
83 !codec->inv_eapd ? 0x00 : 0x02); in ad198x_power_eapd_write()
86 static void ad198x_power_eapd(struct hda_codec *codec) in ad198x_power_eapd() argument
89 switch (codec->core.vendor_id) { in ad198x_power_eapd()
90 case 0x11d41882: in ad198x_power_eapd()
91 case 0x11d4882a: in ad198x_power_eapd()
92 case 0x11d41884: in ad198x_power_eapd()
93 case 0x11d41984: in ad198x_power_eapd()
94 case 0x11d41883: in ad198x_power_eapd()
95 case 0x11d4184a: in ad198x_power_eapd()
96 case 0x11d4194a: in ad198x_power_eapd()
97 case 0x11d4194b: in ad198x_power_eapd()
98 case 0x11d41988: in ad198x_power_eapd()
99 case 0x11d4198b: in ad198x_power_eapd()
100 case 0x11d4989a: in ad198x_power_eapd()
101 case 0x11d4989b: in ad198x_power_eapd()
102 ad198x_power_eapd_write(codec, 0x12, 0x11); in ad198x_power_eapd()
104 case 0x11d41981: in ad198x_power_eapd()
105 case 0x11d41983: in ad198x_power_eapd()
106 ad198x_power_eapd_write(codec, 0x05, 0x06); in ad198x_power_eapd()
108 case 0x11d41986: in ad198x_power_eapd()
109 ad198x_power_eapd_write(codec, 0x1b, 0x1a); in ad198x_power_eapd()
114 static int ad198x_suspend(struct hda_codec *codec) in ad198x_suspend() argument
116 snd_hda_shutup_pins(codec); in ad198x_suspend()
117 ad198x_power_eapd(codec); in ad198x_suspend()
118 return 0; in ad198x_suspend()
124 struct hda_codec *codec = private_data; in ad_vmaster_eapd_hook() local
125 struct ad198x_spec *spec = codec->spec; in ad_vmaster_eapd_hook()
127 if (!spec->eapd_nid) in ad_vmaster_eapd_hook()
129 if (codec->inv_eapd) in ad_vmaster_eapd_hook()
131 snd_hda_codec_write_cache(codec, spec->eapd_nid, 0, in ad_vmaster_eapd_hook()
133 enabled ? 0x02 : 0x00); in ad_vmaster_eapd_hook()
140 static int ad198x_auto_build_controls(struct hda_codec *codec) in ad198x_auto_build_controls() argument
144 err = snd_hda_gen_build_controls(codec); in ad198x_auto_build_controls()
145 if (err < 0) in ad198x_auto_build_controls()
147 err = create_beep_ctls(codec); in ad198x_auto_build_controls()
148 if (err < 0) in ad198x_auto_build_controls()
150 return 0; in ad198x_auto_build_controls()
164 static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp) in ad198x_parse_auto_config() argument
166 struct ad198x_spec *spec = codec->spec; in ad198x_parse_auto_config()
167 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in ad198x_parse_auto_config()
170 codec->spdif_status_reset = 1; in ad198x_parse_auto_config()
171 codec->no_trigger_sense = 1; in ad198x_parse_auto_config()
172 codec->no_sticky_stream = 1; in ad198x_parse_auto_config()
174 spec->gen.indep_hp = indep_hp; in ad198x_parse_auto_config()
175 if (!spec->gen.add_stereo_mix_input) in ad198x_parse_auto_config()
176 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; in ad198x_parse_auto_config()
178 err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0); in ad198x_parse_auto_config()
179 if (err < 0) in ad198x_parse_auto_config()
181 err = snd_hda_gen_parse_auto_config(codec, cfg); in ad198x_parse_auto_config()
182 if (err < 0) in ad198x_parse_auto_config()
185 return 0; in ad198x_parse_auto_config()
192 static int alloc_ad_spec(struct hda_codec *codec) in alloc_ad_spec() argument
198 return -ENOMEM; in alloc_ad_spec()
199 codec->spec = spec; in alloc_ad_spec()
200 snd_hda_gen_spec_init(&spec->gen); in alloc_ad_spec()
201 codec->patch_ops = ad198x_auto_patch_ops; in alloc_ad_spec()
202 return 0; in alloc_ad_spec()
209 /* Lenovo N100 seems to report the reversed bit for HP jack-sensing */
210 static void ad_fixup_inv_jack_detect(struct hda_codec *codec, in ad_fixup_inv_jack_detect() argument
213 struct ad198x_spec *spec = codec->spec; in ad_fixup_inv_jack_detect()
216 codec->inv_jack_detect = 1; in ad_fixup_inv_jack_detect()
217 spec->gen.keep_eapd_on = 1; in ad_fixup_inv_jack_detect()
218 spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook; in ad_fixup_inv_jack_detect()
219 spec->eapd_nid = 0x1b; in ad_fixup_inv_jack_detect()
224 static void ad1986a_fixup_eapd(struct hda_codec *codec, in ad1986a_fixup_eapd() argument
227 struct ad198x_spec *spec = codec->spec; in ad1986a_fixup_eapd()
230 codec->inv_eapd = 0; in ad1986a_fixup_eapd()
231 spec->gen.keep_eapd_on = 1; in ad1986a_fixup_eapd()
232 spec->eapd_nid = 0x1b; in ad1986a_fixup_eapd()
236 /* enable stereo-mix input for avoiding regression on KDE (bko#88251) */
237 static void ad1986a_fixup_eapd_mix_in(struct hda_codec *codec, in ad1986a_fixup_eapd_mix_in() argument
240 struct ad198x_spec *spec = codec->spec; in ad1986a_fixup_eapd_mix_in()
243 ad1986a_fixup_eapd(codec, fix, action); in ad1986a_fixup_eapd_mix_in()
244 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_ENABLE; in ad1986a_fixup_eapd_mix_in()
268 { 0x1b, 0x90170110 }, /* speaker */
269 { 0x1d, 0x90a7013e }, /* int mic */
276 { 0x1b, 0x90170110 }, /* speaker */
277 { 0x1d, 0x90a7013e }, /* int mic */
278 { 0x20, 0x411111f0 }, /* N/A */
279 { 0x24, 0x411111f0 }, /* N/A */
286 { 0x1a, 0x02214021 }, /* headphone */
287 { 0x1b, 0x01014011 }, /* front */
288 { 0x1c, 0x01813030 }, /* line-in */
289 { 0x1d, 0x01a19020 }, /* rear mic */
290 { 0x1e, 0x411111f0 }, /* N/A */
291 { 0x1f, 0x02a190f0 }, /* mic */
292 { 0x20, 0x411111f0 }, /* N/A */
299 { 0x1a, 0x02214021 }, /* headphone */
300 { 0x1b, 0x90170110 }, /* speaker */
301 { 0x1c, 0x411111f0 }, /* N/A */
302 { 0x1d, 0x411111f0 }, /* N/A */
303 { 0x1e, 0x411111f0 }, /* N/A */
304 { 0x1f, 0x02a191f0 }, /* mic */
305 { 0x20, 0x411111f0 }, /* N/A */
312 { 0x1d, 0x90a7013e }, /* int mic */
329 { 0x1a, 0x0421402f }, /* headphone */
330 { 0x1b, 0x90170110 }, /* speaker */
331 { 0x1c, 0x411111f0 }, /* N/A */
332 { 0x1d, 0x90a70130 }, /* int mic */
333 { 0x1e, 0x411111f0 }, /* N/A */
334 { 0x1f, 0x04a19040 }, /* mic */
335 { 0x20, 0x411111f0 }, /* N/A */
336 { 0x21, 0x411111f0 }, /* N/A */
337 { 0x22, 0x411111f0 }, /* N/A */
338 { 0x23, 0x411111f0 }, /* N/A */
339 { 0x24, 0x411111f0 }, /* N/A */
340 { 0x25, 0x411111f0 }, /* N/A */
349 SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC),
350 SND_PCI_QUIRK(0x1043, 0x1153, "ASUS M9V", AD1986A_FIXUP_LAPTOP_IMIC),
351 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS Z99He", AD1986A_FIXUP_EAPD),
352 SND_PCI_QUIRK(0x1043, 0x1447, "ASUS A8JN", AD1986A_FIXUP_EAPD),
353 SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK),
354 SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK),
355 SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK),
356 SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba Satellite L40", AD1986A_FIXUP_EAPD),
357 SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_FIXUP_LAPTOP),
358 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_FIXUP_SAMSUNG),
359 SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_FIXUP_ULTRA),
360 SND_PCI_QUIRK(0x1631, 0xc022, "PackardBell EasyNote MX65", AD1986A_FIXUP_EASYNOTE),
361 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo N100", AD1986A_FIXUP_INV_JACK_DETECT),
362 SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_FIXUP_3STACK),
363 SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_FIXUP_3STACK),
370 { .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-imic" },
371 { .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-eapd" }, /* alias */
378 static int patch_ad1986a(struct hda_codec *codec) in patch_ad1986a() argument
383 0x1a, 0x03, in patch_ad1986a()
384 0x1b, 0x03, in patch_ad1986a()
385 0x1c, 0x04, in patch_ad1986a()
386 0x1d, 0x05, in patch_ad1986a()
387 0x1e, 0x03, in patch_ad1986a()
388 0 in patch_ad1986a()
391 err = alloc_ad_spec(codec); in patch_ad1986a()
392 if (err < 0) in patch_ad1986a()
394 spec = codec->spec; in patch_ad1986a()
397 codec->inv_eapd = 1; in patch_ad1986a()
399 spec->gen.mixer_nid = 0x07; in patch_ad1986a()
400 spec->gen.beep_nid = 0x19; in patch_ad1986a()
401 set_beep_amp(spec, 0x18, 0, HDA_OUTPUT); in patch_ad1986a()
409 spec->gen.multiout.no_share_stream = 1; in patch_ad1986a()
411 spec->gen.preferred_dacs = preferred_pairs; in patch_ad1986a()
414 spec->gen.auto_mute_via_amp = 1; in patch_ad1986a()
416 snd_hda_pick_fixup(codec, ad1986a_fixup_models, ad1986a_fixup_tbl, in patch_ad1986a()
418 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1986a()
420 err = ad198x_parse_auto_config(codec, false); in patch_ad1986a()
421 if (err < 0) { in patch_ad1986a()
422 snd_hda_gen_free(codec); in patch_ad1986a()
426 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1986a()
428 return 0; in patch_ad1986a()
437 * SPDIF mux control for AD1983 auto-parser
442 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_info() local
443 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_info()
446 int num_conns = spec->num_smux_conns; in ad1983_auto_smux_enum_info()
453 return -EINVAL; in ad1983_auto_smux_enum_info()
459 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_get() local
460 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_get()
462 ucontrol->value.enumerated.item[0] = spec->cur_smux; in ad1983_auto_smux_enum_get()
463 return 0; in ad1983_auto_smux_enum_get()
469 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_put() local
470 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_put()
471 unsigned int val = ucontrol->value.enumerated.item[0]; in ad1983_auto_smux_enum_put()
472 hda_nid_t dig_out = spec->gen.multiout.dig_out_nid; in ad1983_auto_smux_enum_put()
473 int num_conns = spec->num_smux_conns; in ad1983_auto_smux_enum_put()
476 return -EINVAL; in ad1983_auto_smux_enum_put()
477 if (spec->cur_smux == val) in ad1983_auto_smux_enum_put()
478 return 0; in ad1983_auto_smux_enum_put()
479 spec->cur_smux = val; in ad1983_auto_smux_enum_put()
480 snd_hda_codec_write_cache(codec, dig_out, 0, in ad1983_auto_smux_enum_put()
493 static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec) in ad1983_add_spdif_mux_ctl() argument
495 struct ad198x_spec *spec = codec->spec; in ad1983_add_spdif_mux_ctl()
496 hda_nid_t dig_out = spec->gen.multiout.dig_out_nid; in ad1983_add_spdif_mux_ctl()
500 return 0; in ad1983_add_spdif_mux_ctl()
501 num_conns = snd_hda_get_num_conns(codec, dig_out); in ad1983_add_spdif_mux_ctl()
503 return 0; in ad1983_add_spdif_mux_ctl()
504 spec->num_smux_conns = num_conns; in ad1983_add_spdif_mux_ctl()
505 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &ad1983_auto_smux_mixer)) in ad1983_add_spdif_mux_ctl()
506 return -ENOMEM; in ad1983_add_spdif_mux_ctl()
507 return 0; in ad1983_add_spdif_mux_ctl()
510 static int patch_ad1983(struct hda_codec *codec) in patch_ad1983() argument
512 static const hda_nid_t conn_0c[] = { 0x08 }; in patch_ad1983()
513 static const hda_nid_t conn_0d[] = { 0x09 }; in patch_ad1983()
517 err = alloc_ad_spec(codec); in patch_ad1983()
518 if (err < 0) in patch_ad1983()
520 spec = codec->spec; in patch_ad1983()
522 spec->gen.mixer_nid = 0x0e; in patch_ad1983()
523 spec->gen.beep_nid = 0x10; in patch_ad1983()
524 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); in patch_ad1983()
527 snd_hda_override_conn_list(codec, 0x0c, ARRAY_SIZE(conn_0c), conn_0c); in patch_ad1983()
528 snd_hda_override_conn_list(codec, 0x0d, ARRAY_SIZE(conn_0d), conn_0d); in patch_ad1983()
530 err = ad198x_parse_auto_config(codec, false); in patch_ad1983()
531 if (err < 0) in patch_ad1983()
533 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1983()
534 if (err < 0) in patch_ad1983()
536 return 0; in patch_ad1983()
539 snd_hda_gen_free(codec); in patch_ad1983()
548 static void ad1981_fixup_hp_eapd(struct hda_codec *codec, in ad1981_fixup_hp_eapd() argument
551 struct ad198x_spec *spec = codec->spec; in ad1981_fixup_hp_eapd()
554 spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook; in ad1981_fixup_hp_eapd()
555 spec->eapd_nid = 0x05; in ad1981_fixup_hp_eapd()
559 /* set the upper-limit for mixer amp to 0dB for avoiding the possible
562 static void ad1981_fixup_amp_override(struct hda_codec *codec, in ad1981_fixup_amp_override() argument
566 snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT, in ad1981_fixup_amp_override()
567 (0x17 << AC_AMPCAP_OFFSET_SHIFT) | in ad1981_fixup_amp_override()
568 (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | in ad1981_fixup_amp_override()
569 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | in ad1981_fixup_amp_override()
592 SND_PCI_QUIRK_VENDOR(0x1014, "Lenovo", AD1981_FIXUP_AMP_OVERRIDE),
593 SND_PCI_QUIRK_VENDOR(0x103c, "HP", AD1981_FIXUP_HP_EAPD),
594 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", AD1981_FIXUP_AMP_OVERRIDE),
596 SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_FIXUP_HP_EAPD),
600 static int patch_ad1981(struct hda_codec *codec) in patch_ad1981() argument
605 err = alloc_ad_spec(codec); in patch_ad1981()
606 if (err < 0) in patch_ad1981()
607 return -ENOMEM; in patch_ad1981()
608 spec = codec->spec; in patch_ad1981()
610 spec->gen.mixer_nid = 0x0e; in patch_ad1981()
611 spec->gen.beep_nid = 0x10; in patch_ad1981()
612 set_beep_amp(spec, 0x0d, 0, HDA_OUTPUT); in patch_ad1981()
614 snd_hda_pick_fixup(codec, NULL, ad1981_fixup_tbl, ad1981_fixups); in patch_ad1981()
615 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1981()
617 err = ad198x_parse_auto_config(codec, false); in patch_ad1981()
618 if (err < 0) in patch_ad1981()
620 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1981()
621 if (err < 0) in patch_ad1981()
624 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1981()
626 return 0; in patch_ad1981()
629 snd_hda_gen_free(codec); in patch_ad1981()
640 * port-A 0x11 (mute/hp) <- 0x22 <- 0x37 <- 03/04/06
641 * port-B 0x14 (mute/hp) <- 0x2b <- 0x30 <- 03/04/06
642 * port-C 0x15 (mute) <- 0x2c <- 0x31 <- 05/0a
643 * port-D 0x12 (mute/hp) <- 0x29 <- 04
644 * port-E 0x17 (mute/hp) <- 0x26 <- 0x32 <- 05/0a
645 * port-F 0x16 (mute) <- 0x2a <- 06
646 * port-G 0x24 (mute) <- 0x27 <- 05
647 * port-H 0x25 (mute) <- 0x28 <- 0a
648 * mono 0x13 (mute/amp)<- 0x1e <- 0x36 <- 03/04/06
650 * DAC0 = 03h, DAC1 = 04h, DAC2 = 05h, DAC3 = 06h, DAC4 = 0ah
656 * port-A 0x11 -> 0x38 -> mix 2, ADC 0
657 * port-B 0x14 -> 0x39 -> mix 0, ADC 1
658 * port-C 0x15 -> 0x3a -> 33:0 - mix 1, ADC 2
659 * port-D 0x12 -> 0x3d -> mix 3, ADC 8
660 * port-E 0x17 -> 0x3c -> 34:0 - mix 4, ADC 4
661 * port-F 0x16 -> 0x3b -> mix 5, ADC 3
662 * port-G 0x24 -> N/A -> 33:1 - mix 1, 34:1 - mix 4, ADC 6
663 * port-H 0x25 -> N/A -> 33:2 - mix 1, 34:2 - mix 4, ADC 7
667 * 6stack - front/surr/CLFE/side/opt DACs - 04/06/05/0a/03
668 * 3stack - front/surr/CLFE/opt DACs - 04/05/0a/03
670 * Inputs of Analog Mix (0x20)
671 * 0:Port-B (front mic)
672 * 1:Port-C/G/H (line-in)
673 * 2:Port-A
674 * 3:Port-D (line-in/2)
675 * 4:Port-E/G/H (mic-in)
676 * 5:Port-F (mic2-in)
681 * 0:Port-A
682 * 1:Port-B (front mic-in)
683 * 2:Port-C (line-in)
684 * 3:Port-F (mic2-in)
685 * 4:Port-E (mic-in)
687 * 6:Port-G
688 * 7:Port-H
689 * 8:Port-D (line-in/2)
694 * 6-stack
695 * Port-A front headphone
696 * B front mic-in
697 * C rear line-in
698 * D rear front-out
699 * E rear mic-in
704 * 3-stack
705 * Port-A front headphone
707 * C rear line-in/surround
708 * D rear front-out
709 * E rear mic-in/CLFE
712 * Port-A headphone
713 * B mic-in
722 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_info() local
723 struct ad198x_spec *spec = codec->spec; in ad1988_auto_smux_enum_info()
727 int num_conns = spec->num_smux_conns; in ad1988_auto_smux_enum_info()
737 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_get() local
738 struct ad198x_spec *spec = codec->spec; in ad1988_auto_smux_enum_get()
740 ucontrol->value.enumerated.item[0] = spec->cur_smux; in ad1988_auto_smux_enum_get()
741 return 0; in ad1988_auto_smux_enum_get()
747 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_put() local
748 struct ad198x_spec *spec = codec->spec; in ad1988_auto_smux_enum_put()
749 unsigned int val = ucontrol->value.enumerated.item[0]; in ad1988_auto_smux_enum_put()
751 int num_conns = spec->num_smux_conns; in ad1988_auto_smux_enum_put()
754 return -EINVAL; in ad1988_auto_smux_enum_put()
755 if (spec->cur_smux == val) in ad1988_auto_smux_enum_put()
756 return 0; in ad1988_auto_smux_enum_put()
758 mutex_lock(&codec->control_mutex); in ad1988_auto_smux_enum_put()
759 path = snd_hda_get_path_from_idx(codec, in ad1988_auto_smux_enum_put()
760 spec->smux_paths[spec->cur_smux]); in ad1988_auto_smux_enum_put()
762 snd_hda_activate_path(codec, path, false, true); in ad1988_auto_smux_enum_put()
763 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[val]); in ad1988_auto_smux_enum_put()
765 snd_hda_activate_path(codec, path, true, true); in ad1988_auto_smux_enum_put()
766 spec->cur_smux = val; in ad1988_auto_smux_enum_put()
767 mutex_unlock(&codec->control_mutex); in ad1988_auto_smux_enum_put()
779 static int ad1988_auto_init(struct hda_codec *codec) in ad1988_auto_init() argument
781 struct ad198x_spec *spec = codec->spec; in ad1988_auto_init()
784 err = snd_hda_gen_init(codec); in ad1988_auto_init()
785 if (err < 0) in ad1988_auto_init()
787 if (!spec->gen.autocfg.dig_outs) in ad1988_auto_init()
788 return 0; in ad1988_auto_init()
790 for (i = 0; i < 4; i++) { in ad1988_auto_init()
792 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[i]); in ad1988_auto_init()
794 snd_hda_activate_path(codec, path, path->active, false); in ad1988_auto_init()
797 return 0; in ad1988_auto_init()
800 static int ad1988_add_spdif_mux_ctl(struct hda_codec *codec) in ad1988_add_spdif_mux_ctl() argument
802 struct ad198x_spec *spec = codec->spec; in ad1988_add_spdif_mux_ctl()
810 .path = { 0x02, 0x1d, 0x1b }, in ad1988_add_spdif_mux_ctl()
811 .idx = { 0, 0, 0 }, in ad1988_add_spdif_mux_ctl()
812 .multi = { 0, 0, 0 }, in ad1988_add_spdif_mux_ctl()
816 .path = { 0x08, 0x0b, 0x1d, 0x1b }, in ad1988_add_spdif_mux_ctl()
817 .idx = { 0, 0, 1, 0 }, in ad1988_add_spdif_mux_ctl()
818 .multi = { 0, 1, 0, 0 }, in ad1988_add_spdif_mux_ctl()
822 .path = { 0x09, 0x0b, 0x1d, 0x1b }, in ad1988_add_spdif_mux_ctl()
823 .idx = { 0, 1, 1, 0 }, in ad1988_add_spdif_mux_ctl()
824 .multi = { 0, 1, 0, 0 }, in ad1988_add_spdif_mux_ctl()
828 .path = { 0x0f, 0x0b, 0x1d, 0x1b }, in ad1988_add_spdif_mux_ctl()
829 .idx = { 0, 2, 1, 0 }, in ad1988_add_spdif_mux_ctl()
830 .multi = { 0, 1, 0, 0 }, in ad1988_add_spdif_mux_ctl()
835 if (!spec->gen.autocfg.dig_outs || in ad1988_add_spdif_mux_ctl()
836 get_wcaps_type(get_wcaps(codec, 0x1d)) != AC_WID_AUD_MIX) in ad1988_add_spdif_mux_ctl()
837 return 0; in ad1988_add_spdif_mux_ctl()
839 num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1; in ad1988_add_spdif_mux_ctl()
841 return 0; in ad1988_add_spdif_mux_ctl()
842 spec->num_smux_conns = num_conns; in ad1988_add_spdif_mux_ctl()
844 for (i = 0; i < num_conns; i++) { in ad1988_add_spdif_mux_ctl()
845 struct nid_path *path = snd_array_new(&spec->gen.paths); in ad1988_add_spdif_mux_ctl()
847 return -ENOMEM; in ad1988_add_spdif_mux_ctl()
850 path->active = 1; in ad1988_add_spdif_mux_ctl()
851 spec->smux_paths[i] = snd_hda_get_path_idx(codec, path); in ad1988_add_spdif_mux_ctl()
854 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &ad1988_auto_smux_mixer)) in ad1988_add_spdif_mux_ctl()
855 return -ENOMEM; in ad1988_add_spdif_mux_ctl()
857 codec->patch_ops.init = ad1988_auto_init; in ad1988_add_spdif_mux_ctl()
859 return 0; in ad1988_add_spdif_mux_ctl()
873 { 0x11, 0x02214130 }, /* front-hp */
874 { 0x12, 0x01014010 }, /* line-out */
875 { 0x14, 0x02a19122 }, /* front-mic */
876 { 0x15, 0x01813021 }, /* line-in */
877 { 0x16, 0x01011012 }, /* line-out */
878 { 0x17, 0x01a19020 }, /* mic */
879 { 0x1b, 0x0145f1f0 }, /* SPDIF */
880 { 0x24, 0x01016011 }, /* line-out */
881 { 0x25, 0x01012013 }, /* line-out */
888 { .id = AD1988_FIXUP_6STACK_DIG, .name = "6stack-dig" },
892 static int patch_ad1988(struct hda_codec *codec) in patch_ad1988() argument
897 err = alloc_ad_spec(codec); in patch_ad1988()
898 if (err < 0) in patch_ad1988()
900 spec = codec->spec; in patch_ad1988()
902 spec->gen.mixer_nid = 0x20; in patch_ad1988()
903 spec->gen.mixer_merge_nid = 0x21; in patch_ad1988()
904 spec->gen.beep_nid = 0x10; in patch_ad1988()
905 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); in patch_ad1988()
907 snd_hda_pick_fixup(codec, ad1988_fixup_models, NULL, ad1988_fixups); in patch_ad1988()
908 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1988()
910 err = ad198x_parse_auto_config(codec, true); in patch_ad1988()
911 if (err < 0) in patch_ad1988()
913 err = ad1988_add_spdif_mux_ctl(codec); in patch_ad1988()
914 if (err < 0) in patch_ad1988()
917 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1988()
919 return 0; in patch_ad1988()
922 snd_hda_gen_free(codec); in patch_ad1988()
930 * port-B - front line/mic-in
931 * port-E - aux in/out
932 * port-F - aux in/out
933 * port-C - rear line/mic-in
934 * port-D - rear line/hp-out
935 * port-A - front line/hp-out
937 * AD1984 = AD1884 + two digital mic-ins
941 * port-B (0x14) - front mic-in
942 * port-E (0x1c) - rear mic-in
943 * port-F (0x16) - CD / ext out
944 * port-C (0x15) - rear line-in
945 * port-D (0x12) - rear line-out
946 * port-A (0x11) - front hp-out
948 * AD1984A = AD1884A + digital-mic
950 * AD1984B = AD1984A + extra SPDIF-out
953 /* set the upper-limit for mixer amp to 0dB for avoiding the possible
956 static void ad1884_fixup_amp_override(struct hda_codec *codec, in ad1884_fixup_amp_override() argument
960 snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT, in ad1884_fixup_amp_override()
961 (0x17 << AC_AMPCAP_OFFSET_SHIFT) | in ad1884_fixup_amp_override()
962 (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | in ad1884_fixup_amp_override()
963 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | in ad1884_fixup_amp_override()
970 struct hda_codec *codec = private_data; in ad1884_vmaster_hp_gpio_hook() local
971 struct ad198x_spec *spec = codec->spec; in ad1884_vmaster_hp_gpio_hook()
973 if (spec->eapd_nid) in ad1884_vmaster_hp_gpio_hook()
975 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_vmaster_hp_gpio_hook()
977 enabled ? 0x00 : 0x02); in ad1884_vmaster_hp_gpio_hook()
980 static void ad1884_fixup_hp_eapd(struct hda_codec *codec, in ad1884_fixup_hp_eapd() argument
983 struct ad198x_spec *spec = codec->spec; in ad1884_fixup_hp_eapd()
987 spec->gen.vmaster_mute.hook = ad1884_vmaster_hp_gpio_hook; in ad1884_fixup_hp_eapd()
988 spec->gen.own_eapd_ctl = 1; in ad1884_fixup_hp_eapd()
989 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
990 AC_VERB_SET_GPIO_MASK, 0x02); in ad1884_fixup_hp_eapd()
991 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
992 AC_VERB_SET_GPIO_DIRECTION, 0x02); in ad1884_fixup_hp_eapd()
993 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
994 AC_VERB_SET_GPIO_DATA, 0x02); in ad1884_fixup_hp_eapd()
997 if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) in ad1884_fixup_hp_eapd()
998 spec->eapd_nid = spec->gen.autocfg.line_out_pins[0]; in ad1884_fixup_hp_eapd()
1000 spec->eapd_nid = spec->gen.autocfg.speaker_pins[0]; in ad1884_fixup_hp_eapd()
1005 static void ad1884_fixup_thinkpad(struct hda_codec *codec, in ad1884_fixup_thinkpad() argument
1008 struct ad198x_spec *spec = codec->spec; in ad1884_fixup_thinkpad()
1011 spec->gen.keep_eapd_on = 1; in ad1884_fixup_thinkpad()
1012 spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook; in ad1884_fixup_thinkpad()
1013 spec->eapd_nid = 0x12; in ad1884_fixup_thinkpad()
1014 /* Analog PC Beeper - allow firmware/ACPI beeps */ in ad1884_fixup_thinkpad()
1015 spec->beep_amp = HDA_COMPOSE_AMP_VAL(0x20, 3, 3, HDA_INPUT); in ad1884_fixup_thinkpad()
1016 spec->gen.beep_nid = 0; /* no digital beep */ in ad1884_fixup_thinkpad()
1022 {0x01, AC_VERB_SET_COEF_INDEX, 0x13f7},
1023 {0x01, AC_VERB_SET_PROC_COEF, 0x08},
1065 SND_PCI_QUIRK(0x103c, 0x2a82, "HP Touchsmart", AD1884_FIXUP_HP_TOUCHSMART),
1066 SND_PCI_QUIRK_VENDOR(0x103c, "HP", AD1884_FIXUP_HP_EAPD),
1067 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1884_FIXUP_THINKPAD),
1072 static int patch_ad1884(struct hda_codec *codec) in patch_ad1884() argument
1077 err = alloc_ad_spec(codec); in patch_ad1884()
1078 if (err < 0) in patch_ad1884()
1080 spec = codec->spec; in patch_ad1884()
1082 spec->gen.mixer_nid = 0x20; in patch_ad1884()
1083 spec->gen.mixer_merge_nid = 0x21; in patch_ad1884()
1084 spec->gen.beep_nid = 0x10; in patch_ad1884()
1085 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); in patch_ad1884()
1087 snd_hda_pick_fixup(codec, NULL, ad1884_fixup_tbl, ad1884_fixups); in patch_ad1884()
1088 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1884()
1090 err = ad198x_parse_auto_config(codec, true); in patch_ad1884()
1091 if (err < 0) in patch_ad1884()
1093 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1884()
1094 if (err < 0) in patch_ad1884()
1097 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1884()
1099 return 0; in patch_ad1884()
1102 snd_hda_gen_free(codec); in patch_ad1884()
1109 * port-A - front hp-out
1110 * port-B - front mic-in
1111 * port-C - rear line-in, shared surr-out (3stack)
1112 * port-D - rear line-out
1113 * port-E - rear mic-in, shared clfe-out (3stack)
1114 * port-F - rear surr-out (6stack)
1115 * port-G - rear clfe-out (6stack)
1118 static int patch_ad1882(struct hda_codec *codec) in patch_ad1882() argument
1123 err = alloc_ad_spec(codec); in patch_ad1882()
1124 if (err < 0) in patch_ad1882()
1126 spec = codec->spec; in patch_ad1882()
1128 spec->gen.mixer_nid = 0x20; in patch_ad1882()
1129 spec->gen.mixer_merge_nid = 0x21; in patch_ad1882()
1130 spec->gen.beep_nid = 0x10; in patch_ad1882()
1131 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); in patch_ad1882()
1132 err = ad198x_parse_auto_config(codec, true); in patch_ad1882()
1133 if (err < 0) in patch_ad1882()
1135 err = ad1988_add_spdif_mux_ctl(codec); in patch_ad1882()
1136 if (err < 0) in patch_ad1882()
1138 return 0; in patch_ad1882()
1141 snd_hda_gen_free(codec); in patch_ad1882()
1150 HDA_CODEC_ENTRY(0x11d4184a, "AD1884A", patch_ad1884),
1151 HDA_CODEC_ENTRY(0x11d41882, "AD1882", patch_ad1882),
1152 HDA_CODEC_ENTRY(0x11d41883, "AD1883", patch_ad1884),
1153 HDA_CODEC_ENTRY(0x11d41884, "AD1884", patch_ad1884),
1154 HDA_CODEC_ENTRY(0x11d4194a, "AD1984A", patch_ad1884),
1155 HDA_CODEC_ENTRY(0x11d4194b, "AD1984B", patch_ad1884),
1156 HDA_CODEC_ENTRY(0x11d41981, "AD1981", patch_ad1981),
1157 HDA_CODEC_ENTRY(0x11d41983, "AD1983", patch_ad1983),
1158 HDA_CODEC_ENTRY(0x11d41984, "AD1984", patch_ad1884),
1159 HDA_CODEC_ENTRY(0x11d41986, "AD1986A", patch_ad1986a),
1160 HDA_CODEC_ENTRY(0x11d41988, "AD1988", patch_ad1988),
1161 HDA_CODEC_ENTRY(0x11d4198b, "AD1988B", patch_ad1988),
1162 HDA_CODEC_ENTRY(0x11d4882a, "AD1882A", patch_ad1882),
1163 HDA_CODEC_ENTRY(0x11d4989a, "AD1989A", patch_ad1988),
1164 HDA_CODEC_ENTRY(0x11d4989b, "AD1989B", patch_ad1988),
1170 MODULE_DESCRIPTION("Analog Devices HD-audio codec");