summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorDeanna Phillips <deanna@cvs.openbsd.org>2007-09-10 05:34:22 +0000
committerDeanna Phillips <deanna@cvs.openbsd.org>2007-09-10 05:34:22 +0000
commit97770813cea9e3ad5f17b5e5fb31859bc87f3241 (patch)
tree19d389d8000d47eb6770f15d7de8729432a57e02 /sys/dev/pci
parent76dfc8621235634d2c3d44715179d170e739abea (diff)
Add command verbs, a mixer target and mixer controls for EAPD control.
Some codecs, like the AD1984 found in x60s, need this in order for the speakers to work. New mixer items with names *.eapd will show up for codecs that need it and that are using the generic functions. From kent@netbsd
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/azalia.h6
-rw-r--r--sys/dev/pci/azalia_codec.c50
2 files changed, 54 insertions, 2 deletions
diff --git a/sys/dev/pci/azalia.h b/sys/dev/pci/azalia.h
index 8ef16858305..34c455ef584 100644
--- a/sys/dev/pci/azalia.h
+++ b/sys/dev/pci/azalia.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia.h,v 1.11 2007/07/23 02:03:42 deanna Exp $ */
+/* $OpenBSD: azalia.h,v 1.12 2007/09/10 05:34:21 deanna Exp $ */
/* $NetBSD: azalia.h,v 1.6 2006/01/16 14:15:26 kent Exp $ */
/*-
@@ -348,6 +348,9 @@
#define CORB_PS_RIGHT 0x1
#define CORB_GET_EAPD_BTL_ENABLE 0xf0c
#define CORB_SET_EAPD_BTL_ENABLE 0x70c
+#define CORB_EAPD_BTL 0x01
+#define CORB_EAPD_EAPD 0x02
+#define CORB_EAPD_LRSWAP 0x04
#define CORB_GET_GPI_DATA 0xf10
#define CORB_SET_GPI_DATA 0x710
#define CORB_GET_GPI_WAKE_ENABLE_MASK 0xf11
@@ -510,6 +513,7 @@ typedef struct {
#define MI_TARGET_DAC 0x104
#define MI_TARGET_ADC 0x105
#define MI_TARGET_VOLUME 0x106
+#define MI_TARGET_EAPD 0x107
} mixer_item_t;
#define VALID_WIDGET_NID(nid, codec) (nid == (codec)->audiofunc || \
diff --git a/sys/dev/pci/azalia_codec.c b/sys/dev/pci/azalia_codec.c
index 41d6d2d34b1..566fbd558cb 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.31 2007/09/10 05:26:38 deanna Exp $ */
+/* $OpenBSD: azalia_codec.c,v 1.32 2007/09/10 05:34:21 deanna Exp $ */
/* $NetBSD: azalia_codec.c,v 1.8 2006/05/10 11:17:27 kent Exp $ */
/*-
@@ -690,6 +690,25 @@ azalia_generic_mixer_init(codec_t *this)
this->nmixers++;
}
+ if (w->type == COP_AWTYPE_PIN_COMPLEX &&
+ w->d.pin.cap & COP_PINCAP_EAPD) {
+ MIXER_REG_PROLOG;
+ DPRINTF(("%s: eapd %s\n", __func__, w->name));
+ snprintf(d->label.name, sizeof(d->label.name),
+ "%s.eapd", w->name);
+ d->type = AUDIO_MIXER_ENUM;
+ d->mixer_class = AZ_CLASS_OUTPUT;
+ m->target = MI_TARGET_EAPD;
+ d->un.e.num_mem = 2;
+ d->un.e.member[0].ord = 0;
+ strlcpy(d->un.e.member[0].label.name, AudioNoff,
+ MAX_AUDIO_DEV_LEN);
+ d->un.e.member[1].ord = 1;
+ strlcpy(d->un.e.member[1].label.name, AudioNon,
+ MAX_AUDIO_DEV_LEN);
+ this->nmixers++;
+ }
+
/* volume knob */
if (w->type == COP_AWTYPE_VOLUME_KNOB &&
w->d.volume.cap & COP_VKCAP_DELTA) {
@@ -1013,6 +1032,15 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, mixer_ctrl_
mc->un.value.num_channels = 1;
}
+ /* EAPD */
+ else if (target == MI_TARGET_EAPD) {
+ err = this->comresp(this, nid,
+ CORB_GET_EAPD_BTL_ENABLE, 0, &result);
+ if (err)
+ return err;
+ mc->un.ord = result & CORB_EAPD_EAPD ? 1 : 0;
+ }
+
else {
printf("%s: internal error in %s: target=%x\n",
XNAME(this), __func__, target);
@@ -1268,6 +1296,26 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, const mixer_ctrl_
return err;
}
+ /* EAPD */
+ else if (target == MI_TARGET_EAPD) {
+ if (mc->un.ord >= 2)
+ return EINVAL;
+ err = this->comresp(this, nid,
+ CORB_GET_EAPD_BTL_ENABLE, 0, &result);
+ if (err)
+ return err;
+ result &= 0xff;
+ if (mc->un.ord == 0) {
+ result &= ~CORB_EAPD_EAPD;
+ } else {
+ result |= CORB_EAPD_EAPD;
+ }
+ err = this->comresp(this, nid,
+ CORB_SET_EAPD_BTL_ENABLE, result, &result);
+ if (err)
+ return err;
+ }
+
else {
printf("%s: internal error in %s: target=%x\n",
XNAME(this), __func__, target);