Commit 02d33322 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Fix digita/analog mic auto-switching with IDT codecs

When the auto-mic switching between an analog and a digital mic is
needed with IDT codecs, the current driver doesn't reset the connection
of the digital mux.

This patch fixes the behavior by checking both mux connections properly.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 3db6c037
...@@ -182,8 +182,8 @@ struct sigmatel_jack { ...@@ -182,8 +182,8 @@ struct sigmatel_jack {
struct sigmatel_mic_route { struct sigmatel_mic_route {
hda_nid_t pin; hda_nid_t pin;
unsigned char mux_idx; signed char mux_idx;
unsigned char dmux_idx; signed char dmux_idx;
}; };
struct sigmatel_spec { struct sigmatel_spec {
...@@ -3469,18 +3469,26 @@ static int set_mic_route(struct hda_codec *codec, ...@@ -3469,18 +3469,26 @@ static int set_mic_route(struct hda_codec *codec,
break; break;
if (i <= AUTO_PIN_FRONT_MIC) { if (i <= AUTO_PIN_FRONT_MIC) {
/* analog pin */ /* analog pin */
mic->dmux_idx = 0;
i = get_connection_index(codec, spec->mux_nids[0], pin); i = get_connection_index(codec, spec->mux_nids[0], pin);
if (i < 0) if (i < 0)
return -1; return -1;
mic->mux_idx = i; mic->mux_idx = i;
mic->dmux_idx = -1;
if (spec->dmux_nids)
mic->dmux_idx = get_connection_index(codec,
spec->dmux_nids[0],
spec->mux_nids[0]);
} else if (spec->dmux_nids) { } else if (spec->dmux_nids) {
/* digital pin */ /* digital pin */
mic->mux_idx = 0;
i = get_connection_index(codec, spec->dmux_nids[0], pin); i = get_connection_index(codec, spec->dmux_nids[0], pin);
if (i < 0) if (i < 0)
return -1; return -1;
mic->dmux_idx = i; mic->dmux_idx = i;
mic->mux_idx = -1;
if (spec->mux_nids)
mic->mux_idx = get_connection_index(codec,
spec->mux_nids[0],
spec->dmux_nids[0]);
} }
return 0; return 0;
} }
...@@ -4557,11 +4565,11 @@ static void stac92xx_mic_detect(struct hda_codec *codec) ...@@ -4557,11 +4565,11 @@ static void stac92xx_mic_detect(struct hda_codec *codec)
mic = &spec->ext_mic; mic = &spec->ext_mic;
else else
mic = &spec->int_mic; mic = &spec->int_mic;
if (mic->dmux_idx) if (mic->dmux_idx >= 0)
snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0, snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0,
AC_VERB_SET_CONNECT_SEL, AC_VERB_SET_CONNECT_SEL,
mic->dmux_idx); mic->dmux_idx);
else if (mic->mux_idx >= 0)
snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0, snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0,
AC_VERB_SET_CONNECT_SEL, AC_VERB_SET_CONNECT_SEL,
mic->mux_idx); mic->mux_idx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment