summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2002-06-03 21:13:21 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2002-06-03 21:13:21 +0000
commit4337be2d936382ddedb85398c74c1ccfea8f78a7 (patch)
treedd9c88f271975b1c731e5111febdd890e8d3aa7e /sys/dev/pci
parentaae11517281ee815de56f319642c21529d9c6b7c (diff)
probe for flavours, aps and audigy still need more work though
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/emuxki.c33
-rw-r--r--sys/dev/pci/emuxkireg.h5
-rw-r--r--sys/dev/pci/emuxkivar.h7
3 files changed, 35 insertions, 10 deletions
diff --git a/sys/dev/pci/emuxki.c b/sys/dev/pci/emuxki.c
index 9d2318e6509..922ce0f790b 100644
--- a/sys/dev/pci/emuxki.c
+++ b/sys/dev/pci/emuxki.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: emuxki.c,v 1.10 2002/03/14 03:16:06 millert Exp $ */
+/* $OpenBSD: emuxki.c,v 1.11 2002/06/03 21:13:20 mickey Exp $ */
/* $NetBSD: emuxki.c,v 1.1 2001/10/17 18:39:41 jdolecek Exp $ */
/*-
@@ -342,6 +342,8 @@ emuxki_scinit(struct emuxki_softc *sc)
int err;
bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_HCFG,
+ /* enable spdif(?) output on non-APS */
+ (sc->sc_type == EMUXKI_APS? 0 : EMU_HCFG_GPOUTPUT0) |
EMU_HCFG_LOCKSOUNDCACHE | EMU_HCFG_LOCKTANKCACHE_MASK |
EMU_HCFG_MUTEBUTTONENABLE);
bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_INTE,
@@ -427,7 +429,24 @@ emuxki_attach(struct device *parent, struct device *self, void *aux)
}
printf(": %s\n", intrstr);
- if (emuxki_scinit(sc) || emuxki_ac97_init(sc) ||
+ /* XXX it's unknown wheather APS is made from Audigy as well */
+ if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CREATIVELABS_AUDIGY) {
+ sc->sc_type = EMUXKI_AUDIGY;
+ strcpy(sc->sc_audv.name, "Audigy");
+ } else if (pci_conf_read(pa->pa_pc, pa->pa_tag,
+ PCI_SUBSYS_ID_REG) == EMU_SUBSYS_APS) {
+ sc->sc_type = EMUXKI_APS;
+ strcpy(sc->sc_audv.name, "E-mu APS");
+ } else {
+ sc->sc_type = EMUXKI_SBLIVE;
+ strcpy(sc->sc_audv.name, "SB Live!");
+ }
+ sprintf(sc->sc_audv.version, "0x%02x", PCI_REVISION(pa->pa_class));
+ strcpy(sc->sc_audv.config, "emuxki");
+
+ if (emuxki_scinit(sc) ||
+ /* APS has no ac97 XXX */
+ (sc->sc_type == EMUXKI_APS || emuxki_ac97_init(sc)) ||
(sc->sc_audev = audio_attach_mi(&emuxki_hw_if, sc, self)) == NULL)
emuxki_pci_shutdown(sc);
}
@@ -1845,13 +1864,11 @@ emuxki_halt_input(void *addr)
}
int
-emuxki_getdev(void *addr, struct audio_device *dev)
+emuxki_getdev(void *v, struct audio_device *adp)
{
- strncpy(dev->name, "Creative EMU10k1", sizeof(dev->name));
- strcpy(dev->version, "");
- strncpy(dev->config, "emuxki", sizeof(dev->config));
-
- return (0);
+ struct emuxki_softc *sc = v;
+ *adp = sc->sc_audv;
+ return 0;
}
int
diff --git a/sys/dev/pci/emuxkireg.h b/sys/dev/pci/emuxkireg.h
index b8827b62af4..c9b9d395926 100644
--- a/sys/dev/pci/emuxkireg.h
+++ b/sys/dev/pci/emuxkireg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: emuxkireg.h,v 1.2 2001/10/24 15:09:28 brad Exp $ */
+/* $OpenBSD: emuxkireg.h,v 1.3 2002/06/03 21:13:20 mickey Exp $ */
/* $NetBSD: emuxkireg.h,v 1.1 2001/10/17 18:39:41 jdolecek Exp $ */
/*-
@@ -141,6 +141,9 @@
#define EMU_HCFG_CODECFMT_I2S 0x00010000
#define EMU_HCFG_GPINPUT0 0x00004000
#define EMU_HCFG_GPINPUT1 0x00002000
+#define EMU_HCFG_GPOUTPUT0 0x00001000
+#define EMU_HCFG_GPOUTPUT1 0x00000800
+#define EMU_HCFG_GPOUTPUT2 0x00000400
#define EMU_HCFG_GPOUTPUT_MASK 0x00001c00
#define EMU_HCFG_JOYENABLE 0x00000200
#define EMU_HCFG_PHASETRACKENABLE 0x00000100
diff --git a/sys/dev/pci/emuxkivar.h b/sys/dev/pci/emuxkivar.h
index c51eecbaf27..d609a26ce25 100644
--- a/sys/dev/pci/emuxkivar.h
+++ b/sys/dev/pci/emuxkivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: emuxkivar.h,v 1.3 2001/11/26 18:16:02 mickey Exp $ */
+/* $OpenBSD: emuxkivar.h,v 1.4 2002/06/03 21:13:20 mickey Exp $ */
/* $NetBSD: emuxkivar.h,v 1.1 2001/10/17 18:39:41 jdolecek Exp $ */
/*-
@@ -41,6 +41,7 @@
#define _DEV_PCI_EMU10K1VAR_H_
#define EMU_PCI_CBIO 0x10
+#define EMU_SUBSYS_APS 0x40011102
/*
* dma memory managment
@@ -225,6 +226,10 @@ struct emuxki_stream {
struct emuxki_softc {
struct device sc_dev;
+ struct audio_device sc_audv;
+ enum {
+ EMUXKI_SBLIVE, EMUXKI_APS, EMUXKI_AUDIGY
+ } sc_type;
/* Autoconfig parameters */
bus_space_tag_t sc_iot;