patch-2.1.132 linux/drivers/sound/vidc.c

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

diff -u --recursive --new-file v2.1.131/linux/drivers/sound/vidc.c linux/drivers/sound/vidc.c
@@ -6,32 +6,50 @@
  *	Copyright (C) 1997 by Russell King <rmk@arm.uk.linux.org>
  */
 
+#include <linux/module.h>
+#include <linux/kernel.h>
+
 #include <asm/io.h>
 #include <asm/dma.h>
 #include "sound_config.h"
+#include "soundmodule.h"
 #include "vidc.h"
 
 int vidc_busy;
 
-void vidc_update_filler(int bits, int channels)
+void vidc_update_filler(int format, int channels)
 {
-	int filltype;
+	int fillertype;
+
+#define TYPE(fmt,ch) (((fmt)<<2) | ((ch)&3))
 
-	filltype = bits + channels;
-	switch (filltype)
+	fillertype = TYPE(format, channels);
+printk("filler type: %X\n", fillertype);
+	switch (fillertype)
 	{
 		default:
-		case 9:
-			vidc_filler = vidc_fill_1x8;
+		case TYPE(AFMT_U8, 1):
+			vidc_filler = vidc_fill_1x8_u;
 			break;
-		case 10:
-			vidc_filler = vidc_fill_2x8;
+
+		case TYPE(AFMT_U8, 2):
+			vidc_filler = vidc_fill_2x8_u;
 			break;
-		case 17:
-			vidc_filler = vidc_fill_1x16;
+
+		case TYPE(AFMT_S8, 1):
+			vidc_filler = vidc_fill_1x8_s;
 			break;
-		case 18:
-			vidc_filler = vidc_fill_2x16;
+
+		case TYPE(AFMT_S8, 2):
+			vidc_filler = vidc_fill_2x8_s;
+			break;
+
+		case TYPE(AFMT_S16_LE, 1):
+			vidc_filler = vidc_fill_1x16_s;
+			break;
+
+		case TYPE(AFMT_S16_LE, 2):
+			vidc_filler = vidc_fill_2x16_s;
 			break;
 	}
 }
@@ -55,12 +73,12 @@
 		printk(KERN_ERR "VIDCsound: can't allocate virtual DMA channel\n");
 		return;
 	}
-	if (request_irq(hw_config->irq, vidc_sound_dma_irq, 0, "VIDCsound", NULL))
+	if (request_irq(hw_config->irq, vidc_sound_dma_irq, 0, "VIDCsound", &dma_start))
 	{
 		printk(KERN_ERR "VIDCsound: can't allocate DMA interrupt\n");
 		return;
 	}
-	vidc_synth_init(hw_config);
+//	vidc_synth_init(hw_config);
 	vidc_audio_init(hw_config);
 	vidc_mixer_init(hw_config);
 }
@@ -76,6 +94,32 @@
 
 void unload_vidc(struct address_info *hw_config)
 {
+	int i;
+
 	free_irq(hw_config->irq, NULL);
 	sound_free_dma(hw_config->dma);
+
+	for (i = 0; i < 2; i++)
+		free_page(dma_buf[i]);
+}
+
+#ifdef MODULE
+static struct address_info config;
+
+int init_module(void)
+{
+	if (probe_vidc(&config) == 0)
+		return -ENODEV;
+	printk("VIDC 16-bit serial sound\n");
+	SOUND_LOCK;
+	attach_vidc(&config);
+	return 0;
 }
+
+void cleanup_module(void)
+{
+	unload_vidc(&config);
+	SOUND_LOCK_END;
+}
+
+#endif

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