summaryrefslogtreecommitdiffstats
path: root/drivers/sound
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/sound')
-rw-r--r--drivers/sound/Config.in45
-rw-r--r--drivers/sound/Makefile17
-rw-r--r--drivers/sound/aci.c718
-rw-r--r--drivers/sound/ad1816.c2
-rw-r--r--drivers/sound/ad1848.c55
-rw-r--r--drivers/sound/aedsp16.c (renamed from drivers/sound/lowlevel/aedsp16.c)75
-rw-r--r--drivers/sound/awe_hw.h (renamed from drivers/sound/lowlevel/awe_hw.h)0
-rw-r--r--drivers/sound/awe_wave.c (renamed from drivers/sound/lowlevel/awe_wave.c)577
-rw-r--r--drivers/sound/awe_wave.h (renamed from drivers/sound/lowlevel/awe_config.h)45
-rw-r--r--drivers/sound/dev_table.c1
-rw-r--r--drivers/sound/dev_table.h2
-rw-r--r--drivers/sound/lowlevel/Config.in66
-rw-r--r--drivers/sound/lowlevel/Makefile24
-rw-r--r--drivers/sound/lowlevel/README22
-rw-r--r--drivers/sound/lowlevel/aci.c679
-rw-r--r--drivers/sound/lowlevel/awe_compat.h257
-rw-r--r--drivers/sound/lowlevel/awe_version.h35
-rw-r--r--drivers/sound/lowlevel/lowlevel.h5
-rw-r--r--drivers/sound/lowlevel/soundlow.c67
-rw-r--r--drivers/sound/mad16.c2
-rw-r--r--drivers/sound/miroaci.h (renamed from drivers/sound/lowlevel/miroaci.h)7
-rw-r--r--drivers/sound/sb_card.c24
-rw-r--r--drivers/sound/sb_common.c3
-rw-r--r--drivers/sound/sscape.c1
-rw-r--r--drivers/sound/wavfront.c1
-rw-r--r--drivers/sound/wf_midi.c1
26 files changed, 1053 insertions, 1678 deletions
diff --git a/drivers/sound/Config.in b/drivers/sound/Config.in
index 30ffe5cc0..1d74abb50 100644
--- a/drivers/sound/Config.in
+++ b/drivers/sound/Config.in
@@ -86,6 +86,7 @@ if [ "$CONFIG_SOUND_OSS" = "y" -o "$CONFIG_SOUND_OSS" = "m" ]; then
fi
dep_tristate ' Aztech Sound Galaxy (non-PnP) cards' CONFIG_SOUND_SGALAXY $CONFIG_SOUND_OSS
+ dep_tristate ' ACI mixer (miroPCM12)' CONFIG_SOUND_ACI_MIXER $CONFIG_SOUND_OSS
dep_tristate ' Crystal CS4232 based (PnP) cards' CONFIG_SOUND_CS4232 $CONFIG_SOUND_OSS
dep_tristate ' Ensoniq SoundScape support' CONFIG_SOUND_SSCAPE $CONFIG_SOUND_OSS
dep_tristate ' Gravis Ultrasound support' CONFIG_SOUND_GUS $CONFIG_SOUND_OSS
@@ -115,10 +116,10 @@ if [ "$CONFIG_SOUND_OSS" = "y" -o "$CONFIG_SOUND_OSS" = "m" ]; then
dep_tristate ' PSS (AD1848, ADSP-2115, ESC614) support' CONFIG_SOUND_PSS $CONFIG_SOUND_OSS
if [ "$CONFIG_SOUND_PSS" = "y" -o "$CONFIG_SOUND_PSS" = "m" ]; then
bool ' Enable PSS mixer (Beethoven ADSP-16 and other compatibile)' CONFIG_PSS_MIXER
- fi
- bool ' Have DSPxxx.LD firmware file' CONFIG_PSS_HAVE_BOOT
- if [ "$CONFIG_PSS_HAVE_BOOT" = "y" ]; then
- string ' Full pathname of DSPxxx.LD firmware file' CONFIG_PSS_BOOT_FILE /etc/sound/dsp001.ld
+ bool ' Have DSPxxx.LD firmware file' CONFIG_PSS_HAVE_BOOT
+ if [ "$CONFIG_PSS_HAVE_BOOT" = "y" ]; then
+ string ' Full pathname of DSPxxx.LD firmware file' CONFIG_PSS_BOOT_FILE /etc/sound/dsp001.ld
+ fi
fi
dep_tristate ' SoftOSS software wave table engine' CONFIG_SOUND_SOFTOSS $CONFIG_SOUND_OSS
@@ -128,6 +129,7 @@ if [ "$CONFIG_SOUND_OSS" = "y" -o "$CONFIG_SOUND_OSS" = "m" ]; then
fi
dep_tristate ' 100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support' CONFIG_SOUND_SB $CONFIG_SOUND_OSS
+ dep_tristate ' AWE32 synth' CONFIG_SOUND_AWE32_SYNTH $CONFIG_SOUND_OSS
dep_tristate ' Full support for Turtle Beach WaveFront (Tropez Plus, Tropez, Maui) synth/soundcards' CONFIG_SOUND_WAVEFRONT $CONFIG_SOUND_OSS m
dep_tristate ' Limited support for Turtle Beach Wave Front (Maui, Tropez) synthesizers' CONFIG_SOUND_MAUI $CONFIG_SOUND_OSS
if [ "$CONFIG_SOUND_MAUI" = "y" ]; then
@@ -143,20 +145,33 @@ if [ "$CONFIG_SOUND_OSS" = "y" -o "$CONFIG_SOUND_OSS" = "m" ]; then
dep_tristate ' Yamaha OPL3-SA2, SA3, and SAx based PnP cards' CONFIG_SOUND_OPL3SA2 $CONFIG_SOUND_OSS
dep_tristate ' 6850 UART support' CONFIG_SOUND_UART6850 $CONFIG_SOUND_OSS
+ dep_tristate ' Gallant Audio Cards (SC-6000 and SC-6600 based)' CONFIG_SOUND_AEDSP16 $CONFIG_SOUND_OSS
+ if [ "$CONFIG_SOUND_AEDSP16" = "y" -o "$CONFIG_SOUND_AEDSP16" = "m" ]; then
+ bool ' SC-6600 based audio cards (new Audio Excel DSP 16)' CONFIG_SC6600
+ if [ "$CONFIG_SC6600" = "y" ]; then
+ bool ' Activate SC-6600 Joystick Interface' CONFIG_SC6600_JOY
+ int ' SC-6600 CDROM Interface (4=None, 3=IDE, 1=Panasonic, 0=?Sony?)' CONFIG_SC6600_CDROM 4
+ hex ' SC-6600 CDROM Interface I/O Address' CONFIG_SC6600_CDROMBASE 0
+ fi
+ if [ "$CONFIG_SOUND_SB" = "y" -o "$CONFIG_SOUND_SB" = "m" ]; then
+ if [ "$CONFIG_AEDSP16_MSS" != "y" ]; then
+ bool ' Audio Excel DSP 16 (SBPro emulation)' CONFIG_AEDSP16_SBPRO
+ fi
+ fi
+ if [ "$CONFIG_SOUND_MSS" = "y" -o "$CONFIG_SOUND_MSS" = "m" ]; then
+ if [ "$CONFIG_AEDSP16_SBPRO" != "y" ]; then
+ bool ' Audio Excel DSP 16 (MSS emulation)' CONFIG_AEDSP16_MSS
+ fi
+ fi
+ if [ "$CONFIG_SOUND_MPU401" = "y" -o "$CONFIG_SOUND_MPU401" = "m" ]; then
+ bool ' Audio Excel DSP 16 (MPU401 emulation)' CONFIG_AEDSP16_MPU401
+ fi
+ fi
+
if [ "$CONFIG_ARM" = "y" ]; then
dep_tristate ' VIDC 16-bit sound' CONFIG_SOUND_VIDC $CONFIG_SOUND_OSS
dep_tristate ' Netwinder WaveArtist' CONFIG_SOUND_WAVEARTIST $CONFIG_SOUND_OSS
fi
-
-
- # Additional low level drivers.
-
- mainmenu_option next_comment
- comment 'Additional low level sound drivers'
- bool 'Additional low level sound drivers' CONFIG_LOWLEVEL_SOUND $CONFIG_SOUND_OSS
- if [ "$CONFIG_LOWLEVEL_SOUND" = "y" ]; then
- source drivers/sound/lowlevel/Config.in
- fi
- endmenu
+
fi
diff --git a/drivers/sound/Makefile b/drivers/sound/Makefile
index 2c5df3f14..6a3576df0 100644
--- a/drivers/sound/Makefile
+++ b/drivers/sound/Makefile
@@ -10,13 +10,7 @@
SUB_DIRS :=
MOD_SUB_DIRS :=
MOD_IN_SUB_DIRS :=
-ALL_SUB_DIRS := $(SUB_DIRS) lowlevel
-
-ifeq ($(CONFIG_LOWLEVEL_SOUND),y)
- SUB_DIRS += lowlevel
- MOD_IN_SUB_DIRS += lowlevel
-endif
-
+ALL_SUB_DIRS := $(SUB_DIRS)
# All of the (potential) objects that export symbols.
@@ -47,6 +41,7 @@ obj-$(CONFIG_SOUND_CS4232) += cs4232.o ad1848.o
# Please leave it as is, cause the link order is significant !
+obj-$(CONFIG_SOUND_AEDSP16) += aedsp16.o
obj-$(CONFIG_SOUND_PSS) += pss.o ad1848.o mpu401.o
obj-$(CONFIG_SOUND_TRIX) += trix.o ad1848.o sb_lib.o uart401.o
obj-$(CONFIG_SOUND_OPL3SA1) += opl3sa.o ad1848.o uart401.o
@@ -69,6 +64,8 @@ obj-$(CONFIG_SOUND_VIDC) += vidc_mod.o
obj-$(CONFIG_SOUND_WAVEARTIST) += waveartist.o
obj-$(CONFIG_SOUND_SGALAXY) += sgalaxy.o ad1848.o
obj-$(CONFIG_SOUND_AD1816) += ad1816.o
+obj-$(CONFIG_SOUND_ACI_MIXER) += aci.o
+obj-$(CONFIG_SOUND_AWE32_SYNTH) += awe_wave.o
obj-$(CONFIG_SOUND_VIA82CXXX) += via82cxxx_audio.o sb_lib.o uart401.o ac97.o
obj-$(CONFIG_SOUND_MSNDCLAS) += msnd.o msnd_classic.o
@@ -85,7 +82,7 @@ obj-$(CONFIG_SOUND_TRIDENT) += trident.o ac97_codec.o
# Declare multi-part drivers.
-list-multi := sound.o gus.o pas2.o sb.o softoss2.o vidc_mod.o \
+list-multi := sound.o gus.o pas2.o sb.o sb_lib.o softoss2.o vidc_mod.o \
soundcore.o wavefront.o
sound-objs := \
@@ -137,8 +134,8 @@ O_OBJS := $(filter-out $(export-objs), $(obj-y))
OX_OBJS := $(filter $(export-objs), $(obj-y))
M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m)))
MX_OBJS := $(sort $(filter $(export-objs), $(obj-m)))
-#MI_OBJS := $(sort $(filter-out $(export-objs), $(int-m)))
-#MIX_OBJS := $(sort $(filter $(export-objs), $(int-m)))
+MI_OBJS := $(sort $(filter-out $(export-objs), $(int-m)))
+MIX_OBJS := $(sort $(filter $(export-objs), $(int-m)))
ifeq ($(CONFIG_LOWLEVEL_SOUND),y)
O_OBJS += lowlevel/lowlevel.o
diff --git a/drivers/sound/aci.c b/drivers/sound/aci.c
new file mode 100644
index 000000000..6970bec0d
--- /dev/null
+++ b/drivers/sound/aci.c
@@ -0,0 +1,718 @@
+/*
+ * Audio Command Interface (ACI) driver (sound/aci.c)
+ *
+ * ACI is a protocol used to communicate with the microcontroller on
+ * some sound cards produced by miro, e.g. the miroSOUND PCM12 and
+ * PCM20. The ACI has been developed for miro by Norberto Pellicci
+ * <pellicci@home.com>. Special thanks to both him and miro for
+ * providing the ACI specification.
+ *
+ * The main function of the ACI is to control the mixer and to get a
+ * product identification. On the PCM20, ACI also controls the radio
+ * tuner on this card, this is supported in the Video for Linux
+ * radio-miropcm20 driver.
+ *
+ * This Voxware ACI driver currently only supports the ACI functions
+ * on the miroSOUND PCM12 and PCM20 card. Support for miro sound cards
+ * with additional ACI functions can easily be added later.
+ *
+ * / NOTE / When compiling as a module, make sure to load the module
+ * after loading the mad16 module. The initialisation code expects the
+ * MAD16 default mixer to be already available.
+ *
+ * Revision history:
+ *
+ * 1995-11-10 Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
+ * First version written.
+ * 1995-12-31 Markus Kuhn
+ * Second revision, general code cleanup.
+ * 1996-05-16 Hannu Savolainen
+ * Integrated with other parts of the driver.
+ * 1996-05-28 Markus Kuhn
+ * Initialize CS4231A mixer, make ACI first mixer,
+ * use new private mixer API for solo mode.
+ * 1998-08-18 Ruurd Reitsma <R.A.Reitsma@wbmt.tudelft.nl>
+ * Small modification to export ACI functions and
+ * complete modularisation.
+ */
+
+/*
+ * Some driver specific information and features:
+ *
+ * This mixer driver identifies itself to applications as "ACI" in
+ * mixer_info.id as retrieved by ioctl(fd, SOUND_MIXER_INFO, &mixer_info).
+ *
+ * Proprietary mixer features that go beyond the standard OSS mixer
+ * interface are:
+ *
+ * Full duplex solo configuration:
+ *
+ * int solo_mode;
+ * ioctl(fd, SOUND_MIXER_PRIVATE1, &solo_mode);
+ *
+ * solo_mode = 0: deactivate solo mode (default)
+ * solo_mode > 0: activate solo mode
+ * With activated solo mode, the PCM input can not any
+ * longer hear the signals produced by the PCM output.
+ * Activating solo mode is important in duplex mode in order
+ * to avoid feedback distortions.
+ * solo_mode < 0: do not change solo mode (just retrieve the status)
+ *
+ * When the ioctl() returns 0, solo_mode contains the previous
+ * status (0 = deactivated, 1 = activated). If solo mode is not
+ * implemented on this card, ioctl() returns -1 and sets errno to
+ * EINVAL.
+ *
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+
+#include "sound_config.h"
+
+#undef DEBUG /* if defined, produce a verbose report via syslog */
+
+int aci_port = 0x354; /* as determined by bit 4 in the OPTi 929 MC4 register */
+unsigned char aci_idcode[2] = {0, 0}; /* manufacturer and product ID */
+unsigned char aci_version = 0; /* ACI firmware version */
+int aci_solo; /* status bit of the card that can't be *
+ * checked with ACI versions prior to 0xb0 */
+
+static int aci_present = 0;
+
+#ifdef MODULE /* Whether the aci mixer is to be reset. */
+int aci_reset = 0; /* Default: don't reset if the driver is a */
+MODULE_PARM(aci_reset,"i");
+#else /* module; use "insmod aci.o aci_reset=1" */
+int aci_reset = 1; /* to override. */
+#endif
+
+
+#define COMMAND_REGISTER (aci_port)
+#define STATUS_REGISTER (aci_port + 1)
+#define BUSY_REGISTER (aci_port + 2)
+
+/*
+ * Wait until the ACI microcontroller has set the READYFLAG in the
+ * Busy/IRQ Source Register to 0. This is required to avoid
+ * overrunning the sound card microcontroller. We do a busy wait here,
+ * because the microcontroller is not supposed to signal a busy
+ * condition for more than a few clock cycles. In case of a time-out,
+ * this function returns -1.
+ *
+ * This busy wait code normally requires less than 15 loops and
+ * practically always less than 100 loops on my i486/DX2 66 MHz.
+ *
+ * Warning: Waiting on the general status flag after reseting the MUTE
+ * function can take a VERY long time, because the PCM12 does some kind
+ * of fade-in effect. For this reason, access to the MUTE function has
+ * not been implemented at all.
+ */
+
+static int busy_wait(void)
+{
+ long timeout;
+
+ for (timeout = 0; timeout < 10000000L; timeout++)
+ if ((inb_p(BUSY_REGISTER) & 1) == 0)
+ return 0;
+
+#ifdef DEBUG
+ printk("ACI: READYFLAG timed out.\n");
+#endif
+
+ return -1;
+}
+
+
+/*
+ * Read the GENERAL STATUS register.
+ */
+
+static int read_general_status(void)
+{
+ unsigned long flags;
+ int status;
+
+ save_flags(flags);
+ cli();
+
+ if (busy_wait()) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ status = (unsigned) inb_p(STATUS_REGISTER);
+ restore_flags(flags);
+ return status;
+}
+
+
+/*
+ * The four ACI command types (implied, write, read and indexed) can
+ * be sent to the microcontroller using the following four functions.
+ * If a problem occurred, they return -1.
+ */
+
+int aci_implied_cmd(unsigned char opcode)
+{
+ unsigned long flags;
+
+#ifdef DEBUG
+ printk("ACI: aci_implied_cmd(0x%02x)\n", opcode);
+#endif
+
+ save_flags(flags);
+ cli();
+
+ if (read_general_status() < 0 || busy_wait()) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ outb_p(opcode, COMMAND_REGISTER);
+
+ restore_flags(flags);
+ return 0;
+}
+
+
+int aci_write_cmd(unsigned char opcode, unsigned char parameter)
+{
+ unsigned long flags;
+ int status;
+
+#ifdef DEBUG
+ printk("ACI: aci_write_cmd(0x%02x, 0x%02x)\n", opcode, parameter);
+#endif
+
+ save_flags(flags);
+ cli();
+
+ if (read_general_status() < 0 || busy_wait()) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ outb_p(opcode, COMMAND_REGISTER);
+ if (busy_wait()) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ outb_p(parameter, COMMAND_REGISTER);
+
+ if ((status = read_general_status()) < 0) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ /* polarity of the INVALID flag depends on ACI version */
+ if ((aci_version < 0xb0 && (status & 0x40) != 0) ||
+ (aci_version >= 0xb0 && (status & 0x40) == 0)) {
+ restore_flags(flags);
+ printk("ACI: invalid write command 0x%02x, 0x%02x.\n",
+ opcode, parameter);
+ return -1;
+ }
+
+ restore_flags(flags);
+ return 0;
+}
+
+/*
+ * This write command send 2 parameters instead of one.
+ * Only used in PCM20 radio frequency tuning control
+ */
+
+int aci_write_cmd_d(unsigned char opcode, unsigned char parameter, unsigned char parameter2)
+{
+ unsigned long flags;
+ int status;
+
+#ifdef DEBUG
+ printk("ACI: aci_write_cmd_d(0x%02x, 0x%02x)\n", opcode, parameter, parameter2);
+#endif
+
+ save_flags(flags);
+ cli();
+
+ if (read_general_status() < 0 || busy_wait()) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ outb_p(opcode, COMMAND_REGISTER);
+ if (busy_wait()) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ outb_p(parameter, COMMAND_REGISTER);
+ if (busy_wait()) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ outb_p(parameter2, COMMAND_REGISTER);
+
+ if ((status = read_general_status()) < 0) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ /* polarity of the INVALID flag depends on ACI version */
+ if ((aci_version < 0xb0 && (status & 0x40) != 0) ||
+ (aci_version >= 0xb0 && (status & 0x40) == 0)) {
+ restore_flags(flags);
+#if 0 /* Frequency tuning works, but the INVALID flag is set ??? */
+ printk("ACI: invalid write (double) command 0x%02x, 0x%02x, 0x%02x.\n",
+ opcode, parameter, parameter2);
+#endif
+ return -1;
+ }
+
+ restore_flags(flags);
+ return 0;
+}
+
+int aci_read_cmd(unsigned char opcode, int length, unsigned char *parameter)
+{
+ unsigned long flags;
+ int i = 0;
+
+ save_flags(flags);
+ cli();
+
+ if (read_general_status() < 0) {
+ restore_flags(flags);
+ return -1;
+ }
+ while (i < length) {
+ if (busy_wait()) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ outb_p(opcode, COMMAND_REGISTER);
+ if (busy_wait()) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ parameter[i++] = inb_p(STATUS_REGISTER);
+#ifdef DEBUG
+ if (i == 1)
+ printk("ACI: aci_read_cmd(0x%02x, %d) = 0x%02x\n",
+ opcode, length, parameter[i-1]);
+ else
+ printk("ACI: aci_read_cmd cont.: 0x%02x\n", parameter[i-1]);
+#endif
+ }
+
+ restore_flags(flags);
+ return 0;
+}
+
+
+int aci_indexed_cmd(unsigned char opcode, unsigned char index,
+ unsigned char *parameter)
+{
+ unsigned long flags;
+
+ save_flags(flags);
+ cli();
+
+ if (read_general_status() < 0 || busy_wait()) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ outb_p(opcode, COMMAND_REGISTER);
+ if (busy_wait()) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ outb_p(index, COMMAND_REGISTER);
+ if (busy_wait()) {
+ restore_flags(flags);
+ return -1;
+ }
+
+ *parameter = inb_p(STATUS_REGISTER);
+#ifdef DEBUG
+ printk("ACI: aci_indexed_cmd(0x%02x, 0x%02x) = 0x%02x\n", opcode, index,
+ *parameter);
+#endif
+
+ restore_flags(flags);
+ return 0;
+}
+
+
+/*
+ * The following macro SCALE can be used to scale one integer volume
+ * value into another one using only integer arithmetic. If the input
+ * value x is in the range 0 <= x <= xmax, then the result will be in
+ * the range 0 <= SCALE(xmax,ymax,x) <= ymax.
+ *
+ * This macro has for all xmax, ymax > 0 and all 0 <= x <= xmax the
+ * following nice properties:
+ *
+ * - SCALE(xmax,ymax,xmax) = ymax
+ * - SCALE(xmax,ymax,0) = 0
+ * - SCALE(xmax,ymax,SCALE(ymax,xmax,SCALE(xmax,ymax,x))) = SCALE(xmax,ymax,x)
+ *
+ * In addition, the rounding error is minimal and nicely distributed.
+ * The proofs are left as an exercise to the reader.
+ */
+
+#define SCALE(xmax,ymax,x) (((x)*(ymax)+(xmax)/2)/(xmax))
+
+
+static int getvolume(caddr_t arg,
+ unsigned char left_index, unsigned char right_index)
+{
+ int vol;
+ unsigned char buf;
+
+ /* left channel */
+ if (aci_indexed_cmd(0xf0, left_index, &buf))
+ return -EIO;
+ vol = SCALE(0x20, 100, buf < 0x20 ? 0x20-buf : 0);
+
+ /* right channel */
+ if (aci_indexed_cmd(0xf0, right_index, &buf))
+ return -EIO;
+ vol |= SCALE(0x20, 100, buf < 0x20 ? 0x20-buf : 0) << 8;
+
+ return (*(int *) arg = vol);
+}
+
+
+static int setvolume(caddr_t arg,
+ unsigned char left_index, unsigned char right_index)
+{
+ int vol, ret;
+
+ /* left channel */
+ vol = *(int *)arg & 0xff;
+ if (vol > 100)
+ vol = 100;
+ vol = SCALE(100, 0x20, vol);
+ if (aci_write_cmd(left_index, 0x20 - vol))
+ return -EIO;
+ ret = SCALE(0x20, 100, vol);
+
+
+ /* right channel */
+ vol = (*(int *)arg >> 8) & 0xff;
+ if (vol > 100)
+ vol = 100;
+ vol = SCALE(100, 0x20, vol);
+ if (aci_write_cmd(right_index, 0x20 - vol))
+ return -EIO;
+ ret |= SCALE(0x20, 100, vol) << 8;
+
+ return (*(int *) arg = ret);
+}
+
+
+static int
+aci_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg)
+{
+ int status, vol;
+ unsigned char buf;
+
+ /* handle solo mode control */
+ if (cmd == SOUND_MIXER_PRIVATE1) {
+ if (*(int *) arg >= 0) {
+ aci_solo = !!*(int *) arg;
+ if (aci_write_cmd(0xd2, aci_solo))
+ return -EIO;
+ } else if (aci_version >= 0xb0) {
+ if ((status = read_general_status()) < 0)
+ return -EIO;
+ return (*(int *) arg = (status & 0x20) == 0);
+ }
+
+ return (*(int *) arg = aci_solo);
+ }
+
+ if (((cmd >> 8) & 0xff) == 'M') {
+ if (cmd & IOC_IN)
+ /* read and write */
+ switch (cmd & 0xff) {
+ case SOUND_MIXER_VOLUME:
+ return setvolume(arg, 0x01, 0x00);
+ case SOUND_MIXER_CD:
+ return setvolume(arg, 0x3c, 0x34);
+ case SOUND_MIXER_MIC:
+ return setvolume(arg, 0x38, 0x30);
+ case SOUND_MIXER_LINE:
+ return setvolume(arg, 0x39, 0x31);
+ case SOUND_MIXER_SYNTH:
+ return setvolume(arg, 0x3b, 0x33);
+ case SOUND_MIXER_PCM:
+ return setvolume(arg, 0x3a, 0x32);
+ case SOUND_MIXER_LINE1: /* AUX1 */
+ return setvolume(arg, 0x3d, 0x35);
+ case SOUND_MIXER_LINE2: /* AUX2 */
+ return setvolume(arg, 0x3e, 0x36);
+ case SOUND_MIXER_IGAIN: /* MIC pre-amp */
+ vol = *(int *) arg & 0xff;
+ if (vol > 100)
+ vol = 100;
+ vol = SCALE(100, 3, vol);
+ if (aci_write_cmd(0x03, vol))
+ return -EIO;
+ vol = SCALE(3, 100, vol);
+ return (*(int *) arg = vol | (vol << 8));
+ case SOUND_MIXER_RECSRC:
+ return (*(int *) arg = 0);
+ break;
+ default:
+ return -EINVAL;
+ }
+ else
+ /* only read */
+ switch (cmd & 0xff) {
+ case SOUND_MIXER_DEVMASK:
+ return (*(int *) arg =
+ SOUND_MASK_VOLUME | SOUND_MASK_CD |
+ SOUND_MASK_MIC | SOUND_MASK_LINE |
+ SOUND_MASK_SYNTH | SOUND_MASK_PCM |
+#if 0
+ SOUND_MASK_IGAIN |
+#endif
+ SOUND_MASK_LINE1 | SOUND_MASK_LINE2);
+ break;
+ case SOUND_MIXER_STEREODEVS:
+ return (*(int *) arg =
+ SOUND_MASK_VOLUME | SOUND_MASK_CD |
+ SOUND_MASK_MIC | SOUND_MASK_LINE |
+ SOUND_MASK_SYNTH | SOUND_MASK_PCM |
+ SOUND_MASK_LINE1 | SOUND_MASK_LINE2);
+ break;
+ case SOUND_MIXER_RECMASK:
+ return (*(int *) arg = 0);
+ break;
+ case SOUND_MIXER_RECSRC:
+ return (*(int *) arg = 0);
+ break;
+ case SOUND_MIXER_CAPS:
+ return (*(int *) arg = 0);
+ break;
+ case SOUND_MIXER_VOLUME:
+ return getvolume(arg, 0x04, 0x03);
+ case SOUND_MIXER_CD:
+ return getvolume(arg, 0x0a, 0x09);
+ case SOUND_MIXER_MIC:
+ return getvolume(arg, 0x06, 0x05);
+ case SOUND_MIXER_LINE:
+ return getvolume(arg, 0x08, 0x07);
+ case SOUND_MIXER_SYNTH:
+ return getvolume(arg, 0x0c, 0x0b);
+ case SOUND_MIXER_PCM:
+ return getvolume(arg, 0x0e, 0x0d);
+ case SOUND_MIXER_LINE1: /* AUX1 */
+ return getvolume(arg, 0x11, 0x10);
+ case SOUND_MIXER_LINE2: /* AUX2 */
+ return getvolume(arg, 0x13, 0x12);
+ case SOUND_MIXER_IGAIN: /* MIC pre-amp */
+ if (aci_indexed_cmd(0xf0, 0x21, &buf))
+ return -EIO;
+ vol = SCALE(3, 100, buf <= 3 ? buf : 3);
+ vol |= vol << 8;
+ return (*(int *) arg = vol);
+ default:
+ return -EINVAL;
+ }
+ }
+
+ return -EINVAL;
+}
+
+
+static struct mixer_operations aci_mixer_operations =
+{
+ "ACI",
+ "ACI mixer",
+ aci_mixer_ioctl,
+ NULL
+};
+
+static unsigned char
+mad_read (int port)
+{
+ outb (0xE3, 0xf8f); /* Write MAD16 password */
+ return inb (port); /* Read from port */
+}
+
+
+/*
+ * Check, whether there actually is any ACI port operational and if
+ * one was found, then initialize the ACI interface, reserve the I/O
+ * addresses and attach the new mixer to the relevant VoxWare data
+ * structures.
+ *
+ * Returns: 1 ACI mixer detected
+ * 0 nothing there
+ *
+ * There is also an internal mixer in the codec (CS4231A or AD1845),
+ * that deserves no purpose in an ACI based system which uses an
+ * external ACI controlled stereo mixer. Make sure that this codec
+ * mixer has the AUX1 input selected as the recording source, that the
+ * input gain is set near maximum and that the other channels going
+ * from the inputs to the codec output are muted.
+ */
+
+static int __init attach_aci(void)
+{
+ char *boardname = "unknown";
+ int volume;
+
+#define MC4_PORT 0xf90
+
+ aci_port =
+ (mad_read(MC4_PORT) & 0x10) ? 0x344 : 0x354;
+
+ if (check_region(aci_port, 3)) {
+#ifdef DEBUG
+ printk("ACI: I/O area 0x%03x-0x%03x already used.\n",
+ aci_port, aci_port+2);
+#endif
+ return 0;
+ }
+
+ if (aci_read_cmd(0xf2, 2, aci_idcode)) {
+#ifdef DEBUG
+ printk("ACI: Failed to read idcode.\n");
+#endif
+ return 0;
+ }
+
+ if (aci_read_cmd(0xf1, 1, &aci_version)) {
+#ifdef DEBUG
+ printk("ACI: Failed to read version.\n");
+#endif
+ return 0;
+ }
+
+ if (aci_idcode[0] == 0x6d) {
+ /* It looks like a miro sound card. */
+ switch (aci_idcode[1]) {
+ case 0x41:
+ boardname = "PCM1 pro / early PCM12";
+ break;
+ case 0x42:
+ boardname = "PCM12";
+ break;
+ case 0x43:
+ boardname = "PCM20";
+ break;
+ default:
+ boardname = "unknown miro";
+ }
+ } else
+#ifndef DEBUG
+ return 0;
+#endif
+
+ printk("<ACI %02x, id %02x %02x (%s)> at 0x%03x\n",
+ aci_version, aci_idcode[0], aci_idcode[1], boardname, aci_port);
+
+ if (aci_reset) {
+ /* initialize ACI mixer */
+ aci_implied_cmd(0xff);
+ aci_solo = 0;
+ }
+
+ /* attach the mixer */
+ request_region(aci_port, 3, "sound mixer (ACI)");
+ if (num_mixers < MAX_MIXER_DEV) {
+ if (num_mixers > 0 &&
+ !strncmp("MAD16 WSS", mixer_devs[num_mixers-1]->name, 9)) {
+ /*
+ * The previously registered mixer device is the CS4231A which
+ * has no function on an ACI card. Make the ACI mixer the first
+ * of the two mixer devices.
+ */
+ mixer_devs[num_mixers] = mixer_devs[num_mixers-1];
+ mixer_devs[num_mixers-1] = &aci_mixer_operations;
+ /*
+ * Initialize the CS4231A mixer with reasonable values. It is
+ * unlikely that the user ever will want to change these as all
+ * channels can be mixed via ACI.
+ */
+ volume = 0x6464;
+ mixer_devs[num_mixers]->ioctl(num_mixers,
+ SOUND_MIXER_WRITE_PCM, (caddr_t) &volume);
+ volume = 0x6464;
+ mixer_devs[num_mixers]->ioctl(num_mixers,
+ SOUND_MIXER_WRITE_IGAIN, (caddr_t) &volume);
+ volume = 0;
+ mixer_devs[num_mixers]->ioctl(num_mixers,
+ SOUND_MIXER_WRITE_SPEAKER, (caddr_t) &volume);
+ volume = 0;
+ mixer_devs[num_mixers]->ioctl(num_mixers,
+ SOUND_MIXER_WRITE_MIC, (caddr_t) &volume);
+ volume = 0;
+ mixer_devs[num_mixers]->ioctl(num_mixers,
+ SOUND_MIXER_WRITE_IMIX, (caddr_t) &volume);
+ volume = 0;
+ mixer_devs[num_mixers]->ioctl(num_mixers,
+ SOUND_MIXER_WRITE_LINE1, (caddr_t) &volume);
+ volume = 0;
+ mixer_devs[num_mixers]->ioctl(num_mixers,
+ SOUND_MIXER_WRITE_LINE2, (caddr_t) &volume);
+ volume = 0;
+ mixer_devs[num_mixers]->ioctl(num_mixers,
+ SOUND_MIXER_WRITE_LINE3, (caddr_t) &volume);
+ volume = SOUND_MASK_LINE1;
+ mixer_devs[num_mixers]->ioctl(num_mixers,
+ SOUND_MIXER_WRITE_RECSRC, (caddr_t) &volume);
+ num_mixers++;
+ } else
+ mixer_devs[num_mixers++] = &aci_mixer_operations;
+ }
+
+ /* Just do something; otherwise the first write command fails, at
+ * least with my PCM20.
+ */
+ aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_READ_VOLUME, (caddr_t) &volume);
+
+ if (aci_reset) {
+ /* Initialize ACI mixer with reasonable power-up values */
+ volume = 0x3232;
+ aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_VOLUME, (caddr_t) &volume);
+ volume = 0x3232;
+ aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_SYNTH, (caddr_t) &volume);
+ volume = 0x3232;
+ aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_PCM, (caddr_t) &volume);
+ volume = 0x3232;
+ aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_LINE, (caddr_t) &volume);
+ volume = 0x3232;
+ aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_MIC, (caddr_t) &volume);
+ volume = 0x3232;
+ aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_CD, (caddr_t) &volume);
+ volume = 0x3232;
+ aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_LINE1, (caddr_t) &volume);
+ volume = 0x3232;
+ aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_LINE2, (caddr_t) &volume);
+ }
+
+ aci_present = 1;
+
+ return 1;
+}
+
+static void __exit unload_aci(void)
+{
+ if (aci_present)
+ release_region(aci_port, 3);
+}
+
+module_init(attach_aci);
+module_exit(unload_aci);
diff --git a/drivers/sound/ad1816.c b/drivers/sound/ad1816.c
index d44cf1389..8bd68c4dc 100644
--- a/drivers/sound/ad1816.c
+++ b/drivers/sound/ad1816.c
@@ -1386,7 +1386,7 @@ static int __init setup_ad1816(char *str)
io = ints[1];
irq = ints[2];
dma = ints[3];
- dma16 = ints[4];
+ dma2 = ints[4];
return 1;
}
diff --git a/drivers/sound/ad1848.c b/drivers/sound/ad1848.c
index b7ad6f75c..bce04ef33 100644
--- a/drivers/sound/ad1848.c
+++ b/drivers/sound/ad1848.c
@@ -2502,11 +2502,6 @@ void attach_ms_sound(struct address_info *hw_config)
int dma = hw_config->dma;
int dma2 = hw_config->dma2;
- if(hw_config->io_base != -1 || hw_config->irq == -1 || hw_config->dma == -1) {
- printk(KERN_WARNING "ad1848: must give I/O , IRQ and DMA.\n");
- return;
- }
-
if (hw_config->card_subtype == 1) /* Has no IRQ/DMA registers */
{
hw_config->slots[0] = ad1848_init("MS Sound System", hw_config->io_base + 4,
@@ -2573,9 +2568,6 @@ void attach_ms_sound(struct address_info *hw_config)
dma2, 0,
hw_config->osp);
request_region(hw_config->io_base, 4, "WSS config");
-
- SOUND_LOCK;
- loaded = 1;
}
void unload_ms_sound(struct address_info *hw_config)
@@ -2710,15 +2702,6 @@ EXPORT_SYMBOL(probe_ms_sound);
EXPORT_SYMBOL(attach_ms_sound);
EXPORT_SYMBOL(unload_ms_sound);
-MODULE_PARM(io, "i"); /* I/O for a raw AD1848 card */
-MODULE_PARM(irq, "i"); /* IRQ to use */
-MODULE_PARM(dma, "i"); /* First DMA channel */
-MODULE_PARM(dma2, "i"); /* Second DMA channel */
-MODULE_PARM(type, "i"); /* Card type */
-MODULE_PARM(deskpro_xl, "i"); /* Special magic for Deskpro XL boxen */
-MODULE_PARM(deskpro_m, "i"); /* Special magic for Deskpro M box */
-MODULE_PARM(soundpro, "i"); /* More special magic for SoundPro chips */
-
static int __initdata io = -1;
static int __initdata irq = -1;
static int __initdata dma = -1;
@@ -2727,21 +2710,41 @@ static int __initdata type = 0;
static struct address_info cfg;
+MODULE_PARM(io, "i"); /* I/O for a raw AD1848 card */
+MODULE_PARM(irq, "i"); /* IRQ to use */
+MODULE_PARM(dma, "i"); /* First DMA channel */
+MODULE_PARM(dma2, "i"); /* Second DMA channel */
+MODULE_PARM(type, "i"); /* Card type */
+MODULE_PARM(deskpro_xl, "i"); /* Special magic for Deskpro XL boxen
+*/
+MODULE_PARM(deskpro_m, "i"); /* Special magic for Deskpro M box */
+MODULE_PARM(soundpro, "i"); /* More special magic for SoundPro
+chips */
+
static int __init init_ad1848(void)
{
printk(KERN_INFO "ad1848/cs4248 codec driver Copyright (C) by Hannu Savolainen 1993-1996\n");
- cfg.irq = irq;
- cfg.io_base = io;
- cfg.dma = dma;
- cfg.dma2 = dma2;
- cfg.card_subtype = type;
+ if(io != -1) {
+ if(irq == -1 || dma == -1) {
+ printk(KERN_WARNING "ad1848: must give I/O , IRQ and DMA.\n");
+ return -EINVAL;
+ }
- if(probe_ms_sound(&cfg)) {
+ cfg.irq = irq;
+ cfg.io_base = io;
+ cfg.dma = dma;
+ cfg.dma2 = dma2;
+ cfg.card_subtype = type;
+
+ if(!probe_ms_sound(&cfg))
+ return -ENODEV;
attach_ms_sound(&cfg);
- return 0;
- } else
- return -ENODEV;
+ loaded = 1;
+ }
+
+ SOUND_LOCK;
+ return 0;
}
static void __exit cleanup_ad1848(void)
diff --git a/drivers/sound/lowlevel/aedsp16.c b/drivers/sound/aedsp16.c
index 48ef93f19..74b961521 100644
--- a/drivers/sound/lowlevel/aedsp16.c
+++ b/drivers/sound/aedsp16.c
@@ -27,25 +27,14 @@
#include <linux/delay.h>
#include <linux/module.h>
#include <linux/init.h>
-#include "../sound_config.h"
-#include "../soundmodule.h"
+#include "sound_config.h"
+#include "soundmodule.h"
/*
* Sanity checks
*/
-#if !defined(CONFIG_AEDSP16_BASE)
-# undef CONFIG_AEDSP16
-#else
-# if defined(MODULE) && defined(CONFIG_AEDSP16_MODULE)
-# define CONFIG_AEDSP16 1
-# endif
-#endif
-
-
-#if defined(CONFIG_AEDSP16)
-
-#if defined(CONFIG_AEDSP16_SBPRO) && defined(CONFIG_AEDSP16_MSS)
+#if defined(CONFIG_SOUND_AEDSP16_SBPRO) && defined(CONFIG_SOUND_AEDSP16_MSS)
#error You have to enable only one of the MSS and SBPRO emulations.
#endif
@@ -1275,22 +1264,6 @@ int __init init_aedsp16(void)
{
int initialized = FALSE;
-#if !defined(MODULE)
- ae_config.base_io = CONFIG_AEDSP16_BASE;
-#if defined(CONFIG_AEDSP16_SBPRO)
- ae_config.irq = CONFIG_AEDSP16_SB_IRQ;
- ae_config.dma = CONFIG_AEDSP16_SB_DMA;
-#endif
-#if defined(CONFIG_AEDSP16_MSS)
- ae_config.mss_base = CONFIG_MSS_BASE;
- ae_config.irq = CONFIG_AEDSP16_MSS_IRQ;
- ae_config.dma = CONFIG_AEDSP16_MSS_DMA;
-#endif
-#if defined(CONFIG_AEDSP16_MPU401)
- ae_config.mpu_base = CONFIG_MPU_BASE;
- ae_config.mpu_irq = CONFIG_AEDSP16_MPU_IRQ;
-#endif
-#endif /* !MODULE */
DBG(("Initializing BASE[0x%x] IRQ[%d] DMA[%d] MIRQ[%d]\n",
ae_config.base_io,ae_config.irq,ae_config.dma,ae_config.mpu_irq));
@@ -1339,15 +1312,12 @@ void __init uninit_aedsp16(void)
uninit_aedsp16_mpu();
}
-#if defined(MODULE)
-
-int io = -1;
-int irq = -1;
-int dma = -1;
-int mpu_irq = -1;
-int mss_base = -1;
-int mpu_base = -1;
-
+static int __initdata io = -1;
+static int __initdata irq = -1;
+static int __initdata dma = -1;
+static int __initdata mpu_irq = -1;
+static int __initdata mss_base = -1;
+static int __initdata mpu_base = -1;
MODULE_PARM(io, "i");
MODULE_PARM_DESC(io, "I/O base address (0x220 0x240)");
@@ -1364,7 +1334,7 @@ MODULE_PARM_DESC(mpu_base,"MPU-401 I/O base address (0x300 0x310 0x320 0x330)");
MODULE_AUTHOR("Riccardo Facchetti <fizban@tin.it>");
MODULE_DESCRIPTION("Audio Excel DSP 16 Driver Version " VERSION);
-int init_module(void) {
+static int __init do_init_aedsp16(void) {
printk("Audio Excel DSP 16 init driver Copyright (C) Riccardo Facchetti 1995-98\n");
if (io == -1 || dma == -1 || irq == -1) {
printk(KERN_INFO "aedsp16: I/O, IRQ and DMA are mandatory\n");
@@ -1391,10 +1361,29 @@ int init_module(void) {
return 0;
}
-void cleanup_module(void) {
+static void __exit cleanup_aedsp16(void) {
uninit_aedsp16();
SOUND_LOCK_END;
}
-#endif /* MODULE */
-#endif /* CONFIG_AEDSP16 */
+module_init(do_init_aedsp16);
+module_exit(cleanup_aedsp16);
+
+#ifndef MODULE
+static int __init setup_aedsp16(char *str)
+{
+ /* io, irq, dma, mss_io, mpu_io, mpu_irq */
+ int ints[7];
+
+ str = get_options(str, ARRAY_SIZE(ints), ints);
+
+ io = ints[1];
+ irq = ints[2];
+ dma = ints[3];
+ mss_base = ints[4];
+ mpu_base = ints[5];
+ mpu_irq = ints[6];
+}
+
+__setup("aedsp16=", setup_aedsp16);
+#endif
diff --git a/drivers/sound/lowlevel/awe_hw.h b/drivers/sound/awe_hw.h
index c7dde2679..c7dde2679 100644
--- a/drivers/sound/lowlevel/awe_hw.h
+++ b/drivers/sound/awe_hw.h
diff --git a/drivers/sound/lowlevel/awe_wave.c b/drivers/sound/awe_wave.c
index 8608e179e..bedebb3b6 100644
--- a/drivers/sound/lowlevel/awe_wave.c
+++ b/drivers/sound/awe_wave.c
@@ -21,23 +21,29 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* include initial header files and compatibility macros */
-#ifdef __FreeBSD__
-# include <i386/isa/sound/awe_compat.h>
-#else
-# include "awe_compat.h"
-#endif /* FreeBSD */
-#ifdef __linux__
-# include <linux/config.h>
-#endif
+#include <linux/awe_voice.h>
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/string.h>
-/*----------------------------------------------------------------*/
+#include "sound_config.h"
+#include "soundmodule.h"
-#if defined(CONFIG_AWE32_SYNTH) || defined(CONFIG_AWE32_SYNTH_MODULE)
+#include "awe_wave.h"
+#include "awe_hw.h"
-/*----------------------------------------------------------------
+#ifdef AWE_HAS_GUS_COMPATIBILITY
+#include "tuning.h"
+#include <linux/ultrasound.h>
+#endif
+
+/*
* debug message
- *----------------------------------------------------------------*/
+ */
+
+/* do not allocate buffer at beginning */
+#define INIT_TABLE(buffer,index,nums,type) {buffer=NULL; index=0;}
#ifdef AWE_DEBUG_ON
#define DEBUG(LVL,XXX) {if (ctrls[AWE_MD_DEBUG_MODE] > LVL) { XXX; }}
@@ -49,9 +55,9 @@
#define FATALERR(XXX) XXX
#endif
-/*----------------------------------------------------------------
+/*
* bank and voice record
- *----------------------------------------------------------------*/
+ */
/* soundfont record */
typedef struct _sf_list {
@@ -115,9 +121,9 @@ static awe_voice_list *infos = NULL;
/* preset table index */
static int preset_table[AWE_MAX_PRESETS];
-/*----------------------------------------------------------------
+/*
* voice table
- *----------------------------------------------------------------*/
+ */
/* effects table */
typedef struct FX_Rec { /* channel effects */
@@ -200,23 +206,18 @@ static awe_chan_info channels[AWE_MAX_CHANNELS];
#define AWE_DEFAULT_MEM_SIZE -1 /* autodetect */
#endif
-/* set variables */
-#if defined(AWE_MODULE_SUPPORT) && defined(MODULE)
-/* replace awe_port variable with exported variable */
#define awe_port io
#define awe_mem_size memsize
int io = AWE_DEFAULT_BASE_ADDR; /* Emu8000 base address */
int memsize = AWE_DEFAULT_MEM_SIZE; /* memory size in Kbytes */
-#ifdef MODULE_PARM
+
+MODULE_AUTHOR("Takashi Iwai <iwai@ww.uni-erlangen.de>");
+MODULE_DESCRIPTION("SB AWE32/64 WaveTable driver");
MODULE_PARM(io, "i");
MODULE_PARM_DESC(io, "base i/o port of Emu8000");
MODULE_PARM(memsize, "i");
MODULE_PARM_DESC(memsize, "onboard DRAM size in Kbytes");
-#endif
-#else
-static int awe_port = AWE_DEFAULT_BASE_ADDR;
-static int awe_mem_size = AWE_DEFAULT_MEM_SIZE;
-#endif /* module */
+EXPORT_NO_SYMBOLS;
/* DRAM start offset */
static int awe_mem_start = AWE_DRAM_OFFSET;
@@ -261,15 +262,13 @@ static struct synth_info awe_info = {
static struct voice_alloc_info *voice_alloc; /* set at initialization */
-/*----------------------------------------------------------------
+/*
* function prototypes
- *----------------------------------------------------------------*/
+ */
-#if defined(linux) && !defined(AWE_OBSOLETE_VOXWARE)
static int awe_check_port(void);
static void awe_request_region(void);
static void awe_release_region(void);
-#endif /* linux & obsolete */
static void awe_reset_samples(void);
/* emu8000 chip i/o access */
@@ -346,9 +345,6 @@ static void awe_aftertouch(int dev, int voice, int pressure);
static void awe_controller(int dev, int voice, int ctrl_num, int value);
static void awe_panning(int dev, int voice, int value);
static void awe_volume_method(int dev, int mode);
-#ifndef AWE_NO_PATCHMGR
-static int awe_patchmgr(int dev, struct patmgr_info *rec);
-#endif
static void awe_bender(int dev, int voice, int value);
static int awe_alloc(int dev, int chn, int note, struct voice_alloc_info *alloc);
static void awe_setup_voice(int dev, int voice, int chn);
@@ -439,15 +435,9 @@ static void unload_midiemu(void);
#define limitvalue(x, a, b) if ((x) < (a)) (x) = (a); else if ((x) > (b)) (x) = (b)
-#ifdef __FreeBSD__
-/* FIXME */
-#define MALLOC_LOOP_DATA
-#define WAIT_BY_LOOP
-#endif
-
-/*----------------------------------------------------------------
+/*
* control parameters
- *----------------------------------------------------------------*/
+ */
#ifdef AWE_USE_NEW_VOLUME_CALC
@@ -499,9 +489,7 @@ static int ctrls[AWE_MD_END];
static struct synth_operations awe_operations =
{
-#ifdef AWE_OSS38
"EMU8K",
-#endif
&awe_info,
0,
SYNTH_TYPE_SAMPLE,
@@ -519,9 +507,6 @@ static struct synth_operations awe_operations =
awe_controller,
awe_panning,
awe_volume_method,
-#ifndef AWE_NO_PATCHMGR
- awe_patchmgr,
-#endif
awe_bender,
awe_alloc,
awe_setup_voice
@@ -543,12 +528,10 @@ static int _attach_awe(void)
}
/* check AWE32 ports are available */
-#if defined(linux) && !defined(AWE_OBSOLETE_VOXWARE)
if (awe_check_port()) {
printk(KERN_WARNING "AWE32: I/O area already used.\n");
return 0;
}
-#endif
/* set buffers to NULL */
sflists = NULL;
@@ -577,10 +560,8 @@ static int _attach_awe(void)
attach_midiemu();
#endif
-#if defined(linux) && !defined(AWE_OBSOLETE_VOXWARE)
/* reserve I/O ports for awedrv */
awe_request_region();
-#endif
/* clear all samples */
awe_reset_samples();
@@ -594,25 +575,22 @@ static int _attach_awe(void)
awe_present = TRUE;
-#if defined(AWE_MODULE_SUPPORT) && defined(MODULE)
SOUND_LOCK;
-#endif
return 1;
}
-#ifdef AWE_DYNAMIC_BUFFER
static void free_tables(void)
{
- if (sflists)
- my_free(sflists);
+ if(sflists)
+ vfree(sflists);
sflists = NULL; max_sfs = 0;
if (samples)
- my_free(samples);
+ vfree(samples);
samples = NULL; max_samples = 0;
if (infos)
- my_free(infos);
+ vfree(infos);
infos = NULL; max_infos = 0;
}
@@ -621,23 +599,16 @@ static void *realloc_block(void *buf, int oldsize, int size)
void *ptr;
if (oldsize == size)
return buf;
- if ((ptr = my_malloc(size)) == NULL)
+ if ((ptr = vmalloc(size)) == NULL)
return NULL;
if (oldsize && size)
- MEMCPY(ptr, buf, ((oldsize < size) ? oldsize : size) );
+ memcpy(ptr, buf, ((oldsize < size) ? oldsize : size) );
if (buf)
- my_free(buf);
+ vfree(buf);
return ptr;
}
-#else /* dynamic buffer */
-
-#define free_buffers() /**/
-
-#endif /* dynamic_buffer */
-
-
static void _unload_awe(void)
{
if (awe_present) {
@@ -652,22 +623,13 @@ static void _unload_awe(void)
#endif
sound_unload_synthdev(my_dev);
awe_present = FALSE;
-#if defined(AWE_MODULE_SUPPORT) && defined(MODULE)
SOUND_LOCK_END;
-#endif
}
}
-
-/*================================================================
- * Linux interface
- *================================================================*/
-
-#ifdef linux
-
-/*----------------------------------------------------------------
+/*
* Linux PnP driver support
- *----------------------------------------------------------------*/
+ */
#ifdef CONFIG_PNP_DRV
@@ -756,118 +718,9 @@ static void awe_unload_pnp (void)
}
#endif /* PnP support */
-/*----------------------------------------------------------------
- * device / lowlevel (module) interface
- *----------------------------------------------------------------*/
-
-#ifdef AWE_OBSOLETEL_VOXWARE
-
-/* old type interface */
-int attach_awe_obsolete(int mem_start, struct address_info *hw_config)
-{
- my_malloc_init(mem_start);
- if (! _attach_awe())
- return 0;
- return my_malloc_memptr();
-}
-
-int probe_awe_obsolete(struct address_info *hw_config)
-{
- return 1;
- /*return awe_detect();*/
-}
-
-#else /* !obsolete */
-
-/* new type interface */
-int attach_awe(void)
-{
-#ifdef CONFIG_PNP_DRV
- if (pnp) {
- awe_initpnp();
- if (awe_pnp_ok)
- return 0;
- }
-#endif /* pnp */
- _attach_awe();
- return 0;
-}
-
-void unload_awe(void)
-{
-#ifdef CONFIG_PNP_DRV
- if (pnp)
- awe_unload_pnp();
-#endif /* pnp */
- _unload_awe();
-}
-
-/* module interface */
-
-#if defined(AWE_MODULE_SUPPORT) && defined(MODULE)
-int init_module(void)
-{
- return attach_awe();
-}
-
-void cleanup_module(void)
-{
- unload_awe();
-}
-
-#ifdef MODULE_PARM
-EXPORT_NO_SYMBOLS;
-MODULE_AUTHOR("Takashi Iwai <iwai@ww.uni-erlangen.de>");
-MODULE_DESCRIPTION("SB AWE32/64 WaveTable driver");
-MODULE_SUPPORTED_DEVICE("sound");
-#endif
-
-#endif /* module */
-
-#endif /* AWE_OBSOLETE_VOXWARE */
-
-#endif /* linux */
-
-
-/*================================================================
- * FreeBSD interface
- *================================================================*/
-
-#ifdef __FreeBSD__
-
-#ifdef AWE_OBSOLETE_VOXWARE
-long attach_awe_obsolete(long mem_start, struct address_info *hw_config)
-{
- _attach_awe();
- return 0;
-}
-
-int probe_awe_obsolete(struct address_info *hw_config)
-{
- return 1;
-}
-
-#else /* !obsolete */
-
-/* new type interface */
-void attach_awe(struct address_info *hw_config)
-{
- _attach_awe();
-}
-
-int probe_awe(struct address_info *hw_config)
-{
- return 1;
-}
-
-#endif /* obsolete */
-
-#endif /* FreeBSD */
-
-
-/*================================================================
+/*
* clear sample tables
- *================================================================*/
+ */
static void
awe_reset_samples(void)
@@ -886,16 +739,16 @@ awe_reset_samples(void)
}
-/*================================================================
+/*
* EMU register access
- *================================================================*/
+ */
/* select a given AWE32 pointer */
static int awe_ports[5];
static int port_setuped = FALSE;
static int awe_cur_cmd = -1;
#define awe_set_cmd(cmd) \
-if (awe_cur_cmd != cmd) { OUTW(cmd, awe_ports[Pointer]); awe_cur_cmd = cmd; }
+if (awe_cur_cmd != cmd) { outw(cmd, awe_ports[Pointer]); awe_cur_cmd = cmd; }
/* store values to i/o port array */
static void setup_ports(int port1, int port2, int port3)
@@ -914,25 +767,25 @@ static void setup_ports(int port1, int port2, int port3)
}
/* write 16bit data */
-INLINE static void
+static inline void
awe_poke(unsigned short cmd, unsigned short port, unsigned short data)
{
awe_set_cmd(cmd);
- OUTW(data, awe_ports[port]);
+ outw(data, awe_ports[port]);
}
/* write 32bit data */
-INLINE static void
+static inline void
awe_poke_dw(unsigned short cmd, unsigned short port, unsigned int data)
{
unsigned short addr = awe_ports[port];
awe_set_cmd(cmd);
- OUTW(data, addr); /* write lower 16 bits */
- OUTW(data >> 16, addr + 2); /* write higher 16 bits */
+ outw(data, addr); /* write lower 16 bits */
+ outw(data >> 16, addr + 2); /* write higher 16 bits */
}
/* read 16bit data */
-INLINE static unsigned short
+static inline unsigned short
awe_peek(unsigned short cmd, unsigned short port)
{
unsigned short k;
@@ -942,7 +795,7 @@ awe_peek(unsigned short cmd, unsigned short port)
}
/* read 32bit data */
-INLINE static unsigned int
+static inline unsigned int
awe_peek_dw(unsigned short cmd, unsigned short port)
{
unsigned int k1, k2;
@@ -987,19 +840,17 @@ static void awe_wait(unsigned short delay)
#endif /* wait by loop */
/* write a word data */
-INLINE static void
+static inline void
awe_write_dram(unsigned short c)
{
awe_poke(AWE_SMLD, c);
}
-#if defined(linux) && !defined(AWE_OBSOLETE_VOXWARE)
-
-/*================================================================
+/*
* port check / request
* 0x620-623, 0xA20-A23, 0xE20-E23
- *================================================================*/
+ */
static int
awe_check_port(void)
@@ -1028,12 +879,9 @@ awe_release_region(void)
release_region(awe_ports[3], 4);
}
-#endif /* linux && !AWE_OBSOLETE_VOXWARE */
-
-
-/*================================================================
+/*
* AWE32 initialization
- *================================================================*/
+ */
static void
awe_initialize(void)
{
@@ -1079,9 +927,9 @@ awe_initialize(void)
}
-/*================================================================
+/*
* AWE32 voice parameters
- *================================================================*/
+ */
/* initialize voice_info record */
static void
@@ -1244,9 +1092,9 @@ calc_rate_offset(int Hz)
}
-/*----------------------------------------------------------------
+/*
* convert envelope time parameter to AWE32 raw parameter
- *----------------------------------------------------------------*/
+ */
/* attack & decay/release time table (msec) */
static short attack_time_tbl[128] = {
@@ -1314,9 +1162,9 @@ calc_parm_search(int msec, short *table)
#endif /* AWE_HAS_GUS_COMPATIBILITY */
-/*================================================================
+/*
* effects table
- *================================================================*/
+ */
/* set an effect value */
#define FX_FLAG_OFF 0
@@ -1466,9 +1314,9 @@ FX_OFFSET(FX_Rec *rec, FX_Rec *lay, int lo, int hi, int mode)
}
-/*================================================================
+/*
* turn on/off sample
- *================================================================*/
+ */
/* table for volume target calculation */
static unsigned short voltarget[16] = {
@@ -1687,9 +1535,9 @@ awe_exclusive_off(int voice)
}
-/*================================================================
+/*
* change the parameters of an audible voice
- *================================================================*/
+ */
/* change pitch */
static void
@@ -2137,9 +1985,9 @@ static void awe_terminate_and_init(int voice, int forced)
}
-/*================================================================
+/*
* synth operation routines
- *================================================================*/
+ */
#define AWE_VOICE_KEY(v) (0x8000 | (v))
#define AWE_CHAN_KEY(c,n) (((c) << 8) | ((n) + 1))
@@ -2185,8 +2033,8 @@ awe_voice_init(int voice, int init_all)
static void awe_fx_init(int ch)
{
if (SINGLE_LAYER_MODE() && !ctrls[AWE_MD_KEEP_EFFECT]) {
- BZERO(&channels[ch].fx, sizeof(channels[ch].fx));
- BZERO(&channels[ch].fx_layer, sizeof(&channels[ch].fx_layer));
+ memset(&channels[ch].fx, 0, sizeof(channels[ch].fx));
+ memset(&channels[ch].fx_layer, 0, sizeof(&channels[ch].fx_layer));
}
}
@@ -2216,8 +2064,8 @@ static void awe_channel_init(int ch, int init_all)
cp->sustained = 0;
if (! ctrls[AWE_MD_KEEP_EFFECT]) {
- BZERO(&cp->fx, sizeof(cp->fx));
- BZERO(&cp->fx_layer, sizeof(cp->fx_layer));
+ memset(&cp->fx, 0, sizeof(cp->fx));
+ memset(&cp->fx_layer, 0, sizeof(cp->fx_layer));
}
}
@@ -2255,7 +2103,7 @@ static int
awe_open(int dev, int mode)
{
if (awe_busy)
- return RET_ERROR(EBUSY);
+ return -EBUSY;
awe_busy = TRUE;
@@ -2310,7 +2158,7 @@ awe_ioctl(int dev, unsigned int cmd, caddr_t arg)
awe_info.nr_voices = awe_max_voices;
else
awe_info.nr_voices = AWE_MAX_CHANNELS;
- IOCTL_TO_USER((char*)arg, 0, &awe_info, sizeof(awe_info));
+ memcpy((char*)arg, &awe_info + 0, sizeof(awe_info));
return 0;
break;
@@ -2330,7 +2178,7 @@ awe_ioctl(int dev, unsigned int cmd, caddr_t arg)
default:
printk("AWE32: unsupported ioctl %d\n", cmd);
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
}
@@ -2379,7 +2227,7 @@ awe_kill_note(int dev, int voice, int note, int velocity)
DEBUG(2,printk("AWE32: [off(%d) nt=%d vl=%d]\n", voice, note, velocity));
if (! voice_in_range(voice))
- return RET_ERROR(EINVAL);
+ return -EINVAL;
switch (playing_mode) {
case AWE_PLAY_DIRECT:
@@ -2392,7 +2240,7 @@ awe_kill_note(int dev, int voice, int note, int velocity)
voice_alloc->map[voice] = 0;
voice = v2;
if (voice < 0 || voice >= AWE_MAX_CHANNELS)
- return RET_ERROR(EINVAL);
+ return -EINVAL;
/* continue to below */
default:
key = AWE_CHAN_KEY(voice, note);
@@ -2438,7 +2286,7 @@ awe_start_note(int dev, int voice, int note, int velocity)
DEBUG(2,printk("AWE32: [on(%d) nt=%d vl=%d]\n", voice, note, velocity));
if (! voice_in_range(voice))
- return RET_ERROR(EINVAL);
+ return -EINVAL;
if (velocity == 0)
state = AWE_ST_STANDBY; /* stand by for playing */
@@ -2457,7 +2305,7 @@ awe_start_note(int dev, int voice, int note, int velocity)
case AWE_PLAY_MULTI2:
voice = voice_alloc->map[voice] >> 8;
if (voice < 0 || voice >= AWE_MAX_CHANNELS)
- return RET_ERROR(EINVAL);
+ return -EINVAL;
/* continue to below */
default:
if (note >= 128) { /* key volume mode */
@@ -2532,7 +2380,7 @@ awe_set_instr_2(int dev, int voice, int instr_no)
if (playing_mode == AWE_PLAY_MULTI2) {
voice = voice_alloc->map[voice] >> 8;
if (voice < 0 || voice >= AWE_MAX_CHANNELS)
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
return awe_set_instr(dev, voice, instr_no);
}
@@ -2545,10 +2393,10 @@ awe_set_instr(int dev, int voice, int instr_no)
int def_bank;
if (! voice_in_range(voice))
- return RET_ERROR(EINVAL);
+ return -EINVAL;
if (instr_no < 0 || instr_no >= AWE_MAX_PRESETS)
- return RET_ERROR(EINVAL);
+ return -EINVAL;
cinfo = &channels[voice];
@@ -3049,17 +2897,6 @@ awe_volume_method(int dev, int mode)
}
-#ifndef AWE_NO_PATCHMGR
-/* patch manager */
-static int
-awe_patchmgr(int dev, struct patmgr_info *rec)
-{
- printk("AWE32 Warning: patch manager control not supported\n");
- return 0;
-}
-#endif
-
-
/* pitch wheel change: 0-16384 */
static void
awe_bender(int dev, int voice, int value)
@@ -3105,21 +2942,21 @@ awe_load_patch(int dev, int format, const char *addr,
return 0;
} else if (format != AWE_PATCH) {
printk("AWE32 Error: Invalid patch format (key) 0x%x\n", format);
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
if (count < AWE_PATCH_INFO_SIZE) {
printk("AWE32 Error: Patch header too short\n");
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
- COPY_FROM_USER(((char*)&patch) + offs, addr, offs,
+ copy_from_user(((char*)&patch) + offs, addr + offs,
AWE_PATCH_INFO_SIZE - offs);
count -= AWE_PATCH_INFO_SIZE;
if (count < patch.len) {
printk("AWE32: sample: Patch record too short (%d<%d)\n",
count, patch.len);
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
switch (patch.type) {
@@ -3160,7 +2997,7 @@ awe_load_patch(int dev, int format, const char *addr,
default:
printk("AWE32 Error: unknown patch format type %d\n",
patch.type);
- rc = RET_ERROR(EINVAL);
+ rc = -EINVAL;
}
return rc;
@@ -3176,9 +3013,6 @@ awe_create_sf(int type, char *name)
/* terminate sounds */
awe_reset(0);
if (current_sf_id >= max_sfs) {
-#ifndef AWE_DYNAMIC_BUFFER
- return 1;
-#else
int newsize = max_sfs + AWE_MAX_SF_LISTS;
sf_list *newlist = realloc_block(sflists, sizeof(sf_list)*max_sfs,
sizeof(sf_list)*newsize);
@@ -3186,7 +3020,6 @@ awe_create_sf(int type, char *name)
return 1;
sflists = newlist;
max_sfs = newsize;
-#endif /* dynamic buffer */
}
rec = &sflists[current_sf_id];
rec->sf_id = current_sf_id + 1;
@@ -3238,7 +3071,7 @@ static int is_shared_sf(unsigned char *name)
AWE_MINOR_VERSION,
AWE_TINY_VERSION,
};
- if (MEMCMP(name, id_head, 6) == 0)
+ if (memcmp(name, id_head, 6) == 0)
return TRUE;
return FALSE;
}
@@ -3247,7 +3080,7 @@ static int is_shared_sf(unsigned char *name)
static int is_identical_name(unsigned char *name, int sf)
{
char *id = sflists[sf-1].name;
- if (is_shared_sf(id) && MEMCMP(id, name, AWE_PATCH_NAME_LEN) == 0)
+ if (is_shared_sf(id) && memcmp(id, name, AWE_PATCH_NAME_LEN) == 0)
return TRUE;
return FALSE;
}
@@ -3285,7 +3118,7 @@ awe_open_patch(awe_patch_info *patch, const char *addr, int count)
awe_open_parm parm;
int shared;
- COPY_FROM_USER(&parm, addr, AWE_PATCH_INFO_SIZE, sizeof(parm));
+ copy_from_user(&parm, addr + AWE_PATCH_INFO_SIZE, sizeof(parm));
shared = FALSE;
#ifdef AWE_ALLOW_SAMPLE_SHARING
@@ -3303,7 +3136,7 @@ awe_open_patch(awe_patch_info *patch, const char *addr, int count)
if (! shared) {
if (awe_create_sf(parm.type, parm.name)) {
printk("AWE32: can't open: failed to alloc new list\n");
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
}
}
patch_opened = TRUE;
@@ -3317,7 +3150,7 @@ check_patch_opened(int type, char *name)
if (! patch_opened) {
if (awe_create_sf(type, name)) {
printk("AWE32: failed to alloc new list\n");
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
}
patch_opened = TRUE;
return current_sf_id;
@@ -3355,10 +3188,6 @@ static int alloc_new_info(int nvoices)
awe_voice_list *newlist;
free_info = awe_free_info();
if (free_info + nvoices >= max_infos) {
-#ifndef AWE_DYNAMIC_BUFFER
- printk("AWE32: can't alloc info table\n");
- return RET_ERROR(ENOSPC);
-#else
do {
newsize = max_infos + AWE_MAX_INFOS;
} while (free_info + nvoices >= newsize);
@@ -3366,11 +3195,10 @@ static int alloc_new_info(int nvoices)
sizeof(awe_voice_list)*newsize);
if (newlist == NULL) {
printk("AWE32: can't alloc info table\n");
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
}
infos = newlist;
max_infos = newsize;
-#endif
}
return 0;
}
@@ -3382,21 +3210,16 @@ static int alloc_new_sample(void)
awe_sample_list *newlist;
free_sample = awe_free_sample();
if (free_sample >= max_samples) {
-#ifndef AWE_DYNAMIC_BUFFER
- printk("AWE32: can't alloc sample table\n");
- return RET_ERROR(ENOSPC);
-#else
newsize = max_samples + AWE_MAX_SAMPLES;
newlist = realloc_block(samples,
sizeof(awe_sample_list)*max_samples,
sizeof(awe_sample_list)*newsize);
if (newlist == NULL) {
printk("AWE32: can't alloc sample table\n");
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
}
samples = newlist;
max_samples = newsize;
-#endif
}
return 0;
}
@@ -3412,9 +3235,9 @@ awe_load_map(awe_patch_info *patch, const char *addr, int count)
/* get the link info */
if (count < sizeof(map)) {
printk("AWE32 Error: invalid patch info length\n");
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
- COPY_FROM_USER(&map, addr, AWE_PATCH_INFO_SIZE, sizeof(map));
+ copy_from_user(&map, addr + AWE_PATCH_INFO_SIZE, sizeof(map));
/* check if the identical mapping already exists */
p = awe_search_instr(map.map_bank, map.map_instr);
@@ -3428,10 +3251,10 @@ awe_load_map(awe_patch_info *patch, const char *addr, int count)
}
if (check_patch_opened(AWE_PAT_TYPE_MAP, NULL) < 0)
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
if (alloc_new_info(1) < 0)
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
free_info = awe_free_info();
rec = &infos[free_info];
@@ -3464,14 +3287,14 @@ awe_probe_info(awe_patch_info *patch, const char *addr, int count)
int p;
if (! patch_opened)
- return RET_ERROR(EINVAL);
+ return -EINVAL;
/* get the link info */
if (count < sizeof(map)) {
printk("AWE32 Error: invalid patch info length\n");
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
- COPY_FROM_USER(&map, addr, AWE_PATCH_INFO_SIZE, sizeof(map));
+ copy_from_user(&map, addr + AWE_PATCH_INFO_SIZE, sizeof(map));
/* check if the identical mapping already exists */
p = awe_search_instr(map.src_bank, map.src_instr);
@@ -3483,7 +3306,7 @@ awe_probe_info(awe_patch_info *patch, const char *addr, int count)
return 0; /* already present! */
}
#endif /* allow sharing */
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
#endif
@@ -3493,13 +3316,13 @@ awe_probe_data(awe_patch_info *patch, const char *addr, int count)
{
#ifdef AWE_ALLOW_SAMPLE_SHARING
if (! patch_opened)
- return RET_ERROR(EINVAL);
+ return -EINVAL;
/* search the specified sample by optarg */
if (search_sample_index(current_sf_id, patch->optarg, 0) >= 0)
return 0;
#endif /* allow sharing */
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
/* load voice information data */
@@ -3513,26 +3336,26 @@ awe_load_info(awe_patch_info *patch, const char *addr, int count)
if (count < AWE_VOICE_REC_SIZE) {
printk("AWE32 Error: invalid patch info length\n");
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
offset = AWE_PATCH_INFO_SIZE;
- COPY_FROM_USER((char*)&hdr, addr, offset, AWE_VOICE_REC_SIZE);
+ copy_from_user((char*)&hdr, addr + offset, AWE_VOICE_REC_SIZE);
offset += AWE_VOICE_REC_SIZE;
if (hdr.nvoices <= 0 || hdr.nvoices >= 100) {
printk("AWE32 Error: Illegal voice number %d\n", hdr.nvoices);
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
total_size = AWE_VOICE_REC_SIZE + AWE_VOICE_INFO_SIZE * hdr.nvoices;
if (count < total_size) {
printk("AWE32 Error: patch length(%d) is smaller than nvoices(%d)\n",
count, hdr.nvoices);
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
if (check_patch_opened(AWE_PAT_TYPE_MISC, NULL) < 0)
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
#if 0 /* it looks like not so useful.. */
/* check if the same preset already exists in the info list */
@@ -3552,7 +3375,7 @@ awe_load_info(awe_patch_info *patch, const char *addr, int count)
#endif
if (alloc_new_info(hdr.nvoices) < 0)
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
for (i = 0; i < hdr.nvoices; i++) {
int rec = awe_free_info();
@@ -3563,7 +3386,7 @@ awe_load_info(awe_patch_info *patch, const char *addr, int count)
infos[rec].disabled = FALSE;
/* copy awe_voice_info parameters */
- COPY_FROM_USER(&infos[rec].v, addr, offset, AWE_VOICE_INFO_SIZE);
+ copy_from_user(&infos[rec].v, addr + offset, AWE_VOICE_INFO_SIZE);
offset += AWE_VOICE_INFO_SIZE;
infos[rec].v.sf_id = current_sf_id;
#ifdef AWE_ALLOW_SAMPLE_SHARING
@@ -3592,16 +3415,16 @@ awe_load_data(awe_patch_info *patch, const char *addr, int count)
awe_sample_info tmprec, *rec;
if (check_patch_opened(AWE_PAT_TYPE_MISC, NULL) < 0)
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
size = (count - AWE_SAMPLE_INFO_SIZE) / 2;
offset = AWE_PATCH_INFO_SIZE;
- COPY_FROM_USER(&tmprec, addr, offset, AWE_SAMPLE_INFO_SIZE);
+ copy_from_user(&tmprec, addr + offset, AWE_SAMPLE_INFO_SIZE);
offset += AWE_SAMPLE_INFO_SIZE;
if (size != tmprec.size) {
printk("AWE32: load: sample size differed (%d != %d)\n",
tmprec.size, size);
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
if (search_sample_index(current_sf_id, tmprec.sample, 0) >= 0) {
@@ -3611,11 +3434,11 @@ awe_load_data(awe_patch_info *patch, const char *addr, int count)
return 0;
#endif /* allow sharing */
DEBUG(1,printk("AWE32: sample data %d already present\n", tmprec.sample));
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
if (alloc_new_sample() < 0)
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
free_sample = awe_free_sample();
rec = &samples[free_sample].v;
@@ -3646,22 +3469,22 @@ awe_replace_data(awe_patch_info *patch, const char *addr, int count)
if (! patch_opened) {
printk("AWE32: replace: patch not opened\n");
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
size = (count - AWE_SAMPLE_INFO_SIZE) / 2;
offset = AWE_PATCH_INFO_SIZE;
- COPY_FROM_USER(&cursmp, addr, offset, AWE_SAMPLE_INFO_SIZE);
+ copy_from_user(&cursmp, addr + offset, AWE_SAMPLE_INFO_SIZE);
offset += AWE_SAMPLE_INFO_SIZE;
if (cursmp.size == 0 || size != cursmp.size) {
printk("AWE32: replace: illegal sample size (%d!=%d)\n",
cursmp.size, size);
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
channels = patch->optarg;
if (channels <= 0 || channels > AWE_NORMAL_VOICES) {
printk("AWE32: replace: illegal channels %d\n", channels);
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
for (i = sflists[current_sf_id-1].samples;
@@ -3672,18 +3495,18 @@ awe_replace_data(awe_patch_info *patch, const char *addr, int count)
if (i < 0) {
printk("AWE32: replace: cannot find existing sample data %d\n",
cursmp.sample);
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
if (samples[i].v.size != cursmp.size) {
printk("AWE32: replace: exiting size differed (%d!=%d)\n",
samples[i].v.size, cursmp.size);
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
save_mem_ptr = awe_free_mem_ptr();
sflists[current_sf_id-1].mem_ptr = samples[i].v.start - awe_mem_start;
- MEMCPY(&samples[i].v, &cursmp, sizeof(cursmp));
+ memcpy(&samples[i].v, &cursmp, sizeof(cursmp));
if ((rc = awe_write_wave_data(addr, offset, &samples[i].v, channels)) != 0)
return rc;
sflists[current_sf_id-1].mem_ptr = save_mem_ptr;
@@ -3713,10 +3536,10 @@ readbuf_init(const char *addr, int offset, awe_sample_info *sp)
readbuf_loopend = sp->loopend;
if (sp->mode_flags & (AWE_SAMPLE_BIDIR_LOOP|AWE_SAMPLE_REVERSE_LOOP)) {
int looplen = sp->loopend - sp->loopstart;
- readbuf_loop = my_malloc(looplen * 2);
+ readbuf_loop = vmalloc(looplen * 2);
if (readbuf_loop == NULL) {
printk("AWE32: can't malloc temp buffer\n");
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
}
}
#endif
@@ -3734,10 +3557,10 @@ readbuf_word(int pos)
/* read from user buffer */
if (readbuf_flags & AWE_SAMPLE_8BITS) {
unsigned char cc;
- GET_BYTE_FROM_USER(cc, readbuf_addr, readbuf_offs + pos);
+ get_user(cc, (unsigned char*)&(readbuf_addr)[readbuf_offs + pos]);
c = cc << 8; /* convert 8bit -> 16bit */
} else {
- GET_SHORT_FROM_USER(c, readbuf_addr, readbuf_offs + pos * 2);
+ get_user(c, (unsigned short*)&(readbuf_addr)[readbuf_offs + pos * 2]);
}
if (readbuf_flags & AWE_SAMPLE_UNSIGNED)
c ^= 0x8000; /* unsigned -> signed */
@@ -3764,9 +3587,8 @@ readbuf_word_cache(int pos)
static void
readbuf_end(void)
{
- if (readbuf_loop) {
- my_free(readbuf_loop);
- }
+ if (readbuf_loop)
+ vfree(readbuf_loop);
readbuf_loop = NULL;
}
@@ -3805,7 +3627,7 @@ awe_write_wave_data(const char *addr, int offset, awe_sample_info *sp, int chann
truesize += BLANK_LOOP_SIZE;
if (awe_free_mem_ptr() + truesize >= awe_mem_size/2) {
DEBUG(-1,printk("AWE32 Error: Sample memory full\n"));
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
}
/* recalculate address offset */
@@ -3829,7 +3651,7 @@ awe_write_wave_data(const char *addr, int offset, awe_sample_info *sp, int chann
return rc;
if (readbuf_init(addr, offset, sp) < 0)
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
for (i = 0; i < sp->size; i++) {
unsigned short c;
@@ -3913,21 +3735,21 @@ awe_load_guspatch(const char *addr, int offs, int size, int pmgr_flag)
sizeof_patch = (int)((long)&patch.data[0] - (long)&patch); /* header size */
if (size < sizeof_patch) {
printk("AWE32 Error: Patch header too short\n");
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
- COPY_FROM_USER(((char*)&patch) + offs, addr, offs, sizeof_patch - offs);
+ copy_from_user(((char*)&patch) + offs, addr + offs, sizeof_patch - offs);
size -= sizeof_patch;
if (size < patch.len) {
printk("AWE32 Warning: Patch record too short (%d<%d)\n",
size, patch.len);
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
if (check_patch_opened(AWE_PAT_TYPE_GUS, NULL) < 0)
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
if (alloc_new_sample() < 0)
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
if (alloc_new_info(1))
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
free_sample = awe_free_sample();
smp = &samples[free_sample].v;
@@ -4055,9 +3877,9 @@ awe_load_guspatch(const char *addr, int offs, int size, int pmgr_flag)
#endif /* AWE_HAS_GUS_COMPATIBILITY */
-/*----------------------------------------------------------------
+/*
* sample and voice list handlers
- *----------------------------------------------------------------*/
+ */
/* append this to the sf list */
static void add_sf_info(int rec)
@@ -4496,18 +4318,15 @@ awe_setup_voice(int dev, int voice, int chn)
#ifdef CONFIG_AWE32_MIXER
-/*================================================================
+/*
* AWE32 mixer device control
- *================================================================*/
+ */
static int awe_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg);
static int my_mixerdev = -1;
static struct mixer_operations awe_mixer_operations = {
-#ifndef __FreeBSD__
- "AWE32",
-#endif
"AWE32 Equalizer",
awe_mixer_ioctl,
};
@@ -4531,13 +4350,13 @@ awe_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
int i, level, value;
if (((cmd >> 8) & 0xff) != 'M')
- return RET_ERROR(EINVAL);
+ return -EINVAL;
- level = (int)IOCTL_IN(arg);
+ level = (int) *(int *)arg;
level = ((level & 0xff) + (level >> 8)) / 2;
DEBUG(0,printk("AWEMix: cmd=%x val=%d\n", cmd & 0xff, level));
- if (IO_WRITE_CHECK(cmd)) {
+ if (_SIOC_DIR(cmd) & _IOC_WRITE) {
switch (cmd & 0xff) {
case SOUND_MIXER_BASS:
value = level * 12 / 100;
@@ -4589,14 +4408,14 @@ awe_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
level = 0;
break;
}
- return IOCTL_OUT(arg, level);
+ return *(int *)arg = level;
}
#endif /* CONFIG_AWE32_MIXER */
-/*================================================================
+/*
* initialization of AWE32
- *================================================================*/
+ */
/* intiailize audio channels */
static void
@@ -4912,7 +4731,7 @@ awe_open_dram_for_write(int offset, int channels)
awe_poke_dw(AWE_CCCA(vidx[i]), 0);
voices[vidx[i]].state = AWE_ST_OFF;
}
- return RET_ERROR(ENOSPC);
+ return -ENOSPC;
}
/* set address to write */
@@ -5091,13 +4910,13 @@ awe_load_chorus_fx(awe_patch_info *patch, const char *addr, int count)
{
if (patch->optarg < AWE_CHORUS_PREDEFINED || patch->optarg >= AWE_CHORUS_NUMBERS) {
printk("AWE32 Error: illegal chorus mode %d for uploading\n", patch->optarg);
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
if (count < sizeof(awe_chorus_fx_rec)) {
printk("AWE32 Error: too short chorus fx parameters\n");
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
- COPY_FROM_USER(&chorus_parm[patch->optarg], addr, AWE_PATCH_INFO_SIZE,
+ copy_from_user(&chorus_parm[patch->optarg], addr + AWE_PATCH_INFO_SIZE,
sizeof(awe_chorus_fx_rec));
chorus_defined[patch->optarg] = TRUE;
return 0;
@@ -5198,13 +5017,13 @@ awe_load_reverb_fx(awe_patch_info *patch, const char *addr, int count)
{
if (patch->optarg < AWE_REVERB_PREDEFINED || patch->optarg >= AWE_REVERB_NUMBERS) {
printk("AWE32 Error: illegal reverb mode %d for uploading\n", patch->optarg);
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
if (count < sizeof(awe_reverb_fx_rec)) {
printk("AWE32 Error: too short reverb fx parameters\n");
- return RET_ERROR(EINVAL);
+ return -EINVAL;
}
- COPY_FROM_USER(&reverb_parm[patch->optarg], addr, AWE_PATCH_INFO_SIZE,
+ copy_from_user(&reverb_parm[patch->optarg], addr + AWE_PATCH_INFO_SIZE,
sizeof(awe_reverb_fx_rec));
reverb_defined[patch->optarg] = TRUE;
return 0;
@@ -5400,9 +5219,9 @@ static void unload_midiemu(void)
}
-/*================================================================
+/*
* open/close midi device
- *================================================================*/
+ */
static int midi_opened = FALSE;
@@ -5465,7 +5284,7 @@ awe_midi_open (int dev, int mode,
curst.read = 0;
curst.status = 0;
curst.chan = 0;
- BZERO(curst.buf, sizeof(curst.buf));
+ memset(curst.buf, 0, sizeof(curst.buf));
init_midi_status(&curst);
@@ -5499,9 +5318,9 @@ awe_midi_outputc (int dev, unsigned char midi_byte)
}
-/*================================================================
+/*
* initialize
- *================================================================*/
+ */
static void init_midi_status(MidiStatus *st)
{
@@ -5511,9 +5330,9 @@ static void init_midi_status(MidiStatus *st)
}
-/*================================================================
+/*
* RPN & NRPN
- *================================================================*/
+ */
#define MAX_MIDI_CHANNELS 16
@@ -5538,9 +5357,9 @@ static void clear_rpn(void)
}
-/*================================================================
+/*
* process midi queue
- *================================================================*/
+ */
/* status event types */
typedef void (*StatusEvent)(MidiStatus *st);
@@ -5649,9 +5468,9 @@ static void queue_read(MidiStatus *st, int c)
}
-/*================================================================
+/*
* status events
- *================================================================*/
+ */
/* note on */
static void midi_note_on(MidiStatus *st)
@@ -5907,14 +5726,14 @@ static void midi_system_exclusive(MidiStatus *st)
#endif
/* GM on */
- if (MEMCMP(st->buf, gm_on_macro, sizeof(gm_on_macro)) == 0) {
+ if (memcmp(st->buf, gm_on_macro, sizeof(gm_on_macro)) == 0) {
if (midi_mode != MODE_GS && midi_mode != MODE_XG)
midi_mode = MODE_GM;
init_midi_status(st);
}
/* GS macros */
- else if (MEMCMP(st->buf, gs_pfx_macro, sizeof(gs_pfx_macro)) == 0) {
+ else if (memcmp(st->buf, gs_pfx_macro, sizeof(gs_pfx_macro)) == 0) {
if (midi_mode != MODE_GS && midi_mode != MODE_XG)
midi_mode = MODE_GS;
@@ -5957,7 +5776,7 @@ static void midi_system_exclusive(MidiStatus *st)
}
/* XG on */
- else if (MEMCMP(st->buf, xg_on_macro, sizeof(xg_on_macro)) == 0) {
+ else if (memcmp(st->buf, xg_on_macro, sizeof(xg_on_macro)) == 0) {
midi_mode = MODE_XG;
xg_mapping = TRUE;
xg_bankmode = 0;
@@ -5965,9 +5784,9 @@ static void midi_system_exclusive(MidiStatus *st)
}
-/*================================================================
+/*
* convert NRPN/control values
- *================================================================*/
+ */
static int send_converted_effect(ConvTable *table, int num_tables, MidiStatus *st, int type, int val)
{
@@ -5996,9 +5815,9 @@ static int add_converted_effect(ConvTable *table, int num_tables, MidiStatus *st
}
-/*----------------------------------------------------------------
+/*
* AWE32 NRPN effects
- *----------------------------------------------------------------*/
+ */
static unsigned short fx_delay(int val);
static unsigned short fx_attack(int val);
@@ -6120,9 +5939,9 @@ static ConvTable awe_effects[] =
static int num_awe_effects = numberof(awe_effects);
-/*----------------------------------------------------------------
+/*
* GS(SC88) NRPN effects; still experimental
- *----------------------------------------------------------------*/
+ */
/* cutoff: quarter semitone step, max=255 */
static unsigned short gs_cutoff(int val)
@@ -6252,4 +6071,48 @@ static int xg_control_change(MidiStatus *st, int cmd, int val)
#endif /* CONFIG_AWE32_MIDIEMU */
-#endif /* CONFIG_AWE32_SYNTH */
+/* new type interface */
+static int __init attach_awe(void)
+{
+#ifdef CONFIG_PNP_DRV
+ if (pnp) {
+ awe_initpnp();
+ if (awe_pnp_ok)
+ return 0;
+ }
+#endif /* pnp */
+
+ _attach_awe();
+
+ return 0;
+}
+
+static void __exit unload_awe(void)
+{
+#ifdef CONFIG_PNP_DRV
+ if (pnp)
+ awe_unload_pnp();
+#endif
+
+ _unload_awe();
+}
+
+module_init(attach_awe);
+module_exit(unload_awe);
+
+#ifndef MODULE
+static int __init setup_awe(char *str)
+{
+ /* io, memsize */
+ int ints[3];
+
+ str = get_options(str, ARRAY_SIZE(ints), ints);
+
+ io = ints[1];
+ memsize = ints[2];
+
+ return 1;
+}
+
+__setup("awe=", setup_awe);
+#endif
diff --git a/drivers/sound/lowlevel/awe_config.h b/drivers/sound/awe_wave.h
index ffb958d49..0984da765 100644
--- a/drivers/sound/lowlevel/awe_config.h
+++ b/drivers/sound/awe_wave.h
@@ -21,33 +21,18 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#ifndef AWE_CONFIG_H_DEF
-#define AWE_CONFIG_H_DEF
-
-/*----------------------------------------------------------------
- * system configuration
- *----------------------------------------------------------------*/
-
-/* if your kernel support module for each soundcard, define this.
- * NOTE: it will be automatically set on linux-2.1.x kernels.
- * only define here if you have moduler sound system on
- * 2.0.x kernel (like RedHat).
- */
-#undef AWE_MODULE_SUPPORT
-
-
-/*----------------------------------------------------------------
+/*
* chorus & reverb effects send for FM chip: from 0 to 0xff
* larger numbers often cause weird sounds.
- *----------------------------------------------------------------*/
+ */
#define DEF_FM_CHORUS_DEPTH 0x10
#define DEF_FM_REVERB_DEPTH 0x10
-/*----------------------------------------------------------------*
+/*
* other compile conditions
- *----------------------------------------------------------------*/
+ */
/* initialize FM passthrough even without extended RAM */
#undef AWE_ALWAYS_INIT_FM
@@ -73,30 +58,30 @@
/* allow sample sharing */
#define AWE_ALLOW_SAMPLE_SHARING
-/*================================================================
- * Usually, you don't have to touch the following options.
- *================================================================*/
-
-/*----------------------------------------------------------------
+/*
* AWE32 card configuration:
* uncomment the following lines *ONLY* when auto detection doesn't
* work properly on your machine.
- *----------------------------------------------------------------*/
+ */
/*#define AWE_DEFAULT_BASE_ADDR 0x620*/ /* base port address */
/*#define AWE_DEFAULT_MEM_SIZE 512*/ /* kbytes */
-/*----------------------------------------------------------------
+/*
* maximum size of soundfont list table
- *----------------------------------------------------------------*/
+ */
#define AWE_MAX_SF_LISTS 16
-/*----------------------------------------------------------------
+/*
* chunk size of sample and voice tables
- *----------------------------------------------------------------*/
+ */
#define AWE_MAX_SAMPLES 400
#define AWE_MAX_INFOS 800
-#endif /* AWE_CONFIG_H_DEF */
+#define AWE_MAJOR_VERSION 0
+#define AWE_MINOR_VERSION 4
+#define AWE_TINY_VERSION 3
+#define AWE_VERSION_NUMBER ((AWE_MAJOR_VERSION<<16)|(AWE_MINOR_VERSION<<8)|AWE_TINY_VERSION)
+#define AWEDRV_VERSION "0.4.3"
diff --git a/drivers/sound/dev_table.c b/drivers/sound/dev_table.c
index 5be9a1eef..52d4d79f8 100644
--- a/drivers/sound/dev_table.c
+++ b/drivers/sound/dev_table.c
@@ -11,7 +11,6 @@
* for more info.
*/
-#include <linux/config.h>
#include <linux/init.h>
#define _DEV_TABLE_C_
diff --git a/drivers/sound/dev_table.h b/drivers/sound/dev_table.h
index b15fd505c..db2b141d6 100644
--- a/drivers/sound/dev_table.h
+++ b/drivers/sound/dev_table.h
@@ -15,8 +15,6 @@
#ifndef _DEV_TABLE_H_
#define _DEV_TABLE_H_
-#include <linux/config.h>
-
/*
* Sound card numbers 27 to 999. (1 to 26 are defined in soundcard.h)
* Numbers 1000 to N are reserved for driver's internal use.
diff --git a/drivers/sound/lowlevel/Config.in b/drivers/sound/lowlevel/Config.in
deleted file mode 100644
index 091a8df33..000000000
--- a/drivers/sound/lowlevel/Config.in
+++ /dev/null
@@ -1,66 +0,0 @@
-dep_tristate ' ACI mixer (miroPCM12)' CONFIG_ACI_MIXER $CONFIG_SOUND_OSS
-
-dep_tristate ' AWE32 synth' CONFIG_AWE32_SYNTH $CONFIG_SOUND_OSS
-
-if [ "$CONFIG_AWE32_SYNTH" = "y" -o "$CONFIG_AWE32_SYNTH" = "m" ]; then
- comment 'AWE32 PnP-ISA Cards are not always setup correctly'
- bool 'Configure AWE32 synth Base Address and Default Memory Size' CONFIG_AWE32_SYNTH_DEFAULTS
- if [ "$CONFIG_AWE32_SYNTH_DEFAULTS" = "y" ]; then
- hex 'AWE32 synth Base Address 620' AWE_DEFAULT_BASE_ADDR 620
- int 'AWE32 synth Default Memory Size 512 1024 or 4096' AWE_DEFAULT_MEM_SIZE 512
- fi
-fi
-
-if [ "$CONFIG_SOUND_OSS" = "y" -o "$CONFIG_SOUND" = "m" ]; then
- dep_tristate ' Gallant Audio Cards (SC-6000 and SC-6600 based)' CONFIG_AEDSP16 $CONFIG_SOUND_OSS
- if [ "$CONFIG_AEDSP16" = "y" -o "$CONFIG_AEDSP16" = "m" ]; then
- hex 'I/O base for Audio Excel DSP 16 220 or 240' CONFIG_AEDSP16_BASE 220
- hex 'I/O base for MPU401 Check from manual of the card' CONFIG_MPU_BASE 330
- fi
-
- if [ "$CONFIG_AEDSP16" = "y" -o "$CONFIG_AEDSP16" = "m" ]; then
- comment 'SC-6600 Audio Cards have no jumper switches at all'
- bool ' SC-6600 based audio cards (new Audio Excel DSP 16)' CONFIG_SC6600
- if [ "$CONFIG_SC6600" = "y" ]; then
- comment 'SC-6600 specific configuration'
- bool ' Activate SC-6600 Joystick Interface' CONFIG_SC6600_JOY
- int 'SC-6600 CDROM Interface (4=None, 3=IDE, 1=Panasonic, 0=?Sony?)' CONFIG_SC6600_CDROM 4
- hex 'SC-6600 CDROM Interface I/O Address' CONFIG_SC6600_CDROMBASE 0
- fi
-
- if [ "$CONFIG_SOUND_SB" = "y" -o "$CONFIG_SOUND_SB" = "m" ]; then
- if [ "$CONFIG_AEDSP16_MSS" != "y" ]; then
- bool 'Audio Excel DSP 16 (SBPro emulation)' CONFIG_AEDSP16_SBPRO
- if [ "$CONFIG_AEDSP16_SBPRO" = "y" ]; then
- comment 'Audio Excel DSP 16 [Sound Blaster Pro]'
- hex 'I/O base for Audio Excel DSP 16 220, 240' CONFIG_AEDSP16_BASE $CONFIG_SB_BASE 220
- int 'Audio Excel DSP 16 IRQ 5, 7, 9, 10, 11' CONFIG_AEDSP16_SB_IRQ $CONFIG_SB_IRQ 5
- int 'Audio Excel DSP 16 DMA 0, 1 or 3' CONFIG_AEDSP16_SB_DMA $CONFIG_SB_DMA 0
- fi
- fi
- fi
-
- if [ "$CONFIG_SOUND_MSS" = "y" -o "$CONFIG_SOUND_MSS" = "m" ]; then
- if [ "$CONFIG_AEDSP16_SBPRO" != "y" ]; then
- bool ' Audio Excel DSP 16 (MSS emulation)' CONFIG_AEDSP16_MSS
- if [ "$CONFIG_AEDSP16_MSS" = "y" ]; then
- comment 'Audio Excel DSP 16 [Microsoft Sound System]'
- hex 'I/O base for Audio Excel DSP 16 220 or 240' CONFIG_AEDSP16_BASE 220
- int 'Audio Excel DSP 16 IRQ 5, 7, 9, 10, 11' CONFIG_AEDSP16_MSS_IRQ $CONFIG_MSS_IRQ 5
- int 'Audio Excel DSP 16 DMA 0, 1 or 3' CONFIG_AEDSP16_MSS_DMA $CONFIG_MSS_DMA 1
- fi
- fi
- fi
-
- if [ "$CONFIG_SOUND_MPU401" = "y" -o "$CONFIG_SOUND_MPU401" = "m" ]; then
- bool 'Audio Excel DSP 16 (MPU401 emulation)' CONFIG_AEDSP16_MPU401
- if [ "$CONFIG_AEDSP16_MPU401" = "y" ]; then
- comment 'Audio Excel DSP 16 [MPU-401]'
- if [ "$CONFIG_AEDSP16_SBPRO" != "y" -a "$CONFIG_AEDSP16_MSS" != "y" ]; then
- hex 'I/O base for Audio Excel DSP 16 220 or 240' CONFIG_AEDSP16_BASE 220
- fi
- int 'MPU401 IRQ for Audio Excel DSP 16 5, 7, 9, 10 or 0 (disable)' CONFIG_AEDSP16_MPU_IRQ $CONFIG_MPU_IRQ
- fi
- fi
- fi
-fi
diff --git a/drivers/sound/lowlevel/Makefile b/drivers/sound/lowlevel/Makefile
deleted file mode 100644
index 921f10362..000000000
--- a/drivers/sound/lowlevel/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-# Makefile for the Linux low-level sound card drivers.
-#
-# 11 Feb 1998, Michael Elizabeth Chastain, <mailto:mec@shout.net>
-# Rewritten to use lists instead of if statements.
-
-export-objs := soundlow.o
-
-list-y :=
-list-m :=
-list-n :=
-list- :=
-
-obj-$(CONFIG_SOUND_OSS) += soundlow.o
-obj-$(CONFIG_ACI_MIXER) += aci.o
-obj-$(CONFIG_AEDSP16) += aedsp16.o
-obj-$(CONFIG_AWE32_SYNTH) += awe_wave.o
-
-O_TARGET := lowlevel.o
-O_OBJS := $(sort $(filter-out $(export-objs), $(obj-y)))
-OX_OBJS := $(sort $(filter $(export-objs), $(obj-y)))
-M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m)))
-MX_OBJS := $(sort $(filter $(export-objs), $(obj-m)))
-
-include $(TOPDIR)/Rules.make
diff --git a/drivers/sound/lowlevel/README b/drivers/sound/lowlevel/README
deleted file mode 100644
index da66e3396..000000000
--- a/drivers/sound/lowlevel/README
+++ /dev/null
@@ -1,22 +0,0 @@
-Additional low level sound drivers for Linux
-============================================
-
-This directory contains some low level sound drivers.
-These drivers are used to be (when Linux sound drivers was OSS/Lite) external
-drivers, not maintained by Hannu Savolainen and not touched by him.
-Now things are changed: the new Linux sound driver code maintained by Alan Cox
-include these lowlevel drivers and they are no more neglected (thanks Alan).
-
-The following low level drivers are included:
-
-- ACI MIXER for miroPCM12 by Markus Kuhn
- (mskuhn@cip.informatik.uni-erlangen.de).
-- Audio Excel DSP 16 initialization driver by Riccardo Facchetti
- (fizban@tin.it)
-- SB32/AWE synthesizer driver (Emu8000) by Takashi Iwai
- (iwai@dragon.mm.t.u-tokyo.ac.jp).
-
-You can find documentation for these drivers in the Documentation/sound
-directory.
-
-[ File edited 17.01.1999 - Riccardo Facchetti ]
diff --git a/drivers/sound/lowlevel/aci.c b/drivers/sound/lowlevel/aci.c
deleted file mode 100644
index fc71be47d..000000000
--- a/drivers/sound/lowlevel/aci.c
+++ /dev/null
@@ -1,679 +0,0 @@
-/*
- * Audio Command Interface (ACI) driver (sound/aci.c)
- *
- * ACI is a protocol used to communicate with the microcontroller on
- * some sound cards produced by miro, e.g. the miroSOUND PCM12 and
- * PCM20. The ACI has been developed for miro by Norberto Pellicci
- * <pellicci@home.com>. Special thanks to both him and miro for
- * providing the ACI specification.
- *
- * The main function of the ACI is to control the mixer and to get a
- * product identification. On the PCM20, ACI also controls the radio
- * tuner on this card, this is supported in the Video for Linux
- * radio-miropcm20 driver.
- *
- * This Voxware ACI driver currently only supports the ACI functions
- * on the miroSOUND PCM12 and PCM20 card. Support for miro sound cards
- * with additional ACI functions can easily be added later.
- *
- * / NOTE / When compiling as a module, make sure to load the module
- * after loading the mad16 module. The initialisation code expects the
- * MAD16 default mixer to be already available.
- *
- * / NOTE / When compiling as a module, make sure to load the module
- * after loading the mad16 module. The initialisation code expects the
- * MAD16 default mixer to be already available.
- *
- * Revision history:
- *
- * 1995-11-10 Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
- * First version written.
- * 1995-12-31 Markus Kuhn
- * Second revision, general code cleanup.
- * 1996-05-16 Hannu Savolainen
- * Integrated with other parts of the driver.
- * 1996-05-28 Markus Kuhn
- * Initialize CS4231A mixer, make ACI first mixer,
- * use new private mixer API for solo mode.
- * 1998-08-18 Ruurd Reitsma <R.A.Reitsma@wbmt.tudelft.nl>
- * Small modification to export ACI functions and
- * complete modularisation.
- */
-
-/*
- * Some driver specific information and features:
- *
- * This mixer driver identifies itself to applications as "ACI" in
- * mixer_info.id as retrieved by ioctl(fd, SOUND_MIXER_INFO, &mixer_info).
- *
- * Proprietary mixer features that go beyond the standard OSS mixer
- * interface are:
- *
- * Full duplex solo configuration:
- *
- * int solo_mode;
- * ioctl(fd, SOUND_MIXER_PRIVATE1, &solo_mode);
- *
- * solo_mode = 0: deactivate solo mode (default)
- * solo_mode > 0: activate solo mode
- * With activated solo mode, the PCM input can not any
- * longer hear the signals produced by the PCM output.
- * Activating solo mode is important in duplex mode in order
- * to avoid feedback distortions.
- * solo_mode < 0: do not change solo mode (just retrieve the status)
- *
- * When the ioctl() returns 0, solo_mode contains the previous
- * status (0 = deactivated, 1 = activated). If solo mode is not
- * implemented on this card, ioctl() returns -1 and sets errno to
- * EINVAL.
- *
- */
-
-#include <linux/config.h> /* for CONFIG_ACI_MIXER */
-#include <linux/module.h>
-#include "lowlevel.h"
-#include "../sound_config.h"
-
-#if defined(CONFIG_ACI_MIXER) || defined(CONFIG_ACI_MIXER_MODULE)
-
-#undef DEBUG /* if defined, produce a verbose report via syslog */
-
-int aci_port = 0x354; /* as determined by bit 4 in the OPTi 929 MC4 register */
-unsigned char aci_idcode[2] = {0, 0}; /* manufacturer and product ID */
-unsigned char aci_version = 0; /* ACI firmware version */
-int aci_solo; /* status bit of the card that can't be *
- * checked with ACI versions prior to 0xb0 */
-
-static int aci_present = 0;
-
-#ifdef MODULE /* Whether the aci mixer is to be reset. */
-int aci_reset = 0; /* Default: don't reset if the driver is a */
-MODULE_PARM(aci_reset,"i");
-#else /* module; use "insmod aci.o aci_reset=1" */
-int aci_reset = 1; /* to override. */
-#endif
-
-
-#define COMMAND_REGISTER (aci_port)
-#define STATUS_REGISTER (aci_port + 1)
-#define BUSY_REGISTER (aci_port + 2)
-
-/*
- * Wait until the ACI microcontroller has set the READYFLAG in the
- * Busy/IRQ Source Register to 0. This is required to avoid
- * overrunning the sound card microcontroller. We do a busy wait here,
- * because the microcontroller is not supposed to signal a busy
- * condition for more than a few clock cycles. In case of a time-out,
- * this function returns -1.
- *
- * This busy wait code normally requires less than 15 loops and
- * practically always less than 100 loops on my i486/DX2 66 MHz.
- *
- * Warning: Waiting on the general status flag after reseting the MUTE
- * function can take a VERY long time, because the PCM12 does some kind
- * of fade-in effect. For this reason, access to the MUTE function has
- * not been implemented at all.
- */
-
-static int busy_wait(void)
-{
- long timeout;
-
- for (timeout = 0; timeout < 10000000L; timeout++)
- if ((inb_p(BUSY_REGISTER) & 1) == 0)
- return 0;
-
-#ifdef DEBUG
- printk("ACI: READYFLAG timed out.\n");
-#endif
-
- return -1;
-}
-
-
-/*
- * Read the GENERAL STATUS register.
- */
-
-static int read_general_status(void)
-{
- unsigned long flags;
- int status;
-
- save_flags(flags);
- cli();
- if (busy_wait()) { restore_flags(flags); return -1; }
- status = (unsigned) inb_p(STATUS_REGISTER);
- restore_flags(flags);
- return status;
-}
-
-
-/*
- * The four ACI command types (implied, write, read and indexed) can
- * be sent to the microcontroller using the following four functions.
- * If a problem occurred, they return -1.
- */
-
-int aci_implied_cmd(unsigned char opcode)
-{
- unsigned long flags;
-
-#ifdef DEBUG
- printk("ACI: aci_implied_cmd(0x%02x)\n", opcode);
-#endif
-
- save_flags(flags);
- cli();
-
- if (read_general_status() < 0 || busy_wait()) {
- restore_flags(flags);
- return -1;
- }
- outb_p(opcode, COMMAND_REGISTER);
-
- restore_flags(flags);
- return 0;
-}
-
-
-int aci_write_cmd(unsigned char opcode, unsigned char parameter)
-{
- unsigned long flags;
- int status;
-
-#ifdef DEBUG
- printk("ACI: aci_write_cmd(0x%02x, 0x%02x)\n", opcode, parameter);
-#endif
-
- save_flags(flags);
- cli();
-
- if (read_general_status() < 0 || busy_wait()) {
- restore_flags(flags);
- return -1;
- }
- outb_p(opcode, COMMAND_REGISTER);
- if (busy_wait()) { restore_flags(flags); return -1; }
- outb_p(parameter, COMMAND_REGISTER);
-
- if ((status = read_general_status()) < 0) {
- restore_flags(flags);
- return -1;
- }
- /* polarity of the INVALID flag depends on ACI version */
- if ((aci_version < 0xb0 && (status & 0x40) != 0) ||
- (aci_version >= 0xb0 && (status & 0x40) == 0)) {
- restore_flags(flags);
- printk("ACI: invalid write command 0x%02x, 0x%02x.\n",
- opcode, parameter);
- return -1;
- }
-
- restore_flags(flags);
- return 0;
-}
-
-/*
- * This write command send 2 parameters instead of one.
- * Only used in PCM20 radio frequency tuning control
- */
-
-int aci_write_cmd_d(unsigned char opcode, unsigned char parameter, unsigned char parameter2)
-{
- unsigned long flags;
- int status;
-
-#ifdef DEBUG
- printk("ACI: aci_write_cmd_d(0x%02x, 0x%02x)\n", opcode, parameter, parameter2);
-#endif
-
- save_flags(flags);
- cli();
-
- if (read_general_status() < 0 || busy_wait()) {
- restore_flags(flags);
- return -1;
- }
- outb_p(opcode, COMMAND_REGISTER);
- if (busy_wait()) { restore_flags(flags); return -1; }
- outb_p(parameter, COMMAND_REGISTER);
- if (busy_wait()) { restore_flags(flags); return -1; }
- outb_p(parameter2, COMMAND_REGISTER);
-
- if ((status = read_general_status()) < 0) {
- restore_flags(flags);
- return -1;
- }
- /* polarity of the INVALID flag depends on ACI version */
- if ((aci_version < 0xb0 && (status & 0x40) != 0) ||
- (aci_version >= 0xb0 && (status & 0x40) == 0)) {
- restore_flags(flags);
-#if 0 /* Frequency tuning works, but the INVALID flag is set ??? */
- printk("ACI: invalid write (double) command 0x%02x, 0x%02x, 0x%02x.\n",
- opcode, parameter, parameter2);
-#endif
- return -1;
- }
-
- restore_flags(flags);
- return 0;
-}
-
-int aci_read_cmd(unsigned char opcode, int length, unsigned char *parameter)
-{
- unsigned long flags;
- int i = 0;
-
- save_flags(flags);
- cli();
-
- if (read_general_status() < 0) { restore_flags(flags); return -1; }
- while (i < length) {
- if (busy_wait()) { restore_flags(flags); return -1; }
- outb_p(opcode, COMMAND_REGISTER);
- if (busy_wait()) { restore_flags(flags); return -1; }
- parameter[i++] = inb_p(STATUS_REGISTER);
-#ifdef DEBUG
- if (i == 1)
- printk("ACI: aci_read_cmd(0x%02x, %d) = 0x%02x\n", opcode, length,
- parameter[i-1]);
- else
- printk("ACI: aci_read_cmd cont.: 0x%02x\n", parameter[i-1]);
-#endif
- }
-
- restore_flags(flags);
- return 0;
-}
-
-
-int aci_indexed_cmd(unsigned char opcode, unsigned char index,
- unsigned char *parameter)
-{
- unsigned long flags;
-
- save_flags(flags);
- cli();
-
- if (read_general_status() < 0 || busy_wait()) {
- restore_flags(flags);
- return -1;
- }
- outb_p(opcode, COMMAND_REGISTER);
- if (busy_wait()) { restore_flags(flags); return -1; }
- outb_p(index, COMMAND_REGISTER);
- if (busy_wait()) { restore_flags(flags); return -1; }
- *parameter = inb_p(STATUS_REGISTER);
-#ifdef DEBUG
- printk("ACI: aci_indexed_cmd(0x%02x, 0x%02x) = 0x%02x\n", opcode, index,
- *parameter);
-#endif
-
- restore_flags(flags);
- return 0;
-}
-
-
-/*
- * The following macro SCALE can be used to scale one integer volume
- * value into another one using only integer arithmetic. If the input
- * value x is in the range 0 <= x <= xmax, then the result will be in
- * the range 0 <= SCALE(xmax,ymax,x) <= ymax.
- *
- * This macro has for all xmax, ymax > 0 and all 0 <= x <= xmax the
- * following nice properties:
- *
- * - SCALE(xmax,ymax,xmax) = ymax
- * - SCALE(xmax,ymax,0) = 0
- * - SCALE(xmax,ymax,SCALE(ymax,xmax,SCALE(xmax,ymax,x))) = SCALE(xmax,ymax,x)
- *
- * In addition, the rounding error is minimal and nicely distributed.
- * The proofs are left as an exercise to the reader.
- */
-
-#define SCALE(xmax,ymax,x) (((x)*(ymax)+(xmax)/2)/(xmax))
-
-
-static int getvolume(caddr_t arg,
- unsigned char left_index, unsigned char right_index)
-{
- int vol;
- unsigned char buf;
-
- /* left channel */
- if (aci_indexed_cmd(0xf0, left_index, &buf)) return -EIO;
- vol = SCALE(0x20, 100, buf < 0x20 ? 0x20-buf : 0);
- /* right channel */
- if (aci_indexed_cmd(0xf0, right_index, &buf)) return -EIO;
- vol |= SCALE(0x20, 100, buf < 0x20 ? 0x20-buf : 0) << 8;
-
- return (*(int *) arg = vol);
-}
-
-
-static int setvolume(caddr_t arg,
- unsigned char left_index, unsigned char right_index)
-{
- int vol, ret;
-
- /* left channel */
- vol = *(int *)arg & 0xff;
- if (vol > 100) vol = 100;
- vol = SCALE(100, 0x20, vol);
- if (aci_write_cmd(left_index, 0x20 - vol)) return -EIO;
- ret = SCALE(0x20, 100, vol);
- /* right channel */
- vol = (*(int *)arg >> 8) & 0xff;
- if (vol > 100) vol = 100;
- vol = SCALE(100, 0x20, vol);
- if (aci_write_cmd(right_index, 0x20 - vol)) return -EIO;
- ret |= SCALE(0x20, 100, vol) << 8;
-
- return (*(int *) arg = ret);
-}
-
-
-static int
-aci_mixer_ioctl (int dev, unsigned int cmd, caddr_t arg)
-{
- int status, vol;
- unsigned char buf;
-
- /* handle solo mode control */
- if (cmd == SOUND_MIXER_PRIVATE1) {
- if (*(int *) arg >= 0) {
- aci_solo = !!*(int *) arg;
- if (aci_write_cmd(0xd2, aci_solo)) return -EIO;
- } else if (aci_version >= 0xb0) {
- if ((status = read_general_status()) < 0) return -EIO;
- return (*(int *) arg = (status & 0x20) == 0);
- }
- return (*(int *) arg = aci_solo);
- }
-
- if (((cmd >> 8) & 0xff) == 'M') {
- if (cmd & IOC_IN)
- /* read and write */
- switch (cmd & 0xff) {
- case SOUND_MIXER_VOLUME:
- return setvolume(arg, 0x01, 0x00);
- case SOUND_MIXER_CD:
- return setvolume(arg, 0x3c, 0x34);
- case SOUND_MIXER_MIC:
- return setvolume(arg, 0x38, 0x30);
- case SOUND_MIXER_LINE:
- return setvolume(arg, 0x39, 0x31);
- case SOUND_MIXER_SYNTH:
- return setvolume(arg, 0x3b, 0x33);
- case SOUND_MIXER_PCM:
- return setvolume(arg, 0x3a, 0x32);
- case SOUND_MIXER_LINE1: /* AUX1 */
- return setvolume(arg, 0x3d, 0x35);
- case SOUND_MIXER_LINE2: /* AUX2 */
- return setvolume(arg, 0x3e, 0x36);
- case SOUND_MIXER_IGAIN: /* MIC pre-amp */
- vol = *(int *) arg & 0xff;
- if (vol > 100) vol = 100;
- vol = SCALE(100, 3, vol);
- if (aci_write_cmd(0x03, vol)) return -EIO;
- vol = SCALE(3, 100, vol);
- return (*(int *) arg = vol | (vol << 8));
- case SOUND_MIXER_RECSRC:
- return (*(int *) arg = 0);
- break;
- default:
- return -EINVAL;
- }
- else
- /* only read */
- switch (cmd & 0xff) {
- case SOUND_MIXER_DEVMASK:
- return (*(int *) arg =
- SOUND_MASK_VOLUME | SOUND_MASK_CD |
- SOUND_MASK_MIC | SOUND_MASK_LINE |
- SOUND_MASK_SYNTH | SOUND_MASK_PCM |
-#if 0
- SOUND_MASK_IGAIN |
-#endif
- SOUND_MASK_LINE1 | SOUND_MASK_LINE2);
- break;
- case SOUND_MIXER_STEREODEVS:
- return (*(int *) arg =
- SOUND_MASK_VOLUME | SOUND_MASK_CD |
- SOUND_MASK_MIC | SOUND_MASK_LINE |
- SOUND_MASK_SYNTH | SOUND_MASK_PCM |
- SOUND_MASK_LINE1 | SOUND_MASK_LINE2);
- break;
- case SOUND_MIXER_RECMASK:
- return (*(int *) arg = 0);
- break;
- case SOUND_MIXER_RECSRC:
- return (*(int *) arg = 0);
- break;
- case SOUND_MIXER_CAPS:
- return (*(int *) arg = 0);
- break;
- case SOUND_MIXER_VOLUME:
- return getvolume(arg, 0x04, 0x03);
- case SOUND_MIXER_CD:
- return getvolume(arg, 0x0a, 0x09);
- case SOUND_MIXER_MIC:
- return getvolume(arg, 0x06, 0x05);
- case SOUND_MIXER_LINE:
- return getvolume(arg, 0x08, 0x07);
- case SOUND_MIXER_SYNTH:
- return getvolume(arg, 0x0c, 0x0b);
- case SOUND_MIXER_PCM:
- return getvolume(arg, 0x0e, 0x0d);
- case SOUND_MIXER_LINE1: /* AUX1 */
- return getvolume(arg, 0x11, 0x10);
- case SOUND_MIXER_LINE2: /* AUX2 */
- return getvolume(arg, 0x13, 0x12);
- case SOUND_MIXER_IGAIN: /* MIC pre-amp */
- if (aci_indexed_cmd(0xf0, 0x21, &buf)) return -EIO;
- vol = SCALE(3, 100, buf <= 3 ? buf : 3);
- vol |= vol << 8;
- return (*(int *) arg = vol);
- default:
- return -EINVAL;
- }
- }
-
- return -EINVAL;
-}
-
-
-static struct mixer_operations aci_mixer_operations =
-{
- "ACI",
- "ACI mixer",
- aci_mixer_ioctl,
- NULL
-};
-
-static unsigned char
-mad_read (int port)
-{
- outb (0xE3, 0xf8f); /* Write MAD16 password */
- return inb (port); /* Read from port */
-}
-
-
-/*
- * Check, whether there actually is any ACI port operational and if
- * one was found, then initialize the ACI interface, reserve the I/O
- * addresses and attach the new mixer to the relevant VoxWare data
- * structures.
- *
- * Returns: 1 ACI mixer detected
- * 0 nothing there
- *
- * There is also an internal mixer in the codec (CS4231A or AD1845),
- * that deserves no purpose in an ACI based system which uses an
- * external ACI controlled stereo mixer. Make sure that this codec
- * mixer has the AUX1 input selected as the recording source, that the
- * input gain is set near maximum and that the other channels going
- * from the inputs to the codec output are muted.
- */
-
-int attach_aci(void)
-{
- char *boardname = "unknown";
- int volume;
-
-#define MC4_PORT 0xf90
-
- aci_port =
- (mad_read(MC4_PORT) & 0x10) ? 0x344 : 0x354;
-
- if (check_region(aci_port, 3)) {
-#ifdef DEBUG
- printk("ACI: I/O area 0x%03x-0x%03x already used.\n",
- aci_port, aci_port+2);
-#endif
- return 0;
- }
-
- if (aci_read_cmd(0xf2, 2, aci_idcode)) {
-#ifdef DEBUG
- printk("ACI: Failed to read idcode.\n");
-#endif
- return 0;
- }
- if (aci_read_cmd(0xf1, 1, &aci_version)) {
-#ifdef DEBUG
- printk("ACI: Failed to read version.\n");
-#endif
- return 0;
- }
-
- if (aci_idcode[0] == 0x6d) {
- /* It looks like a miro sound card. */
- switch (aci_idcode[1]) {
- case 0x41:
- boardname = "PCM1 pro / early PCM12";
- break;
- case 0x42:
- boardname = "PCM12";
- break;
- case 0x43:
- boardname = "PCM20";
- break;
- default:
- boardname = "unknown miro";
- }
- } else
-#ifndef DEBUG
- return 0;
-#endif
-
- printk("<ACI %02x, id %02x %02x (%s)> at 0x%03x\n",
- aci_version, aci_idcode[0], aci_idcode[1], boardname, aci_port);
-
- if (aci_reset) {
- /* initialize ACI mixer */
- aci_implied_cmd(0xff);
- aci_solo = 0;
- }
-
- /* attach the mixer */
- request_region(aci_port, 3, "sound mixer (ACI)");
- if (num_mixers < MAX_MIXER_DEV) {
- if (num_mixers > 0 &&
- !strncmp("MAD16 WSS", mixer_devs[num_mixers-1]->name, 9)) {
- /*
- * The previously registered mixer device is the CS4231A which
- * has no function on an ACI card. Make the ACI mixer the first
- * of the two mixer devices.
- */
- mixer_devs[num_mixers] = mixer_devs[num_mixers-1];
- mixer_devs[num_mixers-1] = &aci_mixer_operations;
- /*
- * Initialize the CS4231A mixer with reasonable values. It is
- * unlikely that the user ever will want to change these as all
- * channels can be mixed via ACI.
- */
- volume = 0x6464;
- mixer_devs[num_mixers]->
- ioctl(num_mixers, SOUND_MIXER_WRITE_PCM, (caddr_t) &volume);
- volume = 0x6464;
- mixer_devs[num_mixers]->
- ioctl(num_mixers, SOUND_MIXER_WRITE_IGAIN, (caddr_t) &volume);
- volume = 0;
- mixer_devs[num_mixers]->
- ioctl(num_mixers, SOUND_MIXER_WRITE_SPEAKER, (caddr_t) &volume);
- volume = 0;
- mixer_devs[num_mixers]->
- ioctl(num_mixers, SOUND_MIXER_WRITE_MIC, (caddr_t) &volume);
- volume = 0;
- mixer_devs[num_mixers]->
- ioctl(num_mixers, SOUND_MIXER_WRITE_IMIX, (caddr_t) &volume);
- volume = 0;
- mixer_devs[num_mixers]->
- ioctl(num_mixers, SOUND_MIXER_WRITE_LINE1, (caddr_t) &volume);
- volume = 0;
- mixer_devs[num_mixers]->
- ioctl(num_mixers, SOUND_MIXER_WRITE_LINE2, (caddr_t) &volume);
- volume = 0;
- mixer_devs[num_mixers]->
- ioctl(num_mixers, SOUND_MIXER_WRITE_LINE3, (caddr_t) &volume);
- volume = SOUND_MASK_LINE1;
- mixer_devs[num_mixers]->
- ioctl(num_mixers, SOUND_MIXER_WRITE_RECSRC, (caddr_t) &volume);
- num_mixers++;
- } else
- mixer_devs[num_mixers++] = &aci_mixer_operations;
- }
-
- /* Just do something; otherwise the first write command fails, at
- * least with my PCM20.
- */
- aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_READ_VOLUME, (caddr_t) &volume);
-
- if (aci_reset) {
- /* Initialize ACI mixer with reasonable power-up values */
- volume = 0x3232;
- aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_VOLUME, (caddr_t) &volume);
- volume = 0x3232;
- aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_SYNTH, (caddr_t) &volume);
- volume = 0x3232;
- aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_PCM, (caddr_t) &volume);
- volume = 0x3232;
- aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_LINE, (caddr_t) &volume);
- volume = 0x3232;
- aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_MIC, (caddr_t) &volume);
- volume = 0x3232;
- aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_CD, (caddr_t) &volume);
- volume = 0x3232;
- aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_LINE1, (caddr_t) &volume);
- volume = 0x3232;
- aci_mixer_ioctl(num_mixers-1, SOUND_MIXER_WRITE_LINE2, (caddr_t) &volume);
- }
-
- aci_present = 1;
-
- return 1;
-}
-
-void unload_aci(void)
-{
- if (aci_present)
- release_region(aci_port, 3);
-}
-
-#endif
-
-#if defined(MODULE)
-
-int init_module(void) {
- attach_aci();
- return(0);
-}
-
-void cleanup_module(void) {
- unload_aci();
-}
-
-#endif /* MODULE */
- \ No newline at end of file
diff --git a/drivers/sound/lowlevel/awe_compat.h b/drivers/sound/lowlevel/awe_compat.h
deleted file mode 100644
index 6ced8d65d..000000000
--- a/drivers/sound/lowlevel/awe_compat.h
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * sound/awe_compat.h
- *
- * Compat defines for the AWE32/SB32/AWE64 wave table synth driver.
- * version 0.4.3; Oct. 1, 1998
- *
- * Copyright (C) 1996-1998 Takashi Iwai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef AWE_COMPAT_H_DEF
-#define AWE_COMPAT_H_DEF
-
-/*================================================================
- * version check
- *================================================================*/
-
-#include "awe_config.h"
-
-#define ASC_LINUX_VERSION(V,P,S) (((V) * 65536) + ((P) * 256) + (S))
-
-#ifndef LINUX_VERSION_CODE
-#include <linux/version.h>
-#endif
-
-/* linux version check */
-#if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,0,0)
-#define AWE_OBSOLETE_VOXWARE
-#endif
-
-#if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(2,1,0)
-#define AWE_NEW_KERNEL_INTERFACE
-#if LINUX_VERSION_CODE >= ASC_LINUX_VERSION(2,1,80)
-#define AWE_MODULE_SUPPORT
-#endif
-#endif
-
-#ifdef AWE_OBSOLETE_VOXWARE
-#include "soundvers.h"
-#else
-#include "../soundvers.h"
-#endif
-
-#if defined(SOUND_INTERNAL_VERSION) && SOUND_INTERNAL_VERSION >= 0x30803
-/* OSS/Free-3.8 */
-#define AWE_NO_PATCHMGR
-#define AWE_OSS38
-#define HAS_LOWLEVEL_H
-#endif
-
-/*================================================================
- * INCLUDE OTHER HEADER FILES
- *================================================================*/
-
-/* set up module */
-
-#if defined(AWE_MODULE_SUPPORT) && defined(MODULE)
-#include <linux/config.h>
-#include <linux/string.h>
-#include <linux/module.h>
-#include "../soundmodule.h"
-#endif
-
-
-/* reading configuration of sound driver */
-
-#ifdef AWE_OBSOLETE_VOXWARE
-
-#include "sound_config.h"
-#if defined(CONFIGURE_SOUNDCARD) && !defined(EXCLUDE_AWE32)
-#define CONFIG_AWE32_SYNTH
-#endif
-
-#else /* AWE_OBSOLETE_VOXWARE */
-
-#ifdef HAS_LOWLEVEL_H
-#include "lowlevel.h"
-#endif
-
-#include "../sound_config.h"
-
-#endif /* AWE_OBSOLETE_VOXWARE */
-
-
-/*================================================================
- * include AWE header files
- *================================================================*/
-
-#if defined(CONFIG_AWE32_SYNTH) || defined(CONFIG_AWE32_SYNTH_MODULE)
-
-#include "awe_hw.h"
-#include "awe_version.h"
-#include <linux/awe_voice.h>
-
-#ifdef AWE_HAS_GUS_COMPATIBILITY
-/* include finetune table */
-#ifdef AWE_OBSOLETE_VOXWARE
-# include "tuning.h"
-#else
-# include "../tuning.h"
-#endif
-#include <linux/ultrasound.h>
-#endif /* AWE_HAS_GUS_COMPATIBILITY */
-
-
-/*----------------------------------------------------------------
- * compatibility macros for AWE32 driver
- *----------------------------------------------------------------*/
-
-/* redefine following macros */
-#undef IOCTL_IN
-#undef IOCTL_OUT
-#undef OUTW
-#undef COPY_FROM_USER
-#undef COPY_TO_USER
-#undef GET_BYTE_FROM_USER
-#undef GET_SHORT_FROM_USER
-#undef IOCTL_TO_USER
-
-/* use inline prefix */
-#define INLINE /*inline*/
-
-/*----------------------------------------------------------------
- * memory management for linux
- *----------------------------------------------------------------*/
-
-#ifdef AWE_OBSOLETE_VOXWARE
-/* old type linux system */
-
-/* i/o requests; nothing */
-#define awe_check_port() 0 /* always false */
-#define awe_request_region() /* nothing */
-#define awe_release_region() /* nothing */
-
-static int _mem_start; /* memory pointer for permanent buffers */
-
-#define my_malloc_init(memptr) _mem_start = (memptr)
-#define my_malloc_memptr() _mem_start
-#define my_free(ptr) /* do nothing */
-
-/* allocate buffer only once */
-#define INIT_TABLE(buffer,index,nums,type) {\
-PERMANENT_MALLOC(buffer, char*, size, _mem_start); index = (nums);\
-}
-
-#else
-
-#define AWE_DYNAMIC_BUFFER
-
-#define my_malloc_init(ptr) /* nothing */
-#define my_malloc_memptr() 0
-#define my_malloc(size) vmalloc(size)
-#define my_free(ptr) if (ptr) {vfree(ptr);}
-
-/* do not allocate buffer at beginning */
-#define INIT_TABLE(buffer,index,nums,type) {buffer=NULL; index=0;}
-
-/* old type macro */
-#define RET_ERROR(err) -err
-
-#endif
-
-/*----------------------------------------------------------------
- * i/o interfaces for linux
- *----------------------------------------------------------------*/
-
-#define OUTW(data,addr) outw(data, addr)
-
-#ifdef AWE_NEW_KERNEL_INTERFACE
-#define COPY_FROM_USER(target,source,offs,count) \
- copy_from_user(target, (source)+(offs), count)
-#define GET_BYTE_FROM_USER(target,addr,offs) \
- get_user(target, (unsigned char*)&((addr)[offs]))
-#define GET_SHORT_FROM_USER(target,addr,offs) \
- get_user(target, (unsigned short*)&((addr)[offs]))
-#ifdef AWE_OSS38
-#define IOCTL_TO_USER(target,offs,source,count) \
- memcpy(target, (source)+(offs), count)
-#define IO_WRITE_CHECK(cmd) (_SIOC_DIR(cmd) & _IOC_WRITE)
-#else
-#define IOCTL_TO_USER(target,offs,source,count) \
- copy_to_user(target, (source)+(offs), count)
-#define IO_WRITE_CHECK(cmd) (_IOC_DIR(cmd) & _IOC_WRITE)
-#endif /* AWE_OSS38 */
-#define COPY_TO_USER IOCTL_TO_USER
-#define IOCTL_IN(arg) (*(int*)(arg))
-#define IOCTL_OUT(arg,val) (*(int*)(arg) = (val))
-
-#else /* old type i/o */
-#define COPY_FROM_USER(target,source,offs,count) \
- memcpy_fromfs(target, (source)+(offs), (count))
-#define GET_BYTE_FROM_USER(target,addr,offs) \
- *((char *)&(target)) = get_fs_byte((addr)+(offs))
-#define GET_SHORT_FROM_USER(target,addr,offs) \
- *((short *)&(target)) = get_fs_word((addr)+(offs))
-#ifdef AWE_OSS38
-#define IOCTL_TO_USER(target,offs,source,count) \
- memcpy(target, (source)+(offs), count)
-#define COPY_TO_USER(target,offs,source,count) \
- memcpy_tofs(target, (source)+(offs), (count))
-#define IOCTL_IN(arg) (*(int*)(arg))
-#define IOCTL_OUT(arg,val) (*(int*)(arg) = (val))
-#define IO_WRITE_CHECK(cmd) (_SIOC_DIR(cmd) & _IOC_WRITE)
-#else /* AWE_OSS38 */
-#define IOCTL_TO_USER(target,offs,source,count) \
- memcpy_tofs(target, (source)+(offs), (count))
-#define COPY_TO_USER IOCTL_TO_USER
-#define IOCTL_IN(arg) get_fs_long((long *)(arg))
-#define IOCTL_OUT(arg,ret) snd_ioctl_return((int *)arg, ret)
-#define IO_WRITE_CHECK(cmd) (cmd & IOC_IN)
-#endif /* AWE_OSS38 */
-
-#endif /* AWE_NEW_KERNEL_INTERFACE */
-
-#define BZERO(target,len) memset(target, 0, len)
-#define MEMCPY(dst,src,len) memcpy(dst, src, len)
-#define MEMCMP(p1,p2,len) memcmp(p1, p2, len)
-
-/* old style device tables (not modulized) */
-#ifndef AWE_MODULE_SUPPORT
-
-#define sound_alloc_synthdev() \
- (num_synths >= MAX_SYNTH_DEV ? -1 : num_synths++)
-#define sound_alloc_mixerdev() \
- (num_mixers >= MAX_MIXER_DEV ? -1 : num_mixers++)
-#define sound_alloc_mididev() \
- (num_midis >= MAX_MIXER_DEV ? -1 : num_midis++)
-#define sound_unload_synthdev(dev) /**/
-#define sound_unload_mixerdev(dev) /**/
-#define sound_unload_mididev(dev) /**/
-
-#endif /* AWE_MODULE_SUPPORT */
-
-#if LINUX_VERSION_CODE < ASC_LINUX_VERSION(2,1,0)
-inline static void interruptible_sleep_on_timeout(wait_queue_head_t *q, unsigned long timeout)
-{
- current->timeout = jiffies + timeout;
- interruptible_sleep_on(q);
-}
-#endif
-
-#endif /* CONFIG_AWE32_SYNTH */
-
-#endif /* AWE_COMPAT_H_DEF */
diff --git a/drivers/sound/lowlevel/awe_version.h b/drivers/sound/lowlevel/awe_version.h
deleted file mode 100644
index a012d734a..000000000
--- a/drivers/sound/lowlevel/awe_version.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * sound/awe_version.h
- *
- * Version defines for the AWE32/SB32/AWE64 wave table synth driver.
- * version 0.4.3; Mar. 1, 1998
- *
- * Copyright (C) 1996-1998 Takashi Iwai
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/* AWE32 driver version number */
-
-#ifndef AWE_VERSION_H_DEF
-#define AWE_VERSION_H_DEF
-
-#define AWE_MAJOR_VERSION 0
-#define AWE_MINOR_VERSION 4
-#define AWE_TINY_VERSION 3
-#define AWE_VERSION_NUMBER ((AWE_MAJOR_VERSION<<16)|(AWE_MINOR_VERSION<<8)|AWE_TINY_VERSION)
-#define AWEDRV_VERSION "0.4.3"
-
-#endif
diff --git a/drivers/sound/lowlevel/lowlevel.h b/drivers/sound/lowlevel/lowlevel.h
deleted file mode 100644
index bb0f6c7d1..000000000
--- a/drivers/sound/lowlevel/lowlevel.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifdef LOWLEVEL_MODULE
-#define MODVERSIONS
-#include <linux/modversions.h>
-#include "manual_config.h"
-#endif
diff --git a/drivers/sound/lowlevel/soundlow.c b/drivers/sound/lowlevel/soundlow.c
deleted file mode 100644
index 96fdb94be..000000000
--- a/drivers/sound/lowlevel/soundlow.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * lowlevel/init.c - Calls initialization code for configured drivers.
- */
-
-#include "lowlevel.h"
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include "../soundvers.h"
-
-#ifdef LOWLEVEL_MODULE
-char *lowlevel_version = SOUND_VERSION_STRING;
-#endif
-
-extern int attach_aci(void);
-extern void unload_aci(void);
-extern int attach_awe(void);
-extern void unload_awe(void);
-extern int init_aedsp16(void) __init;
-extern void uninit_aedsp16(void) __init;
-
-/*
- * There are two places where you can insert initialization calls of
- * low level drivers. sound_init_lowlevel_drivers() is called after
- * the sound driver has been initialized (the normal case)
- * while sound_preinit_lowlevel_drivers() is called before that.
- */
-void
-sound_preinit_lowlevel_drivers(void)
-{
-#if defined(CONFIG_AEDSP16) && !defined(MODULE)
- init_aedsp16();
-#endif
-}
-
-void
-sound_init_lowlevel_drivers(void)
-{
-#ifdef CONFIG_ACI_MIXER
- attach_aci();
-#endif
-
-#ifdef CONFIG_AWE32_SYNTH
- attach_awe();
-#endif
-}
-
-void
-sound_unload_lowlevel_drivers(void)
-{
-#ifdef CONFIG_ACI_MIXER
- unload_aci();
-#endif
-
-#ifdef CONFIG_AWE32_SYNTH
- unload_awe();
-#endif
-
-#ifdef CONFIG_AEDSP16
- uninit_aedsp16();
-#endif
-
-}
-
-EXPORT_SYMBOL(sound_init_lowlevel_drivers);
-EXPORT_SYMBOL(sound_unload_lowlevel_drivers);
-EXPORT_SYMBOL(sound_preinit_lowlevel_drivers);
diff --git a/drivers/sound/mad16.c b/drivers/sound/mad16.c
index 06b98aec2..bf605dbca 100644
--- a/drivers/sound/mad16.c
+++ b/drivers/sound/mad16.c
@@ -1107,7 +1107,7 @@ static void __exit cleanup_mad16(void)
}
module_init(init_mad16);
-module_exit(exit_mad16);
+module_exit(cleanup_mad16);
#ifndef MODULE
static int __init setup_mad16(char *str)
diff --git a/drivers/sound/lowlevel/miroaci.h b/drivers/sound/miroaci.h
index a8b7ff49a..9fea58a53 100644
--- a/drivers/sound/lowlevel/miroaci.h
+++ b/drivers/sound/miroaci.h
@@ -1,13 +1,6 @@
#include <linux/config.h>
-#if defined(CONFIG_ACI_MIXER) || defined(CONFIG_ACI_MIXER_MODULE)
extern int aci_implied_cmd(unsigned char opcode);
extern int aci_write_cmd(unsigned char opcode, unsigned char parameter);
extern int aci_write_cmd_d(unsigned char opcode, unsigned char parameter, unsigned char parameter2);
extern int aci_read_cmd(unsigned char opcode, int length, unsigned char *parameter);
extern int aci_indexed_cmd(unsigned char opcode, unsigned char index, unsigned char *parameter);
-#else
-
-
-#error Compiling a driver that needs the ACI-mixer but ACI-mixer support is not configured
-
-#endif
diff --git a/drivers/sound/sb_card.c b/drivers/sound/sb_card.c
index 7e3ecb1a1..40804417c 100644
--- a/drivers/sound/sb_card.c
+++ b/drivers/sound/sb_card.c
@@ -285,29 +285,8 @@ static struct pci_dev *sb_init_cmi(struct pci_bus *bus, struct pci_dev *card, st
if((sb_dev = isapnp_find_dev(bus,
ISAPNP_VENDOR('@','X','@'), ISAPNP_FUNCTION(0x0001), NULL)))
{
-#ifdef CMI8330_DMA0BAD
- int dmahack = 0;
-#endif
sb_dev->prepare(sb_dev);
- /* This device doesn't work with DMA 0, so we must allocate
- * it to prevent PnP routines to assign it to the card.
- *
- * I know i could have inlined the following lines, but it's cleaner
- * this way.
- */
-
-#ifdef CMI8330_DMA0BAD
- if(sb_dev->dma_resource[0].start == 0)
- {
- if(!request_dma(0, "cmi8330 dma hack"))
- {
- /* DMA was free, we now have it */
- dmahack = 1;
- }
- }
-#endif
-
if((sb_dev = activate_dev("CMI8330", "sb", sb_dev)))
{
hw_config->io_base = sb_dev->resource[0].start;
@@ -318,9 +297,6 @@ static struct pci_dev *sb_init_cmi(struct pci_bus *bus, struct pci_dev *card, st
show_base("CMI8330", "sb", &sb_dev->resource[0]);
}
-#ifdef CMI8330_DMA0BAD
- if(dmahack) free_dma(0);
-#endif
if(!sb_dev) return(NULL);
}
else
diff --git a/drivers/sound/sb_common.c b/drivers/sound/sb_common.c
index ffb1204ad..25318c1ac 100644
--- a/drivers/sound/sb_common.c
+++ b/drivers/sound/sb_common.c
@@ -21,9 +21,6 @@
*
*/
-/* FIXME: *grr* why can't the f**in Makefile do this for me ? */
-#define EXPORT_SYMTAB
-
#include <linux/config.h>
#include <linux/init.h>
#include <linux/module.h>
diff --git a/drivers/sound/sscape.c b/drivers/sound/sscape.c
index 5efd99dd2..89470da82 100644
--- a/drivers/sound/sscape.c
+++ b/drivers/sound/sscape.c
@@ -16,7 +16,6 @@
* Christoph Hellwig : adapted to module_init/module_exit
*/
-#include <linux/config.h>
#include <linux/init.h>
#include <linux/module.h>
diff --git a/drivers/sound/wavfront.c b/drivers/sound/wavfront.c
index af1f8970d..4bf595f86 100644
--- a/drivers/sound/wavfront.c
+++ b/drivers/sound/wavfront.c
@@ -73,7 +73,6 @@
#include <linux/interrupt.h>
#include <linux/config.h>
-#include <linux/init.h>
#include <linux/delay.h>
diff --git a/drivers/sound/wf_midi.c b/drivers/sound/wf_midi.c
index 4b0708ec7..2d7d50fe9 100644
--- a/drivers/sound/wf_midi.c
+++ b/drivers/sound/wf_midi.c
@@ -49,7 +49,6 @@
* for more info.
*/
-#include <linux/config.h>
#include <linux/init.h>
#include "sound_config.h"
#include "soundmodule.h"