Lines Matching refs:codec
49 static int create_beep_ctls(struct hda_codec *codec) in create_beep_ctls() argument
51 struct ad198x_spec *spec = codec->spec; in create_beep_ctls()
60 kctl = snd_ctl_new1(knew, codec); in create_beep_ctls()
64 err = snd_hda_ctl_add(codec, 0, kctl); in create_beep_ctls()
71 #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()
102 ad198x_power_eapd_write(codec, 0x12, 0x11); in ad198x_power_eapd()
106 ad198x_power_eapd_write(codec, 0x05, 0x06); in ad198x_power_eapd()
109 ad198x_power_eapd_write(codec, 0x1b, 0x1a); in ad198x_power_eapd()
114 static void ad198x_shutup(struct hda_codec *codec) in ad198x_shutup() argument
116 snd_hda_shutup_pins(codec); in ad198x_shutup()
117 ad198x_power_eapd(codec); in ad198x_shutup()
121 static int ad198x_suspend(struct hda_codec *codec) in ad198x_suspend() argument
123 ad198x_shutup(codec); in ad198x_suspend()
131 struct hda_codec *codec = private_data; in ad_vmaster_eapd_hook() local
132 struct ad198x_spec *spec = codec->spec; in ad_vmaster_eapd_hook()
136 if (codec->inv_eapd) in ad_vmaster_eapd_hook()
138 snd_hda_codec_write_cache(codec, spec->eapd_nid, 0, in ad_vmaster_eapd_hook()
147 static int ad198x_auto_build_controls(struct hda_codec *codec) in ad198x_auto_build_controls() argument
151 err = snd_hda_gen_build_controls(codec); in ad198x_auto_build_controls()
154 err = create_beep_ctls(codec); in ad198x_auto_build_controls()
174 static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp) in ad198x_parse_auto_config() argument
176 struct ad198x_spec *spec = codec->spec; in ad198x_parse_auto_config()
180 codec->spdif_status_reset = 1; in ad198x_parse_auto_config()
181 codec->no_trigger_sense = 1; in ad198x_parse_auto_config()
182 codec->no_sticky_stream = 1; in ad198x_parse_auto_config()
188 err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0); in ad198x_parse_auto_config()
191 err = snd_hda_gen_parse_auto_config(codec, cfg); in ad198x_parse_auto_config()
202 static int alloc_ad_spec(struct hda_codec *codec) in alloc_ad_spec() argument
209 codec->spec = spec; in alloc_ad_spec()
211 codec->patch_ops = ad198x_auto_patch_ops; in alloc_ad_spec()
220 static void ad_fixup_inv_jack_detect(struct hda_codec *codec, in ad_fixup_inv_jack_detect() argument
223 struct ad198x_spec *spec = codec->spec; in ad_fixup_inv_jack_detect()
226 codec->inv_jack_detect = 1; in ad_fixup_inv_jack_detect()
234 static void ad1986a_fixup_eapd(struct hda_codec *codec, in ad1986a_fixup_eapd() argument
237 struct ad198x_spec *spec = codec->spec; in ad1986a_fixup_eapd()
240 codec->inv_eapd = 0; in ad1986a_fixup_eapd()
247 static void ad1986a_fixup_eapd_mix_in(struct hda_codec *codec, in ad1986a_fixup_eapd_mix_in() argument
250 struct ad198x_spec *spec = codec->spec; in ad1986a_fixup_eapd_mix_in()
253 ad1986a_fixup_eapd(codec, fix, action); in ad1986a_fixup_eapd_mix_in()
388 static int patch_ad1986a(struct hda_codec *codec) in patch_ad1986a() argument
401 err = alloc_ad_spec(codec); in patch_ad1986a()
404 spec = codec->spec; in patch_ad1986a()
407 codec->inv_eapd = 1; in patch_ad1986a()
426 snd_hda_pick_fixup(codec, ad1986a_fixup_models, ad1986a_fixup_tbl, in patch_ad1986a()
428 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1986a()
430 err = ad198x_parse_auto_config(codec, false); in patch_ad1986a()
432 snd_hda_gen_free(codec); in patch_ad1986a()
436 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1986a()
452 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_info() local
453 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_info()
457 int num_conns = snd_hda_get_num_conns(codec, dig_out); in ad1983_auto_smux_enum_info()
470 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_get() local
471 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_get()
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_put() local
481 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_put()
484 int num_conns = snd_hda_get_num_conns(codec, dig_out); in ad1983_auto_smux_enum_put()
491 snd_hda_codec_write_cache(codec, dig_out, 0, in ad1983_auto_smux_enum_put()
504 static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec) in ad1983_add_spdif_mux_ctl() argument
506 struct ad198x_spec *spec = codec->spec; in ad1983_add_spdif_mux_ctl()
512 num_conns = snd_hda_get_num_conns(codec, dig_out); in ad1983_add_spdif_mux_ctl()
520 static int patch_ad1983(struct hda_codec *codec) in patch_ad1983() argument
527 err = alloc_ad_spec(codec); in patch_ad1983()
530 spec = codec->spec; in patch_ad1983()
537 snd_hda_override_conn_list(codec, 0x0c, ARRAY_SIZE(conn_0c), conn_0c); in patch_ad1983()
538 snd_hda_override_conn_list(codec, 0x0d, ARRAY_SIZE(conn_0d), conn_0d); in patch_ad1983()
540 err = ad198x_parse_auto_config(codec, false); in patch_ad1983()
543 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1983()
549 snd_hda_gen_free(codec); in patch_ad1983()
558 static void ad1981_fixup_hp_eapd(struct hda_codec *codec, in ad1981_fixup_hp_eapd() argument
561 struct ad198x_spec *spec = codec->spec; in ad1981_fixup_hp_eapd()
572 static void ad1981_fixup_amp_override(struct hda_codec *codec, in ad1981_fixup_amp_override() argument
576 snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT, in ad1981_fixup_amp_override()
610 static int patch_ad1981(struct hda_codec *codec) in patch_ad1981() argument
615 err = alloc_ad_spec(codec); in patch_ad1981()
618 spec = codec->spec; in patch_ad1981()
624 snd_hda_pick_fixup(codec, NULL, ad1981_fixup_tbl, ad1981_fixups); in patch_ad1981()
625 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1981()
627 err = ad198x_parse_auto_config(codec, false); in patch_ad1981()
630 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1981()
634 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1981()
639 snd_hda_gen_free(codec); in patch_ad1981()
732 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_info() local
736 int num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1; in ad1988_auto_smux_enum_info()
745 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_get() local
746 struct ad198x_spec *spec = codec->spec; in ad1988_auto_smux_enum_get()
755 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_put() local
756 struct ad198x_spec *spec = codec->spec; in ad1988_auto_smux_enum_put()
759 int num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1; in ad1988_auto_smux_enum_put()
766 mutex_lock(&codec->control_mutex); in ad1988_auto_smux_enum_put()
767 path = snd_hda_get_path_from_idx(codec, in ad1988_auto_smux_enum_put()
770 snd_hda_activate_path(codec, path, false, true); in ad1988_auto_smux_enum_put()
771 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[val]); in ad1988_auto_smux_enum_put()
773 snd_hda_activate_path(codec, path, true, true); in ad1988_auto_smux_enum_put()
775 mutex_unlock(&codec->control_mutex); in ad1988_auto_smux_enum_put()
787 static int ad1988_auto_init(struct hda_codec *codec) in ad1988_auto_init() argument
789 struct ad198x_spec *spec = codec->spec; in ad1988_auto_init()
792 err = snd_hda_gen_init(codec); in ad1988_auto_init()
800 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[i]); in ad1988_auto_init()
802 snd_hda_activate_path(codec, path, path->active, false); in ad1988_auto_init()
808 static int ad1988_add_spdif_mux_ctl(struct hda_codec *codec) in ad1988_add_spdif_mux_ctl() argument
810 struct ad198x_spec *spec = codec->spec; in ad1988_add_spdif_mux_ctl()
844 get_wcaps_type(get_wcaps(codec, 0x1d)) != AC_WID_AUD_MIX) in ad1988_add_spdif_mux_ctl()
847 num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1; in ad1988_add_spdif_mux_ctl()
858 spec->smux_paths[i] = snd_hda_get_path_idx(codec, path); in ad1988_add_spdif_mux_ctl()
864 codec->patch_ops.init = ad1988_auto_init; in ad1988_add_spdif_mux_ctl()
899 static int patch_ad1988(struct hda_codec *codec) in patch_ad1988() argument
904 err = alloc_ad_spec(codec); in patch_ad1988()
907 spec = codec->spec; in patch_ad1988()
914 snd_hda_pick_fixup(codec, ad1988_fixup_models, NULL, ad1988_fixups); in patch_ad1988()
915 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1988()
917 err = ad198x_parse_auto_config(codec, true); in patch_ad1988()
920 err = ad1988_add_spdif_mux_ctl(codec); in patch_ad1988()
924 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1988()
929 snd_hda_gen_free(codec); in patch_ad1988()
963 static void ad1884_fixup_amp_override(struct hda_codec *codec, in ad1884_fixup_amp_override() argument
967 snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT, in ad1884_fixup_amp_override()
977 struct hda_codec *codec = private_data; in ad1884_vmaster_hp_gpio_hook() local
978 struct ad198x_spec *spec = codec->spec; in ad1884_vmaster_hp_gpio_hook()
982 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_vmaster_hp_gpio_hook()
987 static void ad1884_fixup_hp_eapd(struct hda_codec *codec, in ad1884_fixup_hp_eapd() argument
990 struct ad198x_spec *spec = codec->spec; in ad1884_fixup_hp_eapd()
996 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
998 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
1000 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
1012 static void ad1884_fixup_thinkpad(struct hda_codec *codec, in ad1884_fixup_thinkpad() argument
1015 struct ad198x_spec *spec = codec->spec; in ad1884_fixup_thinkpad()
1079 static int patch_ad1884(struct hda_codec *codec) in patch_ad1884() argument
1084 err = alloc_ad_spec(codec); in patch_ad1884()
1087 spec = codec->spec; in patch_ad1884()
1094 snd_hda_pick_fixup(codec, NULL, ad1884_fixup_tbl, ad1884_fixups); in patch_ad1884()
1095 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1884()
1097 err = ad198x_parse_auto_config(codec, true); in patch_ad1884()
1100 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1884()
1104 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1884()
1109 snd_hda_gen_free(codec); in patch_ad1884()
1125 static int patch_ad1882(struct hda_codec *codec) in patch_ad1882() argument
1130 err = alloc_ad_spec(codec); in patch_ad1882()
1133 spec = codec->spec; in patch_ad1882()
1139 err = ad198x_parse_auto_config(codec, true); in patch_ad1882()
1142 err = ad1988_add_spdif_mux_ctl(codec); in patch_ad1882()
1148 snd_hda_gen_free(codec); in patch_ad1882()