Commit 776e184e authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[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: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 2d4a485b
...@@ -5782,6 +5782,32 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec) ...@@ -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... */ /* almost identical with ALC880 parser... */
static int alc882_parse_auto_config(struct hda_codec *codec) static int alc882_parse_auto_config(struct hda_codec *codec)
{ {
...@@ -5790,10 +5816,17 @@ 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) if (err < 0)
return err; 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 */ /* hack - override the init verbs */
spec->init_verbs[0] = alc882_auto_init_verbs; spec->init_verbs[0] = alc882_auto_init_verbs;
return err;
return 1; /* config found */
} }
/* additional initialization for auto-configuration model */ /* additional initialization for auto-configuration model */
...@@ -7270,12 +7303,19 @@ static int alc883_parse_auto_config(struct hda_codec *codec) ...@@ -7270,12 +7303,19 @@ static int alc883_parse_auto_config(struct hda_codec *codec)
if (err < 0) if (err < 0)
return err; 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 */ /* hack - override the init verbs */
spec->init_verbs[0] = alc883_auto_init_verbs; spec->init_verbs[0] = alc883_auto_init_verbs;
spec->mixers[spec->num_mixers] = alc883_capture_mixer; spec->mixers[spec->num_mixers] = alc883_capture_mixer;
spec->num_mixers++; spec->num_mixers++;
return err;
return 1; /* config found */
} }
/* additional initialization for auto-configuration model */ /* additional initialization for auto-configuration model */
...@@ -8184,6 +8224,10 @@ static int alc262_parse_auto_config(struct hda_codec *codec) ...@@ -8184,6 +8224,10 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
spec->num_mux_defs = 1; spec->num_mux_defs = 1;
spec->input_mux = &spec->private_imux; spec->input_mux = &spec->private_imux;
err = alc_auto_add_mic_boost(codec);
if (err < 0)
return err;
return 1; return 1;
} }
...@@ -8957,6 +9001,10 @@ static int alc268_parse_auto_config(struct hda_codec *codec) ...@@ -8957,6 +9001,10 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
spec->num_mux_defs = 1; spec->num_mux_defs = 1;
spec->input_mux = &spec->private_imux; spec->input_mux = &spec->private_imux;
err = alc_auto_add_mic_boost(codec);
if (err < 0)
return err;
return 1; return 1;
} }
...@@ -11173,6 +11221,10 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) ...@@ -11173,6 +11221,10 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
spec->num_mux_defs = 1; spec->num_mux_defs = 1;
spec->input_mux = &spec->private_imux; spec->input_mux = &spec->private_imux;
err = alc_auto_add_mic_boost(codec);
if (err < 0)
return err;
return 1; return 1;
} }
......
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