patch-2.1.117 linux/drivers/sound/sonicvibes.c

Next file: linux/drivers/sound/soundcard.c
Previous file: linux/drivers/sound/sequencer.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.116/linux/drivers/sound/sonicvibes.c linux/drivers/sound/sonicvibes.c
@@ -43,6 +43,9 @@
  *                     Fix hwptr out of bounds (now mpg123 works)
  *    14.05.98   0.4   Don't allow excessive interrupt rates
  *    08.06.98   0.5   First release using Alan Cox' soundcore instead of miscdevice
+ *    03.08.98   0.6   Do not include modversions.h
+ *                     Now mixer behaviour can basically be selected between
+ *                     "OSS documented" and "OSS actual" behaviour
  *
  */
 
@@ -50,7 +53,6 @@
       
 #include <linux/version.h>
 #include <linux/module.h>
-#include <linux/modversions.h>
 #include <linux/string.h>
 #include <linux/ioport.h>
 #include <linux/sched.h>
@@ -71,6 +73,10 @@
 
 /* --------------------------------------------------------------------- */
 
+#undef OSS_DOCUMENTED_MIXER_SEMANTICS
+
+/* --------------------------------------------------------------------- */
+
 #ifndef PCI_VENDOR_ID_S3
 #define PCI_VENDOR_ID_S3             0x5333
 #endif
@@ -245,6 +251,9 @@
         /* mixer stuff */
         struct {
                 unsigned int modcnt;
+#ifndef OSS_DOCUMENTED_MIXER_SEMANTICS
+		unsigned short vol[13];
+#endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */
         } mix;
 
 	/* wave stuff */
@@ -471,6 +480,7 @@
 	unsigned long flags;
 	unsigned char r, m, n;
 	unsigned xm, xn, xr, xd, metric = ~0U;
+	/* the warnings about m and n used uninitialized are bogus and may safely be ignored */
 
 	if (rate < 625000/ADCMULT)
 		rate = 625000/ADCMULT;
@@ -619,10 +629,9 @@
 
 /* --------------------------------------------------------------------- */
 
-#define DMABUF_DEFAULTORDER 8
+#define DMABUF_DEFAULTORDER (17-PAGE_SHIFT)
 #define DMABUF_MINORDER 1
 
-
 static void dealloc_dmabuf(struct dmabuf *db)
 {
 	unsigned long map, mapend;
@@ -885,6 +894,8 @@
 	[SOUND_MIXER_PCM]    = { SV_CIMIX_PCMINL,    SV_CIMIX_PCMINR,    MT_6MUTE,     0 }
 };
 
+#ifdef OSS_DOCUMENTED_MIXER_SEMANTICS
+
 static int return_mixval(struct sv_state *s, unsigned i, int *arg)
 {
 	unsigned long flags;
@@ -928,6 +939,23 @@
 	return put_user((rr << 8) | rl, arg);
 }
 
+#else /* OSS_DOCUMENTED_MIXER_SEMANTICS */
+
+static const unsigned char volidx[SOUND_MIXER_NRDEVICES] = 
+{
+	[SOUND_MIXER_RECLEV] = 1,
+	[SOUND_MIXER_LINE1]  = 2,
+	[SOUND_MIXER_CD]     = 3,
+	[SOUND_MIXER_LINE]   = 4,
+	[SOUND_MIXER_MIC]    = 5,
+	[SOUND_MIXER_SYNTH]  = 6,
+	[SOUND_MIXER_LINE2]  = 7,
+	[SOUND_MIXER_VOLUME] = 8,
+	[SOUND_MIXER_PCM]    = 9
+};
+
+#endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */
+
 static unsigned mixer_recmask(struct sv_state *s)
 {
 	unsigned long flags;
@@ -1022,7 +1050,13 @@
 			i = _IOC_NR(cmd);
                         if (i >= SOUND_MIXER_NRDEVICES || !mixtable[i].type)
                                 return -EINVAL;
+#ifdef OSS_DOCUMENTED_MIXER_SEMANTICS
 			return return_mixval(s, i, (int *)arg);
+#else /* OSS_DOCUMENTED_MIXER_SEMANTICS */
+			if (!volidx[i])
+				return -EINVAL;
+			return put_user(s->mix.vol[volidx[i]-1], (int *)arg);
+#endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */
 		}
 	}
         if (_IOC_DIR(cmd) != (_IOC_READ|_IOC_WRITE)) 
