summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2008-12-21 20:47:56 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2008-12-21 20:47:56 +0000
commit5195fe301edf62ff0c2226f04717d78f2caf3d61 (patch)
tree0b00961de6f86f80fc29bd3fc3c62ccea9ab07f9 /sys/dev
parent7adb9c7315a06e35f0a776f215ea8fbfad46c804 (diff)
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.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/azalia.c35
1 files changed, 34 insertions, 1 deletions
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;
}