Lines Matching full:codec
3 * Cirrus Logic CS421x HD-audio codec
105 static inline int cs_vendor_coef_get(struct hda_codec *codec, unsigned int idx) in cs_vendor_coef_get() argument
107 struct cs_spec *spec = codec->spec; in cs_vendor_coef_get()
109 snd_hda_codec_write(codec, spec->vendor_nid, 0, in cs_vendor_coef_get()
111 return snd_hda_codec_read(codec, spec->vendor_nid, 0, in cs_vendor_coef_get()
115 static inline void cs_vendor_coef_set(struct hda_codec *codec, unsigned int idx, in cs_vendor_coef_set() argument
118 struct cs_spec *spec = codec->spec; in cs_vendor_coef_set()
120 snd_hda_codec_write(codec, spec->vendor_nid, 0, in cs_vendor_coef_set()
122 snd_hda_codec_write(codec, spec->vendor_nid, 0, in cs_vendor_coef_set()
132 static void cs_automute(struct hda_codec *codec) in cs_automute() argument
134 struct cs_spec *spec = codec->spec; in cs_automute()
139 snd_hda_gen_update_outputs(codec); in cs_automute()
148 snd_hda_codec_write(codec, 0x01, 0, in cs_automute()
153 static bool is_active_pin(struct hda_codec *codec, hda_nid_t nid) in is_active_pin() argument
157 val = snd_hda_codec_get_pincfg(codec, nid); in is_active_pin()
161 static struct cs_spec *cs_alloc_spec(struct hda_codec *codec, int vendor_nid) in cs_alloc_spec() argument
168 codec->spec = spec; in cs_alloc_spec()
170 codec->power_save_node = 1; in cs_alloc_spec()
221 static void cs421x_fixup_sense_b(struct hda_codec *codec, in cs421x_fixup_sense_b() argument
224 struct cs_spec *spec = codec->spec; in cs421x_fixup_sense_b()
321 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in cs421x_boost_vol_get() local
324 cs_vendor_coef_get(codec, CS421X_IDX_SPK_CTL) & 0x0003; in cs421x_boost_vol_get()
331 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in cs421x_boost_vol_put() local
335 cs_vendor_coef_get(codec, CS421X_IDX_SPK_CTL); in cs421x_boost_vol_put()
341 cs_vendor_coef_set(codec, CS421X_IDX_SPK_CTL, coef); in cs421x_boost_vol_put()
360 static void cs4210_pinmux_init(struct hda_codec *codec) in cs4210_pinmux_init() argument
362 struct cs_spec *spec = codec->spec; in cs4210_pinmux_init()
366 coef = cs_vendor_coef_get(codec, CS421X_IDX_DEV_CFG); in cs4210_pinmux_init()
378 cs_vendor_coef_set(codec, CS421X_IDX_DEV_CFG, coef); in cs4210_pinmux_init()
381 is_active_pin(codec, CS421X_DMIC_PIN_NID)) { in cs4210_pinmux_init()
386 def_conf = snd_hda_codec_get_pincfg(codec, CS421X_DMIC_PIN_NID); in cs4210_pinmux_init()
389 snd_hda_codec_set_pincfg(codec, CS421X_DMIC_PIN_NID, def_conf); in cs4210_pinmux_init()
393 static void cs4210_spdif_automute(struct hda_codec *codec, in cs4210_spdif_automute() argument
396 struct cs_spec *spec = codec->spec; in cs4210_spdif_automute()
405 spdif_present = snd_hda_jack_detect(codec, spdif_pin); in cs4210_spdif_automute()
411 snd_hda_set_pin_ctl(codec, spdif_pin, spdif_present ? PIN_OUT : 0); in cs4210_spdif_automute()
413 cs_automute(codec); in cs4210_spdif_automute()
416 static void parse_cs421x_digital(struct hda_codec *codec) in parse_cs421x_digital() argument
418 struct cs_spec *spec = codec->spec; in parse_cs421x_digital()
425 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { in parse_cs421x_digital()
427 snd_hda_jack_detect_enable_callback(codec, nid, in parse_cs421x_digital()
433 static int cs421x_init(struct hda_codec *codec) in cs421x_init() argument
435 struct cs_spec *spec = codec->spec; in cs421x_init()
438 snd_hda_sequence_write(codec, cs421x_coef_init_verbs); in cs421x_init()
439 snd_hda_sequence_write(codec, cs421x_coef_init_verbs_A1_silicon_fixes); in cs421x_init()
440 cs4210_pinmux_init(codec); in cs421x_init()
443 snd_hda_gen_init(codec); in cs421x_init()
446 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, in cs421x_init()
448 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION, in cs421x_init()
450 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in cs421x_init()
454 cs4210_spdif_automute(codec, NULL); in cs421x_init()
459 static void fix_volume_caps(struct hda_codec *codec, hda_nid_t dac) in fix_volume_caps() argument
464 caps = query_amp_caps(codec, dac, HDA_OUTPUT); in fix_volume_caps()
468 snd_hda_override_amp_caps(codec, dac, HDA_OUTPUT, caps); in fix_volume_caps()
471 static int cs421x_parse_auto_config(struct hda_codec *codec) in cs421x_parse_auto_config() argument
473 struct cs_spec *spec = codec->spec; in cs421x_parse_auto_config()
477 fix_volume_caps(codec, dac); in cs421x_parse_auto_config()
479 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 0); in cs421x_parse_auto_config()
483 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); in cs421x_parse_auto_config()
487 parse_cs421x_digital(codec); in cs421x_parse_auto_config()
503 static int cs421x_suspend(struct hda_codec *codec) in cs421x_suspend() argument
505 struct cs_spec *spec = codec->spec; in cs421x_suspend()
508 snd_hda_shutup_pins(codec); in cs421x_suspend()
510 snd_hda_codec_write(codec, CS4210_DAC_NID, 0, in cs421x_suspend()
512 snd_hda_codec_write(codec, CS4210_ADC_NID, 0, in cs421x_suspend()
516 coef = cs_vendor_coef_get(codec, CS421X_IDX_DEV_CFG); in cs421x_suspend()
518 cs_vendor_coef_set(codec, CS421X_IDX_DEV_CFG, coef); in cs421x_suspend()
524 static int cs421x_probe(struct hda_codec *codec, const struct hda_device_id *id) in cs421x_probe() argument
529 spec = cs_alloc_spec(codec, id->driver_data); in cs421x_probe()
536 snd_hda_pick_fixup(codec, cs421x_models, cs421x_fixup_tbl, in cs421x_probe()
538 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in cs421x_probe()
545 cs4210_pinmux_init(codec); in cs421x_probe()
548 err = cs421x_parse_auto_config(codec); in cs421x_probe()
552 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in cs421x_probe()
557 snd_hda_gen_remove(codec); in cs421x_probe()
583 MODULE_DESCRIPTION("Cirrus Logic CS421x HD-audio codec");