diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2008-11-28 03:27:12 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2008-11-28 03:27:12 +0000 |
commit | b409ba887aaa9a3fe1a8233e858854db76bf9b75 (patch) | |
tree | f460c70811455f478d6830e0249d9f832a6f2773 /sys/dev | |
parent | a0ecbeaf4c06d0ff7a49b261fd3a774ab7f6a2a8 (diff) |
- DACs don't have connection lists like ADCs do
- we're only interested in ADCs in the ADC converter group
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/azalia_codec.c | 74 |
1 files changed, 22 insertions, 52 deletions
diff --git a/sys/dev/pci/azalia_codec.c b/sys/dev/pci/azalia_codec.c index df1d670b2f8..8c0013b377f 100644 --- a/sys/dev/pci/azalia_codec.c +++ b/sys/dev/pci/azalia_codec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia_codec.c,v 1.70 2008/11/28 03:18:11 jakemsr Exp $ */ +/* $OpenBSD: azalia_codec.c,v 1.71 2008/11/28 03:27:11 jakemsr Exp $ */ /* $NetBSD: azalia_codec.c,v 1.8 2006/05/10 11:17:27 kent Exp $ */ /*- @@ -460,12 +460,10 @@ azalia_generic_mixer_init(codec_t *this) * selector "sel%2.2x" */ mixer_item_t *m; - int err, i, j, k; + int err, i, j, k, l; - nid_t dconns[32]; - int ndconns = 0; nid_t aconns[32]; - int naconns = 0; + int naconns; this->maxmixers = 10; this->nmixers = 0; @@ -518,6 +516,7 @@ azalia_generic_mixer_init(codec_t *this) d = &m->devinfo; \ m->nid = i + naconns = 0; FOR_EACH_WIDGET(this, i) { const widget_t *w; @@ -525,56 +524,27 @@ azalia_generic_mixer_init(codec_t *this) if (!w->enable) continue; - /* converters (DACc/ADCs) - * not mixer widgets, but keep track of connections to - * help determine mixer class. - */ - if (w->widgetcap & COP_AWCAP_FORMATOV) { - /* adcs */ - if (w->type == COP_AWTYPE_AUDIO_INPUT) { - for (j = 0; j < w->nconnections; j++) { - const widget_t *ww; + /* usable adcs - connections should be in AZ_CLASS_RECORD */ + if (w->type == COP_AWTYPE_AUDIO_INPUT) { + const convgroupset_t *group; - if (!VALID_WIDGET_NID(w->connections[j], - this)) - continue; - ww = &this->w[w->connections[j]]; - if (!ww->enable) - continue; - for (k = 0; k < naconns; k++) { - if (aconns[k] == - w->connections[j]) - break; - } - if (k == naconns) - aconns[naconns++] = - w->connections[j]; - if (naconns == 32) - break; - } - } - /* dacs */ - if (w->type == COP_AWTYPE_AUDIO_OUTPUT) { - for (j = 0; j < w->nconnections; j++) { - const widget_t *ww; + group = &this->adcs; + for (j = 0; j < group->groups[group->cur].nconv; j++) + if (group->groups[group->cur].conv[j] == w->nid) + break; + if (j == group->groups[group->cur].nconv) + continue; - if (!VALID_WIDGET_NID(w->connections[j], - this)) - continue; - ww = &this->w[w->connections[j]]; - if (!ww->enable) - continue; - for (k = 0; k < ndconns; k++) { - if (dconns[k] == - w->connections[j]) - break; - } - if (k == ndconns) - dconns[ndconns++] = - w->connections[j]; - if (ndconns == 32) + for (j = 0; j < w->nconnections && naconns < 32; j++) { + k = azalia_nid_to_index(this, + w->connections[j]); + if (k == -1) + continue; + for (l = 0; l < naconns; l++) + if (aconns[l] == this->w[k].nid) break; - } + if (l == naconns) + aconns[naconns++] = this->w[k].nid; } } |