diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2008-10-16 02:13:13 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2008-10-16 02:13:13 +0000 |
commit | f362a3a0e2a178c8353a6013b7572769234ac867 (patch) | |
tree | 14414016de52778c66cd21c710ac8321b001ed91 /sys | |
parent | 1fbe46050a0db37a3169039e4038ff77be63766d (diff) |
Some pins are not connected and dead-end. This diff removes such pins
from conection and mixer lists. It also removes knobs connected to
power widgets.
from NetBSD via Alexey Suslikov, thanks
tested by several, thanks also
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/azalia.h | 11 | ||||
-rw-r--r-- | sys/dev/pci/azalia_codec.c | 34 |
2 files changed, 42 insertions, 3 deletions
diff --git a/sys/dev/pci/azalia.h b/sys/dev/pci/azalia.h index 1bdaeb417fe..b6d466daad7 100644 --- a/sys/dev/pci/azalia.h +++ b/sys/dev/pci/azalia.h @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.h,v 1.15 2008/06/26 05:42:17 ray Exp $ */ +/* $OpenBSD: azalia.h,v 1.16 2008/10/16 02:13:12 jakemsr Exp $ */ /* $NetBSD: azalia.h,v 1.6 2006/01/16 14:15:26 kent Exp $ */ /*- @@ -553,6 +553,15 @@ typedef struct { (nid >= (codec)->wstart && \ nid < (codec)->wend)) +#define PIN_STATUS(wid, conn) \ + do { \ + if ((wid)->type != COP_AWTYPE_PIN_COMPLEX) \ + (conn) = 0; \ + else \ + (conn) = \ + ((wid)->d.pin.config & CORB_CD_PORT_MASK) >> 30; \ + } while (0) + typedef struct { int nconv; nid_t conv[HDA_MAX_CHANNELS]; /* front, surround, clfe, side, ... */ diff --git a/sys/dev/pci/azalia_codec.c b/sys/dev/pci/azalia_codec.c index 17cce29c486..000c3edbac8 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.49 2008/06/26 05:42:17 ray Exp $ */ +/* $OpenBSD: azalia_codec.c,v 1.50 2008/10/16 02:13:12 jakemsr Exp $ */ /* $NetBSD: azalia_codec.c,v 1.8 2006/05/10 11:17:27 kent Exp $ */ /*- @@ -428,8 +428,17 @@ azalia_generic_mixer_init(codec_t *this) w = &this->w[i]; + /* skip unconnected pins */ + if (w->type == COP_AWTYPE_PIN_COMPLEX) { + uint8_t conn = + (w->d.pin.config & CORB_CD_PORT_MASK) >> 30; + if (conn == 1) /* no physical connection */ + continue; + } + /* selector */ - if (w->type != COP_AWTYPE_AUDIO_MIXER && w->nconnections >= 2) { + if (w->type != COP_AWTYPE_AUDIO_MIXER && + w->type != COP_AWTYPE_POWER && w->nconnections >= 2) { MIXER_REG_PROLOG; snprintf(d->label.name, sizeof(d->label.name), "%s.source", w->name); @@ -442,8 +451,15 @@ azalia_generic_mixer_init(codec_t *this) d->mixer_class = AZ_CLASS_OUTPUT; m->target = MI_TARGET_CONNLIST; for (j = 0, k = 0; j < w->nconnections && k < 32; j++) { + uint8_t conn; + if (!VALID_WIDGET_NID(w->connections[j], this)) continue; + /* skip unconnected pins */ + PIN_STATUS(&this->w[w->connections[j]], + conn); + if (conn == 1) + continue; d->un.e.member[k].ord = j; strlcpy(d->un.e.member[k].label.name, this->w[w->connections[j]].name, @@ -531,10 +547,17 @@ azalia_generic_mixer_init(codec_t *this) AudioNon, MAX_AUDIO_DEV_LEN); this->nmixers++; } else { + uint8_t conn; + for (j = 0; j < w->nconnections; j++) { MIXER_REG_PROLOG; if (!VALID_WIDGET_NID(w->connections[j], this)) continue; + /* skip unconnected pins */ + PIN_STATUS(&this->w[w->connections[j]], + conn); + if (conn == 1) + continue; snprintf(d->label.name, sizeof(d->label.name), "%s.%s.mute", w->name, this->w[w->connections[j]].name); @@ -582,10 +605,17 @@ azalia_generic_mixer_init(codec_t *this) MIXER_DELTA(COP_AMPCAP_NUMSTEPS(w->inamp_cap)); this->nmixers++; } else { + uint8_t conn; + for (j = 0; j < w->nconnections; j++) { MIXER_REG_PROLOG; if (!VALID_WIDGET_NID(w->connections[j], this)) continue; + /* skip unconnected pins */ + PIN_STATUS(&this->w[w->connections[j]], + conn); + if (conn == 1) + continue; snprintf(d->label.name, sizeof(d->label.name), "%s.%s", w->name, this->w[w->connections[j]].name); |