This is a discussion on Re: support Audigy 2 Value within the mailing.openbsd.tech forums, part of the OpenBSD category; --> Do not forget me. I did some changes in patch. Index: emuxki.c ================================================== ================= RCS file: /cvs/openbsd/src/sys/dev/pci/emuxki.c,v retrieving revision ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Do not forget me. I did some changes in patch. Index: emuxki.c ================================================== ================= RCS file: /cvs/openbsd/src/sys/dev/pci/emuxki.c,v retrieving revision 1.23 diff -u -p -r1.23 emuxki.c --- emuxki.c 20 Jan 2006 09:50:31 -0000 1.23 +++ emuxki.c 26 Mar 2006 08:02:52 -0000 @@ -366,7 +366,7 @@ emuxki_pci_shutdown(struct emuxki_softc int emuxki_scinit(struct emuxki_softc *sc) { - int err; + int err; bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_HCFG, /* enable spdif(?) output on non-APS */ @@ -397,9 +397,15 @@ emuxki_scinit(struct emuxki_softc *sc) EMU_INTE_MUTEENABLE); if (sc->sc_type & EMUXKI_AUDIGY2) { - bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A_IOCFG, - EMU_A_IOCFG_GPOUT0 | - bus_space_read_4(sc->sc_iot, sc->sc_ioh, EMU_A_IOCFG)); + if (sc->sc_details & EMUXKI_CA0108_CHIP) { + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A_IOCFG, + 0x0060 | + bus_space_read_4(sc->sc_iot, sc->sc_ioh, EMU_A_IOCFG)); + } else { + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A_IOCFG, + EMU_A_IOCFG_GPOUT0 | + bus_space_read_4(sc->sc_iot, sc->sc_ioh, EMU_A_IOCFG)); + } } /* No multiple voice support for now */ @@ -433,7 +439,7 @@ emuxki_attach(struct device *parent, str struct emuxki_softc *sc = (struct emuxki_softc *) self; struct pci_attach_args *pa = aux; pci_intr_handle_t ih; - const char *intrstr; + const char *intrstr; if (pci_mapreg_map(pa, EMU_PCI_CBIO, PCI_MAPREG_TYPE_IO, 0, &(sc->sc_iot), &(sc->sc_ioh), &(sc->sc_iob), &(sc->sc_ios), 0)) { @@ -463,16 +469,26 @@ emuxki_attach(struct device *parent, str } printf(": %s\n", intrstr); + sc->sc_details = 0; /* XXX it's unknown whether APS is made from Audigy as well */ if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CREATIVELABS_AUDIGY) { sc->sc_type = EMUXKI_AUDIGY; - if (PCI_REVISION(pa->pa_class) == 0x04 || + if (PCI_REVISION(pa->pa_class) == 0x04 || PCI_REVISION(pa->pa_class) == 0x08) { sc->sc_type |= EMUXKI_AUDIGY2; strlcpy(sc->sc_audv.name, "Audigy2", sizeof sc->sc_audv.name); } else { strlcpy(sc->sc_audv.name, "Audigy", sizeof sc->sc_audv.name); } + } else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CREATIVELABS_AUDIGY2) { + sc->sc_type = EMUXKI_AUDIGY | EMUXKI_AUDIGY2; + if (pci_conf_read(pa->pa_pc, pa->pa_tag, + PCI_SUBSYS_ID_REG) == 0x10011102) { + sc->sc_details = EMUXKI_CA0108_CHIP; + strlcpy(sc->sc_audv.name, "Audigy2Value", sizeof sc->sc_audv.name); + } else { + strlcpy(sc->sc_audv.name, "Audigy2", sizeof sc->sc_audv.name); + } } else if (pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG) == EMU_SUBSYS_APS) { sc->sc_type = EMUXKI_APS; @@ -777,6 +793,11 @@ emuxki_init(struct emuxki_softc *sc) u_int32_t spcs, *ptb; bus_addr_t silentpage; + /* disable audio and lock cache */ + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_HCFG, + EMU_HCFG_LOCKSOUNDCACHE | EMU_HCFG_LOCKTANKCACHE_MASK | + EMU_HCFG_MUTEBUTTONENABLE); + /* disable any channel interrupt */ emuxki_write(sc, 0, EMU_CLIEL, 0); emuxki_write(sc, 0, EMU_CLIEH, 0); @@ -838,17 +859,40 @@ emuxki_init(struct emuxki_softc *sc) emuxki_write(sc, 0, EMU_SPCS1, spcs); emuxki_write(sc, 0, EMU_SPCS2, spcs); - if(sc->sc_type & EMUXKI_AUDIGY2) { - emuxki_write(sc, 0, EMU_A2_SPDIF_SAMPLERATE, EMU_A2_SPDIF_UNKNOWN); - - bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_PTR, EMU_A2_SRCSEL); - bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_DATA, - EMU_A2_SRCSEL_ENABLE_SPDIF | EMU_A2_SRCSEL_ENABLE_SRCMULTI); - - bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_PTR, EMU_A2_SRCMULTI); - bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_DATA, EMU_A2_SRCMULTI_ENABLE_INPUT); - } + if (sc->sc_details & EMUXKI_CA0108_CHIP) { + /* Hacks for Alice3 to work independent of haP16V driver */ + u_int32_t tmp; + + /* Setup SRCMulti_I2S SamplingRate */ + tmp = emuxki_read(sc, 0, EMU_A_SPDIF_SAMPLERATE) & 0xfffff1ff; + emuxki_write(sc, 0, EMU_A_SPDIF_SAMPLERATE, tmp | 0x400); + + /* Setup SRCSel (Enable SPDIF, I2S SRCMulti) */ + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_PTR, EMU_A2_SRCSEL); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_DATA, + EMU_A2_SRCSEL_ENABLE_SPDIF | EMU_A2_SRCSEL_ENABLE_SRCMULTI); + + /* Setup SRCMulti Input Audio Enable */ + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_PTR, 0x7b0000); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_DATA, 0xff000000); + + /* Setup SPDIF Out Audio Enable + * The Audigy 2 Value has a separate SPDIF out, + * so no need for a mixer switch */ + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_PTR, 0x7a0000); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_DATA, 0xff000000); + tmp = bus_space_read_4(sc->sc_iot, sc->sc_ioh, EMU_A_IOCFG) & ~0x8; /* Clear bit 3 */ + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A_IOCFG, tmp); + } else if(sc->sc_type & EMUXKI_AUDIGY2) { /* TODO init by sc->sc_details */ + emuxki_write(sc, 0, EMU_A2_SPDIF_SAMPLERATE, EMU_A2_SPDIF_UNKNOWN); + + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_PTR, EMU_A2_SRCSEL); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_DATA, + EMU_A2_SRCSEL_ENABLE_SPDIF | EMU_A2_SRCSEL_ENABLE_SRCMULTI); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_PTR, EMU_A2_SRCMULTI); + bus_space_write_4(sc->sc_iot, sc->sc_ioh, EMU_A2_DATA, EMU_A2_SRCMULTI_ENABLE_INPUT); + } /* Let's play with sound processor */ emuxki_initfx(sc); Index: emuxkivar.h ================================================== ================= RCS file: /cvs/openbsd/src/sys/dev/pci/emuxkivar.h,v retrieving revision 1.7 diff -u -p -r1.7 emuxkivar.h --- emuxkivar.h 30 Nov 2005 22:17:47 -0000 1.7 +++ emuxkivar.h 26 Mar 2006 08:04:46 -0000 @@ -231,6 +231,9 @@ struct emuxki_softc { EMUXKI_SBLIVE = 0x00, EMUXKI_AUDIGY = 0x01, EMUXKI_AUDIGY2 = 0x02, EMUXKI_LIVE_5_1 = 0x04, EMUXKI_APS = 0x08 } sc_type; + enum { + EMUXKI_CA0108_CHIP = 0x01, EMUXKI_CA0151_CHIP = 0x02 + } sc_details; /* Autoconfig parameters */ bus_space_tag_t sc_iot; |