Lines Matching full:codec

130 static inline int cs_vendor_coef_get(struct hda_codec *codec, unsigned int idx)  in cs_vendor_coef_get()  argument
132 struct cs_spec *spec = codec->spec; in cs_vendor_coef_get()
134 snd_hda_codec_write(codec, spec->vendor_nid, 0, in cs_vendor_coef_get()
136 return snd_hda_codec_read(codec, spec->vendor_nid, 0, in cs_vendor_coef_get()
140 static inline void cs_vendor_coef_set(struct hda_codec *codec, unsigned int idx, in cs_vendor_coef_set() argument
143 struct cs_spec *spec = codec->spec; in cs_vendor_coef_set()
145 snd_hda_codec_write(codec, spec->vendor_nid, 0, in cs_vendor_coef_set()
147 snd_hda_codec_write(codec, spec->vendor_nid, 0, in cs_vendor_coef_set()
157 static void cs_automute(struct hda_codec *codec) in cs_automute() argument
159 struct cs_spec *spec = codec->spec; in cs_automute()
164 snd_hda_gen_update_outputs(codec); in cs_automute()
173 snd_hda_codec_write(codec, 0x01, 0, in cs_automute()
178 static bool is_active_pin(struct hda_codec *codec, hda_nid_t nid) in is_active_pin() argument
182 val = snd_hda_codec_get_pincfg(codec, nid); in is_active_pin()
186 static void init_input_coef(struct hda_codec *codec) in init_input_coef() argument
188 struct cs_spec *spec = codec->spec; in init_input_coef()
193 coef = cs_vendor_coef_get(codec, IDX_BEEP_CFG); in init_input_coef()
194 if (is_active_pin(codec, CS_DMIC2_PIN_NID)) in init_input_coef()
196 if (is_active_pin(codec, CS_DMIC1_PIN_NID)) in init_input_coef()
202 cs_vendor_coef_set(codec, IDX_BEEP_CFG, coef); in init_input_coef()
278 static void init_digital_coef(struct hda_codec *codec) in init_digital_coef() argument
284 if (is_active_pin(codec, CS_DIG_OUT2_PIN_NID)) in init_digital_coef()
289 cs_vendor_coef_set(codec, IDX_SPDIF_CTL, coef); in init_digital_coef()
292 static int cs_init(struct hda_codec *codec) in cs_init() argument
294 struct cs_spec *spec = codec->spec; in cs_init()
298 snd_hda_sequence_write(codec, cs_errata_init_verbs); in cs_init()
299 snd_hda_sequence_write(codec, cs_coef_init_verbs); in cs_init()
301 snd_hda_sequence_write(codec, cs4208_coef_init_verbs); in cs_init()
304 snd_hda_gen_init(codec); in cs_init()
307 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, in cs_init()
309 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION, in cs_init()
311 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in cs_init()
316 init_input_coef(codec); in cs_init()
317 init_digital_coef(codec); in cs_init()
323 static int cs_build_controls(struct hda_codec *codec) in cs_build_controls() argument
327 err = snd_hda_gen_build_controls(codec); in cs_build_controls()
330 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); in cs_build_controls()
344 static int cs_parse_auto_config(struct hda_codec *codec) in cs_parse_auto_config() argument
346 struct cs_spec *spec = codec->spec; in cs_parse_auto_config()
350 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 0); in cs_parse_auto_config()
354 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); in cs_parse_auto_config()
367 snd_hda_gen_fix_pin_power(codec, in cs_parse_auto_config()
396 /* codec SSID */
493 static void cs420x_fixup_gpio_13(struct hda_codec *codec, in cs420x_fixup_gpio_13() argument
497 struct cs_spec *spec = codec->spec; in cs420x_fixup_gpio_13()
506 static void cs420x_fixup_gpio_23(struct hda_codec *codec, in cs420x_fixup_gpio_23() argument
510 struct cs_spec *spec = codec->spec; in cs420x_fixup_gpio_23()
571 static struct cs_spec *cs_alloc_spec(struct hda_codec *codec, int vendor_nid) in cs_alloc_spec() argument
578 codec->spec = spec; in cs_alloc_spec()
580 codec->power_save_node = 1; in cs_alloc_spec()
586 static int patch_cs420x(struct hda_codec *codec) in patch_cs420x() argument
591 spec = cs_alloc_spec(codec, CS420X_VENDOR_NID); in patch_cs420x()
595 codec->patch_ops = cs_patch_ops; in patch_cs420x()
597 codec->single_adc_amp = 1; in patch_cs420x()
599 snd_hda_pick_fixup(codec, cs420x_models, cs420x_fixup_tbl, in patch_cs420x()
601 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_cs420x()
603 err = cs_parse_auto_config(codec); in patch_cs420x()
607 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_cs420x()
612 cs_free(codec); in patch_cs420x()
641 /* codec SSID matching */
651 static void cs4208_fixup_gpio0(struct hda_codec *codec, in cs4208_fixup_gpio0() argument
655 struct cs_spec *spec = codec->spec; in cs4208_fixup_gpio0()
666 /* remap the fixup from codec SSID and apply it */
667 static void cs4208_fixup_mac(struct hda_codec *codec, in cs4208_fixup_mac() argument
673 codec->fixup_id = HDA_FIXUP_ID_NOT_SET; in cs4208_fixup_mac()
674 snd_hda_pick_fixup(codec, NULL, cs4208_mac_fixup_tbl, cs4208_fixups); in cs4208_fixup_mac()
675 if (codec->fixup_id == HDA_FIXUP_ID_NOT_SET) in cs4208_fixup_mac()
676 codec->fixup_id = CS4208_GPIO0; /* default fixup */ in cs4208_fixup_mac()
677 snd_hda_apply_fixup(codec, action); in cs4208_fixup_mac()
681 static void cs4208_fixup_macmini(struct hda_codec *codec, in cs4208_fixup_macmini() argument
692 codec->inv_jack_detect = 1; in cs4208_fixup_macmini()
694 snd_hda_apply_pincfgs(codec, pincfgs); in cs4208_fixup_macmini()
701 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in cs4208_spdif_sw_put() local
702 struct cs_spec *spec = codec->spec; in cs4208_spdif_sw_put()
706 snd_hda_set_pin_ctl_cache(codec, pin, pinctl); in cs4208_spdif_sw_put()
711 static void cs4208_fixup_spdif_switch(struct hda_codec *codec, in cs4208_fixup_spdif_switch() argument
715 struct cs_spec *spec = codec->spec; in cs4208_fixup_spdif_switch()
720 kctl = snd_hda_find_mixer_ctl(codec, "IEC958 Playback Switch"); in cs4208_fixup_spdif_switch()
758 static void cs4208_fix_amp_caps(struct hda_codec *codec, hda_nid_t adc) in cs4208_fix_amp_caps() argument
762 caps = query_amp_caps(codec, adc, HDA_INPUT); in cs4208_fix_amp_caps()
765 snd_hda_override_amp_caps(codec, adc, HDA_INPUT, caps); in cs4208_fix_amp_caps()
768 static int patch_cs4208(struct hda_codec *codec) in patch_cs4208() argument
773 spec = cs_alloc_spec(codec, CS4208_VENDOR_NID); in patch_cs4208()
777 codec->patch_ops = cs_patch_ops; in patch_cs4208()
782 snd_hda_pick_fixup(codec, cs4208_models, cs4208_fixup_tbl, in patch_cs4208()
784 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_cs4208()
786 snd_hda_override_wcaps(codec, 0x18, in patch_cs4208()
787 get_wcaps(codec, 0x18) | AC_WCAP_STEREO); in patch_cs4208()
788 cs4208_fix_amp_caps(codec, 0x18); in patch_cs4208()
789 cs4208_fix_amp_caps(codec, 0x1b); in patch_cs4208()
790 cs4208_fix_amp_caps(codec, 0x1c); in patch_cs4208()
792 err = cs_parse_auto_config(codec); in patch_cs4208()
796 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_cs4208()
801 cs_free(codec); in patch_cs4208()
850 static void cs421x_fixup_sense_b(struct hda_codec *codec, in cs421x_fixup_sense_b() argument
853 struct cs_spec *spec = codec->spec; in cs421x_fixup_sense_b()
950 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in cs421x_boost_vol_get() local
953 cs_vendor_coef_get(codec, CS421X_IDX_SPK_CTL) & 0x0003; in cs421x_boost_vol_get()
960 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in cs421x_boost_vol_put() local
964 cs_vendor_coef_get(codec, CS421X_IDX_SPK_CTL); in cs421x_boost_vol_put()
970 cs_vendor_coef_set(codec, CS421X_IDX_SPK_CTL, coef); in cs421x_boost_vol_put()
989 static void cs4210_pinmux_init(struct hda_codec *codec) in cs4210_pinmux_init() argument
991 struct cs_spec *spec = codec->spec; in cs4210_pinmux_init()
995 coef = cs_vendor_coef_get(codec, CS421X_IDX_DEV_CFG); in cs4210_pinmux_init()
1007 cs_vendor_coef_set(codec, CS421X_IDX_DEV_CFG, coef); in cs4210_pinmux_init()
1010 is_active_pin(codec, CS421X_DMIC_PIN_NID)) { in cs4210_pinmux_init()
1015 def_conf = snd_hda_codec_get_pincfg(codec, CS421X_DMIC_PIN_NID); in cs4210_pinmux_init()
1018 snd_hda_codec_set_pincfg(codec, CS421X_DMIC_PIN_NID, def_conf); in cs4210_pinmux_init()
1022 static void cs4210_spdif_automute(struct hda_codec *codec, in cs4210_spdif_automute() argument
1025 struct cs_spec *spec = codec->spec; in cs4210_spdif_automute()
1034 spdif_present = snd_hda_jack_detect(codec, spdif_pin); in cs4210_spdif_automute()
1040 snd_hda_set_pin_ctl(codec, spdif_pin, spdif_present ? PIN_OUT : 0); in cs4210_spdif_automute()
1042 cs_automute(codec); in cs4210_spdif_automute()
1045 static void parse_cs421x_digital(struct hda_codec *codec) in parse_cs421x_digital() argument
1047 struct cs_spec *spec = codec->spec; in parse_cs421x_digital()
1054 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { in parse_cs421x_digital()
1056 snd_hda_jack_detect_enable_callback(codec, nid, in parse_cs421x_digital()
1062 static int cs421x_init(struct hda_codec *codec) in cs421x_init() argument
1064 struct cs_spec *spec = codec->spec; in cs421x_init()
1067 snd_hda_sequence_write(codec, cs421x_coef_init_verbs); in cs421x_init()
1068 snd_hda_sequence_write(codec, cs421x_coef_init_verbs_A1_silicon_fixes); in cs421x_init()
1069 cs4210_pinmux_init(codec); in cs421x_init()
1072 snd_hda_gen_init(codec); in cs421x_init()
1075 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, in cs421x_init()
1077 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION, in cs421x_init()
1079 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in cs421x_init()
1083 init_input_coef(codec); in cs421x_init()
1085 cs4210_spdif_automute(codec, NULL); in cs421x_init()
1090 static void fix_volume_caps(struct hda_codec *codec, hda_nid_t dac) in fix_volume_caps() argument
1095 caps = query_amp_caps(codec, dac, HDA_OUTPUT); in fix_volume_caps()
1099 snd_hda_override_amp_caps(codec, dac, HDA_OUTPUT, caps); in fix_volume_caps()
1102 static int cs421x_parse_auto_config(struct hda_codec *codec) in cs421x_parse_auto_config() argument
1104 struct cs_spec *spec = codec->spec; in cs421x_parse_auto_config()
1108 fix_volume_caps(codec, dac); in cs421x_parse_auto_config()
1110 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 0); in cs421x_parse_auto_config()
1114 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); in cs421x_parse_auto_config()
1118 parse_cs421x_digital(codec); in cs421x_parse_auto_config()
1135 static int cs421x_suspend(struct hda_codec *codec) in cs421x_suspend() argument
1137 struct cs_spec *spec = codec->spec; in cs421x_suspend()
1140 snd_hda_shutup_pins(codec); in cs421x_suspend()
1142 snd_hda_codec_write(codec, CS4210_DAC_NID, 0, in cs421x_suspend()
1144 snd_hda_codec_write(codec, CS4210_ADC_NID, 0, in cs421x_suspend()
1148 coef = cs_vendor_coef_get(codec, CS421X_IDX_DEV_CFG); in cs421x_suspend()
1150 cs_vendor_coef_set(codec, CS421X_IDX_DEV_CFG, coef); in cs421x_suspend()
1168 static int patch_cs4210(struct hda_codec *codec) in patch_cs4210() argument
1173 spec = cs_alloc_spec(codec, CS4210_VENDOR_NID); in patch_cs4210()
1177 codec->patch_ops = cs421x_patch_ops; in patch_cs4210()
1180 snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl, in patch_cs4210()
1182 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_cs4210()
1189 cs4210_pinmux_init(codec); in patch_cs4210()
1191 err = cs421x_parse_auto_config(codec); in patch_cs4210()
1195 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_cs4210()
1200 cs_free(codec); in patch_cs4210()
1204 static int patch_cs4213(struct hda_codec *codec) in patch_cs4213() argument
1209 spec = cs_alloc_spec(codec, CS4213_VENDOR_NID); in patch_cs4213()
1213 codec->patch_ops = cs421x_patch_ops; in patch_cs4213()
1215 err = cs421x_parse_auto_config(codec); in patch_cs4213()
1222 cs_free(codec); in patch_cs4213()
1240 MODULE_DESCRIPTION("Cirrus Logic HD-audio codec");