]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ALSA: hda - Initialize special cases for input src in init phase
authorTakashi Iwai <tiwai@suse.de>
Thu, 10 Mar 2011 11:51:11 +0000 (12:51 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 23 Mar 2011 20:03:56 +0000 (13:03 -0700)
commit 584c0c4c359bdac37d94157f8d7fc513d26c8328 upstream.

Currently some special handling for the unusual case like dual-ADCs
or a single-input-src is done in the tree-parse time in
set_capture_mixer().  But this setup could be overwritten by static
init verbs.

This patch moves the initialization into the init phase so that
such input-src setup won't be lost.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
sound/pci/hda/patch_realtek.c

index 2a1c4124f300b7c36dd869016e3856dd746812d1..acd209958ea2426fb0b61b88f80ab2174eb4a844 100644 (file)
@@ -394,6 +394,7 @@ struct alc_spec {
        /* other flags */
        unsigned int no_analog :1; /* digital I/O only */
        unsigned int dual_adc_switch:1; /* switch ADCs (for ALC275) */
+       unsigned int single_input_src:1;
        int init_amp;
        int codec_variant;      /* flag for other variants */
 
@@ -3919,6 +3920,8 @@ static struct hda_amp_list alc880_lg_loopbacks[] = {
  * Common callbacks
  */
 
+static void alc_init_special_input_src(struct hda_codec *codec);
+
 static int alc_init(struct hda_codec *codec)
 {
        struct alc_spec *spec = codec->spec;
@@ -3929,6 +3932,7 @@ static int alc_init(struct hda_codec *codec)
 
        for (i = 0; i < spec->num_init_verbs; i++)
                snd_hda_sequence_write(codec, spec->init_verbs[i]);
+       alc_init_special_input_src(codec);
 
        if (spec->init_hook)
                spec->init_hook(codec);
@@ -5590,6 +5594,7 @@ static void fixup_single_adc(struct hda_codec *codec)
                        spec->capsrc_nids += i;
                spec->adc_nids += i;
                spec->num_adc_nids = 1;
+               spec->single_input_src = 1;
        }
 }
 
@@ -5601,6 +5606,16 @@ static void fixup_dual_adc_switch(struct hda_codec *codec)
        init_capsrc_for_pin(codec, spec->int_mic.pin);
 }
 
+/* initialize some special cases for input sources */
+static void alc_init_special_input_src(struct hda_codec *codec)
+{
+       struct alc_spec *spec = codec->spec;
+       if (spec->dual_adc_switch)
+               fixup_dual_adc_switch(codec);
+       else if (spec->single_input_src)
+               init_capsrc_for_pin(codec, spec->autocfg.inputs[0].pin);
+}
+
 static void set_capture_mixer(struct hda_codec *codec)
 {
        struct alc_spec *spec = codec->spec;
@@ -5616,7 +5631,7 @@ static void set_capture_mixer(struct hda_codec *codec)
                int mux = 0;
                int num_adcs = spec->num_adc_nids;
                if (spec->dual_adc_switch)
-                       fixup_dual_adc_switch(codec);
+                       num_adcs = 1;
                else if (spec->auto_mic)
                        fixup_automic_adc(codec);
                else if (spec->input_mux) {
@@ -5625,8 +5640,6 @@ static void set_capture_mixer(struct hda_codec *codec)
                        else if (spec->input_mux->num_items == 1)
                                fixup_single_adc(codec);
                }
-               if (spec->dual_adc_switch)
-                       num_adcs = 1;
                spec->cap_mixer = caps[mux][num_adcs - 1];
        }
 }