Re: [alsa-devel] Can someone verify support for "AzTech Sound Galaxy Nova 16 Extra II-3D - using AZT-2316/R Chipset - FCC-ID:I38-MMSN846" ?
EPPROM ON:
OK, I formated that dos partition and simply sys a: c:, then I installed the driver (copying them to the partition from the linux install), in theinstall I selected the defaults settings (220 irq5 dma1...) and rebooted, now in dos again I used diagnose to test the audio and hwset /mr /ms to reset and save the epprom.
now I rebooted and loged to linux:
sudo modprobe snd-sb8 port=0x220 irq=5 dma8=1 FATAL: Error inserting snd_sb8 (/lib/modules/2.6.20-15-generic/kernel/sound/isa/sb/snd-sb8.ko): No such device
dmesg last lines ( [ 319.827327] Sound Blaster soundcard not found or device busy
-reboot-
EPPROM OFF (SOFTWARE ON):
in dos: diagnose works, reboot and back to lin: sudo modprobe snd-sb8 port=0x220 irq=5 dma8=1
no error, no mention in dmesg, but xmms gives the usual error...
Heres lsmod just for kicks:
Module Size Used by snd_sb8 9216 0 snd_sb8_dsp 12288 1 snd_sb8 snd_sb_common 17792 2 snd_sb8,snd_sb8_dsp snd_opl3_lib 11520 1 snd_sb8 snd_hwdep 9988 1 snd_opl3_lib snd_pcm_oss 44544 0 snd_pcm 79876 3 snd_sb8,snd_sb8_dsp,snd_pcm_oss snd_mixer_oss 17408 1 snd_pcm_oss snd_seq_dummy 4740 0 snd_seq_oss 32896 0 snd_seq_midi 9600 0 snd_rawmidi 25472 2 snd_sb8_dsp,snd_seq_midi snd_seq_midi_event 8448 2 snd_seq_oss,snd_seq_midi snd_seq 52592 6 snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_seq_midi_event snd_timer 23684 3 snd_opl3_lib,snd_pcm,snd_seq snd_seq_device 9100 6 snd_opl3_lib,snd_seq_dummy,snd_seq_oss,snd_seq_midi,snd_rawmidi,snd_seq snd 54020 13 snd_sb8,snd_sb8_dsp,snd_sb_common,snd_opl3_lib,snd_hwdep,snd_pcm_oss,snd_pcm,snd_mixer_oss,snd_seq_oss,snd_rawmidi,snd_seq,snd_timer,snd_seq_device soundcore 8672 1 snd snd_page_alloc 10888 1 snd_pcm nfs 240876 0 nfsd 218992 17 exportfs 6912 1 nfsd lockd 64904 3 nfs,nfsd sunrpc 161340 12 nfs,nfsd,lockd apm 22752 2 ppdev 10116 0 cpufreq_stats 7360 0 cpufreq_ondemand 9228 0 cpufreq_powersave 2688 0 freq_table 5792 2 cpufreq_stats,cpufreq_ondemand cpufreq_conservative 8200 0 cpufreq_userspace 5408 0 nls_iso8859_1 5120 1 nls_cp437 6784 1 vfat 14208 1 fat 53916 1 vfat ext2 66824 1 lp 12452 0 parport_pc 36388 1 parport 36936 3 ppdev,lp,parport_pc pcspkr 4224 0 ipv6 268704 8 tsdev 8768 0 evdev 11008 1 ext3 133128 1 jbd 59816 1 ext3 mbcache 9604 2 ext2,ext3 ide_disk 17024 5 8139too 27648 0 ide_cd 32672 0 cdrom 37664 1 ide_cd floppy 59524 0 ehci_hcd 34188 0 8139cp 25088 0 mii 6528 2 8139too,8139cp uhci_hcd 25360 0 usbcore 134280 3 ehci_hcd,uhci_hcd piix 10756 0 [permanent] generic 5124 0 [permanent] ata_generic 9092 0 libata 125720 1 ata_generic scsi_mod 142348 1 libata fbcon 42656 0 tileblit 3584 1 fbcon font 9216 1 fbcon bitblit 6912 1 fbcon softcursor 3200 1 bitblit vesafb 9220 0 capability 5896 0 commoncap 8192 1 capability
So now atleast we know its not the jumpers ;-) Is their the slight chance xmms is the problem ? gxine crushs too... Is their something like "beep" only for the sound card ? Maybe droping some data to /dev/### to produce a beep ?
Ram Kromberg ramkromberg@mail.com
On 5/13/07, ramkromberg@mail.com ramkromberg@mail.com wrote:
Is their something like "beep" only for the sound card ? Maybe droping some data to /dev/### to produce a beep ?
Perhaps cat /dev/urandom | aplay -f cd or cat /dev/urandom | aplay -Dhw:0,0 -f cd
HTH...
On Sun, May 13, 2007 at 12:17:57PM +0200, ramkromberg@mail.com wrote:
in dos: diagnose works, reboot and back to lin: sudo modprobe snd-sb8 port=0x220 irq=5 dma8=1
no error, no mention in dmesg, but xmms gives the usual error...
Also check what /proc/asound/cards says and check dmesg again after trying to use the card.
On 05/13/2007 12:17 PM, ramkromberg@mail.com wrote:
EPPROM OFF (SOFTWARE ON):
in dos: diagnose works, reboot and back to lin: sudo modprobe snd-sb8 port=0x220 irq=5 dma8=1
no error, no mention in dmesg, but xmms gives the usual error...
Yep. The DSP is there but the IRQ isn't firing.
I now understand what the difference between our boards is; we both have a jumper that can be set to EEPROM, but only I actually have an EEPROM...
It's amazing the things some manufacturers choose to save a penny on but both your and my (formerly) non-working AZT2316A boards do not have an actual EEPROM. It should be on that spot marked UX2 close to the clock (the shiny metal thing in the lower left corner).
This also means your board is simply not supported by any driver currently available in the tree. The driver needs to "play EEPROM" and upload the configuration values to the AZT2316 before the card will work and current drivers don't do this (under DOS, it's the job of that EEPROM.SYS DOS device driver that's executed from CONFIG.SYS).
Attached is a new snd-galaxy driver that _does_ do the enabling. It's not final yet, but works nicely for my EEPROM-less boards. It took quite a bit of grovveling around but it's completely documented now.
I want to test it with more cards first, with and without EEPROMS and with the JMPCFG jumper set to either position, need to figure out full-duplex on cards with a CS4231 (as opposed to a half-duplex CS4248), want to see if there are any cards among them that allow _both_ the SB and the WSS part to be active, and will finally merge in snd-azt2320 as well for one unified snd-galaxy driver.
Thought I'd post it now though. You already said you can't compile new drivers for that machine anyhow so consider this just for educational purposes. In the next message I'll post a small userspace program to do the enabling from userspace so that you can use that for now and then just use either snd-sb8 or snd-sgalaxy to drive the card.
Rene.
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig index 4e3a972..4b07dec 100644 --- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -177,6 +177,19 @@ config SND_ES18XX To compile this driver as a module, choose M here: the module will be called snd-es18xx.
+config SND_GALAXY + tristate "Aztech Sound Galaxy Driver" + depends on SND + select SND_CS4231_LIB + select SND_MPU401_UART + select SND_OPL3_LIB + select SND_PCM + help + Say Y here to include support for Aztech Sound Galaxy cards. + + To compile this driver as a module, choose M here: the module + will be called snd-galaxy. + config SND_GUS_SYNTH tristate
diff --git a/sound/isa/sb/Makefile b/sound/isa/sb/Makefile index fd9d9c5..75ced01 100644 --- a/sound/isa/sb/Makefile +++ b/sound/isa/sb/Makefile @@ -12,6 +12,7 @@ snd-sb16-objs := sb16.o snd-sbawe-objs := sbawe.o emu8000.o snd-emu8000-synth-objs := emu8000_synth.o emu8000_callback.o emu8000_patch.o emu8000_pcm.o snd-es968-objs := es968.o +snd-galaxy-objs := galaxy.o
# # this function returns: @@ -25,6 +26,7 @@ sequencer = $(if $(subst y,,$(CONFIG_SND_SEQUENCER)),$(if $(1),m),$(if $(CONFIG_ obj-$(CONFIG_SND_ALS100) += snd-sb16-dsp.o snd-sb-common.o obj-$(CONFIG_SND_CMI8330) += snd-sb16-dsp.o snd-sb-common.o obj-$(CONFIG_SND_DT019X) += snd-sb16-dsp.o snd-sb-common.o +obj-$(CONFIG_SND_GALAXY) += snd-galaxy.o snd-sb8-dsp.o snd-sb-common.o obj-$(CONFIG_SND_SB8) += snd-sb8.o snd-sb8-dsp.o snd-sb-common.o obj-$(CONFIG_SND_SB16) += snd-sb16.o snd-sb16-dsp.o snd-sb-common.o obj-$(CONFIG_SND_SBAWE) += snd-sbawe.o snd-sb16-dsp.o snd-sb-common.o diff --git a/sound/isa/sb/galaxy.c b/sound/isa/sb/galaxy.c new file mode 100644 index 0000000..dd04194 --- /dev/null +++ b/sound/isa/sb/galaxy.c @@ -0,0 +1,607 @@ +/* + * Aztech Sound Galaxy Driver + */ + +#include <sound/driver.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/isa.h> +#include <linux/delay.h> +#include <asm/io.h> +#include <sound/core.h> +#include <sound/initval.h> +#include <sound/sb.h> +#include <sound/cs4231.h> +#include <sound/mpu401.h> +#include <sound/opl3.h> + +#define CRD_NAME "Aztech Sound Galaxy" +#define DRV_NAME "GALAXY" +#define DEV_NAME "galaxy" + +MODULE_DESCRIPTION(CRD_NAME); +MODULE_AUTHOR("Rene Herman"); +MODULE_LICENSE("GPL"); + +static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; +static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; +static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; + +module_param_array(index, int, NULL, 0444); +MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard."); +module_param_array(id, charp, NULL, 0444); +MODULE_PARM_DESC(id, "ID string for " CRD_NAME " soundcard."); +module_param_array(enable, bool, NULL, 0444); +MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); + +static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static long wss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; +static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; +static int wss_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; +static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; +static int dma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; + +module_param_array(port, long, NULL, 0444); +MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); +module_param_array(wss_port, long, NULL, 0444); +MODULE_PARM_DESC(wss_port, "WSS port # for " CRD_NAME " driver."); +module_param_array(mpu_port, long, NULL, 0444); +MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " CRD_NAME " driver."); +module_param_array(fm_port, long, NULL, 0444); +MODULE_PARM_DESC(fm_port, "OPL3 port # for " CRD_NAME " driver."); +module_param_array(irq, int, NULL, 0444); +MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver."); +module_param_array(wss_irq, int, NULL, 0444); +MODULE_PARM_DESC(wss_irq, "WSS IRQ # for " CRD_NAME " driver."); +module_param_array(mpu_irq, int, NULL, 0444); +MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " CRD_NAME " driver."); +module_param_array(dma, int, NULL, 0444); +MODULE_PARM_DESC(dma, "DMA # for " CRD_NAME " driver."); + +#define GALAXY_PORT_CONFIG 0x400 + +#define WSS_PORT_CONFIG 0 +#define WSS_PORT_SIGNATURE 3 + +#define WSS_SIGNATURE 4 + +/* + * Sound Galaxy 32-bit serial EEPROM + */ + +#define GALAXY_CONFIG_SBDMA_DISABLE (0 << 30) +#define GALAXY_CONFIG_SBDMA_0 (1 << 30) +#define GALAXY_CONFIG_SBDMA_1 (2 << 30) +#define GALAXY_CONFIG_SBDMA_3 (3 << 30) + +#define GALAXY_CONFIG_SBIRQ_10 (1 << 29) +#define GALAXY_CONFIG_SBIRQ_7 (1 << 28) +#define GALAXY_CONFIG_SBIRQ_5 (1 << 27) +#define GALAXY_CONFIG_SBIRQ_2 (1 << 26) + +#define GALAXY_CONFIG_SBA_220 (0 << 24) +#define GALAXY_CONFIG_SBA_240 (1 << 24) +#define GALAXY_CONFIG_SBA_260 (2 << 24) +#define GALAXY_CONFIG_SBA_280 (3 << 24) + +#define GALAXY_CONFIG_CDA_310 (0 << 22) +#define GALAXY_CONFIG_CDA_320 (1 << 22) +#define GALAXY_CONFIG_CDA_340 (2 << 22) +#define GALAXY_CONFIG_CDA_350 (3 << 22) + +#define GALAXY_CONFIG_MPU_ENABLE (1 << 21) +#define GALAXY_CONFIG_MPUA_300 (0 << 20) +#define GALAXY_CONFIG_MPUA_330 (1 << 20) + +#define GALAXY_CONFIG_GAME_ENABLE (1 << 19) + +#define GALAXY_CONFIG_WSS_ENABLE (1 << 18) +#define GALAXY_CONFIG_WSSA_530 (0 << 16) +#define GALAXY_CONFIG_WSSA_604 (1 << 16) +#define GALAXY_CONFIG_WSSA_E80 (2 << 16) +#define GALAXY_CONFIG_WSSA_F40 (3 << 16) + +#define GALAXY_CONFIG_CDDMA16_DISABLE (0 << 14) +#define GALAXY_CONFIG_CDDMA16_5 (1 << 14) +#define GALAXY_CONFIG_CDDMA16_6 (2 << 14) +#define GALAXY_CONFIG_CDDMA16_7 (3 << 14) + +#define GALAXY_CONFIG_CDDMA8_DISABLE (0 << 12) +#define GALAXY_CONFIG_CDDMA8_0 (1 << 12) +#define GALAXY_CONFIG_CDDMA8_1 (2 << 12) +#define GALAXY_CONFIG_CDDMA8_3 (3 << 12) + +#define GALAXY_CONFIG_CD_DISABLE (0 << 8) +#define GALAXY_CONFIG_CD_PANASONIC (1 << 8) +#define GALAXY_CONFIG_CD_SONY (2 << 8) +#define GALAXY_CONFIG_CD_MITSUMI (3 << 8) +#define GALAXY_CONFIG_CD_AZTECH (4 << 8) + +#define GALAXY_CONFIG_CDIRQ_15 (1 << 7) +#define GALAXY_CONFIG_CDIRQ_12 (1 << 6) +#define GALAXY_CONFIG_CDIRQ_11 (1 << 5) +#define GALAXY_CONFIG_CDIRQ_5 (1 << 4) + +#define GALAXY_CONFIG_MPUIRQ_10 (1 << 3) +#define GALAXY_CONFIG_MPUIRQ_7 (1 << 2) +#define GALAXY_CONFIG_MPUIRQ_5 (1 << 1) +#define GALAXY_CONFIG_MPUIRQ_2 (1 << 0) + +/* + * Sound Galaxy specific DSP commands. + */ + +#define SB_DSP_GALAXY 9 + +#define GALAXY_DSP_WSSMODE 0 +#define GALAXY_DSP_MPU 2 +#define GALAXY_DSP_MPUA 4 + +struct snd_galaxy { + struct resource *config_port; + struct resource *wss_port; +}; + +static u32 config[SNDRV_CARDS]; + +static int __devinit snd_galaxy_match(struct device *dev, unsigned int n) +{ + if (!enable[n]) + return 0; + + switch (port[n]) { + case SNDRV_AUTO_PORT: + snd_printk(KERN_ERR "%s: please specify port\n", dev->bus_id); + return 0; + case 0x220: + config[n] |= GALAXY_CONFIG_SBA_220; + break; + case 0x240: + config[n] |= GALAXY_CONFIG_SBA_240; + break; + default: + snd_printk(KERN_ERR "%s: invalid port %#lx\n", dev->bus_id, + port[n]); + return 0; + } + + switch (irq[n]) { + case SNDRV_AUTO_IRQ: + snd_printk(KERN_ERR "%s: please specify irq\n", dev->bus_id); + return 0; + case 2: + config[n] |= GALAXY_CONFIG_SBIRQ_2; + break; + case 5: + config[n] |= GALAXY_CONFIG_SBIRQ_5; + break; + case 7: + config[n] |= GALAXY_CONFIG_SBIRQ_7; + break; + case 10: + config[n] |= GALAXY_CONFIG_SBIRQ_10; + break; + default: + snd_printk(KERN_ERR "%s: invalid irq %d\n", dev->bus_id, + irq[n]); + return 0; + } + + switch (dma[n]) { + case SNDRV_AUTO_DMA: + snd_printk(KERN_ERR "%s: please specify dma\n", dev->bus_id); + return 0; + case 0: + config[n] |= GALAXY_CONFIG_SBDMA_0; + break; + case 1: + config[n] |= GALAXY_CONFIG_SBDMA_1; + break; + case 3: + config[n] |= GALAXY_CONFIG_SBDMA_3; + break; + default: + snd_printk(KERN_ERR "%s: invalid dma %d\n", dev->bus_id, + dma[n]); + return 0; + } + + switch (wss_port[n]) { + case SNDRV_AUTO_PORT: + wss_port[n] = -1; + goto mpu; + case 0x530: + config[n] |= GALAXY_CONFIG_WSS_ENABLE | GALAXY_CONFIG_WSSA_530; + break; + case 0x604: + config[n] |= GALAXY_CONFIG_WSS_ENABLE | GALAXY_CONFIG_WSSA_604; + break; + case 0xe80: + config[n] |= GALAXY_CONFIG_WSS_ENABLE | GALAXY_CONFIG_WSSA_E80; + break; + case 0xf40: + config[n] |= GALAXY_CONFIG_WSS_ENABLE | GALAXY_CONFIG_WSSA_F40; + break; + default: + snd_printk(KERN_ERR "%s: invalid wss port %#lx\n", dev->bus_id, + wss_port[n]); + return 0; + } + + if (wss_irq[n] == irq[n]) { + snd_printk(KERN_ERR "%s: cannot share IRQ between SB and WSS\n", + dev->bus_id); + return 0; + } + + switch (wss_irq[n]) { + case SNDRV_AUTO_IRQ: + snd_printk(KERN_ERR "%s: please specify wss_irq", dev->bus_id); + return 0; + case 2: + case 5: + case 7: + case 10: + break; + default: + snd_printk(KERN_ERR "%s: invalid wss irq %d\n", dev->bus_id, + irq[n]); + return 0; + } + + mpu: + switch (mpu_port[n]) { + case SNDRV_AUTO_PORT: + snd_printk(KERN_WARNING "%s: mpu_port not specified; not using " + "MPU-401\n", dev->bus_id); + mpu_port[n] = -1; + goto fm; + case 0x300: + config[n] |= GALAXY_CONFIG_MPU_ENABLE | GALAXY_CONFIG_MPUA_300; + break; + case 0x330: + config[n] |= GALAXY_CONFIG_MPU_ENABLE | GALAXY_CONFIG_MPUA_330; + break; + default: + snd_printk(KERN_ERR "%s: invalid mpu port %#lx\n", dev->bus_id, + mpu_port[n]); + return 0; + } + + if (mpu_irq[n] == irq[n] || mpu_irq[n] == wss_irq[n]) { + snd_printk(KERN_ERR "%s: cannot share IRQ between SB/WSS " + "and MPU-401\n", dev->bus_id); + return 0; + } + + switch (mpu_irq[n]) { + case SNDRV_AUTO_IRQ: + snd_printk(KERN_WARNING "%s: mpu_irq not specified; using " + "polling mode\n", dev->bus_id); + break; + case 2: + config[n] |= GALAXY_CONFIG_MPUIRQ_2; + break; + case 5: + config[n] |= GALAXY_CONFIG_MPUIRQ_5; + break; + case 7: + config[n] |= GALAXY_CONFIG_MPUIRQ_7; + break; + case 10: + config[n] |= GALAXY_CONFIG_MPUIRQ_10; + break; + default: + snd_printk(KERN_ERR "%s: invalid mpu irq %d\n", dev->bus_id, + irq[n]); + return 0; + } + + fm: + switch (fm_port[n]) { + case SNDRV_AUTO_PORT: + snd_printk(KERN_WARNING "%s: fm_port not specified: not using " + "OPL3\n", dev->bus_id); + fm_port[n] = -1; + break; + case 0x388: + break; + default: + snd_printk(KERN_ERR "%s: illegal fm port %#lx\n", dev->bus_id, + fm_port[n]); + return 0; + } + + config[n] |= GALAXY_CONFIG_GAME_ENABLE; + + return 1; +} + +static int __devinit snd_galaxy_set(struct snd_sb *sb, unsigned char cmd, + int set) +{ + int err; + + err = snd_sbdsp_command(sb, SB_DSP_GALAXY); + if (err < 0) + return err; + + err = snd_sbdsp_command(sb, cmd); + if (err < 0) + return err; + + return snd_sbdsp_command(sb, set ? 255 : 0); +} + +static int __devinit snd_galaxy_config(struct snd_card *card, struct snd_sb *sb, + u32 config) +{ + struct snd_galaxy *galaxy = card->private_data; + unsigned char val; + int err; + + galaxy->config_port = request_region(sb->port + GALAXY_PORT_CONFIG, 5, + DRV_NAME); + if (!galaxy->config_port) + return -EBUSY; + + err = snd_galaxy_set(sb, GALAXY_DSP_MPU, + config & GALAXY_CONFIG_MPU_ENABLE); + if (err < 0) + return err; + + err = snd_galaxy_set(sb, GALAXY_DSP_MPUA, + config & GALAXY_CONFIG_MPUA_330); + if (err < 0) + return err; + + val = inb(sb->port + GALAXY_PORT_CONFIG + 4); + + outb(val | 0x80, sb->port + GALAXY_PORT_CONFIG + 4); + msleep(100); + + outb(config, sb->port + GALAXY_PORT_CONFIG + 3); + config >>= 8; + outb(config, sb->port + GALAXY_PORT_CONFIG + 2); + config >>= 8; + outb(config, sb->port + GALAXY_PORT_CONFIG + 1); + config >>= 8; + outb(config, sb->port + GALAXY_PORT_CONFIG); + + outb(val & 0x7f, sb->port + GALAXY_PORT_CONFIG + 4); + msleep(100); + + return 0; +} + +static int __devinit snd_galaxy_wssmode(struct snd_sb *sb) +{ + int err; + + err = snd_sbdsp_reset(sb); + if (err < 0) + return err; + + err = snd_sbdsp_command(sb, SB_DSP_GALAXY); + if (err < 0) + return err; + + err = snd_sbdsp_command(sb, GALAXY_DSP_WSSMODE); + if (err < 0) + return err; + + msleep(100); + + return 0; +} + +static int __devinit snd_galaxy_wss(struct snd_card *card, unsigned long port, + int irq, int dma) +{ + struct snd_galaxy *galaxy = card->private_data; + unsigned char wss_config; + struct snd_cs4231 *wss; + int err; + + galaxy->wss_port = request_region(port, 4, DRV_NAME); + if (!galaxy->wss_port) + return -EBUSY; + + if ((inb(port + WSS_PORT_SIGNATURE) & 0x3f) != WSS_SIGNATURE) + return -ENODEV; + + switch (irq) { + case 7: + wss_config = 1 << 3; + break; + case 9: + wss_config = 2 << 3; + break; + case 10: + wss_config = 3 << 3; + break; + case 11: + wss_config = 4 << 3; + break; + default: + return -EINVAL; + } + outb(wss_config | 0x40, port + WSS_PORT_CONFIG); + + switch (dma) { + case 0: + wss_config |= 1; + break; + case 1: + wss_config |= 2; + break; + case 3: + wss_config |= 3; + break; + default: + return -EINVAL; + } + outb(wss_config, port + WSS_PORT_CONFIG); + + err = snd_cs4231_create(card, port + 4, -1, irq, dma, -1, + CS4231_HW_DETECT, CS4231_HWSHARE_DMA1, &wss); + if (err < 0) + return err; + + err = snd_cs4231_pcm(wss, 0, NULL); + if (err < 0) + return err; + + err = snd_cs4231_mixer(wss); + if (err < 0) + return err; + + err = snd_cs4231_timer(wss, 0, NULL); + if (err < 0) + return err; + + strcpy(card->shortname, snd_cs4231_chip_id(wss)); + sprintf(card->longname, "%s at %#lx, irq %d, dma %d; ", + card->shortname, wss->port, wss->irq, wss->dma1); + + return 0; +} + +static irqreturn_t snd_galaxy_interrupt(int irq, void *dev_id) +{ + struct snd_sb *sb = dev_id; + + if (sb->open & SB_OPEN_PCM) + return snd_sb8dsp_interrupt(sb); + + return snd_sb8dsp_midi_interrupt(sb); +} + +static void snd_galaxy_free(struct snd_card *card) +{ + struct snd_galaxy *galaxy = card->private_data; + + release_and_free_resource(galaxy->wss_port); + release_and_free_resource(galaxy->config_port); +} + +static int __devinit snd_galaxy_probe(struct device *dev, unsigned int n) +{ + struct snd_card *card; + struct snd_sb *sb; + int err; + + card = snd_card_new(index[n], id[n], THIS_MODULE, + sizeof(struct snd_galaxy)); + if (!card) + return -EINVAL; + + snd_card_set_dev(card, dev); + + err = snd_sbdsp_create(card, port[n], irq[n], snd_galaxy_interrupt, + dma[n], -1, SB_HW_AUTO, &sb); + if (err < 0) + goto error; + + card->private_free = snd_galaxy_free; + + err = snd_galaxy_config(card, sb, config[n]); + if (err < 0) + goto error; + + if (wss_port[n] >= 0) { + err = snd_galaxy_wssmode(sb); + if (err < 0) + goto error; + + err = snd_galaxy_wss(card, wss_port[n], wss_irq[n], sb->dma8); + if (err < 0) + goto error; + } else { + err = snd_sb8dsp_pcm(sb, 0, NULL); + if (err < 0) + goto error; + + err = snd_sbmixer_new(sb); + if (err < 0) + goto error; + + strcpy(card->shortname, sb->name); + } + + sprintf(card->longname + strlen(card->longname), + "%s at %#lx, irq %d, dma %d", + sb->name, sb->port, sb->irq, sb->dma8); + strcpy(card->driver, DRV_NAME); + + if (mpu_port[n] >= 0) { + err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, + mpu_port[n], 0, mpu_irq[n], + mpu_irq[n] < 0 ? 0 : IRQF_DISABLED, + NULL); + if (err < 0) + goto error; + } + + if (fm_port[n] >= 0) { + struct snd_opl3 *opl3; + + err = snd_opl3_create(card, fm_port[n], fm_port[n] + 2, + OPL3_HW_AUTO, 0, &opl3); + if (err < 0) { + snd_printk(KERN_ERR "%s: no OPL device at %#lx\n", + dev->bus_id, fm_port[n]); + goto error; + } + err = snd_opl3_timer_new(opl3, 1, 2); + if (err < 0) + goto error; + + err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); + if (err < 0) + goto error; + } + + err = snd_card_register(card); + if (err < 0) + goto error; + + dev_set_drvdata(dev, card); + return 0; + + error: + snd_card_free(card); + return err; +} + +static int __devexit snd_galaxy_remove(struct device *dev, unsigned int n) +{ + snd_card_free(dev_get_drvdata(dev)); + dev_set_drvdata(dev, NULL); + return 0; +} + +static struct isa_driver snd_galaxy_driver = { + .match = snd_galaxy_match, + .probe = snd_galaxy_probe, + .remove = __devexit_p(snd_galaxy_remove), + + .driver = { + .name = DEV_NAME + } +}; + +static int __init alsa_card_galaxy_init(void) +{ + return isa_register_driver(&snd_galaxy_driver, SNDRV_CARDS); +} + +static void __exit alsa_card_galaxy_exit(void) +{ + isa_unregister_driver(&snd_galaxy_driver); +} + +module_init(alsa_card_galaxy_init); +module_exit(alsa_card_galaxy_exit);
On 05/14/2007 11:53 PM, Rene Herman wrote:
In the next message I'll post a small userspace program to do the enabling from userspace so that you can use that for now and then just use either snd-sb8 or snd-sgalaxy to drive the card.
As said. If you execute this as root it should enable the card. You can pick the base address (the one JMPB0 is set to) with "-p 0x220|0x240". Default is 0x200 if you don't specify one.
You can supply a configuration value yourself; you'd want the same value as the parameter to EEPROM.SYS in CONFIG.SYS under your DOS install. However, if you do not supply a a value the card will just be enabled using a default value (same default value DOS uses) and this should work fine assuming you have those default resources free/reserved.
so:
sudo ./eeprom sudo modprobe snd-sb8 port=0x220 irq=5 dma8=1
or
sudo ./eeprom sudo modprobe snd-sgalaxy sbport=0x220 wssport=0x530
Once you have the card set to wss mode (ie, have loaded snd-sgalaxy) you can't unload snd-sgalaxy again and start using snd-sb8; the card would have to be reset to SB mode first again.
After that sudo ./eeprom, the drivers should not only load but in fact work. Remember to increase/unmute the volumes in a mixer...
The program needs to talk to I/O ports and therefore needs root priviliges. It's generally a fairly bad idea to run root programs you haven't compiled yourself, but if compiling this userspace program is also a problem for you currently, there's a binary at:
http://members.home.nl/rene.herman/eeprom
was compiled on slackware 11.0, staticly linked.
If this still doesn't work you... I'm going to be sad.
Rene.
#include <stdlib.h> #include <stdio.h> #include <stdint.h>
#include <sys/io.h> #include <unistd.h>
#define SB_PORT_RESET 0x06 #define SB_PORT_READ 0x0a #define SB_PORT_STATUS 0x0c #define SB_PORT_COMMAND 0x0c #define SB_PORT_DATA_AVAIL 0x0e
#define SB_DSP_GALAXY 9 #define GALAXY_DSP_MPU 2 #define GALAXY_DSP_MPUA 4
#define GALAXY_PORT_CONFIG 0x400
#define GALAXY_CONFIG_MPU_ENABLE (1 << 21) #define GALAXY_CONFIG_MPUA_330 (1 << 20)
#define BUSY_LOOPS 100000
int sbdsp_reset(long int port) { int i;
outb(1, port + SB_PORT_RESET); usleep(10); outb(0, port + SB_PORT_RESET); usleep(30);
for (i = BUSY_LOOPS; i; i--) if (inb(port + SB_PORT_DATA_AVAIL) & 0x80) { if (inb(port + SB_PORT_READ) == 0xaa) return 0; break; }
return 1; }
int sbdsp_command(long int port, unsigned char val) { int i;
for (i = BUSY_LOOPS; i; i--) if ((inb(port + SB_PORT_STATUS) & 0x80) == 0) { outb(val, port + SB_PORT_COMMAND); return 0; }
return 1; }
int galaxy_set(long int port, unsigned char cmd, int set) { if (sbdsp_command(port, SB_DSP_GALAXY) != 0) return 1;
if (sbdsp_command(port, cmd) != 0) return 1;
return sbdsp_command(port, set ? 255 : 0); }
int main(int argc, char *argv[]) { long int port = 0x220; uint32_t conf = 0x887C0101;
unsigned char val;
char *s; int c = getopt(argc, argv, "p:");
if (c != -1) { if (c != 'p') goto usage;
port = strtol(optarg, &s, 0); if (*s || (port != 0x220 && port != 0x240)) goto usage; }
if (optind < argc) { conf = strtol(argv[optind++], &s, 16); if (*s) goto usage; } if (optind < argc) { usage: printf("usage: %s [-p <port>] [value]\n", argv[0]); return EXIT_FAILURE; }
if (iopl(3) != 0) goto iopl;
if (sbdsp_reset(port) != 0) { printf("could not find board\n"); return EXIT_FAILURE; }
if (galaxy_set(port, GALAXY_DSP_MPU, conf & GALAXY_CONFIG_MPU_ENABLE) != 0) goto set;
if (galaxy_set(port, GALAXY_DSP_MPUA, conf & GALAXY_CONFIG_MPUA_330) != 0) { set: printf("could not set board\n"); return EXIT_FAILURE; }
val = inb(port + GALAXY_PORT_CONFIG + 4);
outb(val | 0x80, port + GALAXY_PORT_CONFIG + 4); usleep(100);
outb(conf, port + GALAXY_PORT_CONFIG + 3); conf >>= 8; outb(conf, port + GALAXY_PORT_CONFIG + 2); conf >>= 8; outb(conf, port + GALAXY_PORT_CONFIG + 1); conf >>= 8; outb(conf, port + GALAXY_PORT_CONFIG);
outb(val & 0x7f, port + GALAXY_PORT_CONFIG + 4);
if (iopl(0) != 0) { iopl: perror ("iopl"); return EXIT_FAILURE; }
return EXIT_SUCCESS; }
On 05/15/2007 12:22 AM, Rene Herman wrote:
As said. If you execute this as root it should enable the card.
(oh, compilation instructions just "gcc -W -Wall -o eeprom eeprom.c")
Rene.
On Tue, May 15, 2007 at 12:22:03AM +0200, Rene Herman wrote:
As said. If you execute this as root it should enable the card. You can pick the base address (the one JMPB0 is set to) with "-p 0x220|0x240". Default is 0x200 if you don't specify one.
^^^^^ 0x220 or 0x240?
Do you think there is any point in trying any of this configuration stuff on an NXPro?
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
It is not often that I see other people use standards compliant return values from main().
On 05/15/2007 12:12 PM, Rask Ingemann Lambertsen wrote:
On Tue, May 15, 2007 at 12:22:03AM +0200, Rene Herman wrote:
As said. If you execute this as root it should enable the card. You can pick the base address (the one JMPB0 is set to) with "-p 0x220|0x240". Default is 0x200 if you don't specify one.
^^^^^
0x220 or 0x240?
0x220.
Do you think there is any point in trying any of this configuration stuff on an NXPro?
Probably not. The oldest Sound Galaxy I have is a NX Pro 16 (I38-MMSN803) and I haven't yet tested on that either. That one does have an EEPROM but the jumper doesn't select between EEPROM and software but between EEPROM and "factory setting" which probably implies it's not software configurable.
(other than by writing to the EEPROM and rebooting the card with the jumper set to EEPROM; writing to the EEPROM is yet another fun little project for a future HWDEP interface in the driver but it's not an important feature).
Does your NX Pro have an EEPROM? It should be a small 8-pin chip marked with something close to "X24C00", near a clock chip and probably near an Intel 8051 microcontroller. And does it have a jumper that sounds like it has anything to do with things?
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
It is not often that I see other people use standards compliant return values from main().
0 and !0 are as standards compliant... :-)
Rene.
On Thu, May 17, 2007 at 01:35:59AM +0200, Rene Herman wrote:
Does your NX Pro have an EEPROM? It should be a small 8-pin chip marked with something close to "X24C00", near a clock chip and probably near an Intel 8051 microcontroller. And does it have a jumper that sounds like it has anything to do with things?
I've found the X24C00 chip, a 12 MHz crystal or oscilator (I'm not sure which) and an Intel S-80C51FANM chip. The uncommented jumpers J1 and J2 are my best bet, although they are connected to the AZTSSPT0592 chip.
On 05/17/2007 03:08 PM, Rask Ingemann Lambertsen wrote:
I've found the X24C00 chip, a 12 MHz crystal or oscilator (I'm not sure which) and an Intel S-80C51FANM chip. The uncommented jumpers J1 and J2 are my best bet, although they are connected to the AZTSSPT0592 chip.
Right, so you also have that one. Also the AZT-NXPMIX0592? If so, then your NX Pro is just my NX Pro 16 minus the AD1848 codec it seems.
If J1 and J2 are connected to pin 17 and 18 at the top (the side which is "up" when you can read the markings) of the AZTSSPT0592 then those will be my J4/J5. Also unmarked, but I have the booklet!
If they're the same, then you should have a "virtual parallel port" at 0x278 when they're closed for "Disney Sound Source" compatibility.
If I find out this NX Pro 16 is software configurable, I'll send you test code for your NX Pro...
Rene.
On Sat, May 19, 2007 at 04:55:12AM +0200, Rene Herman wrote:
On 05/17/2007 03:08 PM, Rask Ingemann Lambertsen wrote:
I've found the X24C00 chip, a 12 MHz crystal or oscilator (I'm not sure which) and an Intel S-80C51FANM chip. The uncommented jumpers J1 and J2 are my best bet, although they are connected to the AZTSSPT0592 chip.
Right, so you also have that one. Also the AZT-NXPMIX0592?
Yes.
If J1 and J2 are connected to pin 17 and 18 at the top (the side which is "up" when you can read the markings) of the AZTSSPT0592 then those will be my J4/J5. Also unmarked, but I have the booklet!
They are. I also have J4/J5 labelled PC SPKR, do you happen to know what they are for?
If they're the same, then you should have a "virtual parallel port" at 0x278 when they're closed for "Disney Sound Source" compatibility.
I do.
Rask Ingemann Lambertsen <rask <at> sygehus.dk> writes:
If J1 and J2 are connected to pin 17 and 18 at the top (the side which is "up" when you can read the markings) of the AZTSSPT0592 then those will be my J4/J5. Also unmarked, but I have the booklet!
They are. I also have J4/J5 labelled PC SPKR, do you happen to know what they are for?
I seem to have misplaced this message; am replying through gmane hoping it will keep the thread intact...
Those will be my J1/J2. Mine are next to the CD-ROM audio connector (and next to a waveblaster header).
My J2 is the one actually labeled "PC SPK" and is not a jumper but a two pin connector; with my NX Pro 16 comes a one-wire cable with a 4-pin connector that you plug onto the motherboard speaker-out connector and a 2-pin connector that you stick on J2, after which the soundcard fills the role of the PC speaker.
J1 is the "speaker amplification jumper". To quote the manual:
"PCs from various manufacturers may have different internal PC speaker loudness. Thus, the function of the Speaker Amplification Jumper (J1) is to compensate for this differing internal PC speaker loudness among PCs."
Open is low amplification, closed is high.
(my Nx Pro 16 by the way also has an additional 4-pin "PHONE1" connector that can be used to again attach the PC speaker to)
Rene.
On Mon, May 14, 2007 at 11:53:18PM +0200, Rene Herman wrote:
--- a/sound/isa/Kconfig +++ b/sound/isa/Kconfig @@ -177,6 +177,19 @@ config SND_ES18XX To compile this driver as a module, choose M here: the module will be called snd-es18xx.
+config SND_GALAXY
- tristate "Aztech Sound Galaxy Driver"
- depends on SND
- select SND_CS4231_LIB
- select SND_MPU401_UART
- select SND_OPL3_LIB
- select SND_PCM
- help
Say Y here to include support for Aztech Sound Galaxy cards.
To compile this driver as a module, choose M here: the module
will be called snd-galaxy.
config SND_GUS_SYNTH tristate
Like you said yourself, there are a lot of different Sound Galaxy cards, not all of which are CS42xx compatible. Perhaps be a bit more specific as to which ones are expected to work (or not work) with the driver.
On 05/15/2007 12:16 PM, Rask Ingemann Lambertsen wrote:
Like you said yourself, there are a lot of different Sound Galaxy cards, not all of which are CS42xx compatible. Perhaps be a bit more specific as to which ones are expected to work (or not work) with the driver.
It's starting to look like I'll be able to support all sound galaxies with this one driver (pnp provides for a different set of entry points so merging azt2320 is also not going to be a problem) where only the very, very first (including your NX pro) would only allow SBB mode. Yes, it then makes more sense to just use snd-sb8, but hey...
My I38-MMSN803 already includes an AD1848 (AZT-NXPMIX0592 and AZTSSPT0592 as the other chips) and I know it drives AZT1605, AZT2316A and AZT2316R...
If it's "all Sound Galaxies except maybe some of the very first 8-bit cards" then I feel snd-galaxy is an okay name (snd-aztech isn't, since aztech has since then also made PCI cards) but yes, I need to do some further testing and probing on different cards before it's final.
Rene
participants (4)
-
j t
-
ramkrombergļ¼ mail.com
-
Rask Ingemann Lambertsen
-
Rene Herman