[alsa-devel] [PATCH 085/112] ALSA: hda - Initialize output paths with current active states

Takashi Iwai tiwai at suse.de
Tue Jan 8 12:39:18 CET 2013


Set path->active flag at the path creation time and let the paths
initialized according to the current path->active state in
set_output_and_unmute().  This allows to modify the active flag of
some output paths dynamically, e.g. switching the front output route
with or without aamix like patch_via.c.

Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
 sound/pci/hda/hda_generic.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 08eced0..5051350 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -873,8 +873,10 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs,
 		}
 		if (!path)
 			dac = dacs[i] = 0;
-		else
+		else {
 			print_nid_path("output", path);
+			path->active = true;
+		}
 		if (dac)
 			badness += assign_out_path_ctls(codec, pin, dac);
 	}
@@ -1045,6 +1047,7 @@ static bool map_singles(struct hda_codec *codec, int outs,
 			dacs[i] = dac;
 			found = true;
 			print_nid_path("output", path);
+			path->active = true;
 		}
 	}
 	return found;
@@ -2416,6 +2419,7 @@ static void parse_digital(struct hda_codec *codec)
 		if (!path)
 			continue;
 		print_nid_path("digout", path);
+		path->active = true;
 		if (!nums) {
 			spec->multiout.dig_out_nid = dig_nid;
 			spec->dig_out_type = spec->autocfg.dig_out_type[0];
@@ -3554,10 +3558,8 @@ static void set_output_and_unmute(struct hda_codec *codec, hda_nid_t pin,
 	path = snd_hda_get_nid_path(codec, dac, pin);
 	if (!path)
 		return;
-	if (path->active)
-		return;
-	snd_hda_activate_path(codec, path, true, true);
-	set_pin_eapd(codec, pin, true);
+	snd_hda_activate_path(codec, path, path->active, true);
+	set_pin_eapd(codec, pin, path->active);
 }
 
 /* initialize primary output paths */
-- 
1.8.0.1



More information about the Alsa-devel mailing list