summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2008-12-21 20:17:17 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2008-12-21 20:17:17 +0000
commit22499e1f27be5180c551f8d72f250bd542ef0cf8 (patch)
tree9f606ce29010996ad2d0cc5577512e900fda2743 /sys/dev
parente6f2cbe701753699fbdde1ab1bf535e839481ba0 (diff)
add function azalia_widget_sole_conn, which determines if the
given widget is the sole connection to an ADC, DAC or pin complex. not used just yet.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/azalia.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c
index 8896ef8b24a..a38095d970d 100644
--- a/sys/dev/pci/azalia.c
+++ b/sys/dev/pci/azalia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia.c,v 1.79 2008/11/30 20:06:41 jakemsr Exp $ */
+/* $OpenBSD: azalia.c,v 1.80 2008/12/21 20:17:16 jakemsr Exp $ */
/* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
/*-
@@ -243,6 +243,7 @@ int azalia_widget_init_audio(widget_t *, const codec_t *);
int azalia_widget_init_pin(widget_t *, const codec_t *);
int azalia_widget_init_connection(widget_t *, const codec_t *);
int azalia_widget_check_conn(codec_t *, int, int);
+int azalia_widget_sole_conn(codec_t *, nid_t);
#ifdef AZALIA_DEBUG
int azalia_widget_print_audio(const widget_t *, const char *);
int azalia_widget_print_pin(const widget_t *);
@@ -1706,6 +1707,42 @@ azalia_widget_init(widget_t *this, const codec_t *codec, nid_t nid)
}
int
+azalia_widget_sole_conn(codec_t *this, nid_t nid)
+{
+ int i, j, target;
+
+ /* connected to ADC */
+ for (i = 0; i < this->adcs.ngroups; i++) {
+ for (j = 0; j < this->adcs.groups[i].nconv; j++) {
+ target = this->adcs.groups[i].conv[j];
+ if (this->w[target].nconnections == 1 &&
+ this->w[target].connections[0] == nid) {
+ return target;
+ }
+ }
+ }
+ /* connected to DAC */
+ for (i = 0; i < this->dacs.ngroups; i++) {
+ for (j = 0; j < this->dacs.groups[i].nconv; j++) {
+ target = this->dacs.groups[i].conv[j];
+ if (this->w[target].nconnections == 1 &&
+ this->w[target].connections[0] == nid) {
+ return target;
+ }
+ }
+ }
+ /* connected to pin complex */
+ FOR_EACH_WIDGET(this, i) {
+ if (this->w[i].type == COP_AWTYPE_PIN_COMPLEX &&
+ this->w[i].nconnections == 1 &&
+ this->w[i].connections[0] == nid) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+int
azalia_widget_label_widgets(codec_t *codec)
{
int i;