static void cs_automic(struct hda_codec *codec) { struct cs_spec *spec = codec->spec; struct auto_pin_cfg *cfg = &spec->autocfg; hda_nid_t nid; unsigned int present; nid = cfg->inputs[spec->automic_idx].pin; present = snd_hda_jack_detect(codec, nid); /* specific to CS421x, single ADC */ if (spec->vendor_nid == CS421X_VENDOR_NID) { if (present) { spec->last_input = spec->cur_input; spec->cur_input = spec->automic_idx; } else { spec->cur_input = spec->last_input; } snd_hda_codec_write_cache(codec, spec->cur_adc, 0, AC_VERB_SET_CONNECT_SEL, spec->adc_idx[spec->cur_input]); } else { if (present) change_cur_input(codec, spec->automic_idx, 0); else change_cur_input(codec, !spec->automic_idx, 0); } }
static void cs_automic(struct hda_codec *codec) { struct cs_spec *spec = codec->spec; struct auto_pin_cfg *cfg = &spec->autocfg; hda_nid_t nid; unsigned int present; nid = cfg->inputs[spec->automic_idx].pin; present = snd_hda_jack_detect(codec, nid); if (present) change_cur_input(codec, spec->automic_idx, 0); else change_cur_input(codec, !spec->automic_idx, 0); }
static void cs_automic(struct hda_codec *codec) { struct cs_spec *spec = codec->spec; struct auto_pin_cfg *cfg = &spec->autocfg; hda_nid_t nid; unsigned int present; nid = cfg->input_pins[spec->automic_idx]; present = snd_hda_jack_detect(codec, nid); if (present) change_cur_input(codec, spec->automic_idx, 0); else { unsigned int imic = (spec->automic_idx == AUTO_PIN_MIC) ? AUTO_PIN_FRONT_MIC : AUTO_PIN_MIC; change_cur_input(codec, imic, 0); } }
static int cs_capture_source_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hda_codec *codec = snd_kcontrol_chip(kcontrol); struct cs_spec *spec = codec->spec; unsigned int idx = ucontrol->value.enumerated.item[0]; if (idx >= spec->num_inputs) return -EINVAL; idx = spec->input_idx[idx]; return change_cur_input(codec, idx, 0); }
static void cs_automic(struct hda_codec *codec) { struct cs_spec *spec = codec->spec; struct auto_pin_cfg *cfg = &spec->autocfg; hda_nid_t nid; unsigned int caps, present; nid = cfg->input_pins[spec->automic_idx]; caps = snd_hda_query_pin_caps(codec, nid); if (caps & AC_PINCAP_TRIG_REQ) snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); present = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0); if (present & AC_PINSENSE_PRESENCE) change_cur_input(codec, spec->automic_idx, 0); else { unsigned int imic = (spec->automic_idx == AUTO_PIN_MIC) ? AUTO_PIN_FRONT_MIC : AUTO_PIN_MIC; change_cur_input(codec, imic, 0); } }