[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
support Audigy 2 Value
- To: tech_(_at_)_openbsd_(_dot_)_org
- Subject: support Audigy 2 Value
- From: Lunatic <openlunatic_(_at_)_gmail_(_dot_)_com>
- Date: Sun, 19 Mar 2006 22:25:26 +0300
Hello, list!
I added support Audigy 2 Value sound card.
Hope, that my patch is useful.
For me works, I am happy. %^)
diff -uNd /usr/src/sys/dev/pci/emuxki.c ./emuxki.c
--- /usr/src/sys/dev/pci/emuxki.c Fri Jan 20 12:50:31 2006
+++ ./emuxki.c Sun Mar 19 21:54:53 2006
@@ -397,9 +397,15 @@
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 */
@@ -473,6 +479,15 @@
} 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 +792,11 @@
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);
@@ -839,16 +859,43 @@
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);
+ /*
+ * I think that some code should be in
+ * if (sc->sc_details & EMUXKI_CA0108_CHIP) {
+ * bla-bla;
+ * }
+ */
+
+ /* ??? */
+ /* emuxki_write(sc, 0, EMU_A2_SPDIF_SAMPLERATE,
EMU_A2_SPDIF_UNKNOWN); */
+
+ /* 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);
- 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 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, EMU_A2_SRCMULTI);
+ * bus_space_write_4(sc->sc_iot, sc->sc_ioh,
EMU_A2_DATA, EMU_A2_SRCMULTI_ENABLE_INPUT); */
+ 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);
- 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);
- }
-
+ /* from ALSA too */
+ /* 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);
+ }
/* Let's play with sound processor */
emuxki_initfx(sc);
diff -uNd /usr/src/sys/dev/pci/emuxkivar.h ./emuxkivar.h
--- /usr/src/sys/dev/pci/emuxkivar.h Thu Dec 1 01:17:47 2005
+++ ./emuxkivar.h Sun Mar 19 17:37:04 2006
@@ -231,6 +231,9 @@
EMUXKI_SBLIVE = 0x00, EMUXKI_AUDIGY = 0x01, EMUXKI_AUDIGY2 = 0x02,
EMUXKI_LIVE_5_1 = 0x04, EMUXKI_APS = 0x08
} sc_type;
+ enum {
+ EMUXKI_CA0108_CHIP = 0x01
+ } sc_details;
/* Autoconfig parameters */
bus_space_tag_t sc_iot;
Visit your host, monkey.org