ALSA: hda - VIA: Fix codec type for VT1708BCE at the right timing

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>

authored by Lydia Wang and committed by Takashi Iwai 0341ccd7 16922281

+5 -4
+5 -4
sound/pci/hda/patch_via.c
··· 159 159 #endif 160 160 }; 161 161 162 + static enum VIA_HDA_CODEC get_codec_type(struct hda_codec *codec); 162 163 static struct via_spec * via_new_spec(struct hda_codec *codec) 163 164 { 164 165 struct via_spec *spec; ··· 170 169 171 170 codec->spec = spec; 172 171 spec->codec = codec; 172 + spec->codec_type = get_codec_type(codec); 173 + /* VT1708BCE & VT1708S are almost same */ 174 + if (spec->codec_type == VT1708BCE) 175 + spec->codec_type = VT1708S; 173 176 return spec; 174 177 } 175 178 ··· 2208 2203 for (i = 0; i < spec->num_iverbs; i++) 2209 2204 snd_hda_sequence_write(codec, spec->init_verbs[i]); 2210 2205 2211 - spec->codec_type = get_codec_type(codec); 2212 - if (spec->codec_type == VT1708BCE) 2213 - spec->codec_type = VT1708S; /* VT1708BCE & VT1708S are almost 2214 - same */ 2215 2206 /* Lydia Add for EAPD enable */ 2216 2207 if (!spec->dig_in_nid) { /* No Digital In connection */ 2217 2208 if (spec->dig_in_pin) {