summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-04-25 12:10:20 +0000
committerAlexandre Ratchov <ratchov@cvs.openbsd.org>2009-04-25 12:10:20 +0000
commit83305b4d12f114d43bae3b6b8a415ba6c0c03fd1 (patch)
tree3ecb71b36dd188f5c7171bd739b89df252b317f6 /sys
parentd1631f649cf84ed52ca5a0ffcc5d44bcdcaaf19d (diff)
start splitting the driver in two parts: one specific to the
generic Envy24 chip common to all cards and another part specific to the cards. This will ease adding support for other card models. ok jakemsr@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/envy.c338
-rw-r--r--sys/dev/pci/envyreg.h21
-rw-r--r--sys/dev/pci/envyvar.h21
3 files changed, 254 insertions, 126 deletions
diff --git a/sys/dev/pci/envy.c b/sys/dev/pci/envy.c
index c17d1d69fff..bf7f8fb70f7 100644
--- a/sys/dev/pci/envy.c
+++ b/sys/dev/pci/envy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: envy.c,v 1.15 2009/03/29 21:53:52 sthen Exp $ */
+/* $OpenBSD: envy.c,v 1.16 2009/04/25 12:10:19 ratchov Exp $ */
/*
* Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
*
@@ -15,6 +15,19 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+/*
+ * TODO:
+ *
+ * - add ndac, nadc, nspdin, nspdout, to struct envy_card
+ *
+ * - split mixer in 3 parts: envy-specific, codec-specific, and card-specific
+ * (gpio knobs) and put codec/card specific parts into envy_card structure
+ *
+ * - use eeprom version rather isht flag
+ *
+ * - rename s/ak/spi/g
+ */
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
@@ -49,9 +62,13 @@ void envy_cci_write(struct envy_softc *, int, int);
void envy_i2c_wait(struct envy_softc *);
int envy_i2c_read(struct envy_softc *, int, int);
void envy_i2c_write(struct envy_softc *, int, int, int);
-int envy_gpio_read(struct envy_softc *);
-void envy_gpio_write(struct envy_softc *, int);
-void envy_eeprom_read(struct envy_softc *, unsigned char *);
+int envy_gpio_getstate(struct envy_softc *);
+void envy_gpio_setstate(struct envy_softc *, int);
+int envy_gpio_getmask(struct envy_softc *);
+void envy_gpio_setmask(struct envy_softc *, int);
+int envy_gpio_getdir(struct envy_softc *);
+void envy_gpio_setdir(struct envy_softc *, int);
+int envy_eeprom_gpioxxx(struct envy_softc *, int);
void envy_reset(struct envy_softc *);
int envy_ak_read(struct envy_softc *, int, int);
void envy_ak_write(struct envy_softc *, int, int, int);
@@ -85,6 +102,12 @@ int envy_get_port(void *, struct mixer_ctrl *);
int envy_set_port(void *, struct mixer_ctrl *);
int envy_get_props(void *);
+void delta_init(struct envy_softc *);
+void delta_ak_write(struct envy_softc *, int, int, int);
+
+void unkenvy_init(struct envy_softc *);
+void unkenvy_ak_write(struct envy_softc *, int, int, int);
+
struct cfattach envy_ca = {
sizeof(struct envy_softc), envymatch, envyattach, envydetach
};
@@ -123,6 +146,10 @@ struct audio_hw_if envy_hw_if = {
NULL
};
+struct pci_matchid envy_matchids[] = {
+ { PCI_VENDOR_ICENSEMBLE, PCI_PRODUCT_ICENSEMBLE_ICE1712 },
+};
+
/*
* correspondence between rates (in frames per second)
* and values of rate register
@@ -135,6 +162,96 @@ struct {
{64000, 0xf}, {88200, 0xb}, {96000, 0x7}, {-1, -1}
};
+/*
+ * array with vendor/product sub-IDs to card info
+ */
+struct envy_card envy_cards[] = {
+ {
+ PCI_ID_CODE(0x1412, 0xd63b),
+ "delta",
+ 4, 4,
+ delta_init,
+ delta_ak_write,
+ NULL
+ }, {
+ 0,
+ "unkenvy",
+ 4, 4,
+ unkenvy_init,
+ unkenvy_ak_write
+ }
+};
+
+/*
+ * m-audio delta specific code
+ */
+
+void
+delta_init(struct envy_softc *sc)
+{
+ int dev;
+
+ for (dev = 0; dev < 4 /* XXX */; dev++) {
+ envy_ak_write(sc, dev, AK_RST, 0x0);
+ delay(300);
+ envy_ak_write(sc, dev, AK_RST, AK_RST_AD | AK_RST_DA);
+ envy_ak_write(sc, dev, AK_FMT, AK_FMT_IIS24);
+ sc->ak[dev].reg[AK_DEEMVOL] = AK_DEEM_OFF;
+ sc->ak[dev].reg[AK_ADC_GAIN0] = 0x7f;
+ sc->ak[dev].reg[AK_ADC_GAIN1] = 0x7f;
+ sc->ak[dev].reg[AK_DAC_GAIN0] = 0x7f;
+ sc->ak[dev].reg[AK_DAC_GAIN1] = 0x7f;
+ }
+}
+
+void
+delta_ak_write(struct envy_softc *sc, int dev, int addr, int data)
+{
+ int bits, i, reg;
+
+ reg = envy_gpio_getstate(sc);
+ reg &= ~ENVY_GPIO_CSMASK;
+ reg |= ENVY_GPIO_CS(dev);
+ envy_gpio_setstate(sc, reg);
+ delay(1);
+
+ bits = 0xa000 | (addr << 8) | data;
+ for (i = 0; i < 16; i++) {
+ reg &= ~(ENVY_GPIO_CLK | ENVY_GPIO_DOUT);
+ reg |= (bits & 0x8000) ? ENVY_GPIO_DOUT : 0;
+ envy_gpio_setstate(sc, reg);
+ delay(1);
+
+ reg |= ENVY_GPIO_CLK;
+ envy_gpio_setstate(sc, reg);
+ delay(1);
+ bits <<= 1;
+ }
+
+ reg |= ENVY_GPIO_CSMASK;
+ envy_gpio_setstate(sc, reg);
+ delay(1);
+}
+
+/*
+ * unknown card, ignore codecs setup and hope it works with the power on
+ * settings
+ */
+
+void
+unkenvy_init(struct envy_softc *sc)
+{
+}
+
+void
+unkenvy_ak_write(struct envy_softc *sc, int dev, int addr, int data)
+{
+}
+
+/*
+ * generic Envy24 and Envy24HT code, common to all cards
+ */
+
int
envy_ccs_read(struct envy_softc *sc, int reg)
{
@@ -163,6 +280,42 @@ envy_cci_write(struct envy_softc *sc, int index, int data)
envy_ccs_write(sc, ENVY_CCI_DATA, data);
}
+int
+envy_gpio_getstate(struct envy_softc *sc)
+{
+ return envy_cci_read(sc, ENVY_CCI_GPIODATA);
+}
+
+void
+envy_gpio_setstate(struct envy_softc *sc, int reg)
+{
+ envy_cci_write(sc, ENVY_CCI_GPIODATA, reg);
+}
+
+int
+envy_gpio_getmask(struct envy_softc *sc)
+{
+ return envy_cci_read(sc, ENVY_CCI_GPIOMASK);
+}
+
+void
+envy_gpio_setmask(struct envy_softc *sc, int mask)
+{
+ envy_cci_write(sc, ENVY_CCI_GPIOMASK, mask);
+}
+
+int
+envy_gpio_getdir(struct envy_softc *sc)
+{
+ return envy_cci_read(sc, ENVY_CCI_GPIODIR);
+}
+
+void
+envy_gpio_setdir(struct envy_softc *sc, int dir)
+{
+ envy_cci_write(sc, ENVY_CCI_GPIODIR, dir);
+}
+
void
envy_i2c_wait(struct envy_softc *sc)
{
@@ -207,23 +360,6 @@ envy_i2c_write(struct envy_softc *sc, int dev, int addr, int data)
envy_ccs_write(sc, ENVY_I2C_DEV, (dev << 1) | 1);
}
-void
-envy_eeprom_read(struct envy_softc *sc, unsigned char *eeprom)
-{
- int i;
-
- for (i = 0; i < ENVY_EEPROM_MAXSZ; i++) {
- eeprom[i] = envy_i2c_read(sc, ENVY_I2C_DEV_EEPROM, i);
- }
-#ifdef ENVY_DEBUG
- printf("%s: eeprom: ", DEVNAME(sc));
- for (i = 0; i < ENVY_EEPROM_MAXSZ; i++) {
- printf(" %02x", (unsigned)eeprom[i]);
- }
- printf("\n");
-#endif
-}
-
int
envy_ak_read(struct envy_softc *sc, int dev, int addr) {
return sc->ak[dev].reg[addr];
@@ -232,40 +368,15 @@ envy_ak_read(struct envy_softc *sc, int dev, int addr) {
void
envy_ak_write(struct envy_softc *sc, int dev, int addr, int data)
{
- int bits, i, reg;
-
DPRINTFN(2, "envy_ak_write: %d, %d, 0x%x\n", dev, addr, data);
sc->ak[dev].reg[addr] = data;
-
- reg = envy_cci_read(sc, ENVY_GPIO_DATA);
- reg &= ~ENVY_GPIO_CSMASK;
- reg |= ENVY_GPIO_CS(dev);
- envy_cci_write(sc, ENVY_GPIO_DATA, reg);
- delay(1);
-
- bits = 0xa000 | (addr << 8) | data;
- for (i = 0; i < 16; i++) {
- reg &= ~(ENVY_GPIO_CLK | ENVY_GPIO_DOUT);
- reg |= (bits & 0x8000) ? ENVY_GPIO_DOUT : 0;
- envy_cci_write(sc, ENVY_GPIO_DATA, reg);
- delay(1);
-
- reg |= ENVY_GPIO_CLK;
- envy_cci_write(sc, ENVY_GPIO_DATA, reg);
- delay(1);
- bits <<= 1;
- }
-
- reg |= ENVY_GPIO_CSMASK;
- envy_cci_write(sc, ENVY_GPIO_DATA, reg);
- delay(1);
+ sc->card->ak_write(sc, dev, addr, data);
}
void
envy_reset(struct envy_softc *sc)
{
- char eeprom[ENVY_EEPROM_MAXSZ];
- int dev;
+ int i;
/*
* full reset
@@ -276,45 +387,48 @@ envy_reset(struct envy_softc *sc)
delay(200);
/*
- * read config from eprom and write it to registers
+ * read eeprom using i2c device or from a static array
+ */
+ if (sc->card->eeprom == NULL) {
+ for (i = 0; i < ENVY_EEPROM_MAXSZ; i++) {
+ sc->eeprom[i] = envy_i2c_read(sc, ENVY_I2C_DEV_EEPROM, i);
+ }
+#ifdef ENVY_DEBUG
+ printf("%s: eeprom: ", DEVNAME(sc));
+ for (i = 0; i < ENVY_EEPROM_MAXSZ; i++) {
+ printf(" %02x", (unsigned)sc->eeprom[i]);
+ }
+ printf("\n");
+#endif
+ } else
+ memcpy(sc->eeprom, sc->card->eeprom, ENVY_EEPROM_MAXSZ);
+
+ /*
+ * write eeprom values to corresponding registers
*/
- envy_eeprom_read(sc, eeprom);
pci_conf_write(sc->pci_pc, sc->pci_tag, ENVY_CONF,
- eeprom[ENVY_EEPROM_CONF] |
- (eeprom[ENVY_EEPROM_ACLINK] << 8) |
- (eeprom[ENVY_EEPROM_I2S] << 16) |
- (eeprom[ENVY_EEPROM_SPDIF] << 24));
- envy_cci_write(sc, ENVY_GPIO_MASK, eeprom[ENVY_EEPROM_GPIOMASK]);
- envy_cci_write(sc, ENVY_GPIO_DIR, eeprom[ENVY_EEPROM_GPIODIR]);
- envy_cci_write(sc, ENVY_GPIO_DATA, eeprom[ENVY_EEPROM_GPIOST]);
+ sc->eeprom[ENVY_EEPROM_CONF] |
+ (sc->eeprom[ENVY_EEPROM_ACLINK] << 8) |
+ (sc->eeprom[ENVY_EEPROM_I2S] << 16) |
+ (sc->eeprom[ENVY_EEPROM_SPDIF] << 24));
+
+ envy_gpio_setmask(sc, sc->eeprom[ENVY_EEPROM_GPIOMASK]);
+ envy_gpio_setdir(sc, sc->eeprom[ENVY_EEPROM_GPIODIR]);
+ envy_gpio_setstate(sc, sc->eeprom[ENVY_EEPROM_GPIOST]);
DPRINTF("%s: gpio_mask = %02x\n", DEVNAME(sc),
- envy_cci_read(sc, ENVY_GPIO_MASK));
+ envy_gpio_getmask(sc));
DPRINTF("%s: gpio_dir = %02x\n", DEVNAME(sc),
- envy_cci_read(sc, ENVY_GPIO_DIR));
+ envy_gpio_getdir(sc));
DPRINTF("%s: gpio_state = %02x\n", DEVNAME(sc),
- envy_cci_read(sc, ENVY_GPIO_DATA));
-
- /*
- * reset ak4524 codecs
- */
- for (dev = 0; dev < 4; dev++) {
- envy_ak_write(sc, dev, AK_RST, 0x0);
- delay(300);
- envy_ak_write(sc, dev, AK_RST, AK_RST_AD | AK_RST_DA);
- envy_ak_write(sc, dev, AK_FMT, AK_FMT_IIS24);
- sc->ak[dev].reg[AK_DEEMVOL] = AK_DEEM_OFF;
- sc->ak[dev].reg[AK_ADC_GAIN0] = 0x7f;
- sc->ak[dev].reg[AK_ADC_GAIN1] = 0x7f;
- sc->ak[dev].reg[AK_DAC_GAIN0] = 0x7f;
- sc->ak[dev].reg[AK_DAC_GAIN1] = 0x7f;
- }
+ envy_gpio_getstate(sc));
/*
* clear all interrupts and unmask used ones
*/
envy_ccs_write(sc, ENVY_CCS_INTSTAT, 0xff);
envy_ccs_write(sc, ENVY_CCS_INTMASK, ~ENVY_CCS_INT_MT);
+ sc->card->init(sc);
}
int
@@ -487,13 +601,8 @@ envy_mon_setvol(struct envy_softc *sc, int idx, int ch, int val) {
int
envymatch(struct device *parent, void *match, void *aux) {
- struct pci_attach_args *pa = (struct pci_attach_args *)aux;
-
- if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ICENSEMBLE &&
- PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ICENSEMBLE_ICE1712) {
- return 1;
- }
- return 0;
+ return pci_matchbyid((struct pci_attach_args *)aux, envy_matchids,
+ sizeof(envy_matchids) / sizeof(envy_matchids[0]));
}
void
@@ -503,6 +612,7 @@ envyattach(struct device *parent, struct device *self, void *aux)
struct pci_attach_args *pa = (struct pci_attach_args *)aux;
pci_intr_handle_t ih;
const char *intrstr;
+ int subid;
sc->pci_tag = pa->pa_tag;
sc->pci_pc = pa->pa_pc;
@@ -513,13 +623,13 @@ envyattach(struct device *parent, struct device *self, void *aux)
sc->mt_iosz = 0;
if (pci_mapreg_map(pa, ENVY_CTL_BAR, PCI_MAPREG_TYPE_IO, 0,
- &sc->ccs_iot, &sc->ccs_ioh, NULL, &sc->ccs_iosz, 0)) {
+ &sc->ccs_iot, &sc->ccs_ioh, NULL, &sc->ccs_iosz, 0)) {
printf(": can't map ctl i/o space\n");
sc->ccs_iosz = 0;
return;
}
- if (pci_mapreg_map(pa, ENVY_MT_BAR, PCI_MAPREG_TYPE_IO, 0,
- &sc->mt_iot, &sc->mt_ioh, NULL, &sc->mt_iosz, 0)) {
+ if (pci_mapreg_map(pa, ENVY_MT_BAR, PCI_MAPREG_TYPE_IO, 0,
+ &sc->mt_iot, &sc->mt_ioh, NULL, &sc->mt_iosz, 0)) {
printf(": can't map mt i/o space\n");
sc->mt_iosz = 0;
return;
@@ -538,6 +648,16 @@ envyattach(struct device *parent, struct device *self, void *aux)
return;
}
printf(": %s\n", intrstr);
+ subid = pci_conf_read(sc->pci_pc, sc->pci_tag, PCI_SUBVEND_0);
+ sc->card = envy_cards;
+ while (sc->card->subid != subid) {
+ if (sc->card->subid == 0) {
+ printf("%s: unknown card\n", DEVNAME(sc));
+ break;
+ }
+ sc->card++;
+ }
+ DPRINTF("%s: type=%s\n", DEVNAME(sc), sc->card->name);
envy_reset(sc);
sc->audio = audio_attach_mi(&envy_hw_if, sc, &sc->dev);
}
@@ -623,8 +743,8 @@ envy_allocm(void *self, int dir, size_t size, int type, int flags)
goto err_destroy;
}
bus_space_write_4(sc->mt_iot, sc->mt_ioh, basereg, buf->seg.ds_addr);
- DPRINTF("%s: allocated %d bytes dir=%d, ka=%p, da=%p\n",
- DEVNAME(sc), buf->size, dir, buf->addr, buf->seg.ds_addr);
+ DPRINTF("%s: allocated %ld bytes dir=%d, ka=%p, da=%p\n",
+ DEVNAME(sc), buf->size, dir, buf->addr, (void *)buf->seg.ds_addr);
return buf->addr;
err_destroy:
@@ -718,23 +838,17 @@ envy_set_params(void *self, int setmode, int usemode,
int
envy_round_blocksize(void *self, int blksz)
{
- /*
- * XXX: sizes depend on the mode but we don't have
- * access to the mode here; So we use the greatest
- * common divisor of input and output blocksizes, until
- * upper layer is fixed
- */
-#define ENVY_GCD (6 * 5 * 4)
- return (blksz / ENVY_GCD) * ENVY_GCD;
+#define ENVY_MUL (6 * 5 * 4)
+ blksz -= blksz % ENVY_MUL;
+ if (blksz == 0)
+ blksz = ENVY_MUL;
+ return blksz;
}
size_t
envy_round_buffersize(void *self, int dir, size_t bufsz)
{
- /*
- * XXX: same remark as above
- */
- return (bufsz / ENVY_GCD) * ENVY_GCD;
+ return bufsz;
}
int
@@ -746,14 +860,16 @@ envy_trigger_output(void *self, void *start, void *end, int blksz,
int st;
bufsz = end - start;
- if (bufsz % (ENVY_PCHANS * 4) != 0) {
- DPRINTF("%s: %d: bad output bufsz\n", DEVNAME(sc), bufsz);
+#ifdef ENVY_DEBUG
+ if (blksz % ENVY_PFRAME_SIZE != 0) {
+ printf("%s: %d: bad output blksz\n", DEVNAME(sc), blksz);
return EINVAL;
}
- if (blksz % (ENVY_PCHANS * 4) != 0) {
- DPRINTF("%s: %d: bad output blksz\n", DEVNAME(sc), blksz);
+ if (bufsz % blksz) {
+ printf("%s: %ld: bad output bufsz\n", DEVNAME(sc), bufsz);
return EINVAL;
}
+#endif
bus_space_write_2(sc->mt_iot, sc->mt_ioh,
ENVY_MT_PBUFSZ, bufsz / 4 - 1);
bus_space_write_2(sc->mt_iot, sc->mt_ioh,
@@ -780,14 +896,16 @@ envy_trigger_input(void *self, void *start, void *end, int blksz,
int st;
bufsz = end - start;
- if (bufsz % (ENVY_RCHANS * 4) != 0) {
- DPRINTF("%s: %d: bad input bufsz\n", DEVNAME(sc), bufsz);
+#ifdef ENVY_DEBUG
+ if (blksz % ENVY_RFRAME_SIZE != 0) {
+ printf("%s: %d: bad input blksz\n", DEVNAME(sc), blksz);
return EINVAL;
}
- if (blksz % (ENVY_RCHANS * 4) != 0) {
- DPRINTF("%s: %d: bad input blksz\n", DEVNAME(sc), blksz);
+ if (bufsz % blksz != 0) {
+ printf("%s: %ld: bad input bufsz\n", DEVNAME(sc), bufsz);
return EINVAL;
}
+#endif
bus_space_write_2(sc->mt_iot, sc->mt_ioh,
ENVY_MT_RBUFSZ, bufsz / 4 - 1);
bus_space_write_2(sc->mt_iot, sc->mt_ioh,
@@ -832,9 +950,11 @@ envy_halt_input(void *self)
int
envy_getdev(void *self, struct audio_device *dev)
{
+ struct envy_softc *sc = (struct envy_softc *)self;
+
strlcpy(dev->name, "Envy24", MAX_AUDIO_DEV_LEN);
- strlcpy(dev->version, "-", MAX_AUDIO_DEV_LEN); /* XXX eeprom version */
- strlcpy(dev->config, "envy", MAX_AUDIO_DEV_LEN);
+ strlcpy(dev->version, "-", MAX_AUDIO_DEV_LEN);
+ strlcpy(dev->config, sc->card->name, MAX_AUDIO_DEV_LEN);
return 0;
}
diff --git a/sys/dev/pci/envyreg.h b/sys/dev/pci/envyreg.h
index 22c95f3151d..6466ab6e876 100644
--- a/sys/dev/pci/envyreg.h
+++ b/sys/dev/pci/envyreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: envyreg.h,v 1.4 2008/11/29 18:32:18 ratchov Exp $ */
+/* $OpenBSD: envyreg.h,v 1.5 2009/04/25 12:10:19 ratchov Exp $ */
/*
* Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
*
@@ -58,9 +58,9 @@
/*
* CCI registers to access GPIO pins
*/
-#define ENVY_GPIO_DATA 0x20
-#define ENVY_GPIO_MASK 0x21
-#define ENVY_GPIO_DIR 0x22
+#define ENVY_CCI_GPIODATA 0x20
+#define ENVY_CCI_GPIOMASK 0x21
+#define ENVY_CCI_GPIODIR 0x22
/*
* GPIO pin numbers
@@ -81,8 +81,6 @@
#define ENVY_EEPROM_GPIOST 11
#define ENVY_EEPROM_GPIODIR 12
-#define ENVY_EEPROM_MAXSZ 32
-
/*
* MT registers for play/record params
*/
@@ -93,14 +91,15 @@
#define ENVY_MT_INTR_RMASK 0x80
#define ENVY_MT_RATE 1
#define ENVY_MT_RATEMASK 0x0f
+#define ENVY_MT_IMASK 3
+#define ENVY_MT_IMASK_PDMA0 0x1
+#define ENVY_MT_IMASK_RDMA0 0x2
#define ENVY_MT_PADDR 0x10
#define ENVY_MT_PBUFSZ 0x14
#define ENVY_MT_PBLKSZ 0x16
#define ENVY_MT_CTL 0x18
#define ENVY_MT_CTL_PSTART 0x01
-#define ENVY_MT_CTL_PPAUSE 0x02
#define ENVY_MT_CTL_RSTART 0x04
-#define ENVY_MT_CTL_RPAUSE 0x08
#define ENVY_MT_RADDR 0x20
#define ENVY_MT_RBUFSZ 0x24
#define ENVY_MT_RBLKSZ 0x26
@@ -174,11 +173,9 @@
/*
* default formats
*/
-#define ENVY_RFRAME_SIZE (4 * 12)
-#define ENVY_PFRAME_SIZE (4 * 10)
-#define ENVY_RBUF_SIZE (ENVY_RFRAME_SIZE * 0x1000)
-#define ENVY_PBUF_SIZE (ENVY_PFRAME_SIZE * 0x1000)
#define ENVY_RCHANS 12
#define ENVY_PCHANS 10
+#define ENVY_RFRAME_SIZE (4 * ENVY_RCHANS)
+#define ENVY_PFRAME_SIZE (4 * ENVY_PCHANS)
#endif /* !defined(SYS_DEV_PCI_ENVYREG_H) */
diff --git a/sys/dev/pci/envyvar.h b/sys/dev/pci/envyvar.h
index 217a3c11a63..5de059eb157 100644
--- a/sys/dev/pci/envyvar.h
+++ b/sys/dev/pci/envyvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: envyvar.h,v 1.5 2008/03/22 11:23:11 ratchov Exp $ */
+/* $OpenBSD: envyvar.h,v 1.6 2009/04/25 12:10:19 ratchov Exp $ */
/*
* Copyright (c) 2007 Alexandre Ratchov <alex@caoua.org>
*
@@ -22,6 +22,8 @@
#include <sys/device.h>
#include <dev/audio_if.h>
+struct envy_softc;
+
struct envy_buf {
bus_dma_segment_t seg;
bus_dmamap_t map;
@@ -29,11 +31,17 @@ struct envy_buf {
size_t size;
};
-/*
- * ak4524 codecs
- */
+struct envy_card {
+ int subid;
+ char *name;
+ int nadc, ndac;
+ void (*init)(struct envy_softc *);
+ void (*ak_write)(struct envy_softc *, int, int, int);
+ unsigned char *eeprom;
+};
+
struct envy_ak {
- unsigned char reg[8]; /* shadow for ak4524 registers */
+ unsigned char reg[16];
};
struct envy_softc {
@@ -50,7 +58,10 @@ struct envy_softc {
bus_space_tag_t mt_iot;
bus_space_handle_t mt_ioh;
bus_size_t mt_iosz;
+ struct envy_card *card;
struct envy_ak ak[4];
+#define ENVY_EEPROM_MAXSZ 32
+ unsigned char eeprom[ENVY_EEPROM_MAXSZ];
void (*iintr)(void *);
void *iarg;
void (*ointr)(void *);