Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=776e184e8082a4ec9bf4fe18b11dae6dc4e43d1f
Commit:     776e184e8082a4ec9bf4fe18b11dae6dc4e43d1f
Parent:     2d4a485b3d02fe65b0a0bcec3c53760c17bdece3
Author:     Takashi Iwai <[EMAIL PROTECTED]>
AuthorDate: Wed Aug 29 15:07:11 2007 +0200
Committer:  Jaroslav Kysela <[EMAIL PROTECTED]>
CommitDate: Tue Oct 16 15:59:33 2007 +0200

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Jaroslav Kysela <[EMAIL PROTECTED]>
---
 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 b108ea3..b3062af 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)
        }
 }
 
+/* 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)
-               /* hack - override the init verbs */
-               spec->init_verbs[0] = alc882_auto_init_verbs;
-       return err;
+       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 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)
-               /* hack - override the init verbs */
-               spec->init_verbs[0] = alc883_auto_init_verbs;
+       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;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to