ALSA: hda - Fix DAC checks for VT2002P/1802/1812 codecs
authorLydia Wang <lydiawang@viatech.com.cn>
Fri, 8 Jul 2011 06:03:43 +0000 (14:03 +0800)
committerTakashi Iwai <tiwai@suse.de>
Fri, 8 Jul 2011 06:19:28 +0000 (08:19 +0200)
For VT2002P, VT1802 and VT1812 codecs, there're only two DACs. So smart51
control shouldn't be created.

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

index 8f59e0b5d477b3514a99d79d88f33da36fc2afa5..b289abf0db5507e0bb65b41ba252e6c27c806cc0 100644 (file)
@@ -1716,18 +1716,21 @@ static int via_auto_fill_dac_nids(struct hda_codec *codec)
 {
        struct via_spec *spec = codec->spec;
        const struct auto_pin_cfg *cfg = &spec->autocfg;
-       int i;
+       int i, dac_num;
        hda_nid_t nid;
 
        spec->multiout.dac_nids = spec->private_dac_nids;
-       spec->multiout.num_dacs = cfg->line_outs;
+       dac_num = 0;
        for (i = 0; i < cfg->line_outs; i++) {
                nid = cfg->line_out_pins[i];
                if (!nid)
                        continue;
-               if (parse_output_path(codec, nid, 0, &spec->out_path[i]))
+               if (parse_output_path(codec, nid, 0, &spec->out_path[i])) {
                        spec->private_dac_nids[i] = spec->out_path[i].path[0];
+                       dac_num++;
+               }
        }
+       spec->multiout.num_dacs = dac_num;
        return 0;
 }
 
@@ -1838,6 +1841,10 @@ static int via_auto_create_multi_out_ctls(struct hda_codec *codec)
        if (err < 0)
                return err;
 
+       if (spec->multiout.num_dacs < 3) {
+               spec->smart51_nums = 0;
+               cfg->line_outs = old_line_outs;
+       }
        for (i = 0; i < cfg->line_outs; i++) {
                hda_nid_t pin, dac;
                pin = cfg->line_out_pins[i];
@@ -3383,6 +3390,7 @@ static int patch_vt2002P(struct hda_codec *codec)
                return -ENOMEM;
 
        spec->aa_mix_nid = 0x21;
+       spec->dac_mixer_idx = 3;
        override_mic_boost(codec, 0x2b, 0, 3, 40);
        override_mic_boost(codec, 0x29, 0, 3, 40);