Based on a diff from ratchov@, I could finally get this card to work after
several long nights of comparing our code to the FreeBSD and Linux drivers,
chasing bugs which weren't there. Turns out I had to disable the on-board
sound chip in the BIOS to get sound from the card...
Any envy(4) users, please give this a spin and report breakage, if any.
If you have a Terratec EWX 24/96 card, please let me know if this diff
makes your card happy, too. Thanks.
Index: sys/dev/pci/envy.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/envy.c,v
retrieving revision 1.40
diff -u -p -r1.40 envy.c
--- sys/dev/pci/envy.c 31 Jul 2010 16:52:37 -0000 1.40
+++ sys/dev/pci/envy.c 3 Sep 2010 10:47:16 -0000
@@ -119,6 +119,8 @@ void delta_codec_write(struct envy_softc
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,
@@ -436,6 +445,50 @@ ap192k_codec_write(struct envy_softc *sc
envy_gpio_setstate(sc, reg);
delay(1);
}
+
+/*
+ * 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
Index: share/man/man4/envy.4
===================================================================
RCS file: /cvs/src/share/man/man4/envy.4,v
retrieving revision 1.11
diff -u -p -r1.11 envy.4
--- share/man/man4/envy.4 31 Jul 2010 16:56:42 -0000 1.11
+++ share/man/man4/envy.4 3 Sep 2010 02:32:01 -0000
@@ -42,6 +42,8 @@ M-Audio Audiophile 192k
ESI Julia
.It
VIA Tremor 5.1
+.It
+Terratec EWX 24/96
.El
.Ss Mixer device
The chip features a digital mixer that routes and mixes the