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()
215 static int alloc_ad_spec(struct hda_codec *codec) in alloc_ad_spec() argument
222 codec->spec = spec; in alloc_ad_spec()
224 codec->patch_ops = ad198x_auto_patch_ops; in alloc_ad_spec()
233 static void ad_fixup_inv_jack_detect(struct hda_codec *codec, in ad_fixup_inv_jack_detect() argument
236 struct ad198x_spec *spec = codec->spec; in ad_fixup_inv_jack_detect()
239 codec->inv_jack_detect = 1; in ad_fixup_inv_jack_detect()
247 static void ad1986a_fixup_eapd(struct hda_codec *codec, in ad1986a_fixup_eapd() argument
250 struct ad198x_spec *spec = codec->spec; in ad1986a_fixup_eapd()
253 codec->inv_eapd = 0; in ad1986a_fixup_eapd()
260 static void ad1986a_fixup_eapd_mix_in(struct hda_codec *codec, in ad1986a_fixup_eapd_mix_in() argument
263 struct ad198x_spec *spec = codec->spec; in ad1986a_fixup_eapd_mix_in()
266 ad1986a_fixup_eapd(codec, fix, action); in ad1986a_fixup_eapd_mix_in()
400 static int patch_ad1986a(struct hda_codec *codec) in patch_ad1986a() argument
413 err = alloc_ad_spec(codec); in patch_ad1986a()
416 spec = codec->spec; in patch_ad1986a()
419 codec->inv_eapd = 1; in patch_ad1986a()
438 snd_hda_pick_fixup(codec, ad1986a_fixup_models, ad1986a_fixup_tbl, in patch_ad1986a()
440 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1986a()
442 err = ad198x_parse_auto_config(codec, false); in patch_ad1986a()
444 snd_hda_gen_free(codec); in patch_ad1986a()
448 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1986a()
464 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_info() local
465 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_info()
469 int num_conns = snd_hda_get_num_conns(codec, dig_out); in ad1983_auto_smux_enum_info()
482 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_get() local
483 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_get()
492 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_put() local
493 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_put()
496 int num_conns = snd_hda_get_num_conns(codec, dig_out); in ad1983_auto_smux_enum_put()
503 snd_hda_codec_write_cache(codec, dig_out, 0, in ad1983_auto_smux_enum_put()
516 static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec) in ad1983_add_spdif_mux_ctl() argument
518 struct ad198x_spec *spec = codec->spec; in ad1983_add_spdif_mux_ctl()
524 num_conns = snd_hda_get_num_conns(codec, dig_out); in ad1983_add_spdif_mux_ctl()
532 static int patch_ad1983(struct hda_codec *codec) in patch_ad1983() argument
539 err = alloc_ad_spec(codec); in patch_ad1983()
542 spec = codec->spec; in patch_ad1983()
549 snd_hda_override_conn_list(codec, 0x0c, ARRAY_SIZE(conn_0c), conn_0c); in patch_ad1983()
550 snd_hda_override_conn_list(codec, 0x0d, ARRAY_SIZE(conn_0d), conn_0d); in patch_ad1983()
552 err = ad198x_parse_auto_config(codec, false); in patch_ad1983()
555 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1983()
561 snd_hda_gen_free(codec); in patch_ad1983()
570 static void ad1981_fixup_hp_eapd(struct hda_codec *codec, in ad1981_fixup_hp_eapd() argument
573 struct ad198x_spec *spec = codec->spec; in ad1981_fixup_hp_eapd()
584 static void ad1981_fixup_amp_override(struct hda_codec *codec, in ad1981_fixup_amp_override() argument
588 snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT, in ad1981_fixup_amp_override()
622 static int patch_ad1981(struct hda_codec *codec) in patch_ad1981() argument
627 err = alloc_ad_spec(codec); in patch_ad1981()
630 spec = codec->spec; in patch_ad1981()
636 snd_hda_pick_fixup(codec, NULL, ad1981_fixup_tbl, ad1981_fixups); in patch_ad1981()
637 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1981()
639 err = ad198x_parse_auto_config(codec, false); in patch_ad1981()
642 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1981()
646 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1981()
651 snd_hda_gen_free(codec); in patch_ad1981()
744 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_info() local
748 int num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1; in ad1988_auto_smux_enum_info()
757 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_get() local
758 struct ad198x_spec *spec = codec->spec; in ad1988_auto_smux_enum_get()
767 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_put() local
768 struct ad198x_spec *spec = codec->spec; in ad1988_auto_smux_enum_put()
771 int num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1; in ad1988_auto_smux_enum_put()
778 mutex_lock(&codec->control_mutex); in ad1988_auto_smux_enum_put()
779 path = snd_hda_get_path_from_idx(codec, in ad1988_auto_smux_enum_put()
782 snd_hda_activate_path(codec, path, false, true); in ad1988_auto_smux_enum_put()
783 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[val]); in ad1988_auto_smux_enum_put()
785 snd_hda_activate_path(codec, path, true, true); in ad1988_auto_smux_enum_put()
787 mutex_unlock(&codec->control_mutex); in ad1988_auto_smux_enum_put()
799 static int ad1988_auto_init(struct hda_codec *codec) in ad1988_auto_init() argument
801 struct ad198x_spec *spec = codec->spec; in ad1988_auto_init()
804 err = snd_hda_gen_init(codec); in ad1988_auto_init()
812 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[i]); in ad1988_auto_init()
814 snd_hda_activate_path(codec, path, path->active, false); in ad1988_auto_init()
820 static int ad1988_add_spdif_mux_ctl(struct hda_codec *codec) in ad1988_add_spdif_mux_ctl() argument
822 struct ad198x_spec *spec = codec->spec; in ad1988_add_spdif_mux_ctl()
856 get_wcaps_type(get_wcaps(codec, 0x1d)) != AC_WID_AUD_MIX) in ad1988_add_spdif_mux_ctl()
859 num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1; in ad1988_add_spdif_mux_ctl()
870 spec->smux_paths[i] = snd_hda_get_path_idx(codec, path); in ad1988_add_spdif_mux_ctl()
876 codec->patch_ops.init = ad1988_auto_init; in ad1988_add_spdif_mux_ctl()
911 static int patch_ad1988(struct hda_codec *codec) in patch_ad1988() argument
916 err = alloc_ad_spec(codec); in patch_ad1988()
919 spec = codec->spec; in patch_ad1988()
926 snd_hda_pick_fixup(codec, ad1988_fixup_models, NULL, ad1988_fixups); in patch_ad1988()
927 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1988()
929 err = ad198x_parse_auto_config(codec, true); in patch_ad1988()
932 err = ad1988_add_spdif_mux_ctl(codec); in patch_ad1988()
936 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1988()
941 snd_hda_gen_free(codec); in patch_ad1988()
975 static void ad1884_fixup_amp_override(struct hda_codec *codec, in ad1884_fixup_amp_override() argument
979 snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT, in ad1884_fixup_amp_override()
989 struct hda_codec *codec = private_data; in ad1884_vmaster_hp_gpio_hook() local
990 struct ad198x_spec *spec = codec->spec; in ad1884_vmaster_hp_gpio_hook()
994 snd_hda_codec_update_cache(codec, 0x01, 0, in ad1884_vmaster_hp_gpio_hook()
999 static void ad1884_fixup_hp_eapd(struct hda_codec *codec, in ad1884_fixup_hp_eapd() argument
1002 struct ad198x_spec *spec = codec->spec; in ad1884_fixup_hp_eapd()
1008 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
1010 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
1012 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
1024 static void ad1884_fixup_thinkpad(struct hda_codec *codec, in ad1884_fixup_thinkpad() argument
1027 struct ad198x_spec *spec = codec->spec; in ad1884_fixup_thinkpad()
1091 static int patch_ad1884(struct hda_codec *codec) in patch_ad1884() argument
1096 err = alloc_ad_spec(codec); in patch_ad1884()
1099 spec = codec->spec; in patch_ad1884()
1106 snd_hda_pick_fixup(codec, NULL, ad1884_fixup_tbl, ad1884_fixups); in patch_ad1884()
1107 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1884()
1109 err = ad198x_parse_auto_config(codec, true); in patch_ad1884()
1112 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1884()
1116 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1884()
1121 snd_hda_gen_free(codec); in patch_ad1884()
1137 static int patch_ad1882(struct hda_codec *codec) in patch_ad1882() argument
1142 err = alloc_ad_spec(codec); in patch_ad1882()
1145 spec = codec->spec; in patch_ad1882()
1151 err = ad198x_parse_auto_config(codec, true); in patch_ad1882()
1154 err = ad1988_add_spdif_mux_ctl(codec); in patch_ad1882()
1160 snd_hda_gen_free(codec); in patch_ad1882()