From a926757f0431042b32ef4188ce8201cbe0fcbb50 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Thu, 7 Jul 2011 15:12:55 +0200
Subject: [PATCH] ALSA: hda - Fix warning with ALC882 digital-out detection
Git-commit: a926757f0431042b32ef4188ce8201cbe0fcbb50
Patch-mainline: 3.1-rc2
Refernces: FATE#314106,FATE#314311,FATE#313695

The digital out pin on ALC882 may have multiple connections.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

---
 sound/pci/hda/patch_realtek.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2089,12 +2089,14 @@ static void alc_auto_parse_digital(struc
 	/* support multiple SPDIFs; the secondary is set up as a slave */
 	nums = 0;
 	for (i = 0; i < spec->autocfg.dig_outs; i++) {
+		hda_nid_t conn[4];
 		err = snd_hda_get_connections(codec,
 					      spec->autocfg.dig_out_pins[i],
-					      &dig_nid, 1);
+					      conn, ARRAY_SIZE(conn));
 		if (err <= 0)
 			continue;
-		if (!nums) {
+		dig_nid = conn[0]; /* assume the first element is audio-out */
+		if (!i) {
 			spec->multiout.dig_out_nid = dig_nid;
 			spec->dig_out_type = spec->autocfg.dig_out_type[0];
 		} else {
