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 #endif 160 }; 161 162 static struct via_spec * via_new_spec(struct hda_codec *codec) 163 { 164 struct via_spec *spec; ··· 170 171 codec->spec = spec; 172 spec->codec = codec; 173 return spec; 174 } 175 ··· 2208 for (i = 0; i < spec->num_iverbs; i++) 2209 snd_hda_sequence_write(codec, spec->init_verbs[i]); 2210 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 /* Lydia Add for EAPD enable */ 2216 if (!spec->dig_in_nid) { /* No Digital In connection */ 2217 if (spec->dig_in_pin) {
··· 159 #endif 160 }; 161 162 + static enum VIA_HDA_CODEC get_codec_type(struct hda_codec *codec); 163 static struct via_spec * via_new_spec(struct hda_codec *codec) 164 { 165 struct via_spec *spec; ··· 169 170 codec->spec = spec; 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; 176 return spec; 177 } 178 ··· 2203 for (i = 0; i < spec->num_iverbs; i++) 2204 snd_hda_sequence_write(codec, spec->init_verbs[i]); 2205 2206 /* Lydia Add for EAPD enable */ 2207 if (!spec->dig_in_nid) { /* No Digital In connection */ 2208 if (spec->dig_in_pin) {