Lines Matching +full:gpio1 +full:- +full:cfg

1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright (c) 2005-2007 Takashi Iwai <tiwai@suse.de>
44 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir)) /* mono */
52 struct ad198x_spec *spec = codec->spec; in create_beep_ctls()
55 if (!spec->beep_amp) in create_beep_ctls()
58 for (knew = ad_beep_mixer ; knew->name; knew++) { in create_beep_ctls()
63 return -ENOMEM; in create_beep_ctls()
64 kctl->private_value = spec->beep_amp; in create_beep_ctls()
80 !codec->inv_eapd ? 0x00 : 0x02); in ad198x_power_eapd_write()
83 !codec->inv_eapd ? 0x00 : 0x02); in ad198x_power_eapd_write()
89 switch (codec->core.vendor_id) { in ad198x_power_eapd()
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()
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() local
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()
181 err = snd_hda_gen_parse_auto_config(codec, cfg); in ad198x_parse_auto_config()
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()
209 /* Lenovo N100 seems to report the reversed bit for HP jack-sensing */
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()
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) */
240 struct ad198x_spec *spec = codec->spec; in ad1986a_fixup_eapd_mix_in()
244 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_ENABLE; in ad1986a_fixup_eapd_mix_in()
288 { 0x1c, 0x01813030 }, /* line-in */
355 SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK),
370 { .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-imic" },
371 { .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-eapd" }, /* alias */
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()
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()
437 * SPDIF mux control for AD1983 auto-parser
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()
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()
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()
479 spec->cur_smux = val; in ad1983_auto_smux_enum_put()
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()
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()
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()
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
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()
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
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
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
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()
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()
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()
758 mutex_lock(&codec->control_mutex); in ad1988_auto_smux_enum_put()
760 spec->smux_paths[spec->cur_smux]); 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()
766 spec->cur_smux = val; in ad1988_auto_smux_enum_put()
767 mutex_unlock(&codec->control_mutex); in ad1988_auto_smux_enum_put()
781 struct ad198x_spec *spec = codec->spec; in ad1988_auto_init()
787 if (!spec->gen.autocfg.dig_outs) 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()
802 struct ad198x_spec *spec = codec->spec; in ad1988_add_spdif_mux_ctl()
835 if (!spec->gen.autocfg.dig_outs || in ad1988_add_spdif_mux_ctl()
842 spec->num_smux_conns = num_conns; 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()
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 */
880 { 0x24, 0x01016011 }, /* line-out */
881 { 0x25, 0x01012013 }, /* line-out */
888 { .id = AD1988_FIXUP_6STACK_DIG, .name = "6stack-dig" },
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()
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
967 /* toggle GPIO1 according to the mute state */
971 struct ad198x_spec *spec = codec->spec; in ad1884_vmaster_hp_gpio_hook()
973 if (spec->eapd_nid) in ad1884_vmaster_hp_gpio_hook()
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()
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()
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()
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()
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)
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()
1170 MODULE_DESCRIPTION("Analog Devices HD-audio codec");