aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-10-01 10:38:11 -0400
committerTakashi Iwai <tiwai@suse.de>2009-10-01 10:38:11 -0400
commit02d3332285377c9de395c2b5b792805d43923fd0 (patch)
tree6d835a3ddd8176427be24be9ddc6596585ceed27
parent3db6c037c6954ed6d98ef199938e4004fea96908 (diff)
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: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_sigmatel.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 826137ec3002..a9b26828a651 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -182,8 +182,8 @@ struct sigmatel_jack {
182 182
183struct sigmatel_mic_route { 183struct sigmatel_mic_route {
184 hda_nid_t pin; 184 hda_nid_t pin;
185 unsigned char mux_idx; 185 signed char mux_idx;
186 unsigned char dmux_idx; 186 signed char dmux_idx;
187}; 187};
188 188
189struct sigmatel_spec { 189struct sigmatel_spec {
@@ -3469,18 +3469,26 @@ static int set_mic_route(struct hda_codec *codec,
3469 break; 3469 break;
3470 if (i <= AUTO_PIN_FRONT_MIC) { 3470 if (i <= AUTO_PIN_FRONT_MIC) {
3471 /* analog pin */ 3471 /* analog pin */
3472 mic->dmux_idx = 0;
3473 i = get_connection_index(codec, spec->mux_nids[0], pin); 3472 i = get_connection_index(codec, spec->mux_nids[0], pin);
3474 if (i < 0) 3473 if (i < 0)
3475 return -1; 3474 return -1;
3476 mic->mux_idx = i; 3475 mic->mux_idx = i;
3476 mic->dmux_idx = -1;
3477 if (spec->dmux_nids)
3478 mic->dmux_idx = get_connection_index(codec,
3479 spec->dmux_nids[0],
3480 spec->mux_nids[0]);
3477 } else if (spec->dmux_nids) { 3481 } else if (spec->dmux_nids) {
3478 /* digital pin */ 3482 /* digital pin */
3479 mic->mux_idx = 0;
3480 i = get_connection_index(codec, spec->dmux_nids[0], pin); 3483 i = get_connection_index(codec, spec->dmux_nids[0], pin);
3481 if (i < 0) 3484 if (i < 0)
3482 return -1; 3485 return -1;
3483 mic->dmux_idx = i; 3486 mic->dmux_idx = i;
3487 mic->mux_idx = -1;
3488 if (spec->mux_nids)
3489 mic->mux_idx = get_connection_index(codec,
3490 spec->mux_nids[0],
3491 spec->dmux_nids[0]);
3484 } 3492 }
3485 return 0; 3493 return 0;
3486} 3494}
@@ -4557,11 +4565,11 @@ static void stac92xx_mic_detect(struct hda_codec *codec)
4557 mic = &spec->ext_mic; 4565 mic = &spec->ext_mic;
4558 else 4566 else
4559 mic = &spec->int_mic; 4567 mic = &spec->int_mic;
4560 if (mic->dmux_idx) 4568 if (mic->dmux_idx >= 0)
4561 snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0, 4569 snd_hda_codec_write_cache(codec, spec->dmux_nids[0], 0,
4562 AC_VERB_SET_CONNECT_SEL, 4570 AC_VERB_SET_CONNECT_SEL,
4563 mic->dmux_idx); 4571 mic->dmux_idx);
4564 else 4572 if (mic->mux_idx >= 0)
4565 snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0, 4573 snd_hda_codec_write_cache(codec, spec->mux_nids[0], 0,
4566 AC_VERB_SET_CONNECT_SEL, 4574 AC_VERB_SET_CONNECT_SEL,
4567 mic->mux_idx); 4575 mic->mux_idx);