patch-2.1.110 linux/drivers/sound/cs4232.c
Next file: linux/drivers/sound/dev_table.h
Previous file: linux/drivers/sound/ad1848.c
Back to the patch index
Back to the overall index
- Lines: 171
- Date:
Sat Jul 18 14:11:41 1998
- Orig file:
v2.1.109/linux/drivers/sound/cs4232.c
- Orig date:
Thu Jul 16 18:09:26 1998
diff -u --recursive --new-file v2.1.109/linux/drivers/sound/cs4232.c linux/drivers/sound/cs4232.c
@@ -8,6 +8,21 @@
* gets implemented. Just the WSS codec, FM synth and the MIDI ports are
* supported. Other interfaces are left uninitialized.
*
+ * ifdef ...WAVEFRONT...
+ *
+ * Support is provided for initializing the WaveFront synth
+ * interface as well, which is logical device #4. Note that if
+ * you have a Tropez+ card, you probably don't need to setup
+ * the CS4232-supported MIDI interface, since it corresponds to
+ * the internal 26-pin header that's hard to access. Using this
+ * requires an additional IRQ, a resource none too plentiful in
+ * this environment. Just don't set module parameters mpuio and
+ * mpuirq, and the MIDI port will be left uninitialized. You can
+ * still use the ICS2115 hosted MIDI interface which corresponds
+ * to the 9-pin D connector on the back of the card.
+ *
+ * endif ...WAVEFRONT...
+ *
* Supported chips are:
* CS4232
* CS4236
@@ -17,7 +32,9 @@
* anyway.
*
* Changes
- * Alan Cox Modularisation, Basic cleanups.
+ * Alan Cox Modularisation, Basic cleanups.
+ * Paul Barton-Davis Separated MPU configuration, added
+ * Tropez+ (WaveFront) support
*/
/*
@@ -46,6 +63,9 @@
#define CS_OUT3(a, b, c) {CS_OUT(a);CS_OUT(b);CS_OUT(c);}
static int mpu_base = 0, mpu_irq = 0;
+#ifdef CONFIG_SOUND_WAVEFRONT_MODULE
+static int synth_base = 0, synth_irq = 0;
+#endif CONFIG_SOUND_WAVEFRONT_MODULE
static int mpu_detected = 0;
int probe_cs4232_mpu(struct address_info *hw_config)
@@ -170,6 +190,15 @@
}
#endif
+#if defined(CONFIG_SOUND_WAVEFRONT) || defined(CONFIG_SOUND_WAVEFRONT_MODULE)
+ {
+ CS_OUT2 (0x15, 0x04); /* logical device 4 (WaveFront) */
+ CS_OUT3 (0x47, (synth_base >> 8) & 0xff,
+ synth_base & 0xff); /* base */
+ CS_OUT2 (0x22, synth_irq); /* IRQ */
+ CS_OUT2 (0x33, 0x01); /* Activate logical dev 4 */
+ }
+#endif
/*
* Finally activate the chip
*/
@@ -248,6 +277,7 @@
{
int base = hw_config->io_base, irq = hw_config->irq;
int dma1 = hw_config->dma, dma2 = hw_config->dma2;
+ int mixer = audio_devs[hw_config->slots[0]]->mixer_dev;
if (dma2 == -1)
dma2 = dma1;
@@ -257,6 +287,10 @@
dma1, /* Playback DMA */
dma2, /* Capture DMA */
0);
+
+ if (mixer >= 0) {
+ sound_unload_mixerdev (mixer);
+ }
sound_unload_audiodev(hw_config->slots[0]);
#if defined(CONFIG_UART401) && defined(CONFIG_MIDI)
if (mpu_base != 0 && mpu_irq != 0 && mpu_detected)
@@ -293,15 +327,27 @@
int irq = -1;
int dma = -1;
int dma2 = -1;
+int mpuio = -1;
+int mpuirq = -1;
MODULE_PARM(io,"i");
MODULE_PARM(irq,"i");
MODULE_PARM(dma,"i");
MODULE_PARM(dma2,"i");
+MODULE_PARM(mpuio,"i");
+MODULE_PARM(mpuirq,"i");
+
+#ifdef CONFIG_SOUND_WAVEFRONT_MODULE
+int synthio = -1;
+int synthirq = -1;
+MODULE_PARM(synthio,"i");
+MODULE_PARM(synthirq,"i");
+#endif CONFIG_SOUND_WAVEFRONT_MODULE
EXPORT_NO_SYMBOLS;
struct address_info cfg;
+struct address_info mpu_cfg;
/*
* Install a CS4232 based card. Need to have ad1848 and mpu401
@@ -310,31 +356,60 @@
int init_module(void)
{
+
+#ifndef CONFIG_SOUND_WAVEFRONT_MODULE
+
if (io == -1 || irq == -1 || dma == -1 || dma2 == -1)
{
printk(KERN_ERR "cs4232: dma, dma2, irq and io must be set.\n");
return -EINVAL;
}
+#else
+ if (synthio == -1 || synthirq == -1 ||
+ io == -1 || irq == -1 || dma == -1 || dma2 == -1)
+ {
+ printk(KERN_ERR "cs4232: synthio, synthirq, dma, dma2, "
+ "irq and io must be set.\n");
+ return -EINVAL;
+ }
+
+#endif CONFIG_SOUND_WAVEFRONT_MODULE
+
cfg.io_base = io;
cfg.irq = irq;
cfg.dma = dma;
cfg.dma2 = dma2;
+#ifdef CONFIG_SOUND_WAVEFRONT_MODULE
+ synth_base = synthio;
+ synth_irq = synthirq;
+#endif CONFIG_SOUND_WAVEFRONT_MODULE
+
if (probe_cs4232(&cfg) == 0)
return -ENODEV;
- probe_cs4232_mpu(&cfg); /* Bug always returns 0 not OK -- AC */
+ mpu_cfg.io_base = -1;
+ mpu_cfg.irq = -1;
+
+ if (mpuio != -1 && mpuirq != -1) {
+ mpu_cfg.io_base = mpuio;
+ mpu_cfg.irq = mpuirq;
+ probe_cs4232_mpu(&mpu_cfg); /* Bug always returns 0 not OK -- AC */
+ }
attach_cs4232(&cfg);
- attach_cs4232_mpu(&cfg);
+
+ if (mpuio != -1 && mpuirq != -1) {
+ attach_cs4232_mpu(&mpu_cfg);
+ }
+
SOUND_LOCK;
return 0;
}
void cleanup_module(void)
{
- unload_cs4232_mpu(&cfg);
- unload_cs4232(&cfg);
+ unload_cs4232(&cfg); /* unloads MPU as well, if needed */
SOUND_LOCK_END;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov