ALSA: hda - VIA: Fix codec type for VT1708BCE at the right timing
authorLydia Wang <lydiawang@viatech.com.cn>
Tue, 22 Mar 2011 08:25:03 +0000 (16:25 +0800)
committerTakashi Iwai <tiwai@suse.de>
Tue, 22 Mar 2011 11:54:32 +0000 (12:54 +0100)
Add get_codec_type() in via_new_spec() function to make sure getting
correct codec type before building mixer controls.

Signed-off-by: Lydia Wang <lydiawang@viatech.com.cn>
Cc: <stable@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_via.c

index 299a18b..269bb36 100644 (file)
@@ -159,6 +159,7 @@ struct via_spec {
 #endif
 };
 
+static enum VIA_HDA_CODEC get_codec_type(struct hda_codec *codec);
 static struct via_spec * via_new_spec(struct hda_codec *codec)
 {
        struct via_spec *spec;
@@ -169,6 +170,10 @@ static struct via_spec * via_new_spec(struct hda_codec *codec)
 
        codec->spec = spec;
        spec->codec = codec;
+       spec->codec_type = get_codec_type(codec);
+       /* VT1708BCE & VT1708S are almost same */
+       if (spec->codec_type == VT1708BCE)
+               spec->codec_type = VT1708S;
        return spec;
 }
 
@@ -2203,10 +2208,6 @@ static int via_init(struct hda_codec *codec)
        for (i = 0; i < spec->num_iverbs; i++)
                snd_hda_sequence_write(codec, spec->init_verbs[i]);
 
-       spec->codec_type = get_codec_type(codec);
-       if (spec->codec_type == VT1708BCE)
-               spec->codec_type = VT1708S; /* VT1708BCE & VT1708S are almost
-                                              same */
        /* Lydia Add for EAPD enable */
        if (!spec->dig_in_nid) { /* No Digital In connection */
                if (spec->dig_in_pin) {