Lines Matching +full:mic +full:- +full:int
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright (c) 2005-2007 Takashi Iwai <tiwai@suse.de>
32 int model;
35 int smux_paths[4];
36 unsigned int cur_smux;
39 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
40 int num_smux_conns;
53 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir)) /* mono */
59 static int create_beep_ctls(struct hda_codec *codec)
61 struct ad198x_spec *spec = codec->spec;
64 if (!spec->beep_amp)
67 for (knew = ad_beep_mixer ; knew->name; knew++) {
68 int err;
72 return -ENOMEM;
73 kctl->private_value = spec->beep_amp;
89 !codec->inv_eapd ? 0x00 : 0x02);
92 !codec->inv_eapd ? 0x00 : 0x02);
98 switch (codec->core.vendor_id) {
123 static int ad_codec_suspend(struct hda_codec *codec)
131 static void ad_vmaster_eapd_hook(void *private_data, int enabled)
134 struct ad198x_spec *spec = codec->spec;
136 if (!spec->eapd_nid)
138 if (codec->inv_eapd)
140 snd_hda_codec_write_cache(codec, spec->eapd_nid, 0,
149 static int ad_codec_build_controls(struct hda_codec *codec)
151 int err;
162 static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp)
164 struct ad198x_spec *spec = codec->spec;
165 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
166 int err;
168 codec->spdif_status_reset = 1;
169 codec->no_trigger_sense = 1;
170 codec->no_sticky_stream = 1;
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;
190 static int alloc_ad_spec(struct hda_codec *codec)
196 return -ENOMEM;
197 codec->spec = spec;
198 snd_hda_gen_spec_init(&spec->gen);
206 /* Lenovo N100 seems to report the reversed bit for HP jack-sensing */
208 const struct hda_fixup *fix, int action)
210 struct ad198x_spec *spec = codec->spec;
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;
222 const struct hda_fixup *fix, int action)
224 struct ad198x_spec *spec = codec->spec;
227 codec->inv_eapd = 0;
228 spec->gen.keep_eapd_on = 1;
229 spec->eapd_nid = 0x1b;
233 /* enable stereo-mix input for avoiding regression on KDE (bko#88251) */
235 const struct hda_fixup *fix, int action)
237 struct ad198x_spec *spec = codec->spec;
241 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_ENABLE;
266 { 0x1d, 0x90a7013e }, /* int mic */
274 { 0x1d, 0x90a7013e }, /* int mic */
285 { 0x1c, 0x01813030 }, /* line-in */
286 { 0x1d, 0x01a19020 }, /* rear mic */
288 { 0x1f, 0x02a190f0 }, /* mic */
301 { 0x1f, 0x02a191f0 }, /* mic */
309 { 0x1d, 0x90a7013e }, /* int mic */
329 { 0x1d, 0x90a70130 }, /* int mic */
331 { 0x1f, 0x04a19040 }, /* mic */
352 SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK),
367 { .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-imic" },
368 { .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-eapd" }, /* alias */
375 static int ad1986a_probe(struct hda_codec *codec)
377 int err;
378 struct ad198x_spec *spec = codec->spec;
389 codec->inv_eapd = 1;
391 spec->gen.mixer_nid = 0x07;
392 spec->gen.beep_nid = 0x19;
401 spec->gen.multiout.no_share_stream = 1;
403 spec->gen.preferred_dacs = preferred_pairs;
406 spec->gen.auto_mute_via_amp = 1;
427 * SPDIF mux control for AD1983 auto-parser
429 static int ad1983_auto_smux_enum_info(struct snd_kcontrol *kcontrol,
433 struct ad198x_spec *spec = codec->spec;
436 int num_conns = spec->num_smux_conns;
443 return -EINVAL;
446 static int ad1983_auto_smux_enum_get(struct snd_kcontrol *kcontrol,
450 struct ad198x_spec *spec = codec->spec;
452 ucontrol->value.enumerated.item[0] = spec->cur_smux;
456 static int ad1983_auto_smux_enum_put(struct snd_kcontrol *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;
466 return -EINVAL;
467 if (spec->cur_smux == val)
469 spec->cur_smux = val;
483 static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec)
485 struct ad198x_spec *spec = codec->spec;
486 hda_nid_t dig_out = spec->gen.multiout.dig_out_nid;
487 int num_conns;
494 spec->num_smux_conns = num_conns;
495 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &ad1983_auto_smux_mixer))
496 return -ENOMEM;
500 static int ad1983_probe(struct hda_codec *codec)
504 struct ad198x_spec *spec = codec->spec;
505 int err;
507 spec->gen.mixer_nid = 0x0e;
508 spec->gen.beep_nid = 0x10;
530 const struct hda_fixup *fix, int action)
532 struct ad198x_spec *spec = codec->spec;
535 spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
536 spec->eapd_nid = 0x05;
540 /* set the upper-limit for mixer amp to 0dB for avoiding the possible
544 const struct hda_fixup *fix, int action)
581 static int ad1981_probe(struct hda_codec *codec)
583 struct ad198x_spec *spec = codec->spec;
584 int err;
586 spec->gen.mixer_nid = 0x0e;
587 spec->gen.beep_nid = 0x10;
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
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
639 * 6stack - front/surr/CLFE/side/opt DACs - 04/06/05/0a/03
640 * 3stack - front/surr/CLFE/opt DACs - 04/05/0a/03
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)
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)
659 * 6:Port-G
660 * 7:Port-H
661 * 8:Port-D (line-in/2)
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
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
684 * Port-A headphone
685 * B mic-in
688 * E/F quad mic array
691 static int ad1988_auto_smux_enum_info(struct snd_kcontrol *kcontrol,
695 struct ad198x_spec *spec = codec->spec;
699 int num_conns = spec->num_smux_conns;
706 static int ad1988_auto_smux_enum_get(struct snd_kcontrol *kcontrol,
710 struct ad198x_spec *spec = codec->spec;
712 ucontrol->value.enumerated.item[0] = spec->cur_smux;
716 static int ad1988_auto_smux_enum_put(struct snd_kcontrol *kcontrol,
720 struct ad198x_spec *spec = codec->spec;
721 unsigned int val = ucontrol->value.enumerated.item[0];
723 int num_conns = spec->num_smux_conns;
726 return -EINVAL;
727 if (spec->cur_smux == val)
730 guard(mutex)(&codec->control_mutex);
732 spec->smux_paths[spec->cur_smux]);
735 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[val]);
738 spec->cur_smux = val;
750 static int ad_codec_init(struct hda_codec *codec)
752 struct ad198x_spec *spec = codec->spec;
753 int i, err;
758 if (spec->model != MODEL_AD1988)
760 if (!spec->gen.autocfg.dig_outs)
765 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[i]);
767 snd_hda_activate_path(codec, path, path->active, false);
773 static int ad1988_add_spdif_mux_ctl(struct hda_codec *codec)
775 struct ad198x_spec *spec = codec->spec;
776 int i, num_conns;
808 if (!spec->gen.autocfg.dig_outs ||
815 spec->num_smux_conns = num_conns;
818 struct nid_path *path = snd_array_new(&spec->gen.paths);
820 return -ENOMEM;
823 path->active = 1;
824 spec->smux_paths[i] = snd_hda_get_path_idx(codec, path);
827 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &ad1988_auto_smux_mixer))
828 return -ENOMEM;
844 { 0x11, 0x02214130 }, /* front-hp */
845 { 0x12, 0x01014010 }, /* line-out */
846 { 0x14, 0x02a19122 }, /* front-mic */
847 { 0x15, 0x01813021 }, /* line-in */
848 { 0x16, 0x01011012 }, /* line-out */
849 { 0x17, 0x01a19020 }, /* mic */
851 { 0x24, 0x01016011 }, /* line-out */
852 { 0x25, 0x01012013 }, /* line-out */
859 { .id = AD1988_FIXUP_6STACK_DIG, .name = "6stack-dig" },
863 static int ad1988_probe(struct hda_codec *codec)
865 struct ad198x_spec *spec = codec->spec;
866 int err;
868 spec->gen.mixer_nid = 0x20;
869 spec->gen.mixer_merge_nid = 0x21;
870 spec->gen.beep_nid = 0x10;
892 * port-B - front line/mic-in
893 * port-E - aux in/out
894 * port-F - aux in/out
895 * port-C - rear line/mic-in
896 * port-D - rear line/hp-out
897 * port-A - front line/hp-out
899 * AD1984 = AD1884 + two digital mic-ins
903 * port-B (0x14) - front mic-in
904 * port-E (0x1c) - rear mic-in
905 * port-F (0x16) - CD / ext out
906 * port-C (0x15) - rear line-in
907 * port-D (0x12) - rear line-out
908 * port-A (0x11) - front hp-out
910 * AD1984A = AD1884A + digital-mic
912 * AD1984B = AD1984A + extra SPDIF-out
915 /* set the upper-limit for mixer amp to 0dB for avoiding the possible
919 const struct hda_fixup *fix, int action)
930 static void ad1884_vmaster_hp_gpio_hook(void *private_data, int enabled)
933 struct ad198x_spec *spec = codec->spec;
935 if (spec->eapd_nid)
943 const struct hda_fixup *fix, int action)
945 struct ad198x_spec *spec = codec->spec;
949 spec->gen.vmaster_mute.hook = ad1884_vmaster_hp_gpio_hook;
950 spec->gen.own_eapd_ctl = 1;
959 if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT)
960 spec->eapd_nid = spec->gen.autocfg.line_out_pins[0];
962 spec->eapd_nid = spec->gen.autocfg.speaker_pins[0];
968 const struct hda_fixup *fix, int action)
970 struct ad198x_spec *spec = codec->spec;
973 spec->gen.keep_eapd_on = 1;
974 spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook;
975 spec->eapd_nid = 0x12;
976 /* Analog PC Beeper - allow firmware/ACPI beeps */
977 spec->beep_amp = HDA_COMPOSE_AMP_VAL(0x20, 3, 3, HDA_INPUT);
978 spec->gen.beep_nid = 0; /* no digital beep */
1034 static int ad1884_probe(struct hda_codec *codec)
1036 struct ad198x_spec *spec = codec->spec;
1037 int err;
1039 spec->gen.mixer_nid = 0x20;
1040 spec->gen.mixer_merge_nid = 0x21;
1041 spec->gen.beep_nid = 0x10;
1062 * port-A - front hp-out
1063 * port-B - front mic-in
1064 * port-C - rear line-in, shared surr-out (3stack)
1065 * port-D - rear line-out
1066 * port-E - rear mic-in, shared clfe-out (3stack)
1067 * port-F - rear surr-out (6stack)
1068 * port-G - rear clfe-out (6stack)
1071 static int ad1882_probe(struct hda_codec *codec)
1073 struct ad198x_spec *spec = codec->spec;
1074 int err;
1076 spec->gen.mixer_nid = 0x20;
1077 spec->gen.mixer_merge_nid = 0x21;
1078 spec->gen.beep_nid = 0x10;
1092 static int ad_codec_probe(struct hda_codec *codec,
1096 int err;
1100 return -ENOMEM;
1101 spec = codec->spec;
1102 spec->model = id->driver_data;
1104 switch (spec->model) {
1124 err = -EINVAL;
1169 MODULE_DESCRIPTION("Analog Devices HD-audio codec");