Module Name:    src
Committed By:   jmcneill
Date:           Sun Aug 15 19:39:56 UTC 2010

Modified Files:
        src/sys/dev/pci/hdaudio: hdaudio_afg.c hdaudiovar.h

Log Message:
be less spammy when dumping assocs. extra details can be had with boot -x


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/pci/hdaudio/hdaudio_afg.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/hdaudio/hdaudiovar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/hdaudio/hdaudio_afg.c
diff -u src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.23 src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.24
--- src/sys/dev/pci/hdaudio/hdaudio_afg.c:1.23	Sun Aug 15 16:21:46 2010
+++ src/sys/dev/pci/hdaudio/hdaudio_afg.c	Sun Aug 15 19:39:56 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio_afg.c,v 1.23 2010/08/15 16:21:46 jmcneill Exp $ */
+/* $NetBSD: hdaudio_afg.c,v 1.24 2010/08/15 19:39:56 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <[email protected]>
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.23 2010/08/15 16:21:46 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio_afg.c,v 1.24 2010/08/15 19:39:56 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -94,6 +94,8 @@
 
 #define	hda_debug(sc, ...)		\
 	if (hdaudio_afg_debug) hda_print(sc, __VA_ARGS__)
+#define	hda_debug1(sc, ...)		\
+	if (hdaudio_afg_debug) hda_print1(sc, __VA_ARGS__)
 
 #define HDAUDIO_MIXER_CLASS_OUTPUTS	0
 #define	HDAUDIO_MIXER_CLASS_INPUTS	1
@@ -700,49 +702,123 @@
 	}
 }
 
+static int
+hdaudio_afg_assoc_count_channels(struct hdaudio_afg_softc *sc,
+    struct hdaudio_assoc *as, enum hdaudio_pindir dir)
+{
+	struct hdaudio_widget *w;
+	int *dacmap;
+	int i, dacmapsz = sizeof(*dacmap) * sc->sc_endnode;
+	int nchans = 0;
+
+	if (as->as_enable == false || as->as_dir != dir)
+		return 0;
+
+	dacmap = kmem_zalloc(dacmapsz, KM_SLEEP);
+	if (dacmap == NULL)
+		return 0;
+
+	for (i = 0; i < HDAUDIO_MAXPINS; i++)
+		if (as->as_dacs[i])
+			dacmap[as->as_dacs[i]] = 1;
+
+	for (i = 1; i < sc->sc_endnode; i++) {
+		if (!dacmap[i])
+			continue;
+		w = hdaudio_afg_widget_lookup(sc, i);
+		if (w == NULL || w->w_enable == false)
+			continue;
+		nchans += (w->w_p.aw_cap & COP_AWCAP_STEREO) ? 2 : 1;
+	}
+
+	kmem_free(dacmap, dacmapsz);
+
+	return nchans;
+}
+
 static void
 hdaudio_afg_assoc_dump(struct hdaudio_afg_softc *sc)
 {
 	struct hdaudio_assoc *as = sc->sc_assocs;
 	struct hdaudio_widget *w;
-	uint32_t conn, color, defdev;
+	uint32_t conn, color, defdev, curdev, curport;
 	int maxassocs = sc->sc_nassocs;
 	int i, j;
 
 	for (i = 0; i < maxassocs; i++) {
-		int ndacs = 0;
+		uint32_t devmask = 0, portmask = 0;
+		bool firstdev = true;
+		int nchan;
 
 		if (as[i].as_enable == false)
 			continue;
 
+		hda_print(sc, "%s%02X",
+		    as[i].as_dir == HDAUDIO_PINDIR_IN ? "ADC" : "DAC", i);
+		hda_trace1(sc, " %s",
+		    as[i].as_digital ? "[DIGITAL]" : "[ANALOG]");
+
+		nchan = hdaudio_afg_assoc_count_channels(sc, &as[i],
+		    as[i].as_dir);
+		hda_print1(sc, " %dch:", nchan);
+
 		for (j = 0; j < HDAUDIO_MAXPINS; j++) {
 			if (as[i].as_dacs[j] == 0)
 				continue;
-			++ndacs;
-			hda_print(sc, "%s%d:%02X, %s ",
-			    as[i].as_dir == HDAUDIO_PINDIR_IN ? "ADC" : "DAC",
-			    i, as[i].as_dacs[j],
-			    as[i].as_digital ? "Digital" : "Analog");
-
 			w = hdaudio_afg_widget_lookup(sc, as[i].as_pins[j]);
-			if (w == NULL) {
-				hda_print1(sc, "<none>\n");
+			if (w == NULL)
 				continue;
-			}
 			conn = COP_CFG_PORT_CONNECTIVITY(w->w_pin.config);
-			color = COP_CFG_COLOR(w->w_pin.config);
 			defdev = COP_CFG_DEFAULT_DEVICE(w->w_pin.config);
-			if (conn != 1) {
-				hda_print1(sc, "%s: %s (%s, %02X)\n",
-				    hdaudio_afg_default_device[defdev],
-				    hdaudio_afg_port_connectivity[conn],
-				    hdaudio_afg_color[color], w->w_nid);
-			} else {
-				hda_print1(sc, "<unknown>\n");
+			if (conn != COP_PORT_NONE) {
+				devmask |= (1 << defdev);
+				portmask |= (1 << conn);
+			}
+		}
+		for (curdev = 0; curdev < 16; curdev++) {
+			bool firstport = true;
+			if ((devmask & (1 << curdev)) == 0)
+				continue;
+
+			if (firstdev == false)
+				hda_print1(sc, ",");
+			firstdev = false;
+			hda_print1(sc, " %s",
+			    hdaudio_afg_default_device[curdev]);
+
+			for (curport = 0; curport < 4; curport++) {
+				if ((portmask & (1 << curport)) == 0)
+					continue;
+
+				hda_print1(sc, " [%s",
+				    hdaudio_afg_port_connectivity[curport]);
+				for (j = 0; j < HDAUDIO_MAXPINS; j++) {
+					if (as[i].as_dacs[j] == 0)
+						continue;
+
+					w = hdaudio_afg_widget_lookup(sc,
+					    as[i].as_pins[j]);
+					if (w == NULL)
+						continue;
+					conn = COP_CFG_PORT_CONNECTIVITY(w->w_pin.config);
+					color = COP_CFG_COLOR(w->w_pin.config);
+					defdev = COP_CFG_DEFAULT_DEVICE(w->w_pin.config);
+					if (conn != curport || defdev != curdev)
+						continue;
+
+					if (firstport == false)
+						hda_trace1(sc, ",");
+					else
+						hda_trace1(sc, " ");
+					firstport = false;
+					hda_trace1(sc, "%s",
+					    hdaudio_afg_color[color]);
+					hda_trace1(sc, "(%02X)", w->w_nid);
+				}
+				hda_print1(sc, "]");
 			}
 		}
-		if (ndacs == 0)
-			hda_print1(sc, "<none>\n");
+		hda_print1(sc, "\n");
 	}
 }
 
@@ -2766,40 +2842,6 @@
 	return handled;
 }
 
-static int
-hdaudio_afg_assoc_count_channels(struct hdaudio_afg_softc *sc,
-    struct hdaudio_assoc *as, enum hdaudio_pindir dir)
-{
-	struct hdaudio_widget *w;
-	int *dacmap;
-	int i, dacmapsz = sizeof(*dacmap) * sc->sc_endnode;
-	int nchans = 0;
-
-	if (as->as_enable == false || as->as_dir != dir)
-		return 0;
-
-	dacmap = kmem_zalloc(dacmapsz, KM_SLEEP);
-	if (dacmap == NULL)
-		return 0;
-
-	for (i = 0; i < HDAUDIO_MAXPINS; i++)
-		if (as->as_dacs[i])
-			dacmap[as->as_dacs[i]] = 1;
-
-	for (i = 1; i < sc->sc_endnode; i++) {
-		if (!dacmap[i])
-			continue;
-		w = hdaudio_afg_widget_lookup(sc, i);
-		if (w == NULL || w->w_enable == false)
-			continue;
-		nchans += (w->w_p.aw_cap & COP_AWCAP_STEREO) ? 2 : 1;
-	}
-
-	kmem_free(dacmap, dacmapsz);
-
-	return nchans;
-}
-
 static bool
 hdaudio_afg_rate_supported(struct hdaudio_afg_softc *sc, u_int frequency)
 {

Index: src/sys/dev/pci/hdaudio/hdaudiovar.h
diff -u src/sys/dev/pci/hdaudio/hdaudiovar.h:1.5 src/sys/dev/pci/hdaudio/hdaudiovar.h:1.6
--- src/sys/dev/pci/hdaudio/hdaudiovar.h:1.5	Sun Oct 11 08:50:12 2009
+++ src/sys/dev/pci/hdaudio/hdaudiovar.h	Sun Aug 15 19:39:56 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudiovar.h,v 1.5 2009/10/11 08:50:12 sborrill Exp $ */
+/* $NetBSD: hdaudiovar.h,v 1.6 2010/08/15 19:39:56 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <[email protected]>
@@ -56,6 +56,8 @@
 	aprint_error_dev((sc)->sc_dev, __VA_ARGS__)
 #define	hda_trace(sc, ...)		\
 	aprint_debug_dev((sc)->sc_dev, __VA_ARGS__)
+#define	hda_trace1(sc, ...)		\
+	aprint_debug(__VA_ARGS__)
 #define	hda_delay(us)			\
 	delay((us))
 

Reply via email to