[ALSA] hda-codec - Add Mic Boost control with auto-configuration

Some codecs need Mic Boost mixer controls for obtaining a proper recording
level, but the auto-configuration doesn't create them.
This patch adds the creation of mic-boost controls on corresponding codecs.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
This commit is contained in:
Takashi Iwai 2007-08-29 15:07:11 +02:00 committed by Jaroslav Kysela
parent 2d4a485b3d
commit 776e184e80

View file

@ -5782,6 +5782,32 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec)
}
}
/* add mic boosts if needed */
static int alc_auto_add_mic_boost(struct hda_codec *codec)
{
struct alc_spec *spec = codec->spec;
int err;
hda_nid_t nid;
nid = spec->autocfg.input_pins[AUTO_PIN_MIC];
if (nid) {
err = add_control(spec, ALC_CTL_WIDGET_VOL,
"Mic Boost",
HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
if (err < 0)
return err;
}
nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC];
if (nid) {
err = add_control(spec, ALC_CTL_WIDGET_VOL,
"Front Mic Boost",
HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT));
if (err < 0)
return err;
}
return 0;
}
/* almost identical with ALC880 parser... */
static int alc882_parse_auto_config(struct hda_codec *codec)
{
@ -5790,10 +5816,17 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
if (err < 0)
return err;
else if (err > 0)
else if (!err)
return 0; /* no config found */
err = alc_auto_add_mic_boost(codec);
if (err < 0)
return err;
/* hack - override the init verbs */
spec->init_verbs[0] = alc882_auto_init_verbs;
return err;
return 1; /* config found */
}
/* additional initialization for auto-configuration model */
@ -7270,12 +7303,19 @@ static int alc883_parse_auto_config(struct hda_codec *codec)
if (err < 0)
return err;
else if (err > 0)
else if (!err)
return 0; /* no config found */
err = alc_auto_add_mic_boost(codec);
if (err < 0)
return err;
/* hack - override the init verbs */
spec->init_verbs[0] = alc883_auto_init_verbs;
spec->mixers[spec->num_mixers] = alc883_capture_mixer;
spec->num_mixers++;
return err;
return 1; /* config found */
}
/* additional initialization for auto-configuration model */
@ -8184,6 +8224,10 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
spec->num_mux_defs = 1;
spec->input_mux = &spec->private_imux;
err = alc_auto_add_mic_boost(codec);
if (err < 0)
return err;
return 1;
}
@ -8957,6 +9001,10 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
spec->num_mux_defs = 1;
spec->input_mux = &spec->private_imux;
err = alc_auto_add_mic_boost(codec);
if (err < 0)
return err;
return 1;
}
@ -11173,6 +11221,10 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
spec->num_mux_defs = 1;
spec->input_mux = &spec->private_imux;
err = alc_auto_add_mic_boost(codec);
if (err < 0)
return err;
return 1;
}