]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ALSA: hda - Support multiple digital outs with auto-probing
authorTakashi Iwai <tiwai@suse.de>
Fri, 13 Feb 2009 10:19:09 +0000 (11:19 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 13 Feb 2009 10:59:33 +0000 (11:59 +0100)
Added the support of multiple digital outputs via auto-probing for
Realtek ALC88x codecs.  The multiple outputs are handled as slave
streams, so only one PCM stream (and the corresponding IEC958*
elements) is provided to control both digital outputs.

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

index ef9b7ee34100bb217dfdb33bb208aebc7a7617c6..244de597c5be67020496b839fd2ed74a72175708 100644 (file)
@@ -279,6 +279,7 @@ struct alc_spec {
                                         * dig_out_nid and hp_nid are optional
                                         */
        hda_nid_t alt_dac_nid;
+       hda_nid_t slave_dig_outs[3];    /* optional - for auto-parsing */
        int dig_out_type;
 
        /* capture */
@@ -4269,7 +4270,7 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec)
 static int alc880_parse_auto_config(struct hda_codec *codec)
 {
        struct alc_spec *spec = codec->spec;
-       int err;
+       int i, err;
        static hda_nid_t alc880_ignore[] = { 0x1d, 0 };
 
        err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
@@ -4300,8 +4301,23 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
 
        spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
-       if (spec->autocfg.dig_outs)
-               spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
+       /* check multiple SPDIF-out (for recent codecs) */
+       for (i = 0; i < spec->autocfg.dig_outs; i++) {
+               hda_nid_t dig_nid;
+               err = snd_hda_get_connections(codec,
+                                             spec->autocfg.dig_out_pins[i],
+                                             &dig_nid, 1);
+               if (err < 0)
+                       continue;
+               if (!i)
+                       spec->multiout.dig_out_nid = dig_nid;
+               else {
+                       spec->multiout.slave_dig_outs = spec->slave_dig_outs;
+                       spec->slave_dig_outs[i - 1] = dig_nid;
+                       if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
+                               break;
+               }
+       }
        if (spec->autocfg.dig_in_pin)
                spec->dig_in_nid = ALC880_DIGIN_NID;