diff options
-rw-r--r-- | share/man/man4/envy.4 | 6 | ||||
-rw-r--r-- | sys/dev/pci/envy.c | 55 |
2 files changed, 58 insertions, 3 deletions
diff --git a/share/man/man4/envy.4 b/share/man/man4/envy.4 index 203af0f1837..6565764ad71 100644 --- a/share/man/man4/envy.4 +++ b/share/man/man4/envy.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: envy.4,v 1.11 2010/07/31 16:56:42 ratchov Exp $ +.\" $OpenBSD: envy.4,v 1.12 2010/09/08 20:34:11 stsp Exp $ .\" .\" Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: July 31 2010 $ +.Dd $Mdocdate: September 8 2010 $ .Dt ENVY 4 .Os .Sh NAME @@ -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 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 */ |