aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorHerton Ronaldo Krzesinski <herton@mandriva.com.br>2009-08-11 21:33:09 -0400
committerTakashi Iwai <tiwai@suse.de>2009-08-12 01:35:02 -0400
commit5908589f318835f515bf94829650d36dcb2d9024 (patch)
tree6915b2874a4029732448e7f59d752878a8387be1 /sound
parent4f5d17062085ee1c74ff44a37ffb09f94ab4db1c (diff)
ALSA: hda - fix noise issue when recording from digital mic with alc268
With auto config model of alc268 realtek codec, it allows to select any of possible available digital microphone inputs when only one is available. For example, when only digital mic in nid 0x12 is available, on second input source it will allow you to select unavailable digital mic in nid 0x13. The problem is that selecting unavailable digital mic creates a source of noise when recording (I'm not sure if this happens on all machines with alc268 and only one digital mic input, but testing on a quanta uw1 netbook a lot of noise is introduced in recording from digital mic 0x12/first input source, when you select the unavailable digital mic 0x13 for capture source 0x24 in the second input source in mixer). Then to avoid noise when recording from digital mic with auto model in this case, prevent a digital mic input source to be selected if microphone is not available. Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_realtek.c62
1 files changed, 36 insertions, 26 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index ac3207efe106..7ff293458f6f 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -12232,32 +12232,40 @@ static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
12232 const struct auto_pin_cfg *cfg) 12232 const struct auto_pin_cfg *cfg)
12233{ 12233{
12234 struct hda_input_mux *imux = &spec->private_imux[0]; 12234 struct hda_input_mux *imux = &spec->private_imux[0];
12235 int i, idx1; 12235 int i, idx1, dmic_nid;
12236 12236
12237 for (i = 0; i < AUTO_PIN_LAST; i++) { 12237 dmic_nid = 0x12;
12238 switch(cfg->input_pins[i]) { 12238 while (dmic_nid <= 0x13) {
12239 case 0x18: 12239 for (i = 0; i < AUTO_PIN_LAST; i++) {
12240 idx1 = 0; /* Mic 1 */ 12240 switch (cfg->input_pins[i]) {
12241 break; 12241 case 0x18:
12242 case 0x19: 12242 idx1 = 0; /* Mic 1 */
12243 idx1 = 1; /* Mic 2 */ 12243 break;
12244 break; 12244 case 0x19:
12245 case 0x1a: 12245 idx1 = 1; /* Mic 2 */
12246 idx1 = 2; /* Line In */ 12246 break;
12247 break; 12247 case 0x1a:
12248 case 0x1c: 12248 idx1 = 2; /* Line In */
12249 idx1 = 3; /* CD */ 12249 break;
12250 break; 12250 case 0x1c:
12251 case 0x12: 12251 idx1 = 3; /* CD */
12252 case 0x13: 12252 break;
12253 idx1 = 6; /* digital mics */ 12253 case 0x12:
12254 break; 12254 case 0x13:
12255 default: 12255 if (cfg->input_pins[i] != dmic_nid)
12256 continue; 12256 continue;
12257 idx1 = 6; /* digital mics */
12258 break;
12259 default:
12260 continue;
12261 }
12262 imux->items[imux->num_items].label =
12263 auto_pin_cfg_labels[i];
12264 imux->items[imux->num_items].index = idx1;
12265 imux->num_items++;
12257 } 12266 }
12258 imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; 12267 imux++;
12259 imux->items[imux->num_items].index = idx1; 12268 dmic_nid++;
12260 imux->num_items++;
12261 } 12269 }
12262 return 0; 12270 return 0;
12263} 12271}
@@ -12355,7 +12363,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
12355 add_mixer(spec, alc268_beep_mixer); 12363 add_mixer(spec, alc268_beep_mixer);
12356 12364
12357 add_verb(spec, alc268_volume_init_verbs); 12365 add_verb(spec, alc268_volume_init_verbs);
12358 spec->num_mux_defs = 1; 12366 spec->num_mux_defs = 2;
12359 spec->input_mux = &spec->private_imux[0]; 12367 spec->input_mux = &spec->private_imux[0];
12360 12368
12361 err = alc_auto_add_mic_boost(codec); 12369 err = alc_auto_add_mic_boost(codec);
@@ -12665,6 +12673,8 @@ static int patch_alc268(struct hda_codec *codec)
12665 for (i = 0; i < spec->num_adc_nids; i++) 12673 for (i = 0; i < spec->num_adc_nids; i++)
12666 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], 12674 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
12667 0, AC_VERB_SET_CONNECT_SEL, 12675 0, AC_VERB_SET_CONNECT_SEL,
12676 i < spec->num_mux_defs ?
12677 spec->input_mux[i].items[0].index :
12668 spec->input_mux->items[0].index); 12678 spec->input_mux->items[0].index);
12669 } 12679 }
12670 12680