Lines Matching refs:codec
62 static int create_beep_ctls(struct hda_codec *codec) in create_beep_ctls() argument
64 struct ad198x_spec *spec = codec->spec; in create_beep_ctls()
73 kctl = snd_ctl_new1(knew, codec); in create_beep_ctls()
77 err = snd_hda_ctl_add(codec, 0, kctl); in create_beep_ctls()
84 #define create_beep_ctls(codec) 0 argument
88 static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front, in ad198x_power_eapd_write() argument
91 if (snd_hda_query_pin_caps(codec, front) & AC_PINCAP_EAPD) in ad198x_power_eapd_write()
92 snd_hda_codec_write(codec, front, 0, AC_VERB_SET_EAPD_BTLENABLE, in ad198x_power_eapd_write()
93 !codec->inv_eapd ? 0x00 : 0x02); in ad198x_power_eapd_write()
94 if (snd_hda_query_pin_caps(codec, hp) & AC_PINCAP_EAPD) in ad198x_power_eapd_write()
95 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_EAPD_BTLENABLE, in ad198x_power_eapd_write()
96 !codec->inv_eapd ? 0x00 : 0x02); in ad198x_power_eapd_write()
99 static void ad198x_power_eapd(struct hda_codec *codec) in ad198x_power_eapd() argument
102 switch (codec->core.vendor_id) { in ad198x_power_eapd()
115 ad198x_power_eapd_write(codec, 0x12, 0x11); in ad198x_power_eapd()
119 ad198x_power_eapd_write(codec, 0x05, 0x06); in ad198x_power_eapd()
122 ad198x_power_eapd_write(codec, 0x1b, 0x1a); in ad198x_power_eapd()
127 static void ad198x_shutup(struct hda_codec *codec) in ad198x_shutup() argument
129 snd_hda_shutup_pins(codec); in ad198x_shutup()
130 ad198x_power_eapd(codec); in ad198x_shutup()
134 static int ad198x_suspend(struct hda_codec *codec) in ad198x_suspend() argument
136 ad198x_shutup(codec); in ad198x_suspend()
144 struct hda_codec *codec = private_data; in ad_vmaster_eapd_hook() local
145 struct ad198x_spec *spec = codec->spec; in ad_vmaster_eapd_hook()
149 if (codec->inv_eapd) in ad_vmaster_eapd_hook()
151 snd_hda_codec_update_cache(codec, spec->eapd_nid, 0, in ad_vmaster_eapd_hook()
160 static int ad198x_auto_build_controls(struct hda_codec *codec) in ad198x_auto_build_controls() argument
164 err = snd_hda_gen_build_controls(codec); in ad198x_auto_build_controls()
167 err = create_beep_ctls(codec); in ad198x_auto_build_controls()
187 static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp) in ad198x_parse_auto_config() argument
189 struct ad198x_spec *spec = codec->spec; in ad198x_parse_auto_config()
193 codec->spdif_status_reset = 1; in ad198x_parse_auto_config()
194 codec->no_trigger_sense = 1; in ad198x_parse_auto_config()
195 codec->no_sticky_stream = 1; in ad198x_parse_auto_config()
201 err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0); in ad198x_parse_auto_config()
204 err = snd_hda_gen_parse_auto_config(codec, cfg); in ad198x_parse_auto_config()
208 codec->patch_ops = ad198x_auto_patch_ops; in ad198x_parse_auto_config()
217 static int alloc_ad_spec(struct hda_codec *codec) in alloc_ad_spec() argument
224 codec->spec = spec; in alloc_ad_spec()
234 static void ad_fixup_inv_jack_detect(struct hda_codec *codec, in ad_fixup_inv_jack_detect() argument
237 struct ad198x_spec *spec = codec->spec; in ad_fixup_inv_jack_detect()
240 codec->inv_jack_detect = 1; in ad_fixup_inv_jack_detect()
248 static void ad1986a_fixup_eapd(struct hda_codec *codec, in ad1986a_fixup_eapd() argument
251 struct ad198x_spec *spec = codec->spec; in ad1986a_fixup_eapd()
254 codec->inv_eapd = 0; in ad1986a_fixup_eapd()
261 static void ad1986a_fixup_eapd_mix_in(struct hda_codec *codec, in ad1986a_fixup_eapd_mix_in() argument
264 struct ad198x_spec *spec = codec->spec; in ad1986a_fixup_eapd_mix_in()
267 ad1986a_fixup_eapd(codec, fix, action); in ad1986a_fixup_eapd_mix_in()
401 static int patch_ad1986a(struct hda_codec *codec) in patch_ad1986a() argument
414 err = alloc_ad_spec(codec); in patch_ad1986a()
417 spec = codec->spec; in patch_ad1986a()
420 codec->inv_eapd = 1; in patch_ad1986a()
439 snd_hda_pick_fixup(codec, ad1986a_fixup_models, ad1986a_fixup_tbl, in patch_ad1986a()
441 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1986a()
443 err = ad198x_parse_auto_config(codec, false); in patch_ad1986a()
445 snd_hda_gen_free(codec); in patch_ad1986a()
449 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1986a()
465 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_info() local
466 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_info()
470 int num_conns = snd_hda_get_num_conns(codec, dig_out); in ad1983_auto_smux_enum_info()
483 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_get() local
484 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_get()
493 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_put() local
494 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_put()
497 int num_conns = snd_hda_get_num_conns(codec, dig_out); in ad1983_auto_smux_enum_put()
504 snd_hda_codec_write_cache(codec, dig_out, 0, in ad1983_auto_smux_enum_put()
517 static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec) in ad1983_add_spdif_mux_ctl() argument
519 struct ad198x_spec *spec = codec->spec; in ad1983_add_spdif_mux_ctl()
525 num_conns = snd_hda_get_num_conns(codec, dig_out); in ad1983_add_spdif_mux_ctl()
533 static int patch_ad1983(struct hda_codec *codec) in patch_ad1983() argument
540 err = alloc_ad_spec(codec); in patch_ad1983()
543 spec = codec->spec; in patch_ad1983()
550 snd_hda_override_conn_list(codec, 0x0c, ARRAY_SIZE(conn_0c), conn_0c); in patch_ad1983()
551 snd_hda_override_conn_list(codec, 0x0d, ARRAY_SIZE(conn_0d), conn_0d); in patch_ad1983()
553 err = ad198x_parse_auto_config(codec, false); in patch_ad1983()
556 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1983()
562 snd_hda_gen_free(codec); in patch_ad1983()
571 static void ad1981_fixup_hp_eapd(struct hda_codec *codec, in ad1981_fixup_hp_eapd() argument
574 struct ad198x_spec *spec = codec->spec; in ad1981_fixup_hp_eapd()
585 static void ad1981_fixup_amp_override(struct hda_codec *codec, in ad1981_fixup_amp_override() argument
589 snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT, in ad1981_fixup_amp_override()
623 static int patch_ad1981(struct hda_codec *codec) in patch_ad1981() argument
628 err = alloc_ad_spec(codec); in patch_ad1981()
631 spec = codec->spec; in patch_ad1981()
637 snd_hda_pick_fixup(codec, NULL, ad1981_fixup_tbl, ad1981_fixups); in patch_ad1981()
638 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1981()
640 err = ad198x_parse_auto_config(codec, false); in patch_ad1981()
643 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1981()
647 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1981()
652 snd_hda_gen_free(codec); in patch_ad1981()
745 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_info() local
749 int num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1; in ad1988_auto_smux_enum_info()
758 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_get() local
759 struct ad198x_spec *spec = codec->spec; in ad1988_auto_smux_enum_get()
768 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_put() local
769 struct ad198x_spec *spec = codec->spec; in ad1988_auto_smux_enum_put()
772 int num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1; in ad1988_auto_smux_enum_put()
779 mutex_lock(&codec->control_mutex); in ad1988_auto_smux_enum_put()
780 path = snd_hda_get_path_from_idx(codec, in ad1988_auto_smux_enum_put()
783 snd_hda_activate_path(codec, path, false, true); in ad1988_auto_smux_enum_put()
784 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[val]); in ad1988_auto_smux_enum_put()
786 snd_hda_activate_path(codec, path, true, true); in ad1988_auto_smux_enum_put()
788 mutex_unlock(&codec->control_mutex); in ad1988_auto_smux_enum_put()
800 static int ad1988_auto_init(struct hda_codec *codec) in ad1988_auto_init() argument
802 struct ad198x_spec *spec = codec->spec; in ad1988_auto_init()
805 err = snd_hda_gen_init(codec); in ad1988_auto_init()
813 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[i]); in ad1988_auto_init()
815 snd_hda_activate_path(codec, path, path->active, false); in ad1988_auto_init()
821 static int ad1988_add_spdif_mux_ctl(struct hda_codec *codec) in ad1988_add_spdif_mux_ctl() argument
823 struct ad198x_spec *spec = codec->spec; in ad1988_add_spdif_mux_ctl()
857 get_wcaps_type(get_wcaps(codec, 0x1d)) != AC_WID_AUD_MIX) in ad1988_add_spdif_mux_ctl()
860 num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1; in ad1988_add_spdif_mux_ctl()
871 spec->smux_paths[i] = snd_hda_get_path_idx(codec, path); in ad1988_add_spdif_mux_ctl()
877 codec->patch_ops.init = ad1988_auto_init; in ad1988_add_spdif_mux_ctl()
912 static int patch_ad1988(struct hda_codec *codec) in patch_ad1988() argument
917 err = alloc_ad_spec(codec); in patch_ad1988()
920 spec = codec->spec; in patch_ad1988()
927 snd_hda_pick_fixup(codec, ad1988_fixup_models, NULL, ad1988_fixups); in patch_ad1988()
928 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1988()
930 err = ad198x_parse_auto_config(codec, true); in patch_ad1988()
933 err = ad1988_add_spdif_mux_ctl(codec); in patch_ad1988()
937 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1988()
942 snd_hda_gen_free(codec); in patch_ad1988()
976 static void ad1884_fixup_amp_override(struct hda_codec *codec, in ad1884_fixup_amp_override() argument
980 snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT, in ad1884_fixup_amp_override()
990 struct hda_codec *codec = private_data; in ad1884_vmaster_hp_gpio_hook() local
991 struct ad198x_spec *spec = codec->spec; in ad1884_vmaster_hp_gpio_hook()
995 snd_hda_codec_update_cache(codec, 0x01, 0, in ad1884_vmaster_hp_gpio_hook()
1000 static void ad1884_fixup_hp_eapd(struct hda_codec *codec, in ad1884_fixup_hp_eapd() argument
1003 struct ad198x_spec *spec = codec->spec; in ad1884_fixup_hp_eapd()
1009 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
1011 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
1013 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
1025 static void ad1884_fixup_thinkpad(struct hda_codec *codec, in ad1884_fixup_thinkpad() argument
1028 struct ad198x_spec *spec = codec->spec; in ad1884_fixup_thinkpad()
1092 static int patch_ad1884(struct hda_codec *codec) in patch_ad1884() argument
1097 err = alloc_ad_spec(codec); in patch_ad1884()
1100 spec = codec->spec; in patch_ad1884()
1107 snd_hda_pick_fixup(codec, NULL, ad1884_fixup_tbl, ad1884_fixups); in patch_ad1884()
1108 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1884()
1110 err = ad198x_parse_auto_config(codec, true); in patch_ad1884()
1113 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1884()
1117 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1884()
1122 snd_hda_gen_free(codec); in patch_ad1884()
1138 static int patch_ad1882(struct hda_codec *codec) in patch_ad1882() argument
1143 err = alloc_ad_spec(codec); in patch_ad1882()
1146 spec = codec->spec; in patch_ad1882()
1152 err = ad198x_parse_auto_config(codec, true); in patch_ad1882()
1155 err = ad1988_add_spdif_mux_ctl(codec); in patch_ad1882()
1161 snd_hda_gen_free(codec); in patch_ad1882()