diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-08-29 09:07:11 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:59:33 -0400 |
commit | 776e184e8082a4ec9bf4fe18b11dae6dc4e43d1f (patch) | |
tree | a4740ec372784e1064a7ef88e3e25604229fd70c /sound/pci/hda/patch_realtek.c | |
parent | 2d4a485b3d02fe65b0a0bcec3c53760c17bdece3 (diff) |
[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>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 68 |
1 files changed, 60 insertions, 8 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index b108ea3d99b3..b3062afc481c 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -5782,6 +5782,32 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec) | |||
5782 | } | 5782 | } |
5783 | } | 5783 | } |
5784 | 5784 | ||
5785 | /* add mic boosts if needed */ | ||
5786 | static int alc_auto_add_mic_boost(struct hda_codec *codec) | ||
5787 | { | ||
5788 | struct alc_spec *spec = codec->spec; | ||
5789 | int err; | ||
5790 | hda_nid_t nid; | ||
5791 | |||
5792 | nid = spec->autocfg.input_pins[AUTO_PIN_MIC]; | ||
5793 | if (nid) { | ||
5794 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
5795 | "Mic Boost", | ||
5796 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | ||
5797 | if (err < 0) | ||
5798 | return err; | ||
5799 | } | ||
5800 | nid = spec->autocfg.input_pins[AUTO_PIN_FRONT_MIC]; | ||
5801 | if (nid) { | ||
5802 | err = add_control(spec, ALC_CTL_WIDGET_VOL, | ||
5803 | "Front Mic Boost", | ||
5804 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_INPUT)); | ||
5805 | if (err < 0) | ||
5806 | return err; | ||
5807 | } | ||
5808 | return 0; | ||
5809 | } | ||
5810 | |||
5785 | /* almost identical with ALC880 parser... */ | 5811 | /* almost identical with ALC880 parser... */ |
5786 | static int alc882_parse_auto_config(struct hda_codec *codec) | 5812 | static int alc882_parse_auto_config(struct hda_codec *codec) |
5787 | { | 5813 | { |
@@ -5790,10 +5816,17 @@ static int alc882_parse_auto_config(struct hda_codec *codec) | |||
5790 | 5816 | ||
5791 | if (err < 0) | 5817 | if (err < 0) |
5792 | return err; | 5818 | return err; |
5793 | else if (err > 0) | 5819 | else if (!err) |
5794 | /* hack - override the init verbs */ | 5820 | return 0; /* no config found */ |
5795 | spec->init_verbs[0] = alc882_auto_init_verbs; | 5821 | |
5796 | return err; | 5822 | err = alc_auto_add_mic_boost(codec); |
5823 | if (err < 0) | ||
5824 | return err; | ||
5825 | |||
5826 | /* hack - override the init verbs */ | ||
5827 | spec->init_verbs[0] = alc882_auto_init_verbs; | ||
5828 | |||
5829 | return 1; /* config found */ | ||
5797 | } | 5830 | } |
5798 | 5831 | ||
5799 | /* additional initialization for auto-configuration model */ | 5832 | /* additional initialization for auto-configuration model */ |
@@ -7270,12 +7303,19 @@ static int alc883_parse_auto_config(struct hda_codec *codec) | |||
7270 | 7303 | ||
7271 | if (err < 0) | 7304 | if (err < 0) |
7272 | return err; | 7305 | return err; |
7273 | else if (err > 0) | 7306 | else if (!err) |
7274 | /* hack - override the init verbs */ | 7307 | return 0; /* no config found */ |
7275 | spec->init_verbs[0] = alc883_auto_init_verbs; | 7308 | |
7309 | err = alc_auto_add_mic_boost(codec); | ||
7310 | if (err < 0) | ||
7311 | return err; | ||
7312 | |||
7313 | /* hack - override the init verbs */ | ||
7314 | spec->init_verbs[0] = alc883_auto_init_verbs; | ||
7276 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; | 7315 | spec->mixers[spec->num_mixers] = alc883_capture_mixer; |
7277 | spec->num_mixers++; | 7316 | spec->num_mixers++; |
7278 | return err; | 7317 | |
7318 | return 1; /* config found */ | ||
7279 | } | 7319 | } |
7280 | 7320 | ||
7281 | /* additional initialization for auto-configuration model */ | 7321 | /* additional initialization for auto-configuration model */ |
@@ -8184,6 +8224,10 @@ static int alc262_parse_auto_config(struct hda_codec *codec) | |||
8184 | spec->num_mux_defs = 1; | 8224 | spec->num_mux_defs = 1; |
8185 | spec->input_mux = &spec->private_imux; | 8225 | spec->input_mux = &spec->private_imux; |
8186 | 8226 | ||
8227 | err = alc_auto_add_mic_boost(codec); | ||
8228 | if (err < 0) | ||
8229 | return err; | ||
8230 | |||
8187 | return 1; | 8231 | return 1; |
8188 | } | 8232 | } |
8189 | 8233 | ||
@@ -8957,6 +9001,10 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
8957 | spec->num_mux_defs = 1; | 9001 | spec->num_mux_defs = 1; |
8958 | spec->input_mux = &spec->private_imux; | 9002 | spec->input_mux = &spec->private_imux; |
8959 | 9003 | ||
9004 | err = alc_auto_add_mic_boost(codec); | ||
9005 | if (err < 0) | ||
9006 | return err; | ||
9007 | |||
8960 | return 1; | 9008 | return 1; |
8961 | } | 9009 | } |
8962 | 9010 | ||
@@ -11173,6 +11221,10 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) | |||
11173 | spec->num_mux_defs = 1; | 11221 | spec->num_mux_defs = 1; |
11174 | spec->input_mux = &spec->private_imux; | 11222 | spec->input_mux = &spec->private_imux; |
11175 | 11223 | ||
11224 | err = alc_auto_add_mic_boost(codec); | ||
11225 | if (err < 0) | ||
11226 | return err; | ||
11227 | |||
11176 | return 1; | 11228 | return 1; |
11177 | } | 11229 | } |
11178 | 11230 | ||