ALSA: hda - Detect multiple digital-out pins
authorTakashi Iwai <tiwai@suse.de>
Wed, 11 Feb 2009 10:35:15 +0000 (11:35 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 11 Feb 2009 23:04:19 +0000 (00:04 +0100)
Detect multiple digital-out pins in snd_hda_parse_pin_defconfig().
The dig_out_pin and dig_out_type fields become arrays.

The codec parser still doesn't use this multiple pins detection, though.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_local.h
sound/pci/hda/patch_analog.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_sigmatel.c
sound/pci/hda/patch_via.c

index 95f10aec7a069aa68946a370b31f9defa16fe7cd..29eeb748561d5be536848a25d1b73288e6c8b9ae 100644 (file)
@@ -3423,11 +3423,13 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
                        break;
                case AC_JACK_SPDIF_OUT:
                case AC_JACK_DIG_OTHER_OUT:
-                       cfg->dig_out_pin = nid;
-                       if (loc == AC_JACK_LOC_HDMI)
-                               cfg->dig_out_type = HDA_PCM_TYPE_HDMI;
-                       else
-                               cfg->dig_out_type = HDA_PCM_TYPE_SPDIF;
+                       if (cfg->dig_outs >= ARRAY_SIZE(cfg->dig_out_pins))
+                               continue;
+                       cfg->dig_out_pins[cfg->dig_outs] = nid;
+                       cfg->dig_out_type[cfg->dig_outs] =
+                               (loc == AC_JACK_LOC_HDMI) ?
+                               HDA_PCM_TYPE_HDMI : HDA_PCM_TYPE_SPDIF;
+                       cfg->dig_outs++;
                        break;
                case AC_JACK_SPDIF_IN:
                case AC_JACK_DIG_OTHER_IN:
@@ -3541,8 +3543,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
                   cfg->hp_pins[1], cfg->hp_pins[2],
                   cfg->hp_pins[3], cfg->hp_pins[4]);
        snd_printd("   mono: mono_out=0x%x\n", cfg->mono_out_pin);
-       if (cfg->dig_out_pin)
-               snd_printd("   dig-out=0x%x\n", cfg->dig_out_pin);
+       if (cfg->dig_outs)
+               snd_printd("   dig-out=0x%x/0x%x\n",
+                          cfg->dig_out_pins[0], cfg->dig_out_pins[1]);
        snd_printd("   inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x,"
                   " cd=0x%x, aux=0x%x\n",
                   cfg->input_pins[AUTO_PIN_MIC],
index 4086491ed33a414ec4356585c30926c181e222b4..2ae6b53a46283a23fb1ba764e95008033f9628e3 100644 (file)
@@ -355,10 +355,11 @@ struct auto_pin_cfg {
        int line_out_type;      /* AUTO_PIN_XXX_OUT */
        hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
        hda_nid_t input_pins[AUTO_PIN_LAST];
-       hda_nid_t dig_out_pin;
+       int dig_outs;
+       hda_nid_t dig_out_pins[2];
        hda_nid_t dig_in_pin;
        hda_nid_t mono_out_pin;
-       int dig_out_type; /* HDA_PCM_TYPE_XXX */
+       int dig_out_type[2]; /* HDA_PCM_TYPE_XXX */
        int dig_in_type; /* HDA_PCM_TYPE_XXX */
 };
 
index 6106dfe8ec04ebec28edc7be255cfde7259e2d3b..d58c32b5b433a248c22be70f6fc035286c584ca0 100644 (file)
@@ -2898,7 +2898,7 @@ static int ad1988_parse_auto_config(struct hda_codec *codec)
 
        spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = AD1988_SPDIF_OUT;
        if (spec->autocfg.dig_in_pin)
                spec->dig_in_nid = AD1988_SPDIF_IN;
index 1db99df79502348b6fbadcba20c5a0cbdb68251c..e46251bceb9d952805d87cdcf3cae47e4a86d49b 100644 (file)
@@ -4291,7 +4291,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
 
        spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
        if (spec->autocfg.dig_in_pin)
                spec->dig_in_nid = ALC880_DIGIN_NID;
@@ -5658,7 +5658,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec)
 
        spec->multiout.max_channels = 2;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = ALC260_DIGOUT_NID;
        if (spec->kctls.list)
                add_mixer(spec, spec->kctls.list);
