From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 21 Jan 2013 13:24:31 +0000 (+0100)
Subject: ALSA: hda - Check aamix-output paths from other DACs, too
X-Git-Tag: firefly_0821_release~3680^2~1005^2~77^2~15
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f87498b65197f951899d8bbd99e5553227c41ec9;p=firefly-linux-kernel-4.4.55.git

ALSA: hda - Check aamix-output paths from other DACs, too

Many codecs provide routes to multiple output pins through an aamix
widget, but most of them do it only from a single DAC.  However, the
current generic parser checks only the aamix paths from the original
(directly bound) DACs through aamix NID, and miss the path:
  primary DAC -> aamix -> target out pin

This patch adds a more check for the routes like the above.

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

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 4e9761a91816..e26e8d3430f2 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -1313,14 +1313,26 @@ static int check_aamix_out_path(struct hda_codec *codec, int path_idx)
 {
 	struct hda_gen_spec *spec = codec->spec;
 	struct nid_path *path;
+	hda_nid_t dac, pin;
 
 	path = snd_hda_get_path_from_idx(codec, path_idx);
 	if (!path || !path->depth ||
 	    is_nid_contained(path, spec->mixer_nid))
 		return 0;
-	path = snd_hda_add_new_path(codec, path->path[0],
-				    path->path[path->depth - 1],
-				    spec->mixer_nid);
+	dac = path->path[0];
+	pin = path->path[path->depth - 1];
+	path = snd_hda_add_new_path(codec, dac, pin, spec->mixer_nid);
+	if (!path) {
+		if (dac != spec->multiout.dac_nids[0])
+			dac = spec->multiout.dac_nids[0];
+		else if (spec->multiout.hp_out_nid[0])
+			dac = spec->multiout.hp_out_nid[0];
+		else if (spec->multiout.extra_out_nid[0])
+			dac = spec->multiout.extra_out_nid[0];
+		if (dac)
+			path = snd_hda_add_new_path(codec, dac, pin,
+						    spec->mixer_nid);
+	}
 	if (!path)
 		return 0;
 	/* print_nid_path("output-aamix", path); */