Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Nov 2012 20:06:02 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r243530 - head/sys/dev/sound/pci/hda
Message-ID:  <201211252006.qAPK62QZ019724@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sun Nov 25 20:06:01 2012
New Revision: 243530
URL: http://svnweb.freebsd.org/changeset/base/243530

Log:
  On multiple requests, compact HDA driver verbose output by hiding CODEC's
  detailed information under the sound debug.  To make it easier accessible,
  export that information through the set of sysctls like dev.hdaa.X.nidY.
  Also tune some output to make it both more compact and informative.

Modified:
  head/sys/dev/sound/pci/hda/hdaa.c

Modified: head/sys/dev/sound/pci/hda/hdaa.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdaa.c	Sun Nov 25 19:42:36 2012	(r243529)
+++ head/sys/dev/sound/pci/hda/hdaa.c	Sun Nov 25 20:06:01 2012	(r243530)
@@ -978,6 +978,253 @@ hdaa_local_patch_pin(struct hdaa_widget 
 	w->wclass.pin.newconf = w->wclass.pin.config = config;
 }
 
+static void
+hdaa_dump_audio_formats_sb(struct sbuf *sb, uint32_t fcap, uint32_t pcmcap)
+{
+	uint32_t cap;
+
+	cap = fcap;
+	if (cap != 0) {
+		sbuf_printf(sb, "     Stream cap: 0x%08x", cap);
+		if (HDA_PARAM_SUPP_STREAM_FORMATS_AC3(cap))
+			sbuf_printf(sb, " AC3");
+		if (HDA_PARAM_SUPP_STREAM_FORMATS_FLOAT32(cap))
+			sbuf_printf(sb, " FLOAT32");
+		if (HDA_PARAM_SUPP_STREAM_FORMATS_PCM(cap))
+			sbuf_printf(sb, " PCM");
+		sbuf_printf(sb, "\n");
+	}
+	cap = pcmcap;
+	if (cap != 0) {
+		sbuf_printf(sb, "        PCM cap: 0x%08x", cap);
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_8BIT(cap))
+			sbuf_printf(sb, " 8");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_16BIT(cap))
+			sbuf_printf(sb, " 16");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_20BIT(cap))
+			sbuf_printf(sb, " 20");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT(cap))
+			sbuf_printf(sb, " 24");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT(cap))
+			sbuf_printf(sb, " 32");
+		sbuf_printf(sb, " bits,");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_8KHZ(cap))
+			sbuf_printf(sb, " 8");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_11KHZ(cap))
+			sbuf_printf(sb, " 11");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_16KHZ(cap))
+			sbuf_printf(sb, " 16");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_22KHZ(cap))
+			sbuf_printf(sb, " 22");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_32KHZ(cap))
+			sbuf_printf(sb, " 32");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_44KHZ(cap))
+			sbuf_printf(sb, " 44");
+		sbuf_printf(sb, " 48");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_88KHZ(cap))
+			sbuf_printf(sb, " 88");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_96KHZ(cap))
+			sbuf_printf(sb, " 96");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_176KHZ(cap))
+			sbuf_printf(sb, " 176");
+		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_192KHZ(cap))
+			sbuf_printf(sb, " 192");
+		sbuf_printf(sb, " KHz\n");
+	}
+}
+
+static void
+hdaa_dump_pin_sb(struct sbuf *sb, struct hdaa_widget *w)
+{
+	uint32_t pincap, conf;
+
+	pincap = w->wclass.pin.cap;
+
+	sbuf_printf(sb, "        Pin cap: 0x%08x", pincap);
+	if (HDA_PARAM_PIN_CAP_IMP_SENSE_CAP(pincap))
+		sbuf_printf(sb, " ISC");
+	if (HDA_PARAM_PIN_CAP_TRIGGER_REQD(pincap))
+		sbuf_printf(sb, " TRQD");
+	if (HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(pincap))
+		sbuf_printf(sb, " PDC");
+	if (HDA_PARAM_PIN_CAP_HEADPHONE_CAP(pincap))
+		sbuf_printf(sb, " HP");
+	if (HDA_PARAM_PIN_CAP_OUTPUT_CAP(pincap))
+		sbuf_printf(sb, " OUT");
+	if (HDA_PARAM_PIN_CAP_INPUT_CAP(pincap))
+		sbuf_printf(sb, " IN");
+	if (HDA_PARAM_PIN_CAP_BALANCED_IO_PINS(pincap))
+		sbuf_printf(sb, " BAL");
+	if (HDA_PARAM_PIN_CAP_HDMI(pincap))
+		sbuf_printf(sb, " HDMI");
+	if (HDA_PARAM_PIN_CAP_VREF_CTRL(pincap)) {
+		sbuf_printf(sb, " VREF[");
+		if (HDA_PARAM_PIN_CAP_VREF_CTRL_50(pincap))
+			sbuf_printf(sb, " 50");
+		if (HDA_PARAM_PIN_CAP_VREF_CTRL_80(pincap))
+			sbuf_printf(sb, " 80");
+		if (HDA_PARAM_PIN_CAP_VREF_CTRL_100(pincap))
+			sbuf_printf(sb, " 100");
+		if (HDA_PARAM_PIN_CAP_VREF_CTRL_GROUND(pincap))
+			sbuf_printf(sb, " GROUND");
+		if (HDA_PARAM_PIN_CAP_VREF_CTRL_HIZ(pincap))
+			sbuf_printf(sb, " HIZ");
+		sbuf_printf(sb, " ]");
+	}
+	if (HDA_PARAM_PIN_CAP_EAPD_CAP(pincap))
+		sbuf_printf(sb, " EAPD");
+	if (HDA_PARAM_PIN_CAP_DP(pincap))
+		sbuf_printf(sb, " DP");
+	if (HDA_PARAM_PIN_CAP_HBR(pincap))
+		sbuf_printf(sb, " HBR");
+	sbuf_printf(sb, "\n");
+	conf = w->wclass.pin.config;
+	sbuf_printf(sb, "     Pin config: 0x%08x", conf);
+	sbuf_printf(sb, " as=%d seq=%d "
+	    "device=%s conn=%s ctype=%s loc=%s color=%s misc=%d\n",
+	    HDA_CONFIG_DEFAULTCONF_ASSOCIATION(conf),
+	    HDA_CONFIG_DEFAULTCONF_SEQUENCE(conf),
+	    HDA_DEVS[HDA_CONFIG_DEFAULTCONF_DEVICE(conf)],
+	    HDA_CONNS[HDA_CONFIG_DEFAULTCONF_CONNECTIVITY(conf)],
+	    HDA_CONNECTORS[HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE(conf)],
+	    HDA_LOCS[HDA_CONFIG_DEFAULTCONF_LOCATION(conf)],
+	    HDA_COLORS[HDA_CONFIG_DEFAULTCONF_COLOR(conf)],
+	    HDA_CONFIG_DEFAULTCONF_MISC(conf));
+	sbuf_printf(sb, "    Pin control: 0x%08x", w->wclass.pin.ctrl);
+	if (w->wclass.pin.ctrl & HDA_CMD_SET_PIN_WIDGET_CTRL_HPHN_ENABLE)
+		sbuf_printf(sb, " HP");
+	if (w->wclass.pin.ctrl & HDA_CMD_SET_PIN_WIDGET_CTRL_IN_ENABLE)
+		sbuf_printf(sb, " IN");
+	if (w->wclass.pin.ctrl & HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE)
+		sbuf_printf(sb, " OUT");
+	if (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap)) {
+		if ((w->wclass.pin.ctrl &
+		    HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK) == 0x03)
+			sbuf_printf(sb, " HBR");
+		else if ((w->wclass.pin.ctrl &
+		    HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK) != 0)
+			sbuf_printf(sb, " EPTs");
+	} else {
+		if ((w->wclass.pin.ctrl &
+		    HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK) != 0)
+			sbuf_printf(sb, " VREFs");
+	}
+	sbuf_printf(sb, "\n");
+}
+
+static void
+hdaa_dump_amp_sb(struct sbuf *sb, uint32_t cap, char *banner)
+{
+	int offset, size, step;
+
+	offset = HDA_PARAM_OUTPUT_AMP_CAP_OFFSET(cap);
+	size = HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE(cap);
+	step = HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS(cap);
+	sbuf_printf(sb, "     %s amp: 0x%08x "
+	    "mute=%d step=%d size=%d offset=%d (%+d/%+ddB)\n",
+	    banner, cap,
+	    HDA_PARAM_OUTPUT_AMP_CAP_MUTE_CAP(cap),
+	    step, size, offset,
+	    ((0 - offset) * (size + 1)) / 4,
+	    ((step - offset) * (size + 1)) / 4);
+}
+
+
+static int
+hdaa_sysctl_caps(SYSCTL_HANDLER_ARGS)
+{
+	struct hdaa_devinfo *devinfo;
+	struct hdaa_widget *w, *cw;
+	struct sbuf sb;
+	char buf[64];
+	int error, j;
+
+	w = (struct hdaa_widget *)oidp->oid_arg1;
+	devinfo = w->devinfo;
+	sbuf_new_for_sysctl(&sb, NULL, 256, req);
+
+	sbuf_printf(&sb, "%s%s\n", w->name,
+	    (w->enable == 0) ? " [DISABLED]" : "");
+	sbuf_printf(&sb, "     Widget cap: 0x%08x",
+	    w->param.widget_cap);
+	if (w->param.widget_cap & 0x0ee1) {
+		if (HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP(w->param.widget_cap))
+		    sbuf_printf(&sb, " LRSWAP");
+		if (HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL(w->param.widget_cap))
+		    sbuf_printf(&sb, " PWR");
+		if (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap))
+		    sbuf_printf(&sb, " DIGITAL");
+		if (HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(w->param.widget_cap))
+		    sbuf_printf(&sb, " UNSOL");
+		if (HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET(w->param.widget_cap))
+		    sbuf_printf(&sb, " PROC");
+		if (HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE(w->param.widget_cap))
+		    sbuf_printf(&sb, " STRIPE(x%d)",
+			1 << (fls(w->wclass.conv.stripecap) - 1));
+		j = HDA_PARAM_AUDIO_WIDGET_CAP_CC(w->param.widget_cap);
+		if (j == 1)
+		    sbuf_printf(&sb, " STEREO");
+		else if (j > 1)
+		    sbuf_printf(&sb, " %dCH", j + 1);
+	}
+	sbuf_printf(&sb, "\n");
+	if (w->bindas != -1) {
+		sbuf_printf(&sb, "    Association: %d (0x%04x)\n",
+		    w->bindas, w->bindseqmask);
+	}
+	if (w->ossmask != 0 || w->ossdev >= 0) {
+		sbuf_printf(&sb, "            OSS: %s",
+		    hdaa_audio_ctl_ossmixer_mask2allname(w->ossmask, buf, sizeof(buf)));
+		if (w->ossdev >= 0)
+		    sbuf_printf(&sb, " (%s)", ossnames[w->ossdev]);
+		sbuf_printf(&sb, "\n");
+	}
+	if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_OUTPUT ||
+	    w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT) {
+		hdaa_dump_audio_formats_sb(&sb,
+		    w->param.supp_stream_formats,
+		    w->param.supp_pcm_size_rate);
+	} else if (w->type ==
+	    HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX || w->waspin)
+		hdaa_dump_pin_sb(&sb, w);
+	if (w->param.eapdbtl != HDA_INVALID) {
+		sbuf_printf(&sb, "           EAPD: 0x%08x%s%s%s\n",
+		    w->param.eapdbtl,
+		    (w->param.eapdbtl & HDA_CMD_SET_EAPD_BTL_ENABLE_LR_SWAP) ?
+		     " LRSWAP" : "",
+		    (w->param.eapdbtl & HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD) ?
+		     " EAPD" : "",
+		    (w->param.eapdbtl & HDA_CMD_SET_EAPD_BTL_ENABLE_BTL) ?
+		     " BTL" : "");
+	}
+	if (HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP(w->param.widget_cap) &&
+	    w->param.outamp_cap != 0)
+		hdaa_dump_amp_sb(&sb, w->param.outamp_cap, "Output");
+	if (HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP(w->param.widget_cap) &&
+	    w->param.inamp_cap != 0)
+		hdaa_dump_amp_sb(&sb, w->param.inamp_cap, " Input");
+	if (w->nconns > 0)
+		sbuf_printf(&sb, "    Connections: %d\n", w->nconns);
+	for (j = 0; j < w->nconns; j++) {
+		cw = hdaa_widget_get(devinfo, w->conns[j]);
+		sbuf_printf(&sb, "          + %s<- nid=%d [%s]",
+		    (w->connsenable[j] == 0)?"[DISABLED] ":"",
+		    w->conns[j], (cw == NULL) ? "GHOST!" : cw->name);
+		if (cw == NULL)
+			sbuf_printf(&sb, " [UNKNOWN]");
+		else if (cw->enable == 0)
+			sbuf_printf(&sb, " [DISABLED]");
+		if (w->nconns > 1 && w->selconn == j && w->type !=
+		    HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER)
+			sbuf_printf(&sb, " (selected)");
+		sbuf_printf(&sb, "\n");
+	}
+	sbuf_trim(&sb);
+	error = sbuf_finish(&sb);
+	sbuf_delete(&sb);
+	return (error);
+}
+
 static int
 hdaa_sysctl_config(SYSCTL_HANDLER_ARGS)
 {
@@ -1301,8 +1548,16 @@ hdaa_widget_parse(struct hdaa_widget *w)
 			w->param.eapdbtl |= HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD;
 		} else
 			w->param.eapdbtl = HDA_INVALID;
+	}
+	w->unsol = -1;
 
-		hdaa_unlock(w->devinfo);
+	hdaa_unlock(w->devinfo);
+	snprintf(buf, sizeof(buf), "nid%d", w->nid);
+	SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+	    buf, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
+	    w, sizeof(w), hdaa_sysctl_caps, "A", "Node capabilities");
+	if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) {
 		snprintf(buf, sizeof(buf), "nid%d_config", w->nid);
 		SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
 		    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
@@ -1315,9 +1570,8 @@ hdaa_widget_parse(struct hdaa_widget *w)
 		    buf, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
 		    &w->wclass.pin.original, sizeof(&w->wclass.pin.original),
 		    hdaa_sysctl_config, "A", "Original pin configuration");
-		hdaa_lock(w->devinfo);
 	}
-	w->unsol = -1;
+	hdaa_lock(w->devinfo);
 }
 
 static void
@@ -5327,7 +5581,6 @@ hdaa_dump_ctls(struct hdaa_pcm_devinfo *
 				continue;
 
 			if (printed == 0) {
-				device_printf(pdevinfo->dev, "\n");
 				if (banner != NULL) {
 					device_printf(pdevinfo->dev, "%s", banner);
 				} else {
@@ -5342,7 +5595,6 @@ hdaa_dump_ctls(struct hdaa_pcm_devinfo *
 					    pdevinfo->maxamp[j] / 4);
 				} else
 					printf("\n");
-				device_printf(pdevinfo->dev, "   |\n");
 				printed = 1;
 			}
 			device_printf(pdevinfo->dev, "   +- ctl %2d (nid %3d %s", i,
@@ -5362,6 +5614,8 @@ hdaa_dump_ctls(struct hdaa_pcm_devinfo *
 				printf("%s\n", ctl->mute?"mute":"");
 		}
 	}
+	if (printed)
+		device_printf(pdevinfo->dev, "\n");
 }
 
 static void
@@ -5371,8 +5625,7 @@ hdaa_dump_audio_formats(device_t dev, ui
 
 	cap = fcap;
 	if (cap != 0) {
-		device_printf(dev, "     Stream cap: 0x%08x\n", cap);
-		device_printf(dev, "                ");
+		device_printf(dev, "     Stream cap: 0x%08x", cap);
 		if (HDA_PARAM_SUPP_STREAM_FORMATS_AC3(cap))
 			printf(" AC3");
 		if (HDA_PARAM_SUPP_STREAM_FORMATS_FLOAT32(cap))
@@ -5383,8 +5636,7 @@ hdaa_dump_audio_formats(device_t dev, ui
 	}
 	cap = pcmcap;
 	if (cap != 0) {
-		device_printf(dev, "        PCM cap: 0x%08x\n", cap);
-		device_printf(dev, "                ");
+		device_printf(dev, "        PCM cap: 0x%08x", cap);
 		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_8BIT(cap))
 			printf(" 8");
 		if (HDA_PARAM_SUPP_PCM_SIZE_RATE_16BIT(cap))
@@ -5428,8 +5680,7 @@ hdaa_dump_pin(struct hdaa_widget *w)
 
 	pincap = w->wclass.pin.cap;
 
-	device_printf(w->devinfo->dev, "        Pin cap: 0x%08x\n", pincap);
-	device_printf(w->devinfo->dev, "                ");
+	device_printf(w->devinfo->dev, "        Pin cap: 0x%08x", pincap);
 	if (HDA_PARAM_PIN_CAP_IMP_SENSE_CAP(pincap))
 		printf(" ISC");
 	if (HDA_PARAM_PIN_CAP_TRIGGER_REQD(pincap))
@@ -5530,13 +5781,18 @@ hdaa_dump_pin_configs(struct hdaa_devinf
 static void
 hdaa_dump_amp(device_t dev, uint32_t cap, char *banner)
 {
-	device_printf(dev, "     %s amp: 0x%08x\n", banner, cap);
-	device_printf(dev, "                 "
-	    "mute=%d step=%d size=%d offset=%d\n",
+	int offset, size, step;
+
+	offset = HDA_PARAM_OUTPUT_AMP_CAP_OFFSET(cap);
+	size = HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE(cap);
+	step = HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS(cap);
+	device_printf(dev, "     %s amp: 0x%08x "
+	    "mute=%d step=%d size=%d offset=%d (%+d/%+ddB)\n",
+	    banner, cap,
 	    HDA_PARAM_OUTPUT_AMP_CAP_MUTE_CAP(cap),
-	    HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS(cap),
-	    HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE(cap),
-	    HDA_PARAM_OUTPUT_AMP_CAP_OFFSET(cap));
+	    step, size, offset,
+	    ((0 - offset) * (size + 1)) / 4,
+	    ((step - offset) * (size + 1)) / 4);
 }
 
 static void
@@ -5547,15 +5803,12 @@ hdaa_dump_nodes(struct hdaa_devinfo *dev
 	int i, j;
 
 	device_printf(devinfo->dev, "\n");
-	device_printf(devinfo->dev, "Default Parameter\n");
-	device_printf(devinfo->dev, "-----------------\n");
+	device_printf(devinfo->dev, "Default parameters:\n");
 	hdaa_dump_audio_formats(devinfo->dev,
 	    devinfo->supp_stream_formats,
 	    devinfo->supp_pcm_size_rate);
-	device_printf(devinfo->dev, "         IN amp: 0x%08x\n",
-	    devinfo->inamp_cap);
-	device_printf(devinfo->dev, "        OUT amp: 0x%08x\n",
-	    devinfo->outamp_cap);
+	hdaa_dump_amp(devinfo->dev, devinfo->inamp_cap, " Input");
+	hdaa_dump_amp(devinfo->dev, devinfo->outamp_cap, "Output");
 	for (i = devinfo->startnode; i < devinfo->endnode; i++) {
 		w = hdaa_widget_get(devinfo, i);
 		if (w == NULL) {
@@ -5566,10 +5819,9 @@ hdaa_dump_nodes(struct hdaa_devinfo *dev
 		device_printf(devinfo->dev, "            nid: %d%s\n", w->nid,
 		    (w->enable == 0) ? " [DISABLED]" : "");
 		device_printf(devinfo->dev, "           Name: %s\n", w->name);
-		device_printf(devinfo->dev, "     Widget cap: 0x%08x\n",
+		device_printf(devinfo->dev, "     Widget cap: 0x%08x",
 		    w->param.widget_cap);
 		if (w->param.widget_cap & 0x0ee1) {
-			device_printf(devinfo->dev, "                ");
 			if (HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP(w->param.widget_cap))
 			    printf(" LRSWAP");
 			if (HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL(w->param.widget_cap))
@@ -5588,10 +5840,10 @@ hdaa_dump_nodes(struct hdaa_devinfo *dev
 			    printf(" STEREO");
 			else if (j > 1)
 			    printf(" %dCH", j + 1);
-			printf("\n");
 		}
+		printf("\n");
 		if (w->bindas != -1) {
-			device_printf(devinfo->dev, "    Association: %d (0x%08x)\n",
+			device_printf(devinfo->dev, "    Association: %d (0x%04x)\n",
 			    w->bindas, w->bindseqmask);
 		}
 		if (w->ossmask != 0 || w->ossdev >= 0) {
@@ -5618,10 +5870,8 @@ hdaa_dump_nodes(struct hdaa_devinfo *dev
 		if (HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP(w->param.widget_cap) &&
 		    w->param.inamp_cap != 0)
 			hdaa_dump_amp(devinfo->dev, w->param.inamp_cap, " Input");
-		if (w->nconns > 0) {
-			device_printf(devinfo->dev, "    connections: %d\n", w->nconns);
-			device_printf(devinfo->dev, "          |\n");
-		}
+		if (w->nconns > 0)
+			device_printf(devinfo->dev, "    Connections: %d\n", w->nconns);
 		for (j = 0; j < w->nconns; j++) {
 			cw = hdaa_widget_get(devinfo, w->conns[j]);
 			device_printf(devinfo->dev, "          + %s<- nid=%d [%s]",
@@ -5646,7 +5896,7 @@ hdaa_dump_dst_nid(struct hdaa_pcm_devinf
 	struct hdaa_devinfo *devinfo = pdevinfo->devinfo;
 	struct hdaa_widget *w, *cw;
 	char buf[64];
-	int i, printed = 0;
+	int i;
 
 	if (depth > HDA_PARSE_MAXDEPTH)
 		return;
@@ -5682,10 +5932,6 @@ hdaa_dump_dst_nid(struct hdaa_pcm_devinf
 		cw = hdaa_widget_get(devinfo, w->conns[i]);
 		if (cw == NULL || cw->enable == 0 || cw->bindas == -1)
 			continue;
-		if (printed == 0) {
-			device_printf(pdevinfo->dev, "%*s  |\n", 4 + (depth) * 7, "");
-			printed = 1;
-		}
 		hdaa_dump_dst_nid(pdevinfo, w->conns[i], depth + 1);
 	}
 
@@ -5697,11 +5943,26 @@ hdaa_dump_dac(struct hdaa_pcm_devinfo *p
 	struct hdaa_devinfo *devinfo = pdevinfo->devinfo;
 	struct hdaa_audio_as *as;
 	struct hdaa_widget *w;
-	int i, printed = 0;
+	nid_t *nids;
+	int chid, i;
 
 	if (pdevinfo->playas < 0)
 		return;
 
+	device_printf(pdevinfo->dev, "Playback:\n");
+
+	chid = devinfo->as[pdevinfo->playas].chans[0];
+	hdaa_dump_audio_formats(pdevinfo->dev,
+	    devinfo->chans[chid].supp_stream_formats,
+	    devinfo->chans[chid].supp_pcm_size_rate);
+	for (i = 0; i < devinfo->as[pdevinfo->playas].num_chans; i++) {
+		chid = devinfo->as[pdevinfo->playas].chans[i];
+		device_printf(pdevinfo->dev, "            DAC:");
+		for (nids = devinfo->chans[chid].io; *nids != -1; nids++)
+			printf(" %d", *nids);
+		printf("\n");
+	}
+
 	as = &devinfo->as[pdevinfo->playas];
 	for (i = 0; i < 16; i++) {
 		if (as->pins[i] <= 0)
@@ -5709,14 +5970,10 @@ hdaa_dump_dac(struct hdaa_pcm_devinfo *p
 		w = hdaa_widget_get(devinfo, as->pins[i]);
 		if (w == NULL || w->enable == 0)
 			continue;
-		if (printed == 0) {
-			printed = 1;
-			device_printf(pdevinfo->dev, "\n");
-			device_printf(pdevinfo->dev, "Playback:\n");
-		}
 		device_printf(pdevinfo->dev, "\n");
 		hdaa_dump_dst_nid(pdevinfo, as->pins[i], 0);
 	}
+	device_printf(pdevinfo->dev, "\n");
 }
 
 static void
@@ -5724,12 +5981,26 @@ hdaa_dump_adc(struct hdaa_pcm_devinfo *p
 {
 	struct hdaa_devinfo *devinfo = pdevinfo->devinfo;
 	struct hdaa_widget *w;
-	int i;
-	int printed = 0;
+	nid_t *nids;
+	int chid, i;
 
 	if (pdevinfo->recas < 0)
 		return;
 
+	device_printf(pdevinfo->dev, "Record:\n");
+
+	chid = devinfo->as[pdevinfo->recas].chans[0];
+	hdaa_dump_audio_formats(pdevinfo->dev,
+	    devinfo->chans[chid].supp_stream_formats,
+	    devinfo->chans[chid].supp_pcm_size_rate);
+	for (i = 0; i < devinfo->as[pdevinfo->recas].num_chans; i++) {
+		chid = devinfo->as[pdevinfo->recas].chans[i];
+		device_printf(pdevinfo->dev, "            ADC:");
+		for (nids = devinfo->chans[chid].io; *nids != -1; nids++)
+			printf(" %d", *nids);
+		printf("\n");
+	}
+
 	for (i = devinfo->startnode; i < devinfo->endnode; i++) {
 		w = hdaa_widget_get(devinfo, i);
 		if (w == NULL || w->enable == 0)
@@ -5738,14 +6009,10 @@ hdaa_dump_adc(struct hdaa_pcm_devinfo *p
 			continue;
 		if (w->bindas != pdevinfo->recas)
 			continue;
-		if (printed == 0) {
-			printed = 1;
-			device_printf(pdevinfo->dev, "\n");
-			device_printf(pdevinfo->dev, "Record:\n");
-		}
 		device_printf(pdevinfo->dev, "\n");
 		hdaa_dump_dst_nid(pdevinfo, i, 0);
 	}
+	device_printf(pdevinfo->dev, "\n");
 }
 
 static void
@@ -5766,53 +6033,13 @@ hdaa_dump_mix(struct hdaa_pcm_devinfo *p
 			continue;
 		if (printed == 0) {
 			printed = 1;
-			device_printf(pdevinfo->dev, "\n");
 			device_printf(pdevinfo->dev, "Input Mix:\n");
 		}
 		device_printf(pdevinfo->dev, "\n");
 		hdaa_dump_dst_nid(pdevinfo, i, 0);
 	}
-}
-
-static void
-hdaa_dump_pcmchannels(struct hdaa_pcm_devinfo *pdevinfo)
-{
-	struct hdaa_devinfo *devinfo = pdevinfo->devinfo;
-	nid_t *nids;
-	int chid, i;
-
-	if (pdevinfo->playas >= 0) {
-		device_printf(pdevinfo->dev, "\n");
-		device_printf(pdevinfo->dev, "Playback:\n");
-		device_printf(pdevinfo->dev, "\n");
-		chid = devinfo->as[pdevinfo->playas].chans[0];
-		hdaa_dump_audio_formats(pdevinfo->dev,
-		    devinfo->chans[chid].supp_stream_formats,
-		    devinfo->chans[chid].supp_pcm_size_rate);
-		for (i = 0; i < devinfo->as[pdevinfo->playas].num_chans; i++) {
-			chid = devinfo->as[pdevinfo->playas].chans[i];
-			device_printf(pdevinfo->dev, "            DAC:");
-			for (nids = devinfo->chans[chid].io; *nids != -1; nids++)
-				printf(" %d", *nids);
-			printf("\n");
-		}
-	}
-	if (pdevinfo->recas >= 0) {
-		device_printf(pdevinfo->dev, "\n");
-		device_printf(pdevinfo->dev, "Record:\n");
+	if (printed)
 		device_printf(pdevinfo->dev, "\n");
-		chid = devinfo->as[pdevinfo->recas].chans[0];
-		hdaa_dump_audio_formats(pdevinfo->dev,
-		    devinfo->chans[chid].supp_stream_formats,
-		    devinfo->chans[chid].supp_pcm_size_rate);
-		for (i = 0; i < devinfo->as[pdevinfo->recas].num_chans; i++) {
-			chid = devinfo->as[pdevinfo->recas].chans[i];
-			device_printf(pdevinfo->dev, "            DAC:");
-			for (nids = devinfo->chans[chid].io; *nids != -1; nids++)
-				printf(" %d", *nids);
-			printf("\n");
-		}
-	}
 }
 
 static void
@@ -5991,19 +6218,19 @@ hdaa_configure(device_t dev)
 			}
 			printf("\n");
 		}
+	);
 
+	HDA_BOOTHVERBOSE(
 		device_printf(dev, "\n");
-		device_printf(dev, "+-------------------+\n");
-		device_printf(dev, "| DUMPING HDA NODES |\n");
-		device_printf(dev, "+-------------------+\n");
+		device_printf(dev, "+-----------+\n");
+		device_printf(dev, "| HDA NODES |\n");
+		device_printf(dev, "+-----------+\n");
 		hdaa_dump_nodes(devinfo);
-	);
 
-	HDA_BOOTHVERBOSE(
 		device_printf(dev, "\n");
-		device_printf(dev, "+------------------------+\n");
-		device_printf(dev, "| DUMPING HDA AMPLIFIERS |\n");
-		device_printf(dev, "+------------------------+\n");
+		device_printf(dev, "+----------------+\n");
+		device_printf(dev, "| HDA AMPLIFIERS |\n");
+		device_printf(dev, "+----------------+\n");
 		device_printf(dev, "\n");
 		i = 0;
 		while ((ctl = hdaa_audio_ctl_each(devinfo, &i)) != NULL) {
@@ -6024,9 +6251,6 @@ hdaa_configure(device_t dev)
 			    (ctl->enable == 0) ? " [DISABLED]" : 
 			    ((ctl->ossmask == 0) ? " [UNUSED]" : ""));
 		}
-	);
-
-	HDA_BOOTVERBOSE(
 		device_printf(dev, "\n");
 	);
 }
@@ -6790,21 +7014,9 @@ hdaa_pcm_attach(device_t dev)
 	    HDA_BUFSZ_MIN, HDA_BUFSZ_DEFAULT, HDA_BUFSZ_MAX);
 
 	HDA_BOOTVERBOSE(
-		device_printf(dev, "+--------------------------------------+\n");
-		device_printf(dev, "| DUMPING PCM Playback/Record Channels |\n");
-		device_printf(dev, "+--------------------------------------+\n");
-		hdaa_dump_pcmchannels(pdevinfo);
-		device_printf(dev, "\n");
-		device_printf(dev, "+-------------------------------+\n");
-		device_printf(dev, "| DUMPING Playback/Record Paths |\n");
-		device_printf(dev, "+-------------------------------+\n");
 		hdaa_dump_dac(pdevinfo);
 		hdaa_dump_adc(pdevinfo);
 		hdaa_dump_mix(pdevinfo);
-		device_printf(dev, "\n");
-		device_printf(dev, "+-------------------------+\n");
-		device_printf(dev, "| DUMPING Volume Controls |\n");
-		device_printf(dev, "+-------------------------+\n");
 		hdaa_dump_ctls(pdevinfo, "Master Volume", SOUND_MASK_VOLUME);
 		hdaa_dump_ctls(pdevinfo, "PCM Volume", SOUND_MASK_PCM);
 		hdaa_dump_ctls(pdevinfo, "CD Volume", SOUND_MASK_CD);
@@ -6816,7 +7028,6 @@ hdaa_pcm_attach(device_t dev)
 		hdaa_dump_ctls(pdevinfo, "Input Mix Level", SOUND_MASK_IMIX);
 		hdaa_dump_ctls(pdevinfo, "Input Monitoring Level", SOUND_MASK_IGAIN);
 		hdaa_dump_ctls(pdevinfo, NULL, 0);
-		device_printf(dev, "\n");
 	);
 
 	if (resource_int_value(device_get_name(dev),



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211252006.qAPK62QZ019724>