Skip to content

Commit

Permalink
ALSA: hda - Fix digita/analog mic auto-switching with IDT codecs
Browse files Browse the repository at this point in the history
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: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Oct 1, 2009
1 parent 3db6c03 commit 02d3332
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions sound/pci/hda/patch_sigmatel.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ struct sigmatel_jack {

struct sigmatel_mic_route {
hda_nid_t pin;
unsigned char mux_idx;
unsigned char dmux_idx;
signed char mux_idx;
signed char dmux_idx;
};

struct sigmatel_spec {
Expand Down Expand Up @@ -3469,18 +3469,26 @@ static int set_mic_route(struct hda_codec *codec,
break;
if (i <= AUTO_PIN_FRONT_MIC) {
/* analog pin */
mic->dmux_idx = 0;
i = get_connection_index(codec, spec->mux_nids[0], pin);
if (i < 0)
return -1;
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) {
/* digital pin */
mic->mux_idx = 0;
i = get_connection_index(codec, spec->dmux_nids[0], pin);
if (i < 0)
return -1;
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;
}
Expand Down Expand Up @@ -4557,11 +4565,11 @@ static void stac92xx_mic_detect(struct hda_codec *codec)
mic = &spec->ext_mic;
else
mic = &spec->int_mic;
if (mic->dmux_idx)
if (mic->dmux_idx >= 0)
snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0,
AC_VERB_SET_CONNECT_SEL,
mic->dmux_idx);
else
if (mic->mux_idx >= 0)
snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0,
AC_VERB_SET_CONNECT_SEL,
mic->mux_idx);
Expand Down

0 comments on commit 02d3332

Please sign in to comment.