]>
Commit | Line | Data |
---|---|---|
82094b55 AF |
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 | |
6 | References: bnc#511306 | |
7 | ||
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 | |
10 | of the digital mux. | |
11 | ||
12 | This patch fixes the behavior by checking both mux connections properly. | |
13 | ||
14 | Signed-off-by: Takashi Iwai <tiwai@suse.de> | |
15 | ||
16 | --- | |
17 | sound/pci/hda/patch_sigmatel.c | 20 ++++++++++++++------ | |
18 | 1 file changed, 14 insertions(+), 6 deletions(-) | |
19 | ||
20 | --- a/sound/pci/hda/patch_sigmatel.c | |
21 | +++ b/sound/pci/hda/patch_sigmatel.c | |
22 | @@ -176,8 +176,8 @@ | |
23 | ||
24 | struct sigmatel_mic_route { | |
25 | hda_nid_t pin; | |
26 | - unsigned char mux_idx; | |
27 | - unsigned char dmux_idx; | |
28 | + signed char mux_idx; | |
29 | + signed char dmux_idx; | |
30 | }; | |
31 | ||
32 | struct sigmatel_spec { | |
33 | @@ -3326,18 +3326,26 @@ | |
34 | break; | |
35 | if (i <= AUTO_PIN_FRONT_MIC) { | |
36 | /* analog pin */ | |
37 | - mic->dmux_idx = 0; | |
38 | i = get_connection_index(codec, spec->mux_nids[0], pin); | |
39 | if (i < 0) | |
40 | return -1; | |
41 | mic->mux_idx = i; | |
42 | + mic->dmux_idx = -1; | |
43 | + if (spec->dmux_nids) | |
44 | + mic->dmux_idx = get_connection_index(codec, | |
45 | + spec->dmux_nids[0], | |
46 | + spec->mux_nids[0]); | |
47 | } else if (spec->dmux_nids) { | |
48 | /* digital pin */ | |
49 | - mic->mux_idx = 0; | |
50 | i = get_connection_index(codec, spec->dmux_nids[0], pin); | |
51 | if (i < 0) | |
52 | return -1; | |
53 | mic->dmux_idx = i; | |
54 | + mic->mux_idx = -1; | |
55 | + if (spec->mux_nids) | |
56 | + mic->mux_idx = get_connection_index(codec, | |
57 | + spec->mux_nids[0], | |
58 | + spec->dmux_nids[0]); | |
59 | } | |
60 | return 0; | |
61 | } | |
62 | @@ -4290,11 +4298,11 @@ | |
63 | mic = &spec->ext_mic; | |
64 | else | |
65 | mic = &spec->int_mic; | |
66 | - if (mic->dmux_idx) | |
67 | + if (mic->dmux_idx >= 0) | |
68 | snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0, | |
69 | AC_VERB_SET_CONNECT_SEL, | |
70 | mic->dmux_idx); | |
71 | - else | |
72 | + if (mic->mux_idx >= 0) | |
73 | snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0, | |
74 | AC_VERB_SET_CONNECT_SEL, | |
75 | mic->mux_idx); |