Lines Matching refs:codec
50 static int create_beep_ctls(struct hda_codec *codec)
52 struct ad198x_spec *spec = codec->spec;
61 kctl = snd_ctl_new1(knew, codec);
65 err = snd_hda_ctl_add(codec, 0, kctl);
72 #define create_beep_ctls(codec) 0
76 static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front,
79 if (snd_hda_query_pin_caps(codec, front) & AC_PINCAP_EAPD)
80 snd_hda_codec_write(codec, front, 0, AC_VERB_SET_EAPD_BTLENABLE,
81 !codec->inv_eapd ? 0x00 : 0x02);
82 if (snd_hda_query_pin_caps(codec, hp) & AC_PINCAP_EAPD)
83 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_EAPD_BTLENABLE,
84 !codec->inv_eapd ? 0x00 : 0x02);
87 static void ad198x_power_eapd(struct hda_codec *codec)
90 switch (codec->core.vendor_id) {
103 ad198x_power_eapd_write(codec, 0x12, 0x11);
107 ad198x_power_eapd_write(codec, 0x05, 0x06);
110 ad198x_power_eapd_write(codec, 0x1b, 0x1a);
115 static void ad198x_shutup(struct hda_codec *codec)
117 snd_hda_shutup_pins(codec);
118 ad198x_power_eapd(codec);
122 static int ad198x_suspend(struct hda_codec *codec)
124 ad198x_shutup(codec);
132 struct hda_codec *codec = private_data;
133 struct ad198x_spec *spec = codec->spec;
137 if (codec->inv_eapd)
139 snd_hda_codec_write_cache(codec, spec->eapd_nid, 0,
148 static int ad198x_auto_build_controls(struct hda_codec *codec)
152 err = snd_hda_gen_build_controls(codec);
155 err = create_beep_ctls(codec);
175 static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp)
177 struct ad198x_spec *spec = codec->spec;
181 codec->spdif_status_reset = 1;
182 codec->no_trigger_sense = 1;
183 codec->no_sticky_stream = 1;
189 err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0);
192 err = snd_hda_gen_parse_auto_config(codec, cfg);
203 static int alloc_ad_spec(struct hda_codec *codec)
210 codec->spec = spec;
212 codec->patch_ops = ad198x_auto_patch_ops;
221 static void ad_fixup_inv_jack_detect(struct hda_codec *codec,
224 struct ad198x_spec *spec = codec->spec;
227 codec->inv_jack_detect = 1;
235 static void ad1986a_fixup_eapd(struct hda_codec *codec,
238 struct ad198x_spec *spec = codec->spec;
241 codec->inv_eapd = 0;
248 static void ad1986a_fixup_eapd_mix_in(struct hda_codec *codec,
251 struct ad198x_spec *spec = codec->spec;
254 ad1986a_fixup_eapd(codec, fix, action);
389 static int patch_ad1986a(struct hda_codec *codec)
402 err = alloc_ad_spec(codec);
405 spec = codec->spec;
408 codec->inv_eapd = 1;
427 snd_hda_pick_fixup(codec, ad1986a_fixup_models, ad1986a_fixup_tbl,
429 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
431 err = ad198x_parse_auto_config(codec, false);
433 snd_hda_gen_free(codec);
437 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
453 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
454 struct ad198x_spec *spec = codec->spec;
470 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
471 struct ad198x_spec *spec = codec->spec;
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
481 struct ad198x_spec *spec = codec->spec;
491 snd_hda_codec_write_cache(codec, dig_out, 0,
504 static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec)
506 struct ad198x_spec *spec = codec->spec;
512 num_conns = snd_hda_get_num_conns(codec, dig_out);
521 static int patch_ad1983(struct hda_codec *codec)
528 err = alloc_ad_spec(codec);
531 spec = codec->spec;
538 snd_hda_override_conn_list(codec, 0x0c, ARRAY_SIZE(conn_0c), conn_0c);
539 snd_hda_override_conn_list(codec, 0x0d, ARRAY_SIZE(conn_0d), conn_0d);
541 err = ad198x_parse_auto_config(codec, false);
544 err = ad1983_add_spdif_mux_ctl(codec);
550 snd_hda_gen_free(codec);
559 static void ad1981_fixup_hp_eapd(struct hda_codec *codec,
562 struct ad198x_spec *spec = codec->spec;
573 static void ad1981_fixup_amp_override(struct hda_codec *codec,
577 snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT,
611 static int patch_ad1981(struct hda_codec *codec)
616 err = alloc_ad_spec(codec);
619 spec = codec->spec;
625 snd_hda_pick_fixup(codec, NULL, ad1981_fixup_tbl, ad1981_fixups);
626 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
628 err = ad198x_parse_auto_config(codec, false);
631 err = ad1983_add_spdif_mux_ctl(codec);
635 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
640 snd_hda_gen_free(codec);
733 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
734 struct ad198x_spec *spec = codec->spec;
748 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
749 struct ad198x_spec *spec = codec->spec;
758 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
759 struct ad198x_spec *spec = codec->spec;
769 mutex_lock(&codec->control_mutex);
770 path = snd_hda_get_path_from_idx(codec,
773 snd_hda_activate_path(codec, path, false, true);
774 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[val]);
776 snd_hda_activate_path(codec, path, true, true);
778 mutex_unlock(&codec->control_mutex);
790 static int ad1988_auto_init(struct hda_codec *codec)
792 struct ad198x_spec *spec = codec->spec;
795 err = snd_hda_gen_init(codec);
803 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[i]);
805 snd_hda_activate_path(codec, path, path->active, false);
811 static int ad1988_add_spdif_mux_ctl(struct hda_codec *codec)
813 struct ad198x_spec *spec = codec->spec;
847 get_wcaps_type(get_wcaps(codec, 0x1d)) != AC_WID_AUD_MIX)
850 num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1;
862 spec->smux_paths[i] = snd_hda_get_path_idx(codec, path);
868 codec->patch_ops.init = ad1988_auto_init;
903 static int patch_ad1988(struct hda_codec *codec)
908 err = alloc_ad_spec(codec);
911 spec = codec->spec;
918 snd_hda_pick_fixup(codec, ad1988_fixup_models, NULL, ad1988_fixups);
919 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
921 err = ad198x_parse_auto_config(codec, true);
924 err = ad1988_add_spdif_mux_ctl(codec);
928 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
933 snd_hda_gen_free(codec);
967 static void ad1884_fixup_amp_override(struct hda_codec *codec,
971 snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT,
981 struct hda_codec *codec = private_data;
982 struct ad198x_spec *spec = codec->spec;
986 snd_hda_codec_write_cache(codec, 0x01, 0,
991 static void ad1884_fixup_hp_eapd(struct hda_codec *codec,
994 struct ad198x_spec *spec = codec->spec;
1000 snd_hda_codec_write_cache(codec, 0x01, 0,
1002 snd_hda_codec_write_cache(codec, 0x01, 0,
1004 snd_hda_codec_write_cache(codec, 0x01, 0,
1016 static void ad1884_fixup_thinkpad(struct hda_codec *codec,
1019 struct ad198x_spec *spec = codec->spec;
1083 static int patch_ad1884(struct hda_codec *codec)
1088 err = alloc_ad_spec(codec);
1091 spec = codec->spec;
1098 snd_hda_pick_fixup(codec, NULL, ad1884_fixup_tbl, ad1884_fixups);
1099 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1101 err = ad198x_parse_auto_config(codec, true);
1104 err = ad1983_add_spdif_mux_ctl(codec);
1108 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1113 snd_hda_gen_free(codec);
1129 static int patch_ad1882(struct hda_codec *codec)
1134 err = alloc_ad_spec(codec);
1137 spec = codec->spec;
1143 err = ad198x_parse_auto_config(codec, true);
1146 err = ad1988_add_spdif_mux_ctl(codec);
1152 snd_hda_gen_free(codec);
1181 MODULE_DESCRIPTION("Analog Devices HD-audio codec");