1 From 02d3332285377c9de395c2b5b792805d43923fd0 Mon Sep 17 00:00:00 2001
2 From: Takashi Iwai <tiwai@suse.de>
3 Date: Thu, 1 Oct 2009 16:38:11 +0200
4 Subject: ALSA: hda - Fix digita/analog mic auto-switching with IDT codecs
5 Patch-mainline: 2.6.32-rc1
8 When the auto-mic switching between an analog and a digital mic is
9 needed with IDT codecs, the current driver doesn't reset the connection
12 This patch fixes the behavior by checking both mux connections properly.
14 Signed-off-by: Takashi Iwai <tiwai@suse.de>
17 sound/pci/hda/patch_sigmatel.c | 20 ++++++++++++++------
18 1 file changed, 14 insertions(+), 6 deletions(-)
20 --- a/sound/pci/hda/patch_sigmatel.c
21 +++ b/sound/pci/hda/patch_sigmatel.c
24 struct sigmatel_mic_route {
26 - unsigned char mux_idx;
27 - unsigned char dmux_idx;
28 + signed char mux_idx;
29 + signed char dmux_idx;
32 struct sigmatel_spec {
33 @@ -3326,18 +3326,26 @@
35 if (i <= AUTO_PIN_FRONT_MIC) {
38 i = get_connection_index(codec, spec->mux_nids[0], pin);
43 + if (spec->dmux_nids)
44 + mic->dmux_idx = get_connection_index(codec,
47 } else if (spec->dmux_nids) {
50 i = get_connection_index(codec, spec->dmux_nids[0], pin);
56 + mic->mux_idx = get_connection_index(codec,
58 + spec->dmux_nids[0]);
62 @@ -4290,11 +4298,11 @@
67 + if (mic->dmux_idx >= 0)
68 snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0,
69 AC_VERB_SET_CONNECT_SEL,
72 + if (mic->mux_idx >= 0)
73 snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0,
74 AC_VERB_SET_CONNECT_SEL,