diff options
-rw-r--r-- | sys/dev/pci/azalia.c | 21 | ||||
-rw-r--r-- | sys/dev/pci/azalia.h | 5 | ||||
-rw-r--r-- | sys/dev/pci/azalia_codec.c | 36 |
3 files changed, 41 insertions, 21 deletions
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c index 6dceb7b96a1..62b90982789 100644 --- a/sys/dev/pci/azalia.c +++ b/sys/dev/pci/azalia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.c,v 1.105 2009/01/02 00:25:33 jakemsr Exp $ */ +/* $OpenBSD: azalia.c,v 1.106 2009/01/02 20:18:18 jakemsr Exp $ */ /* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */ /*- @@ -1264,6 +1264,7 @@ azalia_codec_init(codec_t *this) sizeof(this->w[this->audiofunc].name)); this->speaker = -1; + this->mic = -1; FOR_EACH_WIDGET(this, i) { err = azalia_widget_init(&this->w[i], this, i); if (err) @@ -2172,14 +2173,6 @@ azalia_widget_init_pin(widget_t *this, const codec_t *codec) return err; this->d.pin.cap = result; - if (this->d.pin.device == CORB_CD_MICIN && - CORB_CD_PORT(this->d.pin.config) == CORB_CD_FIXED) - this->d.pin.cap &= ~(COP_PINCAP_OUTPUT); - - if (this->d.pin.device == CORB_CD_SPEAKER && - CORB_CD_PORT(this->d.pin.config) == CORB_CD_FIXED) - this->d.pin.cap &= ~(COP_PINCAP_INPUT); - switch (this->d.pin.device) { case CORB_CD_LINEOUT: case CORB_CD_SPEAKER: @@ -2275,6 +2268,16 @@ azalia_widget_init_pin(widget_t *this, const codec_t *codec) wcodec->speaker = this->nid; } + if (this->d.pin.device == CORB_CD_MICIN && + (this->d.pin.cap & COP_PINCAP_INPUT) && + (CORB_CD_PORT(this->d.pin.config) == CORB_CD_FIXED || + CORB_CD_PORT(this->d.pin.config) == CORB_CD_BOTH)) { + if (codec->mic == -1 || + (this->d.pin.association < + codec->w[codec->mic].d.pin.association)) + wcodec->mic = this->nid; + } + return 0; } diff --git a/sys/dev/pci/azalia.h b/sys/dev/pci/azalia.h index 18d29c28595..f61c2ea0499 100644 --- a/sys/dev/pci/azalia.h +++ b/sys/dev/pci/azalia.h @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.h,v 1.33 2009/01/02 00:39:25 jakemsr Exp $ */ +/* $OpenBSD: azalia.h,v 1.34 2009/01/02 20:18:18 jakemsr Exp $ */ /* $NetBSD: azalia.h,v 1.6 2006/01/16 14:15:26 kent Exp $ */ /*- @@ -644,10 +644,11 @@ typedef struct codec_t { int nencs; int headphones; - int speaker; int hp_dac; + int speaker; int spkr_dac; int spkr_muters; + int mic; volgroup_t playvols; volgroup_t recvols; diff --git a/sys/dev/pci/azalia_codec.c b/sys/dev/pci/azalia_codec.c index 3cf988e814e..c0fc7e98683 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.102 2009/01/02 00:39:25 jakemsr Exp $ */ +/* $OpenBSD: azalia_codec.c,v 1.103 2009/01/02 20:18:18 jakemsr Exp $ */ /* $NetBSD: azalia_codec.c,v 1.8 2006/05/10 11:17:27 kent Exp $ */ /*- @@ -339,9 +339,15 @@ azalia_generic_codec_add_convgroup(codec_t *this, convgroupset_t *group, if (type == COP_AWTYPE_AUDIO_OUTPUT) { if (!(w->d.pin.cap & COP_PINCAP_OUTPUT)) continue; + if (this->mic != -1 && + w->nid == this->mic) + continue; } else { if (!(w->d.pin.cap & COP_PINCAP_INPUT)) continue; + if (this->speaker != -1 && + w->nid == this->speaker) + continue; } DPRINTF(("\tpin=%2.2x, assoc=%d, seq=%d:", w->nid, assoc, seq)); @@ -441,7 +447,7 @@ azalia_generic_unsol(codec_t *this, int tag) mc.type = AUDIO_MIXER_ENUM; mc.un.ord = 0; for (i = 0; mc.un.ord == 0 && i < this->nsense_pins; i++) { - if (!(this->spkr_muters & (1 <<i))) + if (!(this->spkr_muters & (1 << i))) continue; err = this->comresp(this, this->sense_pins[i], CORB_GET_PIN_WIDGET_CONTROL, 0, &result); @@ -543,7 +549,8 @@ azalia_generic_mixer_init(codec_t *this) if (w->type != COP_AWTYPE_AUDIO_MIXER && w->nconnections > 0 && !(w->nconnections == 1 && azalia_widget_enabled(this, w->connections[0]) && - strcmp(w->name, this->w[w->connections[0]].name) == 0)) { + strcmp(w->name, this->w[w->connections[0]].name) == 0) && + w->nid != this->mic) { MIXER_REG_PROLOG; snprintf(d->label.name, sizeof(d->label.name), "%s_source", w->name); @@ -573,7 +580,8 @@ azalia_generic_mixer_init(codec_t *this) /* output mute */ if (w->widgetcap & COP_AWCAP_OUTAMP && - w->outamp_cap & COP_AMPCAP_MUTE) { + w->outamp_cap & COP_AMPCAP_MUTE && + w->nid != this->mic) { MIXER_REG_PROLOG; snprintf(d->label.name, sizeof(d->label.name), "%s_mute", w->name); @@ -593,8 +601,9 @@ azalia_generic_mixer_init(codec_t *this) } /* output gain */ - if (w->widgetcap & COP_AWCAP_OUTAMP - && COP_AMPCAP_NUMSTEPS(w->outamp_cap)) { + if (w->widgetcap & COP_AWCAP_OUTAMP && + COP_AMPCAP_NUMSTEPS(w->outamp_cap) && + w->nid != this->mic) { MIXER_REG_PROLOG; snprintf(d->label.name, sizeof(d->label.name), "%s", w->name); @@ -619,7 +628,8 @@ azalia_generic_mixer_init(codec_t *this) /* input mute */ if (w->widgetcap & COP_AWCAP_INAMP && - w->inamp_cap & COP_AMPCAP_MUTE) { + w->inamp_cap & COP_AMPCAP_MUTE && + w->nid != this->speaker) { if (w->type != COP_AWTYPE_AUDIO_MIXER) { MIXER_REG_PROLOG; snprintf(d->label.name, sizeof(d->label.name), @@ -646,6 +656,8 @@ azalia_generic_mixer_init(codec_t *this) if (!azalia_widget_enabled(this, w->connections[j])) continue; + if (w->connections[j] == this->speaker) + continue; d->un.s.member[k].mask = 1 << j; strlcpy(d->un.s.member[k].label.name, this->w[w->connections[j]].name, @@ -659,8 +671,9 @@ azalia_generic_mixer_init(codec_t *this) } /* input gain */ - if (w->widgetcap & COP_AWCAP_INAMP - && COP_AMPCAP_NUMSTEPS(w->inamp_cap)) { + if (w->widgetcap & COP_AWCAP_INAMP && + COP_AMPCAP_NUMSTEPS(w->inamp_cap) && + w->nid != this->speaker) { if (w->type != COP_AWTYPE_AUDIO_SELECTOR && w->type != COP_AWTYPE_AUDIO_MIXER) { MIXER_REG_PROLOG; @@ -682,6 +695,8 @@ azalia_generic_mixer_init(codec_t *this) if (!azalia_widget_enabled(this, w->connections[j])) continue; + if (w->connections[j] == this->speaker) + continue; MIXER_REG_PROLOG; snprintf(d->label.name, sizeof(d->label.name), "%s_%s", @@ -724,7 +739,8 @@ azalia_generic_mixer_init(codec_t *this) /* pin headphone-boost */ if (w->type == COP_AWTYPE_PIN_COMPLEX && - w->d.pin.cap & COP_PINCAP_HEADPHONE) { + w->d.pin.cap & COP_PINCAP_HEADPHONE && + w->nid != this->mic) { MIXER_REG_PROLOG; snprintf(d->label.name, sizeof(d->label.name), "%s_boost", w->name); |