@@ -1116,7 +1150,14 @@
 			break;
 		}
 		spin_unlock_irqrestore(&s->lock, flags);
+#ifdef OSS_DOCUMENTED_MIXER_SEMANTICS
                 return return_mixval(s, i, (int *)arg);
+#else /* OSS_DOCUMENTED_MIXER_SEMANTICS */
+		if (!volidx[i])
+			return -EINVAL;
+		s->mix.vol[volidx[i]-1] = val;
+		return put_user(s->mix.vol[volidx[i]-1], (int *)arg);
+#endif /* OSS_DOCUMENTED_MIXER_SEMANTICS */
 	}
 }
 
@@ -2200,7 +2241,10 @@
 #define NR_DEVICE 5
 
 static int reverb[NR_DEVICE] = { 0, };
+
+#if 0
 static int wavetable[NR_DEVICE] = { 0, };
+#endif
 
 static unsigned dmaio = 0xac00;
 
@@ -2234,7 +2278,7 @@
 
 	if (!pci_present())   /* No PCI bus in this machine! */
 		return -ENODEV;
-	printk(KERN_INFO "sv: version v0.5 time " __TIME__ " " __DATE__ "\n");
+	printk(KERN_INFO "sv: version v0.6 time " __TIME__ " " __DATE__ "\n");
 #if 0
 	if (!(wavetable_mem = __get_free_pages(GFP_KERNEL, 20-PAGE_SHIFT)))
 		printk(KERN_INFO "sv: cannot allocate 1MB of contiguous nonpageable memory for wavetable data\n");
@@ -2297,7 +2341,6 @@
 		/* hack */
 		pci_write_config_dword(pcidev, 0x60, wavetable_mem >> 12);  /* wavetable base address */
 
-
 		if (check_region(s->ioenh, SV_EXTENT_ENH)) {
 			printk(KERN_ERR "sv: io ports %#x-%#x in use\n", s->ioenh, s->ioenh+SV_EXTENT_ENH-1);
 			goto err_region5;
@@ -2328,8 +2371,8 @@
 		udelay(50);
 		outb(0x00, s->ioenh + SV_CODEC_CONTROL); /* deassert reset */
 		udelay(50);
-		outb(SV_CCTRL_INTADRIVE | SV_CCTRL_ENHANCED /*| SV_CCTRL_WAVETABLE | SV_CCTRL_REVERB*/,
-		     s->ioenh + SV_CODEC_CONTROL);
+		outb(SV_CCTRL_INTADRIVE | SV_CCTRL_ENHANCED /*| SV_CCTRL_WAVETABLE */
+		     | (reverb[index] ? SV_CCTRL_REVERB : 0), s->ioenh + SV_CODEC_CONTROL);
 		inb(s->ioenh + SV_CODEC_STATUS); /* clear ints */
 		wrindir(s, SV_CIDRIVECONTROL, 0);  /* drive current 16mA */
 		wrindir(s, SV_CIENABLE, s->enable = 0);  /* disable DMAA and DMAC */
@@ -2412,9 +2455,11 @@
 #ifdef MODULE
 
 MODULE_PARM(reverb, "1-" __MODULE_STRING(NR_DEVICE) "i");
-MODULE_PARM_DESC(reverb, "if 1 enables joystick interface (still need separate driver)");
+MODULE_PARM_DESC(reverb, "if 1 enables the reverb circuitry. NOTE: your card must have the reverb RAM");
+#if 0
 MODULE_PARM(wavetable, "1-" __MODULE_STRING(NR_DEVICE) "i");
-MODULE_PARM_DESC(wavetable, "if 1 the LINE input is converted to LINE out");
+MODULE_PARM_DESC(wavetable, "if 1 the wavetable synth is enabled");
+#endif
 
 MODULE_PARM(dmaio, "i");
 MODULE_PARM_DESC(dmaio, "if the motherboard BIOS did not allocate DDMA io, allocate them starting at this address");

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov