/* mic_autoswitch hook */ static void olpc_xo_automic(struct hda_codec *codec, struct hda_jack_callback *jack) { struct conexant_spec *spec = codec->spec; /* in DC mode, we don't handle automic */ if (!spec->dc_enable) snd_hda_gen_mic_autoswitch(codec, jack); olpc_xo_update_mic_pins(codec); if (spec->dc_enable) olpc_xo_update_mic_boost(codec); }
/* pcm_capture hook */ static void olpc_xo_capture_hook(struct hda_pcm_stream *hinfo, struct hda_codec *codec, struct snd_pcm_substream *substream, int action) { struct conexant_spec *spec = codec->spec; /* toggle spec->recording flag and update mic pins accordingly * for turning on/off LED */ switch (action) { case HDA_GEN_PCM_ACT_PREPARE: spec->recording = 1; olpc_xo_update_mic_pins(codec); break; case HDA_GEN_PCM_ACT_CLEANUP: spec->recording = 0; olpc_xo_update_mic_pins(codec); break; } }
static int olpc_xo_dc_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hda_codec *codec = snd_kcontrol_chip(kcontrol); struct conexant_spec *spec = codec->spec; int dc_enable = !!ucontrol->value.integer.value[0]; if (dc_enable == spec->dc_enable) return 0; spec->dc_enable = dc_enable; olpc_xo_update_mic_pins(codec); olpc_xo_update_mic_boost(codec); return 1; }
/* mic_autoswitch hook */ static void olpc_xo_automic(struct hda_codec *codec, struct hda_jack_tbl *jack) { struct conexant_spec *spec = codec->spec; int saved_cached_write = codec->cached_write; codec->cached_write = 1; /* in DC mode, we don't handle automic */ if (!spec->dc_enable) snd_hda_gen_mic_autoswitch(codec, jack); olpc_xo_update_mic_pins(codec); snd_hda_codec_flush_cache(codec); codec->cached_write = saved_cached_write; if (spec->dc_enable) olpc_xo_update_mic_boost(codec); }
static int olpc_xo_dc_bias_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct hda_codec *codec = snd_kcontrol_chip(kcontrol); struct conexant_spec *spec = codec->spec; const struct hda_input_mux *imux = &olpc_xo_dc_bias; unsigned int idx; idx = ucontrol->value.enumerated.item[0]; if (idx >= imux->num_items) idx = imux->num_items - 1; if (spec->dc_input_bias == idx) return 0; spec->dc_input_bias = idx; if (spec->dc_enable) olpc_xo_update_mic_pins(codec); return 1; }