@@ -10626,7 +10626,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
        if (err < 0)
                return err;
        if (!spec->autocfg.line_outs) {
-               if (spec->autocfg.dig_out_pin || spec->autocfg.dig_in_pin) {
+               if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) {
                        spec->multiout.max_channels = 2;
                        spec->no_analog = 1;
                        goto dig_only;
@@ -10643,9 +10643,9 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
        spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
  dig_only:
-       if (spec->autocfg.dig_out_pin) {
+       if (spec->autocfg.dig_outs) {
                spec->multiout.dig_out_nid = ALC262_DIGOUT_NID;
-               spec->dig_out_type = spec->autocfg.dig_out_type;
+               spec->dig_out_type = spec->autocfg.dig_out_type[0];
        }
        if (spec->autocfg.dig_in_pin)
                spec->dig_in_nid = ALC262_DIGIN_NID;
@@ -11807,7 +11807,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
        spec->multiout.max_channels = 2;
 
        /* digital only support output */
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = ALC268_DIGOUT_NID;
 
        if (spec->kctls.list)
@@ -12722,7 +12722,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
 
        spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = ALC269_DIGOUT_NID;
 
        if (spec->kctls.list)
@@ -13779,7 +13779,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec)
 
        spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = ALC861_DIGOUT_NID;
 
        if (spec->kctls.list)
@@ -14881,7 +14881,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)
 
        spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID;
 
        if (spec->kctls.list)
@@ -16689,7 +16689,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec)
 
        spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
 
        if (spec->kctls.list)
index 12b30884843b4cf8703f3fecd8b3863e3120cc8c..1882c5735879a2bfb8e721843af63a6ad0ef6163 100644 (file)
@@ -2546,7 +2546,7 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
                codec->num_pcms++;
                info++;
                info->name = "STAC92xx Digital";
-               info->pcm_type = spec->autocfg.dig_out_type;
+               info->pcm_type = spec->autocfg.dig_out_type[0];
                if (spec->multiout.dig_out_nid) {
                        info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback;
                        info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid;
@@ -3706,7 +3706,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
        if (spec->multiout.max_channels > 2)
                spec->surr_switch = 1;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = dig_out;
        if (dig_in && spec->autocfg.dig_in_pin)
                spec->dig_in_nid = dig_in;
@@ -3819,7 +3819,7 @@ static int stac9200_parse_auto_config(struct hda_codec *codec)
        if (err < 0)
                return err;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = 0x05;
        if (spec->autocfg.dig_in_pin)
                spec->dig_in_nid = 0x04;
@@ -4069,8 +4069,8 @@ static int stac92xx_init(struct hda_codec *codec)
        for (i = 0; i < spec->num_dmics; i++)
                stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i],
                                        AC_PINCTL_IN_EN);
-       if (cfg->dig_out_pin)
-               stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,
+       if (cfg->dig_out_pins[0])
+               stac92xx_auto_set_pinctl(codec, cfg->dig_out_pins[0],
                                         AC_PINCTL_OUT_EN);
        if (cfg->dig_in_pin)
                stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,
index c761394cbe84baabf9433c0bdd3c1d928f79f08c..639b2ff510a61b77fb3a9a602baf284c95a50e62 100644 (file)
@@ -1354,7 +1354,7 @@ static int vt1708_parse_auto_config(struct hda_codec *codec)
 
        spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = VT1708_DIGOUT_NID;
        if (spec->autocfg.dig_in_pin)
                spec->dig_in_nid = VT1708_DIGIN_NID;
@@ -1827,7 +1827,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec)
 
        spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = VT1709_DIGOUT_NID;
        if (spec->autocfg.dig_in_pin)
                spec->dig_in_nid = VT1709_DIGIN_NID;
@@ -2371,7 +2371,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec)
 
        spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = VT1708B_DIGOUT_NID;
        if (spec->autocfg.dig_in_pin)
                spec->dig_in_nid = VT1708B_DIGIN_NID;
@@ -2836,7 +2836,7 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec)
 
        spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = VT1708S_DIGOUT_NID;
 
        spec->extra_dig_out_nid = 0x15;
@@ -3155,7 +3155,7 @@ static int vt1702_parse_auto_config(struct hda_codec *codec)
 
        spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
-       if (spec->autocfg.dig_out_pin)
+       if (spec->autocfg.dig_outs)
                spec->multiout.dig_out_nid = VT1702_DIGOUT_NID;
 
        spec->extra_dig_out_nid = 0x1B;