summaryrefslogtreecommitdiff
path: root/sys/dev/pci/envy.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/pci/envy.c')
-rw-r--r--sys/dev/pci/envy.c55
1 files changed, 54 insertions, 1 deletions
diff --git a/sys/dev/pci/envy.c b/sys/dev/pci/envy.c
index 3ba0358dbfd..45f83d31873 100644
--- a/sys/dev/pci/envy.c
+++ b/sys/dev/pci/envy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: envy.c,v 1.40 2010/07/31 16:52:37 ratchov Exp $ */
+/* $OpenBSD: envy.c,v 1.41 2010/09/08 20:34:11 stsp Exp $ */
/*
* Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
*
@@ -119,6 +119,8 @@ void delta_codec_write(struct envy_softc *, int, int, int);
void ap192k_init(struct envy_softc *);
void ap192k_codec_write(struct envy_softc *, int, int, int);
+void ewx_codec_write(struct envy_softc *, int, int, int);
+
void revo51_init(struct envy_softc *);
void revo51_codec_write(struct envy_softc *, int, int, int);
@@ -269,6 +271,13 @@ struct envy_card envy_cards[] = {
delta_codec_write,
NULL
}, {
+ PCI_ID_CODE(0x153b, 0x1130),
+ "Terratec EWX 24/96",
+ 2, &ak4524_adc, 2, &ak4524_dac,
+ delta_init,
+ ewx_codec_write,
+ NULL
+ }, {
0,
"unknown 1712-based card",
8, &unkenvy_codec, 8, &unkenvy_codec,
@@ -438,6 +447,50 @@ ap192k_codec_write(struct envy_softc *sc, int dev, int addr, int data)
}
/*
+ * Terratec EWX specific code
+ */
+
+/*
+ * GPIO pin numbers
+ */
+#define EWX_GPIO_CSMASK 0x01
+#define EWX_GPIO_DOUT 0x10
+#define EWX_GPIO_CLK 0x20
+
+void
+ewx_codec_write(struct envy_softc *sc, int dev, int addr, int data)
+{
+ int bits, i, reg;
+
+ reg = envy_gpio_getstate(sc);
+ reg |= (EWX_GPIO_CSMASK | EWX_GPIO_CLK);
+ envy_gpio_setstate(sc, reg);
+ delay(1);
+
+ bits = 0xa000 | (addr << 8) | data;
+ for (i = 0; i < 16; i++) {
+ reg &= ~(EWX_GPIO_CLK | EWX_GPIO_DOUT);
+ reg |= (bits & 0x8000) ? EWX_GPIO_DOUT : 0;
+ envy_gpio_setstate(sc, reg);
+ delay(1);
+
+ reg |= EWX_GPIO_CLK;
+ envy_gpio_setstate(sc, reg);
+ delay(1);
+ bits <<= 1;
+ }
+
+ reg &= ~EWX_GPIO_CSMASK;
+ envy_gpio_setstate(sc, reg);
+ delay(1);
+
+ reg |= EWX_GPIO_CSMASK;
+ envy_gpio_setstate(sc, reg);
+ delay(1);
+}
+
+
+/*
* M-Audio Revolution 5.1 specific code
*/