static void init_output(struct hda_codec *codec) { struct cs_spec *spec = codec->spec; struct auto_pin_cfg *cfg = &spec->autocfg; int i; /* mute first */ for (i = 0; i < spec->multiout.num_dacs; i++) snd_hda_codec_write(codec, spec->multiout.dac_nids[i], 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); if (spec->multiout.hp_nid) snd_hda_codec_write(codec, spec->multiout.hp_nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) { if (!spec->multiout.extra_out_nid[i]) break; snd_hda_codec_write(codec, spec->multiout.extra_out_nid[i], 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE); } /* set appropriate pin controls */ for (i = 0; i < cfg->line_outs; i++) snd_hda_codec_write(codec, cfg->line_out_pins[i], 0, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); /* HP */ for (i = 0; i < cfg->hp_outs; i++) { hda_nid_t nid = cfg->hp_pins[i]; snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); if (!cfg->speaker_outs) continue; if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | HP_EVENT); spec->hp_detect = 1; } } /* Speaker */ for (i = 0; i < cfg->speaker_outs; i++) snd_hda_codec_write(codec, cfg->speaker_pins[i], 0, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); /* SPDIF is enabled on presence detect for CS421x */ if (spec->hp_detect || spec->spdif_detect) cs_automute(codec); }
static void cs4210_spdif_automute(struct hda_codec *codec, struct hda_jack_callback *tbl) { struct cs_spec *spec = codec->spec; bool spdif_present = false; hda_nid_t spdif_pin = spec->gen.autocfg.dig_out_pins[0]; /* detect on spdif is specific to CS4210 */ if (!spec->spdif_detect || spec->vendor_nid != CS4210_VENDOR_NID) return; spdif_present = snd_hda_jack_detect(codec, spdif_pin); if (spdif_present == spec->spdif_present) return; spec->spdif_present = spdif_present; /* SPDIF TX on/off */ snd_hda_set_pin_ctl(codec, spdif_pin, spdif_present ? PIN_OUT : 0); cs_automute(codec); }