Commit 5908589f authored by Herton Ronaldo Krzesinski's avatar Herton Ronaldo Krzesinski Committed by Takashi Iwai

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: default avatarHerton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 4f5d1706
...@@ -12232,32 +12232,40 @@ static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, ...@@ -12232,32 +12232,40 @@ static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec,
const struct auto_pin_cfg *cfg) const struct auto_pin_cfg *cfg)
{ {
struct hda_input_mux *imux = &spec->private_imux[0]; struct hda_input_mux *imux = &spec->private_imux[0];
int i, idx1; int i, idx1, dmic_nid;
for (i = 0; i < AUTO_PIN_LAST; i++) { dmic_nid = 0x12;
switch(cfg->input_pins[i]) { while (dmic_nid <= 0x13) {
case 0x18: for (i = 0; i < AUTO_PIN_LAST; i++) {
idx1 = 0; /* Mic 1 */ switch (cfg->input_pins[i]) {
break; case 0x18:
case 0x19: idx1 = 0; /* Mic 1 */
idx1 = 1; /* Mic 2 */ break;
break; case 0x19:
case 0x1a: idx1 = 1; /* Mic 2 */
idx1 = 2; /* Line In */ break;
break; case 0x1a:
case 0x1c: idx1 = 2; /* Line In */
idx1 = 3; /* CD */ break;
break; case 0x1c:
case 0x12: idx1 = 3; /* CD */
case 0x13: break;
idx1 = 6; /* digital mics */ case 0x12:
break; case 0x13:
default: if (cfg->input_pins[i] != dmic_nid)
continue; continue;
idx1 = 6; /* digital mics */
break;
default:
continue;
}
imux->items[imux->num_items].label =
auto_pin_cfg_labels[i];
imux->items[imux->num_items].index = idx1;
imux->num_items++;
} }
imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; imux++;
imux->items[imux->num_items].index = idx1; dmic_nid++;
imux->num_items++;
} }
return 0; return 0;
} }
...@@ -12355,7 +12363,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec) ...@@ -12355,7 +12363,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
add_mixer(spec, alc268_beep_mixer); add_mixer(spec, alc268_beep_mixer);
add_verb(spec, alc268_volume_init_verbs); add_verb(spec, alc268_volume_init_verbs);
spec->num_mux_defs = 1; spec->num_mux_defs = 2;
spec->input_mux = &spec->private_imux[0]; spec->input_mux = &spec->private_imux[0];
err = alc_auto_add_mic_boost(codec); err = alc_auto_add_mic_boost(codec);
...@@ -12665,6 +12673,8 @@ static int patch_alc268(struct hda_codec *codec) ...@@ -12665,6 +12673,8 @@ static int patch_alc268(struct hda_codec *codec)
for (i = 0; i < spec->num_adc_nids; i++) for (i = 0; i < spec->num_adc_nids; i++)
snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
0, AC_VERB_SET_CONNECT_SEL, 0, AC_VERB_SET_CONNECT_SEL,
i < spec->num_mux_defs ?
spec->input_mux[i].items[0].index :
spec->input_mux->items[0].index); spec->input_mux->items[0].index);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment