From 5195fe301edf62ff0c2226f04717d78f2caf3d61 Mon Sep 17 00:00:00 2001 From: Jacob Meuser Date: Sun, 21 Dec 2008 20:47:56 +0000 Subject: if a widget is the sole connection to another widget, name the widget for the widget it's connected to. but be a bit careful to not end up with duplicate mixer item names. --- sys/dev/pci/azalia.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'sys') diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c index 80146a7f31c..c23d56de6ee 100644 --- a/sys/dev/pci/azalia.c +++ b/sys/dev/pci/azalia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.c,v 1.82 2008/12/21 20:44:04 jakemsr Exp $ */ +/* $OpenBSD: azalia.c,v 1.83 2008/12/21 20:47:55 jakemsr Exp $ */ /* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */ /*- @@ -1893,6 +1893,39 @@ azalia_widget_label_widgets(codec_t *codec) if (codec->init_widget != NULL) codec->init_widget(codec, w, w->nid); } + + /* Rename mixers and selectors that connect to only one other + * widget as the widget they are connected to. + */ + FOR_EACH_WIDGET(codec, i) { + if (codec->w[i].type != COP_AWTYPE_AUDIO_MIXER && + codec->w[i].type != COP_AWTYPE_AUDIO_SELECTOR) + continue; + /* Special case. A selector with outamp capabilities + * and is connected to a single widget that has no + * inamp capabilities. This widget serves only to act + * as the input amp for the widget it is connected to. + */ + j = -1; + if (codec->w[i].type == COP_AWTYPE_AUDIO_SELECTOR && + (codec->w[i].widgetcap & COP_AWCAP_OUTAMP) && + codec->w[i].nconnections == 1) { + j = codec->w[i].connections[0]; + if (!(codec->w[j].widgetcap & COP_AWCAP_INAMP)) + codec->w[i].mixer_class = AZ_CLASS_INPUT; + else + j = -1; + } + if (j == -1) + j = azalia_widget_sole_conn(codec, i); + if (j >= 0) { + snprintf(codec->w[i].name, sizeof(codec->w[i].name), + "%s", codec->w[j].name); + if (codec->w[j].mixer_class == AZ_CLASS_RECORD) + codec->w[i].mixer_class = AZ_CLASS_RECORD; + } + } + return 0; } -- cgit v1.2.3