[PATCH] The scheduled removal of some OSS drivers
Adrian Bunk [Wed, 4 Oct 2006 09:17:22 +0000 (02:17 -0700)]
This patch contains the scheduled removal of OSS drivers that:
- have ALSA drivers for the same hardware without known regressions and
- whose Kconfig options have been removed in 2.6.17.

[michal.k.k.piotrowski@gmail.com: build fix]
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

81 files changed:
Documentation/feature-removal-schedule.txt
Documentation/kernel-parameters.txt
Documentation/sound/oss/AWE32 [deleted file]
Documentation/sound/oss/CMI8338 [deleted file]
Documentation/sound/oss/INSTALL.awe [deleted file]
Documentation/sound/oss/MAD16 [deleted file]
Documentation/sound/oss/Maestro [deleted file]
Documentation/sound/oss/Maestro3 [deleted file]
Documentation/sound/oss/NEWS [deleted file]
Documentation/sound/oss/OPL3-SA [deleted file]
Documentation/sound/oss/README.awe [deleted file]
Documentation/sound/oss/Wavefront [deleted file]
Documentation/sound/oss/es1370 [deleted file]
Documentation/sound/oss/rme96xx [deleted file]
Documentation/sound/oss/solo1 [deleted file]
Documentation/sound/oss/sonicvibes [deleted file]
MAINTAINERS
include/linux/Kbuild
include/linux/ac97_codec.h
include/linux/sound.h
include/linux/wavefront.h [deleted file]
sound/oss/Makefile
sound/oss/ac97.c
sound/oss/ac97.h
sound/oss/ac97_codec.c
sound/oss/ac97_plugin_ad1980.c [deleted file]
sound/oss/ad1848.c
sound/oss/ad1848.h
sound/oss/ali5455.c [deleted file]
sound/oss/au1000.c [deleted file]
sound/oss/audio_syms.c
sound/oss/awe_hw.h [deleted file]
sound/oss/awe_wave.c [deleted file]
sound/oss/awe_wave.h [deleted file]
sound/oss/cmpci.c [deleted file]
sound/oss/cs4281/Makefile [deleted file]
sound/oss/cs4281/cs4281_hwdefs.h [deleted file]
sound/oss/cs4281/cs4281_wrapper-24.c [deleted file]
sound/oss/cs4281/cs4281m.c [deleted file]
sound/oss/cs4281/cs4281pm-24.c [deleted file]
sound/oss/cs4281/cs4281pm.h [deleted file]
sound/oss/dm.h [deleted file]
sound/oss/dmabuf.c
sound/oss/es1370.c [deleted file]
sound/oss/esssolo1.c [deleted file]
sound/oss/forte.c [deleted file]
sound/oss/gus.h [deleted file]
sound/oss/gus_card.c [deleted file]
sound/oss/gus_hw.h [deleted file]
sound/oss/gus_linearvol.h [deleted file]
sound/oss/gus_midi.c [deleted file]
sound/oss/gus_vol.c [deleted file]
sound/oss/gus_wave.c [deleted file]
sound/oss/harmony.c [deleted file]
sound/oss/ics2101.c [deleted file]
sound/oss/iwmem.h [deleted file]
sound/oss/mad16.c [deleted file]
sound/oss/maestro.c [deleted file]
sound/oss/maestro.h [deleted file]
sound/oss/maestro3.c [deleted file]
sound/oss/maestro3.h [deleted file]
sound/oss/maui.c [deleted file]
sound/oss/mpu401.c
sound/oss/mpu401.h
sound/oss/opl3sa.c [deleted file]
sound/oss/rme96xx.c [deleted file]
sound/oss/rme96xx.h [deleted file]
sound/oss/sequencer.c
sound/oss/sequencer_syms.c
sound/oss/sgalaxy.c [deleted file]
sound/oss/sonicvibes.c [deleted file]
sound/oss/sound_calls.h
sound/oss/tuning.h
sound/oss/wavfront.c [deleted file]
sound/oss/wf_midi.c [deleted file]
sound/oss/ymfpci.c [deleted file]
sound/oss/ymfpci.h [deleted file]
sound/oss/ymfpci_image.h [deleted file]
sound/oss/yss225.c [deleted file]
sound/oss/yss225.h [deleted file]
sound/sound_core.c

index 42b95e0..24f3c63 100644 (file)
@@ -29,14 +29,6 @@ Who: Adrian Bunk <bunk@stusta.de>
 
 ---------------------------
 
-What:  drivers that were depending on OBSOLETE_OSS_DRIVER
-        (config options already removed)
-When:  before 2.6.19
-Why:   OSS drivers with ALSA replacements
-Who:   Adrian Bunk <bunk@stusta.de>
-
----------------------------
-
 What:  raw1394: requests of type RAW1394_REQ_ISO_SEND, RAW1394_REQ_ISO_LISTEN
 When:  November 2006
 Why:   Deprecated in favour of the new ioctl-based rawiso interface, which is
index e1543a3..ff571f9 100644 (file)
@@ -289,9 +289,6 @@ and is between 256 and 4096 characters. It is defined in the file
 
        autotest        [IA64]
 
-       awe=            [HW,OSS] AWE32/SB32/AWE64 wave table synth
-                       Format: <io>,<memsize>,<isapnp>
-
        aztcd=          [HW,CD] Aztech CD268 CDROM driver
                        Format: <io>,0x79 (?)
 
@@ -536,10 +533,6 @@ and is between 256 and 4096 characters. It is defined in the file
                        Default value is 0.
                        Value can be changed at runtime via /selinux/enforce.
 
-       es1370=         [HW,OSS]
-                       Format: <lineout>[,<micbias>]
-                       See also header of sound/oss/es1370.c.
-
        es1371=         [HW,OSS]
                        Format: <spdif>,[<nomix>,[<amplifier>]]
                        See also header of sound/oss/es1371.c.
@@ -580,9 +573,6 @@ and is between 256 and 4096 characters. It is defined in the file
        gscd=           [HW,CD]
                        Format: <io>
 
-       gus=            [HW,OSS]
-                       Format: <io>,<irq>,<dma>,<dma16>
-
        gvp11=          [HW,SCSI]
 
        hashdist=       [KNL,NUMA] Large hashes allocated during boot
@@ -841,12 +831,6 @@ and is between 256 and 4096 characters. It is defined in the file
                        (machvec) in a generic kernel.
                        Example: machvec=hpzx1_swiotlb
 
-       mad16=          [HW,OSS] Format:
-                       <io>,<irq>,<dma>,<dma16>,<mpu_io>,<mpu_irq>,<joystick>
-
-       maui=           [HW,OSS]
-                       Format: <io>,<irq>
-
        max_loop=       [LOOP] Maximum number of loopback devices that can
                        be mounted
                        Format: <1-256>
@@ -1114,9 +1098,6 @@ and is between 256 and 4096 characters. It is defined in the file
        opl3=           [HW,OSS]
                        Format: <io>
 
-       opl3sa=         [HW,OSS]
-                       Format: <io>,<irq>,<dma>,<dma2>,<mpu_io>,<mpu_irq>
-
        opl3sa2=        [HW,OSS] Format:
                        <io>,<irq>,<dma>,<dma2>,<mss_io>,<mpu_io>,<ymode>,<loopback>[,<isapnp>,<multiple]
 
@@ -1451,9 +1432,6 @@ and is between 256 and 4096 characters. It is defined in the file
 
        sg_def_reserved_size=   [SCSI]
 
-       sgalaxy=        [HW,OSS]
-                       Format: <io>,<irq>,<dma>,<dma2>,<sgbase>
-
        shapers=        [NET]
                        Maximal number of shapers.
 
@@ -1594,9 +1572,6 @@ and is between 256 and 4096 characters. It is defined in the file
 
        snd-ymfpci=     [HW,ALSA]
 
-       sonicvibes=     [HW,OSS]
-                       Format: <reverb>
-
        sonycd535=      [HW,CD]
                        Format: <io>[,<irq>]
 
diff --git a/Documentation/sound/oss/AWE32 b/Documentation/sound/oss/AWE32
deleted file mode 100644 (file)
index b5908a6..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-       Installing and using Creative AWE midi sound under Linux.
-
-This documentation is devoted to the Creative Sound Blaster AWE32, AWE64 and 
-SB32.
-
-1) Make sure you have an ORIGINAL Creative SB32, AWE32 or AWE64 card. This
-   is important, because the driver works only with real Creative cards.
-
-2) The first thing you need to do is re-compile your kernel with support for
-   your sound card. Run your favourite tool to configure the kernel and when
-   you get to the "Sound" menu you should enable support for the following:
-
-   Sound card support,
-   OSS sound modules,
-   100% Sound Blaster compatibles (SB16/32/64, ESS, Jazz16) support,
-   AWE32 synth
-
-   If your card is "Plug and Play" you will also need to enable these two
-   options, found under the "Plug and Play configuration" menu:
-
-   Plug and Play support
-   ISA Plug and Play support
-
-   Now compile and install the kernel in normal fashion. If you don't know
-   how to do this you can find instructions for this in the README file
-   located in the root directory of the kernel source.
-
-3) Before you can start playing midi files you will have to load a sound
-   bank file. The utility needed for doing this is called "sfxload", and it
-   is one of the utilities found in a package called "awesfx". If this
-   package is not available in your distribution you can download the AWE
-   snapshot from Creative Labs Open Source website:
-
-   http://www.opensource.creative.com/snapshot.html
-
-   Once you have unpacked the AWE snapshot you will see a "awesfx"
-   directory. Follow the instructions in awesfx/docs/INSTALL to install the
-   utilities in this package. After doing this, sfxload should be installed
-   as:
-
-   /usr/local/bin/sfxload
-
-   To enable AWE general midi synthesis you should also get the sound bank
-   file for general midi from:
-
-   http://members.xoom.com/yar/synthgm.sbk.gz
-
-   Copy it to a directory of your choice, and unpack it there.
-
-4) Edit /etc/modprobe.conf, and insert the following lines at the end of the
-   file:
-
-  alias sound-slot-0 sb
-  alias sound-service-0-1 awe_wave
-  install awe_wave /sbin/modprobe --first-time -i awe_wave && /usr/local/bin/sfxload PATH_TO_SOUND_BANK_FILE
-
-  You will of course have to change "PATH_TO_SOUND_BANK_FILE" to the full
-  path of the sound bank file. That will enable the Sound Blaster and AWE
-  wave synthesis. To play midi files you should get one of these programs if
-  you don't already have them:
-
-  Playmidi:                    http://playmidi.openprojects.net
-
-  AWEMidi Player (drvmidi)     Included in the previously mentioned AWE
-                               snapshot.
-
-  You will probably have to pass the "-e" switch to playmidi to have it use
-  your midi device. drvmidi should work without switches.
-
-  If something goes wrong please e-mail me. All comments and suggestions are
-  welcome.
-
-                   Yaroslav Rosomakho (alons55@dialup.ptt.ru)
-                           http://www.yar.opennet.ru
-
-Last Updated: Feb 3 2001
diff --git a/Documentation/sound/oss/CMI8338 b/Documentation/sound/oss/CMI8338
deleted file mode 100644 (file)
index 387d058..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-Audio driver for CM8338/CM8738 chips by Chen-Li Tien
-
-
-HARDWARE SUPPORTED
-================================================================================
-C-Media CMI8338
-C-Media CMI8738
-On-board C-Media chips
-
-
-STEPS TO BUILD DRIVER
-================================================================================
-
-  1. Backup the Config.in and Makefile in the sound driver directory
-     (/usr/src/linux/driver/sound).
-     The Configure.help provide help when you config driver in step
-     4, please backup the original one (/usr/src/linux/Document) and
-     copy this file.
-     The cmpci is document for the driver in detail, please copy it
-     to /usr/src/linux/Document/sound so you can refer it. Backup if
-     there is already one.
-
-  2. Extract the tar file by 'tar xvzf cmpci-xx.tar.gz' in the above
-     directory.
-
-  3. Change directory to /usr/src/linux
-
-  4. Config cm8338 driver by 'make menuconfig', 'make config' or
-     'make xconfig' command.
-
-  5. Please select Sound Card (CONFIG_SOUND=m) support and CMPCI
-     driver (CONFIG_SOUND_CMPCI=m) as modules. Resident mode not tested.
-     For driver option, please refer 'DRIVER PARAMETER'
-
-  6. Compile the kernel if necessary.
-
-  7. Compile the modules by 'make modules'.
-
-  8. Install the modules by 'make modules_install'
-
-
-INSTALL DRIVER
-================================================================================
-
-  1. Before first time to run the driver, create module dependency by
-     'depmod -a'
-
-  2. To install the driver manually, enter 'modprobe cmpci'.
-
-  3. Driver installation for various distributions:
-
-    a. Slackware 4.0
-       Add the 'modprobe cmpci' command in your /etc/rc.d/rc.modules
-       file.so you can start the driver automatically each time booting.
-
-    b. Caldera OpenLinux 2.2
-       Use LISA to load the cmpci module.
-
-    c. RedHat 6.0 and S.u.S.E. 6.1
-       Add following command in /etc/conf.modules:
-
-       alias sound cmpci
-
-       also visit http://www.cmedia.com.tw for installation instruction.
-
-DRIVER PARAMETER
-================================================================================
-
-  Some functions for the cm8738 can be configured in Kernel Configuration
-  or modules parameters. Set these parameters to 1 to enable.
-
-  mpuio:       I/O ports base for MPU-401, 0 if disabled.
-  fmio:                I/O ports base for OPL-3, 0 if disabled.
-  spdif_inverse:Inverse the S/PDIF-in signal, this depends on your
-               CD-ROM or DVD-ROM.
-  spdif_loop:   Enable S/PDIF loop, this route S/PDIF-in to S/PDIF-out
-                directly.
-  speakers:     Number of speakers used.
-  use_line_as_rear:Enable this if you want to use line-in as
-                rear-out.
-  use_line_as_bass:Enable this if you want to use line-in as
-                bass-out.
-  joystick:    Enable joystick. You will need to install Linux joystick
-               driver.
-
diff --git a/Documentation/sound/oss/INSTALL.awe b/Documentation/sound/oss/INSTALL.awe
deleted file mode 100644 (file)
index 310f42c..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-================================================================
-       INSTALLATION OF AWE32 SOUND DRIVER FOR LINUX
-       Takashi Iwai    <iwai@ww.uni-erlangen.de>
-================================================================
-
-----------------------------------------------------------------
-* Attention to SB-PnP Card Users
-
-If you're using PnP cards, the initialization of PnP is required
-before loading this driver.  You have now three options:
-  1. Use isapnptools.
-  2. Use in-kernel isapnp support.
-  3. Initialize PnP on DOS/Windows, then boot linux by loadlin.
-In this document, only the case 1 case is treated.
-
-----------------------------------------------------------------
-* Installation on Red Hat 5.0 Sound Driver
-
-Please use install-rh.sh under RedHat5.0 directory.
-DO NOT USE install.sh below.
-See INSTALL.RH for more details.
-
-----------------------------------------------------------------
-* Installation/Update by Shell Script
-
-  1. Become root
-
-       % su
-
-  2. If you have never configured the kernel tree yet, run make config
-    once (to make dependencies and symlinks).
-
-       # cd /usr/src/linux
-       # make xconfig
-    
-  3. Run install.sh script
-
-       # sh ./install.sh
-
-  4. Configure your kernel
-
-       (for Linux 2.[01].x user)
-       # cd /usr/src/linux
-       # make xconfig (or make menuconfig)
-
-       (for Linux 1.2.x user)
-       # cd /usr/src/linux
-       # make config
-
-    Answer YES to both "lowlevel drivers" and "AWE32 wave synth" items 
-    in Sound menu.  ("lowlevel drivers" will appear only in 2.x
-    kernel.)
-
-  5. Make your kernel (and modules), and install them as usual.
-
-       5a. make kernel image
-               # make zImage
-
-       5b. make modules and install them
-               # make modules && make modules_install
-
-       5c. If you're using lilo, copy the kernel image and run lilo.
-           Otherwise, copy the kernel image to suitable directory or
-           media for your system.
-
-  6. Reboot the kernel if necessary.
-       - If you updated only the modules, you don't have to reboot
-         the system.  Just remove the old sound modules here.
-               in 
-               # rmmod sound.o         (linux-2.0 or OSS/Free)
-               # rmmod awe_wave.o      (linux-2.1)
-
-  7. If your AWE card is a PnP and not initialized yet, you'll have to
-    do it by isapnp tools.  Otherwise, skip to 8.
-
-       This section described only a brief explanation.  For more
-       details, please see the AWE64-Mini-HOWTO or isapnp tools FAQ.
-
-       7a. If you have no isapnp.conf file, generate it by pnpdump.
-           Otherwise, skip to 7d.
-               # pnpdump > /etc/isapnp.conf
-
-       7b. Edit isapnp.conf file.  Comment out the appropriate
-           lines containing desirable I/O ports, DMA and IRQs.
-           Don't forget to enable (ACT Y) line.
-
-       7c. Add two i/o ports (0xA20 and 0xE20) in WaveTable part.
-           ex)
-               (CONFIGURE CTL0048/58128 (LD 2
-               #     ANSI string -->WaveTable<--
-                 (IO 0 (BASE 0x0620))
-                 (IO 1 (BASE 0x0A20))
-                 (IO 2 (BASE 0x0E20))
-                 (ACT Y)
-               ))
-
-       7d. Load the config file.
-           CAUTION: This will reset all PnP cards!
-
-               # isapnp /etc/isapnp.conf
-
-  8. Load the sound module (if you configured it as a module):
-
-       for 2.0 kernel or OSS/Free monolithic module:
-
-               # modprobe sound.o
-
-       for 2.1 kernel:
-
-               # modprobe sound
-               # insmod uart401
-               # insmod sb io=0x220 irq=5 dma=1 dma16=5 mpu_io=0x330
-               (These values depend on your settings.)
-               # insmod awe_wave
-               (Be sure to load awe_wave after sb!)
-
-               See Documentation/sound/oss/AWE32 for
-               more details.
-
-  9. (only for obsolete systems) If you don't have /dev/sequencer
-     device file, make it according to Readme.linux file on
-     /usr/src/linux/drivers/sound. (Run a shell script included in
-     that file). <-- This file no longer exists in the recent kernels!
-
-  10. OK, load your own soundfont file, and enjoy MIDI!
-
-       % sfxload synthgm.sbk
-       % drvmidi foo.mid
-
-  11. For more advanced use (eg. dynamic loading, virtual bank and
-      etc.), please read the awedrv FAQ or the instructions in awesfx
-      and awemidi packages.
-
-Good luck!
diff --git a/Documentation/sound/oss/MAD16 b/Documentation/sound/oss/MAD16
deleted file mode 100644 (file)
index 865dbd8..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-(This recipe has been edited to update the configuration symbols,
- and change over to modprobe.conf for 2.6)
-
-From: Shaw Carruthers <shaw@shawc.demon.co.uk>
-
-I have been using mad16 sound for some time now with no problems, current
-kernel 2.1.89
-
-lsmod shows:
-
-mad16                   5176   0 
-sb                     22044   0  [mad16]
-uart401                 5576   0  [mad16 sb]
-ad1848                 14176   1  [mad16]
-sound                  61928   0  [mad16 sb uart401 ad1848]
-
-.config has:
-
-CONFIG_SOUND=m
-CONFIG_SOUND_ADLIB=m
-CONFIG_SOUND_MAD16=m
-CONFIG_SOUND_YM3812=m
-
-modprobe.conf has:
-
-alias char-major-14-* mad16
-options sb mad16=1
-options mad16 io=0x530 irq=7 dma=0 dma16=1  && /usr/local/bin/aumix -w 15 -p 20 -m 0 -1 0 -2 0 -3 0 -i 0
-
-
-To get the built in mixer to work this needs to be:
-
-options adlib_card io=0x388     # FM synthesizer
-options sb mad16=1
-options mad16 io=0x530 irq=7 dma=0 dma16=1 mpu_io=816 mpu_irq=5 && /usr/local/bin/aumix -w 15 -p 20 -m 0 -1 0 -2 0 -3 0 -i 0
-
-The addition of the "mpu_io=816 mpu_irq=5" to the mad16 options line is
-
-------------------------------------------------------------------------
-The mad16 module in addition supports the following options:
-
-option:                        meaning:                        default:
-joystick=0,1           disabled, enabled               disabled
-cdtype=0x00,0x02,0x04, disabled, Sony CDU31A,          disabled
-       0x06,0x08,0x0a   Mitsumi, Panasonic,
-                       Secondary IDE, Primary IDE 
-cdport=0x340,0x320,                                    0x340
-       0x330,0x360
-cdirq=0,3,5,7,9,10,11  disabled, IRQ3, ...             disabled
-cddma=0,5,6,7          disabled, DMA5, ...             DMA5 for Mitsumi or IDE
-cddma=0,1,2,3          disabled, DMA1, ...             DMA3 for Sony or Panasonic
-opl4=0,1               OPL3, OPL4                      OPL3    
-
-for more details see linux/drivers/sound/mad16.c
-
-Rui Sousa
diff --git a/Documentation/sound/oss/Maestro b/Documentation/sound/oss/Maestro
deleted file mode 100644 (file)
index 4a80eb3..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-       An OSS/Lite Driver for the ESS Maestro family of sound cards
-
-                       Zach Brown, December 1999
-
-Driver Status and Availability
-------------------------------
-
-The most recent version of this driver will hopefully always be available at
-       http://www.zabbo.net/maestro/
-
-I will try and maintain the most recent stable version of the driver
-in both the stable and development kernel lines.
-
-ESS Maestro Chip Family
------------------------
-
-There are 3 main variants of the ESS Maestro PCI sound chip.  The first
-is the Maestro 1.  It was originally produced by Platform Tech as the
-'AGOGO'.  It can be recognized by Platform Tech's PCI ID 0x1285 with
-0x0100 as the device ID.  It was put on some sound boards and a few laptops.  
-ESS bought the design and cleaned it up as the Maestro 2.  This starts
-their marking with the ESS vendor ID 0x125D and the 'year' device IDs.
-The Maestro 2 claims 0x1968 while the Maestro 2e has 0x1978.
-
-The various families of Maestro are mostly identical as far as this 
-driver is concerned.  It doesn't touch the DSP parts that differ (though
-it could for FM synthesis).
-
-Driver OSS Behavior
---------------------
-
-This OSS driver exports /dev/mixer and /dev/dsp to applications, which
-mostly adhere to the OSS spec.   This driver doesn't register itself
-with /dev/sndstat, so don't expect information to appear there.
-
-The /dev/dsp device exported behaves almost as expected.  Playback is
-supported in all the various lovely formats.  8/16bit stereo/mono from
-8khz to 48khz, and mmap()ing for playback behaves.  Capture/recording
-is limited due to oddities with the Maestro hardware.  One can only
-record in 16bit stereo.  For recording the maestro uses non interleaved
-stereo buffers so that mmap()ing the incoming data does not result in
-a ring buffer of LRLR data.  mmap()ing of the read buffers is therefore
-disallowed until this can be cleaned up.
-
-/dev/mixer is an interface to the AC'97 codec on the Maestro.  It is
-worth noting that there are a variety of AC'97s that can be wired to
-the Maestro.  Which is used is entirely up to the hardware implementor.
-This should only be visible to the user by the presence, or lack, of
-'Bass' and 'Treble' sliders in the mixer.  Not all AC'97s have them.
-
-The driver doesn't support MIDI or FM playback at the moment.  Typically
-the Maestro is wired to an MPU MIDI chip, but some hardware implementations
-don't.  We need to assemble a white list of hardware implementations that
-have MIDI wired properly before we can claim to support it safely.
-
-Compiling and Installing
-------------------------
-
-With the drivers inclusion into the kernel, compiling and installing
-is the same as most OSS/Lite modular sound drivers.  Compilation
-of the driver is enabled through the CONFIG_SOUND_MAESTRO variable
-in the config system.  
-
-It may be modular or statically linked.  If it is modular it should be
-installed with the rest of the modules for the kernel on the system.
-Typically this will be in /lib/modules/ somewhere.  'alias sound maestro'
-should also be added to your module configs (typically /etc/conf.modules)
-if you're using modular OSS/Lite sound and want to default to using a
-maestro chip.
-
-As this is a PCI device, the module does not need to be informed of
-any IO or IRQ resources it should use, it devines these from the
-system.  Sometimes, on sucky PCs, the BIOS fails to allocated resources
-for the maestro.  This will result in a message like:
-       maestro: PCI subsystem reports IRQ 0, this might not be correct.
-from the kernel.  Should this happen the sound chip most likely will
-not operate correctly.  To solve this one has to dig through their BIOS
-(typically entered by hitting a hot key at boot time) and figure out
-what magic needs to happen so that the BIOS will reward the maestro with
-an IRQ.  This operation is incredibly system specific, so you're on your
-own.  Sometimes the magic lies in 'PNP Capable Operating System' settings.
-
-There are very few options to the driver.  One is 'debug' which will 
-tell the driver to print minimal debugging information as it runs.  This
-can be collected with 'dmesg' or through the klogd daemon.
-
-The other, more interesting option, is 'dsps_order'.  Typically at
-install time the driver will only register one available /dev/dsp device
-for its use.  The 'dsps_order' module parameter allows for more devices
-to be allocated, as a power of two.  Up to 4 devices can be registered
-( dsps_order=2 ).  These devices act as fully distinct units and use
-separate channels in the maestro.
-
-Power Management
-----------------
-
-As of version 0.14, this driver has a minimal understanding of PCI
-Power Management.  If it finds a valid power management capability
-on the PCI device it will attempt to use the power management
-functions of the maestro.  It will only do this on Maestro 2Es and
-only on machines that are known to function well.  You can
-force the use of power management by setting the 'use_pm' module
-option to 1, or can disable it entirely by setting it to 0.
-
-When using power management, the driver does a few things
-differently.  It will keep the chip in a lower power mode
-when the module is inserted but /dev/dsp is not open.  This
-allows the mixer to function but turns off the clocks
-on other parts of the chip.  When /dev/dsp is opened the chip
-is brought into full power mode, and brought back down
-when it is closed.  It also powers down the chip entirely
-when the module is removed or the machine is shutdown.  This
-can have nonobvious consequences.  CD audio may not work
-after a power managing driver is removed.  Also, software that
-doesn't understand power management may not be able to talk
-to the powered down chip until the machine goes through a hard
-reboot to bring it back.
-
-.. more details ..
-------------------
-
-drivers/sound/maestro.c contains comments that hopefully explain
-the maestro implementation.
diff --git a/Documentation/sound/oss/Maestro3 b/Documentation/sound/oss/Maestro3
deleted file mode 100644 (file)
index a113718..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-       An OSS/Lite Driver for the ESS Maestro3 family of sound chips
-
-                       Zach Brown, January 2001
-
-Driver Status and Availability
-------------------------------
-
-The most recent version of this driver will hopefully always be available at
-       http://www.zabbo.net/maestro3/
-
-I will try and maintain the most recent stable version of the driver
-in both the stable and development kernel lines.
-
-Historically I've sucked pretty hard at actually doing that, however.
-
-ESS Maestro3 Chip Family
------------------------
-
-The 'Maestro3' is much like the Maestro2 chip.  The noted improvement
-is the removal of the silicon in the '2' that did PCM mixing.  All that
-work is now done through a custom DSP called the ASSP, the Asynchronus
-Specific Signal Processor.
-
-The 'Allegro' is a baby version of the Maestro3.  I'm not entirely clear
-on the extent of the differences, but the driver supports them both :)
-
-The 'Allegro' shows up as PCI ID 0x1988 and the Maestro3 as 0x1998,
-both under ESS's vendor ID of 0x125D.  The Maestro3 can also show up as
-0x199a when hardware strapping is used.
-
-The chip can also act as a multi function device.  The modem IDs follow
-the audio multimedia device IDs.  (so the modem part of an Allegro shows
-up as 0x1989)
-
-Driver OSS Behavior
---------------------
-
-This OSS driver exports /dev/mixer and /dev/dsp to applications, which
-mostly adhere to the OSS spec.   This driver doesn't register itself
-with /dev/sndstat, so don't expect information to appear there.
-
-The /dev/dsp device exported behaves as expected.  Playback is
-supported in all the various lovely formats.  8/16bit stereo/mono from
-8khz to 48khz, with both read()/write(), and mmap().
-
-/dev/mixer is an interface to the AC'97 codec on the Maestro3.  It is
-worth noting that there are a variety of AC'97s that can be wired to
-the Maestro3.  Which is used is entirely up to the hardware implementor.
-This should only be visible to the user by the presence, or lack, of
-'Bass' and 'Treble' sliders in the mixer.  Not all AC'97s have them.
-The Allegro has an onchip AC'97.
-
-The driver doesn't support MIDI or FM playback at the moment.
-
-Compiling and Installing
-------------------------
-
-With the drivers inclusion into the kernel, compiling and installing
-is the same as most OSS/Lite modular sound drivers.  Compilation
-of the driver is enabled through the CONFIG_SOUND_MAESTRO3 variable
-in the config system.  
-
-It may be modular or statically linked.  If it is modular it should be
-installed with the rest of the modules for the kernel on the system.
-Typically this will be in /lib/modules/ somewhere.  'alias sound-slot-0
-maestro3' should also be added to your module configs (typically
-/etc/modprobe.conf) if you're using modular OSS/Lite sound and want to
-default to using a maestro3 chip.
-
-There are very few options to the driver.  One is 'debug' which will 
-tell the driver to print minimal debugging information as it runs.  This
-can be collected with 'dmesg' or through the klogd daemon.
-
-One is 'external_amp', which tells the driver to attempt to enable
-an external amplifier.  This defaults to '1', you can tell the driver
-not to bother enabling such an amplifier by setting it to '0'.
-
-And the last is 'gpio_pin', which tells the driver which GPIO pin number
-the external amp uses (0-15), The Allegro uses 8 by default, all others 1.
-If everything loads correctly and seems to be working but you get no sound, 
-try tweaking this value. 
-
-Systems known to need a different value
-        Panasonic ToughBook CF-72: gpio_pin=13 
-
-Power Management
-----------------
-
-This driver has a minimal understanding of PCI Power Management.  It will
-try and power down the chip when the system is suspended, and power
-it up with it is resumed.  It will also try and power down the chip
-when the machine is shut down.
diff --git a/Documentation/sound/oss/NEWS b/Documentation/sound/oss/NEWS
deleted file mode 100644 (file)
index a81e0ef..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-Linux 2.4 Sound Changes
-2000-September-25
-Christoph Hellwig, <hch@infradead.org>
-
-
-
-=== isapnp support
-
-The Linux 2.4 Kernel does have reliable in-kernel isapnp support.
-Some drivers (sb.o, ad1816.o awe_wave.o) do now support automatically
-detecting and configuring isapnp devices.
-If you have a not yet supported isapnp soundcard, mail me the content
-of '/proc/isapnp' on your system and some information about your card
-and its driver(s) so I can try to get isapnp working for it.
-
-
-
-=== soundcard resources on kernel commandline
-
-Before Linux 2.4 you had to specify the resources for sounddrivers
-statically linked into the kernel at compile time
-(in make config/menuconfig/xconfig). In Linux 2.4 the resources are
-now specified at the boot-time kernel commandline (e.g. the lilo
-'append=' line or everything that's after the kernel name in grub).
-Read the Configure.help entry for your card for the parameters.
-
-
-=== softoss is gone
-
-In Linux 2.4 the softoss in-kernel software synthesizer is no more aviable.
-Use a user space software synthesizer like timidity instead.
-
-
-
-=== /dev/sndstat and /proc/sound are gone
-
-In older Linux versions those files exported some information about the
-OSS/Free configuration to userspace. In Linux 2.3 they were removed because
-they did not support the growing number of pci soundcards and there were
-some general problems with this interface.
-
-
diff --git a/Documentation/sound/oss/OPL3-SA b/Documentation/sound/oss/OPL3-SA
deleted file mode 100644 (file)
index 66a9183..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-OPL3-SA1 sound driver (opl3sa.o)
-
----
-Note: This howto only describes how to setup the OPL3-SA1 chip; this info
-does not apply to the SA2, SA3, or SA4. 
----
-
-The Yamaha OPL3-SA1 sound chip is usually found built into motherboards, and
-it's a decent little chip offering a WSS mode, a SB Pro emulation mode, MPU401
-and OPL3 FM Synth capabilities.
-
-You can enable inclusion of the driver via CONFIG_SOUND_OPL3SA1=m, or
-CONFIG_SOUND_OPL3SA1=y through 'make config/xconfig/menuconfig'.
-
-You'll need to know all of the relevant info (irq, dma, and io port) for the
-chip's WSS mode, since that is the mode the kernel sound driver uses, and of
-course you'll also need to know about where the MPU401 and OPL3 ports and
-IRQs are if you want to use those.
-
-Here's the skinny on how to load it as a module:
-
-       modprobe opl3sa io=0x530 irq=11 dma=0 dma2=1 mpu_io=0x330 mpu_irq=5
-
-Module options in detail:
-
-       io:     This is the WSS's port base.
-       irq:    This is the WSS's IRQ.
-       dma:    This is the WSS's DMA line. In my BIOS setup screen this was
-               listed as "WSS Play DMA"
-       dma2:   This is the WSS's secondary DMA line. My BIOS calls it the
-               "WSS capture DMA"
-       
-       mpu_io: This is the MPU401's port base.
-       mpu_irq: This is the MPU401's IRQ.
-
-If you'd like to use the OPL3 FM Synthesizer, make sure you enable
-CONFIG_SOUND_YM3812 (in 'make config'). That'll build the opl3.o module.
-
-Then a simple 'insmod opl3 io=0x388', and you now have FM Synth.
-
-You can also use the SoftOSS software synthesizer instead of the builtin OPL3.
-Here's how:
-
-Say 'y' or 'm' to "SoftOSS software wave table engine" in make config.
-
-If you said yes, the software synth is available once you boot your new
-kernel.
-
-If you chose to build it as a module, just insmod the resulting softoss2.o
-
-Questions? Comments?
-<stiker@northlink.com>
diff --git a/Documentation/sound/oss/README.awe b/Documentation/sound/oss/README.awe
deleted file mode 100644 (file)
index 80054cd..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-================================================================
-       AWE32 Sound Driver for Linux / FreeBSD
-               version 0.4.3; Nov. 1, 1998
-
-       Takashi Iwai <iwai@ww.uni-erlangen.de>
-================================================================
-
-* GENERAL NOTES
-
-This is a sound driver extension for SoundBlaster AWE32 and other
-compatible cards (AWE32-PnP, SB32, SB32-PnP, AWE64 & etc) to enable
-the wave synth operations.  The driver is provided for Linux 1.2.x
-and 2.[012].x kernels, as well as FreeBSD, on Intel x86 and DEC
-Alpha systems.
-
-This driver was written by Takashi Iwai <iwai@ww.uni-erlangen.de>,
-and provided "as is".  The original source (awedrv-0.4.3.tar.gz) and
-binary packages are available on the following URL:
-       http://bahamut.mm.t.u-tokyo.ac.jp/~iwai/awedrv/
-Note that since the author is apart from this web site, the update is
-not frequent now.
-
-
-* NOTE TO LINUX USERS
-
-To enable this driver on linux-2.[01].x kernels, you need turn on 
-"AWE32 synth" options in sound menu when configure your linux kernel
-and modules.  The precise installation procedure is described in the
-AWE64-Mini-HOWTO and linux-kernel/Documetation/sound/AWE32.
-
-If you're using PnP cards, the card must be initialized before loading
-the sound driver.  There're several options to do this:
-    - Initialize the card via ISA PnP tools, and load the sound module.
-    - Initialize the card on DOS, and load linux by loadlin.exe
-    - Use PnP kernel driver (for Linux-2.x.x)
-The detailed instruction for the solution using isapnp tools is found
-in many documents like above.  A brief instruction is also included in
-the installation document of this package.
-For PnP driver project, please refer to the following URL:
-       http://www-jcr.lmh.ox.ac.uk/~pnp/
-
-
-* USING THE DRIVER
-
-The awedrv has several different playing modes to realize easy channel 
-allocation for MIDI songs.  To hear the exact sound quality, you need
-to obtain the extended sequencer program, drvmidi or playmidi-2.5.
-
-For playing MIDI files, you *MUST* load the soundfont file on the
-driver previously by sfxload utility.  Otherwise you'll here no sounds 
-at all!  All the utilities and driver source packages are found in the
-above URL.  The sfxload program is included in the package
-awesfx-0.4.3.tgz.  Binary packages are available there, too.  See the
-instruction in each package for installation.
-
-Loading a soundfont file is very simple.  Just execute the command
-
-       % sfxload synthgm.sbk
-
-Then, sfxload transfers the file "synthgm.sbk" to the driver.
-Both SF1 and SF2 formats are accepted.
-
-Now you can hear midi musics by a midi player.
-
-       % drvmidi foo.mid
-
-If you run MIDI player after MOD player, you need to load soundfont
-files again, since MOD player programs clear the previous loaded
-samples by their own data.
-
-If you have only 512kb on the sound card, I recommend to use dynamic
-sample loading via -L option of drvmidi.  2MB GM/GS soundfont file is
-available in most midi files.
-
-       % sfxload synthgm
-       % drvmidi -L 2mbgmgs foo.mid
-
-This makes a big difference (believe me)!  For more details, please
-refer to the FAQ list which is available on the URL above.
-
-The current chorus, reverb and equalizer status can be changed by
-aweset utility program (included in awesfx package).  Note that
-some awedrv-native programs (like drvmidi and xmp) will change the
-current settings by themselves.  The aweset program is effective
-only for other programs like playmidi.
-
-Enjoy.
-
-
-* COMPILE FLAGS
-
-Compile conditions are defined in awe_config.h.
-
-[Compatibility Conditions]
-The following flags are defined automatically when using installation
-shell script.
-
-- AWE_MODULE_SUPPORT
-    indicates your Linux kernel supports module for each sound card
-    (in recent 2.1 or 2.2 kernels and unofficial patched 2.0 kernels
-    as distributed in the RH5.0 package).
-    This flag is automatically set when you're using 2.1.x kernels.
-    You can pass the base address and memory size via the following
-    module options,
-       io = base I/O port address (eg. 0x620)
-       memsize = DRAM size in kilobytes (eg. 512)
-    As default, AWE driver probes these values automatically.
-
-
-[Hardware Conditions]
-You DON'T have to define the following two values.
-Define them only when the driver couldn't detect the card properly.
-
-- AWE_DEFAULT_BASE_ADDR                (default: not defined)
-    specifies the base port address of your AWE32 card.
-    0 means to autodetect the address.
-
-- AWE_DEFAULT_MEM_SIZE         (default: not defined)
-    specifies the memory size of your AWE32 card in kilobytes.
-    -1 means to autodetect its size.
-    
-
-[Sample Table Size]
-From ver.0.4.0, sample tables are allocated dynamically (except
-Linux-1.2.x system), so you need NOT to touch these parameters.
-Linux-1.2.x users may need to increase these values to appropriate size 
-if the sound card is equipped with more DRAM.
-
-- AWE_MAX_SF_LISTS, AWE_MAX_SAMPLES, AWE_MAX_INFOS
-
-
-[Other Conditions]
-
-- AWE_ALWAYS_INIT_FM           (default: not defined)
-    indicates the AWE driver always initialize FM passthrough even
-    without DRAM on board.  Emu8000 chip has a restriction for playing
-    samples on DRAM that at least two channels must be occupied as
-    passthrough channels. 
-
-- AWE_DEBUG_ON                 (default: defined)
-    turns on debugging messages if defined.
-
-- AWE_HAS_GUS_COMPATIBILITY    (default: defined)
-    Enables GUS compatibility mode if defined, reading GUS patches and 
-    GUS control commands.  Define this option to use GMOD or other
-    GUS module players.
-
-- CONFIG_AWE32_MIDIEMU         (default: defined)
-    Adds a MIDI emulation device by Emu8000 wavetable.  The emulation
-    device can be accessed as an external MIDI, and sends the MIDI
-    control codes directly.  XG and GS sysex/NRPN are accepted.
-    No MIDI input is supported.
-
-- CONFIG_AWE32_MIXER           (default: not defined)
-    Adds a mixer device for AWE32 bass/treble equalizer control.
-    You can access this device using /dev/mixer?? (usually mixer01).
-
-- AWE_USE_NEW_VOLUME_CALC      (default: defined)
-    Use the new method to calculate the volume change as compatible
-    with DOS/Win drivers.  This option can be toggled via aweset
-    program, or drvmidi player.
-
-- AWE_CHECK_VTARGET            (default: defined)
-    Check the current volume target value when searching for an
-    empty channel to allocate a new voice.  This is experimentally
-    implemented in this version.  (probably, this option doesn't
-    affect the sound quality severely...)
-
-- AWE_ALLOW_SAMPLE_SHARING     (default: defined)
-   Allow sample sharing for differently loaded patches.
-   This function is available only together with awesfx-0.4.3p3.
-   Note that this is still an experimental option.
-
-- DEF_FM_CHORUS_DEPTH          (default: 0x10)
-    The default strength to be sent to the chorus effect engine.
-    From 0 to 0xff.  Larger numbers may often cause weird sounds.
-
-- DEF_FM_REVERB_DEPTH          (default: 0x10)
-    The default strength to be sent to the reverb effect engine.
-    From 0 to 0xff.  Larger numbers may often cause weird sounds.
-
-
-* ACKNOWLEDGMENTS
-
-Thanks to Witold Jachimczyk (witek@xfactor.wpi.edu) for much advice
-on programming of AWE32.  Much code is brought from his AWE32-native 
-MOD player, ALMP.
-The port of awedrv to FreeBSD is done by Randall Hopper
-(rhh@ct.picker.com).
-The new volume calculation routine was derived from Mark Weaver's
-ADIP compatible routines.
-I also thank linux-awe-ml members for their efforts
-to reboot their system many times :-)
-
-
-* TODO'S
-
-- Complete DOS/Win compatibility
-- DSP-like output
-
-
-* COPYRIGHT
-
-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.
diff --git a/Documentation/sound/oss/Wavefront b/Documentation/sound/oss/Wavefront
deleted file mode 100644 (file)
index 16f57ea..0000000
+++ /dev/null
@@ -1,339 +0,0 @@
-            An OSS/Free Driver for WaveFront soundcards
-              (Turtle Beach Maui, Tropez, Tropez Plus)
-
-                    Paul Barton-Davis, July 1998
-
-                         VERSION 0.2.5
-
-Driver Status
--------------
-
-Requires: Kernel 2.1.106 or later (the driver is included with kernels
-2.1.109 and above)
-         
-As of 7/22/1998, this driver is currently in *BETA* state. This means
-that it compiles and runs, and that I use it on my system (Linux
-2.1.106) with some reasonably demanding applications and uses.  I
-believe the code is approaching an initial "finished" state that
-provides bug-free support for the Tropez Plus.
-
-Please note that to date, the driver has ONLY been tested on a Tropez
-Plus. I would very much like to hear (and help out) people with Tropez
-and Maui cards, since I think the driver can support those cards as
-well. 
-
-Finally, the driver has not been tested (or even compiled) as a static
-(non-modular) part of the kernel. Alan Cox's good work in modularizing
-OSS/Free for Linux makes this rather unnecessary.
-
-Some Questions
---------------
-
-**********************************************************************
-0) What does this driver do that the maui driver did not ?
-**********************************************************************
-
-* can fully initialize a WaveFront card from cold boot - no DOS 
-          utilities needed
-* working patch/sample/program loading and unloading (the maui
-      driver didn't document how to make this work, and assumed
-      user-level preparation of the patch data for writing
-      to the board. ick.)
-* full user-level access to all WaveFront commands
-* for the Tropez Plus, (primitive) control of the YSS225 FX processor
-* Virtual MIDI mode supported - 2 MIDI devices accessible via the
-          WaveFront's MPU401/UART emulation. One
-         accesses the WaveFront synth, the other accesses the
-         external MIDI connector. Full MIDI read/write semantics
-         for both devices.
-* OSS-compliant /dev/sequencer interface for the WaveFront synth,
-         including native and GUS-format patch downloading.
-* semi-intelligent patch management (prototypical at this point)
-
-**********************************************************************
-1) What to do about MIDI interfaces ?
-**********************************************************************
-
-The Tropez Plus (and perhaps other WF cards) can in theory support up
-to 2 physical MIDI interfaces. One of these is connected to the
-ICS2115 chip (the WaveFront synth itself) and is controlled by
-MPU/UART-401 emulation code running as part of the WaveFront OS.  The
-other is controlled by the CS4232 chip present on the board. However,
-physical access to the CS4232 connector is difficult, and it is
-unlikely (though not impossible) that you will want to use it.
-
-An older version of this driver introduced an additional kernel config
-variable which controlled whether or not the CS4232 MIDI interface was
-configured. Because of Alan Cox's work on modularizing the sound
-drivers, and now backporting them to 2.0.34 kernels, there seems to be
-little reason to support "static" configuration variables, and so this
-has been abandoned in favor of *only* module parameters. Specifying
-"mpuio" and "mpuirq" for the cs4232 parameter will result in the
-CS4232 MIDI interface being configured; leaving them unspecified will
-leave it unconfigured (and thus unusable).
-
-BTW, I have heard from one Tropez+ user that the CS4232 interface is
-more reliable than the ICS2115 one. I have had no problems with the
-latter, and I don't have the right cable to test the former one
-out. Reports welcome.
-
-**********************************************************************
-2) Why does line XXX of the code look like this .... ?
-**********************************************************************
-
-Either because it's not finished yet, or because you're a better coder
-than I am, or because you don't understand some aspect of how the card
-or the code works. 
-
-I absolutely welcome comments, criticisms and suggestions about the
-design and implementation of the driver. 
-
-**********************************************************************
-3) What files are included ?
-**********************************************************************
-
-   drivers/sound/README.wavefront       -- this file
-
-   drivers/sound/wavefront.patch       -- patches for the 2.1.106 sound drivers
-                                          needed to make the rest of this work
-                                          DO NOT USE IF YOU'VE APPLIED THEM 
-                                          BEFORE, OR HAVE 2.1.109 OR ABOVE
-
-   drivers/sound/wavfront.c             -- the driver
-   drivers/sound/ys225.h                -- data declarations for FX config
-   drivers/sound/ys225.c                -- data definitions for FX config
-   drivers/sound/wf_midi.c              -- the "uart401" driver 
-                                             to support virtual MIDI mode.
-   include/wavefront.h                  -- the header file
-   Documentation/sound/oss/Tropez+          -- short docs on configuration
-
-**********************************************************************
-4) How do I compile/install/use it ?
-**********************************************************************
-
-PART ONE: install the source code into your sound driver directory
-
-  cd <top-of-your-2.1.106-code-base-e.g.-/usr/src/linux>
-  tar -zxvf <where-you-put/wavefront.tar.gz>
-
-PART TWO: apply the patches
-
-     DO THIS ONLY IF YOU HAVE A KERNEL VERSION BELOW 2.1.109
-     AND HAVE NOT ALREADY INSTALLED THE PATCH(ES).
-
-  cd drivers/sound
-  patch < wavefront.patch
-
-PART THREE: configure your kernel
-
-  cd <top of your kernel tree>
-  make xconfig (or whichever config option you use)
-
-         - choose YES for Sound Support              
-         - choose MODULE (M) for OSS Sound Modules
-         - choose MODULE(M) to YM3812/OPL3 support
-        - choose MODULE(M) for WaveFront support
-        - choose MODULE(M) for CS4232 support
-
-        - choose "N" for everything else (unless you have other
-             soundcards you want support for)
-
-
-   make boot
-   .
-   .
-   .
-   <whatever you normally do for a kernel install>
-   make modules
-   .
-   .
-   .
-   make modules_install
-
-Here's my autoconf.h SOUND section:
-
-/*
- * Sound
- */
-#define CONFIG_SOUND 1
-#undef  CONFIG_SOUND_OSS
-#define CONFIG_SOUND_OSS_MODULE 1
-#undef  CONFIG_SOUND_PAS
-#undef  CONFIG_SOUND_SB
-#undef  CONFIG_SOUND_ADLIB
-#undef  CONFIG_SOUND_GUS
-#undef  CONFIG_SOUND_MPU401
-#undef  CONFIG_SOUND_PSS
-#undef  CONFIG_SOUND_MSS
-#undef  CONFIG_SOUND_SSCAPE
-#undef  CONFIG_SOUND_TRIX
-#undef  CONFIG_SOUND_MAD16
-#undef  CONFIG_SOUND_WAVEFRONT
-#define CONFIG_SOUND_WAVEFRONT_MODULE 1
-#undef  CONFIG_SOUND_CS4232
-#define CONFIG_SOUND_CS4232_MODULE 1
-#undef  CONFIG_SOUND_MAUI
-#undef  CONFIG_SOUND_SGALAXY
-#undef  CONFIG_SOUND_OPL3SA1
-#undef  CONFIG_SOUND_SOFTOSS
-#undef  CONFIG_SOUND_YM3812
-#define CONFIG_SOUND_YM3812_MODULE 1
-#undef  CONFIG_SOUND_VMIDI
-#undef  CONFIG_SOUND_UART6850
-/*
- * Additional low level sound drivers
- */
-#undef  CONFIG_LOWLEVEL_SOUND
-
-************************************************************
-6) How do I configure my card ?
-************************************************************
-
-You need to edit /etc/modprobe.conf. Here's mine (edited to show the
-relevant details):
-
-  # Sound system
-  alias char-major-14-* wavefront
-  alias synth0 wavefront
-  alias mixer0 cs4232
-  alias audio0 cs4232
-  install wavefront /sbin/modprobe cs4232 && /sbin/modprobe -i wavefront && /sbin/modprobe opl3
-  options wavefront io=0x200 irq=9
-  options cs4232 synthirq=9 synthio=0x200 io=0x530 irq=5 dma=1 dma2=0
-  options opl3 io=0x388
-
-Things to note: 
-
-       the wavefront options "io" and "irq" ***MUST*** match the "synthio"
-       and "synthirq" cs4232 options.
-
-       you can do without the opl3 module if you don't
-       want to use the OPL/[34] FM synth on the soundcard
-
-       the opl3 io parameter is conventionally not adjustable.
-       In theory, any not-in-use IO port address would work, but
-       just use 0x388 and stick with the crowd.
-
-**********************************************************************
-7) What about firmware ?
-**********************************************************************
-
-Turtle Beach have not given me permission to distribute their firmware
-for the ICS2115. However, if you have a WaveFront card, then you
-almost certainly have the firmware, and if not, its freely available
-on their website, at:
-
-   http://www.tbeach.com/tbs/downloads/scardsdown.htm#tropezplus 
-
-The file is called WFOS2001.MOT (for the Tropez+).
-
-This driver, however, doesn't use the pure firmware as distributed,
-but instead relies on a somewhat processed form of it. You can
-generate this very easily. Following an idea from Andrew Veliath's
-Pinnacle driver, the following flex program will generate the
-processed version:
-
----- cut here -------------------------
-%option main
-%%
-^S[28].*\r$ printf ("%c%.*s", yyleng-1,yyleng-1,yytext);
-<<EOF>> { fputc ('\0', stdout); return; }
-\n {} 
-.  {}
----- cut here -------------------------
-
-To use it, put the above in file (say, ws.l) compile it like this:
-
-      shell> flex -ows.c ws.l
-      shell> cc -o ws ws.c
-      
-and then use it like this:
-
-    ws < my-copy-of-the-oswf.mot-file > /etc/sound/wavefront.os
-
-If you put it somewhere else, you'll always have to use the wf_ospath
-module parameter (see below) or alter the source code.
-
-**********************************************************************
-7) How do I get it working ?
-**********************************************************************
-
-Optionally, you can reboot with the "new" kernel (even though the only
-changes have really been made to a module).
-
-Then, as root do:
-
-     modprobe wavefront
-
-You should get something like this in /var/log/messages:
-
-    WaveFront: firmware 1.20 already loaded.
-
-or 
-
-    WaveFront: no response to firmware probe, assume raw.
-
-then:
-
-    WaveFront: waiting for memory configuration ...
-    WaveFront: hardware version 1.64
-    WaveFront: available DRAM 8191k
-    WaveFront: 332 samples used (266 real, 13 aliases, 53 multi), 180 empty
-    WaveFront: 128 programs slots in use
-    WaveFront: 256 patch slots filled, 142 in use
-
-The whole process takes about 16 seconds, the longest waits being
-after reporting the hardware version (during the firmware download),
-and after reporting program status (during patch status inquiry).  Its
-shorter (about 10 secs) if the firmware is already loaded (i.e. only
-warm reboots since the last firmware load).
-
-The "available DRAM" line will vary depending on how much added RAM
-your card has. Mine has 8MB.
-
-To check basically functionality, use play(1) or splay(1) to send a
-.WAV or other audio file through the audio portion. Then use playmidi
-to play a General MIDI file. Try the "-D 0" to hear the
-difference between sending MIDI to the WaveFront and using the OPL/3,
-which is the default (I think ...). If you have an external synth(s)
-hooked to the soundcard, you can use "-e" to route to the
-external synth(s) (in theory, -D 1 should work as well, but I think
-there is a bug in playmidi which prevents this from doing what it
-should). 
-
-**********************************************************************
-8) What are the module parameters ?
-**********************************************************************
-
-Its best to read wavefront.c for this, but here is a summary:
-
-integers: 
-         wf_raw  - if set, ignore apparent presence of firmware
-                   loaded onto the ICS2115, reset the whole
-                   board, and initialize it from scratch. (default = 0)
-
-          fx_raw  - if set, always initialize the YSS225 processor
-                   on the Tropez plus. (default = 1)
-
-          < The next 4 are basically for kernel hackers to allow
-           tweaking the driver for testing purposes. >             
-
-          wait_usecs        -  loop timer used when waiting for
-                              status conditions on the board. 
-                              The default is 150.
-
-          debug_default    - debugging flags. See sound/wavefront.h
-                            for WF_DEBUG_* values. Default is zero.
-                            Setting this allows you to debug the
-                            driver during module installation.
-strings:
-         ospath - path to get to the pre-processed OS firmware.
-                   (default: /etc/sound/wavefront.os)
-
-**********************************************************************
-9) Who should I contact if I have problems?
-**********************************************************************
-
-Just me: Paul Barton-Davis <pbd@op.net>
-
-
diff --git a/Documentation/sound/oss/es1370 b/Documentation/sound/oss/es1370
deleted file mode 100644 (file)
index 7b38b1a..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/proc/sound, /dev/sndstat
--------------------------
-
-/proc/sound and /dev/sndstat is not supported by the
-driver. To find out whether the driver succeeded loading,
-check the kernel log (dmesg).
-
-
-ALaw/uLaw sample formats
-------------------------
-
-This driver does not support the ALaw/uLaw sample formats.
-ALaw is the default mode when opening a sound device
-using OSS/Free. The reason for the lack of support is
-that the hardware does not support these formats, and adding
-conversion routines to the kernel would lead to very ugly
-code in the presence of the mmap interface to the driver.
-And since xquake uses mmap, mmap is considered important :-)
-and no sane application uses ALaw/uLaw these days anyway.
-In short, playing a Sun .au file as follows:
-
-cat my_file.au > /dev/dsp
-
-does not work. Instead, you may use the play script from
-Chris Bagwell's sox-12.14 package (available from the URL
-below) to play many different audio file formats.
-The script automatically determines the audio format
-and does do audio conversions if necessary.
-http://home.sprynet.com/sprynet/cbagwell/projects.html
-
-
-Blocking vs. nonblocking IO
----------------------------
-
-Unlike OSS/Free this driver honours the O_NONBLOCK file flag
-not only during open, but also during read and write.
-This is an effort to make the sound driver interface more
-regular. Timidity has problems with this; a patch
-is available from http://www.ife.ee.ethz.ch/~sailer/linux/pciaudio.html.
-(Timidity patched will also run on OSS/Free).
-
-
-MIDI UART
----------
-
-The driver supports a simple MIDI UART interface, with
-no ioctl's supported.
-
-
-MIDI synthesizer
-----------------
-
-This soundcard does not have any hardware MIDI synthesizer;
-MIDI synthesis has to be done in software. To allow this
-the driver/soundcard supports two PCM (/dev/dsp) interfaces.
-The second one goes to the mixer "synth" setting and supports
-only a limited set of sampling rates (44100, 22050, 11025, 5512).
-By setting lineout to 1 on the driver command line
-(eg. insmod es1370 lineout=1) it is even possible on some
-cards to convert the LINEIN jack into a second LINEOUT jack, thus
-making it possible to output four independent audio channels!
-
-There is a freely available software package that allows
-MIDI file playback on this soundcard called Timidity.
-See http://www.cgs.fi/~tt/timidity/.
-
-
-
-Thomas Sailer
-t.sailer@alumni.ethz.ch
diff --git a/Documentation/sound/oss/rme96xx b/Documentation/sound/oss/rme96xx
deleted file mode 100644 (file)
index 87d7b7b..0000000
+++ /dev/null
@@ -1,767 +0,0 @@
-Beta release of the rme96xx (driver for RME 96XX cards like the 
-"Hammerfall" and the "Hammerfall light") 
-
-Important: The driver module has to be installed on a freshly rebooted system, 
-otherwise the driver might not be able to acquire its buffers.
-
-features:
-
- - OSS programming interface (i.e. runs with standard OSS soundsoftware) 
- - OSS/Multichannel interface (OSS multichannel is done by just aquiring
-   more than 2 channels). The driver does not use more than one device 
-   ( yet .. this feature may be implemented later ) 
- - more than one RME card supported
-
-The driver uses a specific multichannel interface, which I will document
-when the driver gets stable. (take a look at the defines in rme96xx.h,
-which adds blocked multichannel formats i.e instead of 
-lrlrlrlr --> llllrrrr  etc.
-
-Use the "rmectrl" programm to look at the status of the card .. 
-or use xrmectrl, a GUI interface for the ctrl program.
-
-What you can do with the rmectrl program is to set the stereo device for
-OSS emulation (e.g. if you use SPDIF out).
-
-You do:
-
-./ctrl offset 24 24
-
-which makes the stereo device use channels 25 and 26.
-
-Guenter Geiger <geiger@epy.co.at>
-
-copy the first part of the attached source code into rmectrl.c
-and the  second part into xrmectrl (or get the program from
-http://gige.xdv.org/pages/soft/pages/rme)
-
-to compile: gcc -o rmectrl rmectrl.c
------------------------------- snip ------------------------------------
-
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <linux/soundcard.h>
-#include <math.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include "rme96xx.h"
-
-/*
-  remctrl.c
-  (C) 2000 Guenter Geiger <geiger@debian.org>
-  HP20020201 - Heiko Purnhagen <purnhage@tnt.uni-hannover.de>
-*/
-
-/* # define DEVICE_NAME "/dev/mixer" */
-# define DEVICE_NAME "/dev/mixer1"
-
-
-void usage(void)
-{
-     fprintf(stderr,"usage: rmectrl [/dev/mixer<n>] [command [options]]\n\n");
-     fprintf(stderr,"where command is one of:\n");
-     fprintf(stderr,"  help                       show this help\n");
-     fprintf(stderr,"  status                     show status bits\n");
-     fprintf(stderr,"  control                    show control bits\n");
-     fprintf(stderr,"  mix                        show mixer/offset status\n");
-     fprintf(stderr,"  master <n>                 set sync master\n");
-     fprintf(stderr,"  pro <n>                    set spdif out pro\n");
-     fprintf(stderr,"  emphasis <n>               set spdif out emphasis\n");
-     fprintf(stderr,"  dolby <n>                  set spdif out no audio\n");
-     fprintf(stderr,"  optout <n>                 set spdif out optical\n");
-     fprintf(stderr,"  wordclock <n>              set sync wordclock\n");
-     fprintf(stderr,"  spdifin <n>                set spdif in (0=optical,1=coax,2=intern)\n");
-     fprintf(stderr,"  syncref <n>                set sync source (0=ADAT1,1=ADAT2,2=ADAT3,3=SPDIF)\n");
-     fprintf(stderr,"  adat1cd <n>                set ADAT1 on internal CD\n");
-     fprintf(stderr,"  offset <devnr> <in> <out>  set dev (0..3) offset (0..25)\n");
-     exit(-1);
-}
-
-
-int main(int argc, char* argv[])
-{
-     int cards;
-     int ret;
-     int i;
-     double ft;
-     int fd, fdwr;
-     int param,orig;
-     rme_status_t stat;
-     rme_ctrl_t ctrl;
-     char *device;
-     int argidx;
-
-     if (argc < 2)
-         usage();
-
-     if (*argv[1]=='/') {
-         device = argv[1];
-         argidx = 2;
-     }
-     else {
-         device = DEVICE_NAME;
-         argidx = 1;
-     }
-
-     fprintf(stdout,"mixer device %s\n",device);
-     if ((fd = open(device,O_RDONLY)) < 0) {
-         fprintf(stdout,"opening device failed\n");
-         exit(-1);
-     }
-
-     if ((fdwr = open(device,O_WRONLY)) < 0) {
-         fprintf(stdout,"opening device failed\n");
-         exit(-1);
-     }
-
-     if (argc < argidx+1)
-         usage();
-
-     if (!strcmp(argv[argidx],"help"))
-        usage();
-     if (!strcmp(argv[argidx],"-h"))
-        usage();
-     if (!strcmp(argv[argidx],"--help"))
-        usage();
-
-     if (!strcmp(argv[argidx],"status")) {
-         ioctl(fd,SOUND_MIXER_PRIVATE2,&stat);
-         fprintf(stdout,"stat.irq %d\n",stat.irq);
-         fprintf(stdout,"stat.lockmask %d\n",stat.lockmask);
-         fprintf(stdout,"stat.sr48 %d\n",stat.sr48);
-         fprintf(stdout,"stat.wclock %d\n",stat.wclock);
-         fprintf(stdout,"stat.bufpoint %d\n",stat.bufpoint);
-         fprintf(stdout,"stat.syncmask %d\n",stat.syncmask);
-         fprintf(stdout,"stat.doublespeed %d\n",stat.doublespeed);
-         fprintf(stdout,"stat.tc_busy %d\n",stat.tc_busy);
-         fprintf(stdout,"stat.tc_out %d\n",stat.tc_out);
-         fprintf(stdout,"stat.crystalrate %d (0=64k 3=96k 4=88.2k 5=48k 6=44.1k 7=32k)\n",stat.crystalrate);
-         fprintf(stdout,"stat.spdif_error %d\n",stat.spdif_error);
-         fprintf(stdout,"stat.bufid %d\n",stat.bufid);
-         fprintf(stdout,"stat.tc_valid %d\n",stat.tc_valid);
-         exit (0);
-     }
-
-     if (!strcmp(argv[argidx],"control")) {
-         ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl);
-         fprintf(stdout,"ctrl.start %d\n",ctrl.start);
-         fprintf(stdout,"ctrl.latency %d (0=64 .. 7=8192)\n",ctrl.latency);
-         fprintf(stdout,"ctrl.master %d\n",ctrl.master);
-         fprintf(stdout,"ctrl.ie %d\n",ctrl.ie);
-         fprintf(stdout,"ctrl.sr48 %d\n",ctrl.sr48);
-         fprintf(stdout,"ctrl.spare %d\n",ctrl.spare);
-         fprintf(stdout,"ctrl.doublespeed %d\n",ctrl.doublespeed);
-         fprintf(stdout,"ctrl.pro %d\n",ctrl.pro);
-         fprintf(stdout,"ctrl.emphasis %d\n",ctrl.emphasis);
-         fprintf(stdout,"ctrl.dolby %d\n",ctrl.dolby);
-         fprintf(stdout,"ctrl.opt_out %d\n",ctrl.opt_out);
-         fprintf(stdout,"ctrl.wordclock %d\n",ctrl.wordclock);
-         fprintf(stdout,"ctrl.spdif_in %d (0=optical,1=coax,2=intern)\n",ctrl.spdif_in);
-         fprintf(stdout,"ctrl.sync_ref %d (0=ADAT1,1=ADAT2,2=ADAT3,3=SPDIF)\n",ctrl.sync_ref);
-         fprintf(stdout,"ctrl.spdif_reset %d\n",ctrl.spdif_reset);
-         fprintf(stdout,"ctrl.spdif_select %d\n",ctrl.spdif_select);
-         fprintf(stdout,"ctrl.spdif_clock %d\n",ctrl.spdif_clock);
-         fprintf(stdout,"ctrl.spdif_write %d\n",ctrl.spdif_write);
-         fprintf(stdout,"ctrl.adat1_cd %d\n",ctrl.adat1_cd);
-         exit (0);
-     }
-
-     if (!strcmp(argv[argidx],"mix")) {
-         rme_mixer mix;
-         int i;
-
-         for (i=0; i<4; i++) {
-              mix.devnr = i;
-              ioctl(fd,SOUND_MIXER_PRIVATE1,&mix);
-              if (mix.devnr == i) {
-                   fprintf(stdout,"devnr %d\n",mix.devnr);
-                   fprintf(stdout,"mix.i_offset %2d (0-25)\n",mix.i_offset);
-                   fprintf(stdout,"mix.o_offset %2d (0-25)\n",mix.o_offset);
-              }
-         }
-         exit (0);
-     }
-
-/* the control flags */
-
-     if (argc < argidx+2)
-         usage();
-
-     if (!strcmp(argv[argidx],"master")) {
-         int val = atoi(argv[argidx+1]);
-         ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl);
-         printf("master = %d\n",val);
-         ctrl.master = val;
-         ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl);
-         exit (0);
-     }
-
-     if (!strcmp(argv[argidx],"pro")) {
-         int val = atoi(argv[argidx+1]);
-         ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl);
-         printf("pro = %d\n",val);
-         ctrl.pro = val;
-         ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl);
-         exit (0);
-     }
-
-     if (!strcmp(argv[argidx],"emphasis")) {
-         int val = atoi(argv[argidx+1]);
-         ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl);
-         printf("emphasis = %d\n",val);
-         ctrl.emphasis = val;
-         ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl);
-         exit (0);
-     }
-
-     if (!strcmp(argv[argidx],"dolby")) {
-         int val = atoi(argv[argidx+1]);
-         ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl);
-         printf("dolby = %d\n",val);
-         ctrl.dolby = val;
-         ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl);
-         exit (0);
-     }
-
-     if (!strcmp(argv[argidx],"optout")) {
-         int val = atoi(argv[argidx+1]);
-         ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl);
-         printf("optout = %d\n",val);
-         ctrl.opt_out = val;
-         ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl);
-         exit (0);
-     }
-
-     if (!strcmp(argv[argidx],"wordclock")) {
-         int val = atoi(argv[argidx+1]);
-         ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl);
-         printf("wordclock = %d\n",val);
-         ctrl.wordclock = val;
-         ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl);
-         exit (0);
-     }
-
-     if (!strcmp(argv[argidx],"spdifin")) {
-         int val = atoi(argv[argidx+1]);
-         ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl);
-         printf("spdifin = %d\n",val);
-         ctrl.spdif_in = val;
-         ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl);
-         exit (0);
-     }
-
-     if (!strcmp(argv[argidx],"syncref")) {
-         int val = atoi(argv[argidx+1]);
-         ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl);
-         printf("syncref = %d\n",val);
-         ctrl.sync_ref = val;
-         ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl);
-         exit (0);
-     }
-
-     if (!strcmp(argv[argidx],"adat1cd")) {
-         int val = atoi(argv[argidx+1]);
-         ioctl(fd,SOUND_MIXER_PRIVATE3,&ctrl);
-         printf("adat1cd = %d\n",val);
-         ctrl.adat1_cd = val;
-         ioctl(fdwr,SOUND_MIXER_PRIVATE3,&ctrl);
-         exit (0);
-     }
-
-/* setting offset */
-
-     if (argc < argidx+4)
-         usage();
-
-     if (!strcmp(argv[argidx],"offset")) {
-         rme_mixer mix;
-
-         mix.devnr = atoi(argv[argidx+1]);
-
-         mix.i_offset = atoi(argv[argidx+2]);
-         mix.o_offset = atoi(argv[argidx+3]);
-         ioctl(fdwr,SOUND_MIXER_PRIVATE1,&mix);
-         fprintf(stdout,"devnr %d\n",mix.devnr);
-         fprintf(stdout,"mix.i_offset to %d\n",mix.i_offset);
-         fprintf(stdout,"mix.o_offset to %d\n",mix.o_offset);
-         exit (0);
-     }
-
-     usage();
-     exit (0); /* to avoid warning */
-}
-
-
----------------------------- <snip> --------------------------------
-#!/usr/bin/wish
-
-# xrmectrl
-# (C) 2000 Guenter Geiger <geiger@debian.org>
-# HP20020201 - Heiko Purnhagen <purnhage@tnt.uni-hannover.de>
-
-#set defaults "-relief ridged"
-set CTRLPROG "./rmectrl"
-if {$argc} {
-    set CTRLPROG "$CTRLPROG $argv"
-}
-puts "CTRLPROG $CTRLPROG"
-
-frame .butts
-button .butts.exit -text "Exit" -command "exit" -relief ridge
-#button .butts.state -text "State" -command "get_all"
-
-pack .butts.exit -side left
-pack .butts -side bottom
-
-
-#
-# STATUS
-#
-
-frame .status
-
-# Sampling Rate
-
-frame .status.sr
-label .status.sr.text -text "Sampling Rate" -justify left
-radiobutton .status.sr.441 -selectcolor red -text "44.1 kHz" -width 10 -anchor nw -variable srate -value 44100 -font times
-radiobutton .status.sr.480 -selectcolor red -text "48 kHz" -width 10 -anchor nw -variable srate -value 48000 -font times
-radiobutton .status.sr.882 -selectcolor red -text "88.2 kHz" -width 10 -anchor nw -variable srate -value 88200 -font times
-radiobutton .status.sr.960 -selectcolor red -text "96 kHz" -width 10 -anchor nw  -variable srate -value 96000 -font times
-
-pack .status.sr.text .status.sr.441 .status.sr.480 .status.sr.882 .status.sr.960 -side top -padx 3
-
-# Lock
-
-frame .status.lock
-label .status.lock.text -text "Lock" -justify left
-checkbutton .status.lock.adat1 -selectcolor red -text "ADAT1" -anchor nw -width 10 -variable adatlock1 -font times
-checkbutton .status.lock.adat2 -selectcolor red -text "ADAT2" -anchor nw -width 10 -variable adatlock2 -font times
-checkbutton .status.lock.adat3 -selectcolor red -text "ADAT3" -anchor nw -width 10 -variable adatlock3 -font times
-
-pack .status.lock.text .status.lock.adat1 .status.lock.adat2 .status.lock.adat3 -side top -padx 3 
-
-# Sync
-
-frame .status.sync
-label .status.sync.text -text "Sync" -justify left
-checkbutton .status.sync.adat1 -selectcolor red -text "ADAT1" -anchor nw -width 10 -variable adatsync1 -font times
-checkbutton .status.sync.adat2 -selectcolor red -text "ADAT2" -anchor nw -width 10 -variable adatsync2 -font times
-checkbutton .status.sync.adat3 -selectcolor red -text "ADAT3" -anchor nw -width 10 -variable adatsync3 -font times
-
-pack .status.sync.text .status.sync.adat1 .status.sync.adat2 .status.sync.adat3 -side top -padx 3 
-
-# Timecode
-
-frame .status.tc
-label .status.tc.text -text "Timecode" -justify left
-checkbutton .status.tc.busy -selectcolor red -text "busy" -anchor nw -width 10 -variable tcbusy -font times
-checkbutton .status.tc.out -selectcolor red -text "out" -anchor nw -width 10 -variable tcout -font times
-checkbutton .status.tc.valid -selectcolor red -text "valid" -anchor nw -width 10 -variable tcvalid -font times
-
-pack .status.tc.text .status.tc.busy .status.tc.out .status.tc.valid -side top -padx 3 
-
-# SPDIF In
-
-frame .status.spdif
-label .status.spdif.text -text "SPDIF In" -justify left
-label .status.spdif.sr -text "--.- kHz" -anchor n -width 10 -font times
-checkbutton .status.spdif.error -selectcolor red -text "Input Lock" -anchor nw -width 10 -variable spdiferr -font times
-
-pack .status.spdif.text .status.spdif.sr .status.spdif.error -side top -padx 3 
-
-pack .status.sr .status.lock .status.sync .status.tc .status.spdif -side left -fill x -anchor n -expand 1
-
-
-#
-# CONTROL 
-#
-
-proc setprof {} {
-    global CTRLPROG
-    global spprof
-    exec $CTRLPROG pro $spprof
-}
-
-proc setemph {} {
-    global CTRLPROG
-    global spemph
-    exec $CTRLPROG emphasis $spemph
-}
-
-proc setnoaud {} {
-    global CTRLPROG
-    global spnoaud
-    exec $CTRLPROG dolby $spnoaud
-}
-
-proc setoptical {} {
-    global CTRLPROG
-    global spoptical
-    exec $CTRLPROG optout $spoptical
-}
-
-proc setspdifin {} {
-    global CTRLPROG
-    global spdifin
-    exec $CTRLPROG spdifin [expr $spdifin - 1]
-}
-
-proc setsyncsource {} {
-    global CTRLPROG
-    global syncsource
-    exec $CTRLPROG syncref [expr $syncsource -1]
-}
-
-
-proc setmaster {} {
-    global CTRLPROG
-    global master
-    exec $CTRLPROG master $master
-}
-
-proc setwordclock {} {
-    global CTRLPROG
-    global wordclock
-    exec $CTRLPROG wordclock $wordclock
-}
-
-proc setadat1cd {} {
-    global CTRLPROG
-    global adat1cd
-    exec $CTRLPROG adat1cd $adat1cd
-}
-
-
-frame .control
-
-# SPDIF In & SPDIF Out
-
-
-frame .control.spdif
-
-frame .control.spdif.in
-label .control.spdif.in.text -text "SPDIF In" -justify left
-radiobutton .control.spdif.in.input1 -text "Optical" -anchor nw -width 13 -variable spdifin -value 1 -command setspdifin -selectcolor blue -font times
-radiobutton .control.spdif.in.input2 -text "Coaxial" -anchor nw -width 13 -variable spdifin -value 2 -command setspdifin -selectcolor blue -font times
-radiobutton .control.spdif.in.input3 -text "Intern " -anchor nw -width 13 -variable spdifin -command setspdifin -value 3 -selectcolor blue -font times
-
-checkbutton .control.spdif.in.adat1cd -text "ADAT1 Intern" -anchor nw -width 13 -variable adat1cd -command setadat1cd -selectcolor blue -font times
-
-pack .control.spdif.in.text .control.spdif.in.input1 .control.spdif.in.input2 .control.spdif.in.input3 .control.spdif.in.adat1cd
-
-label .control.spdif.space
-
-frame .control.spdif.out
-label .control.spdif.out.text -text "SPDIF Out" -justify left
-checkbutton .control.spdif.out.pro -text "Professional" -anchor nw -width 13 -variable spprof -command setprof -selectcolor blue -font times
-checkbutton .control.spdif.out.emphasis -text "Emphasis" -anchor nw -width 13 -variable spemph -command setemph -selectcolor blue -font times
-checkbutton .control.spdif.out.dolby -text "NoAudio" -anchor nw -width 13 -variable spnoaud -command setnoaud -selectcolor blue -font times
-checkbutton .control.spdif.out.optout -text "Optical Out" -anchor nw -width 13 -variable spoptical -command setoptical -selectcolor blue -font times
-
-pack .control.spdif.out.optout .control.spdif.out.dolby .control.spdif.out.emphasis .control.spdif.out.pro .control.spdif.out.text -side bottom
-
-pack .control.spdif.in .control.spdif.space .control.spdif.out -side top -fill y -padx 3 -expand 1
-
-# Sync Mode & Sync Source
-
-frame .control.sync
-frame .control.sync.mode
-label .control.sync.mode.text -text "Sync Mode" -justify left
-checkbutton .control.sync.mode.master -text "Master" -anchor nw -width 13 -variable master -command setmaster -selectcolor blue -font times
-checkbutton .control.sync.mode.wc -text "Wordclock" -anchor nw -width 13 -variable wordclock -command setwordclock -selectcolor blue -font times
-
-pack .control.sync.mode.text .control.sync.mode.master .control.sync.mode.wc
-
-label .control.sync.space
-
-frame .control.sync.src
-label .control.sync.src.text -text "Sync Source" -justify left
-radiobutton .control.sync.src.input1 -text "ADAT1" -anchor nw -width 13 -variable syncsource -value 1 -command setsyncsource -selectcolor blue -font times
-radiobutton .control.sync.src.input2 -text "ADAT2" -anchor nw -width 13 -variable syncsource -value 2 -command setsyncsource -selectcolor blue -font times
-radiobutton .control.sync.src.input3 -text "ADAT3" -anchor nw -width 13 -variable syncsource -command setsyncsource -value 3 -selectcolor blue -font times
-radiobutton .control.sync.src.input4 -text "SPDIF" -anchor nw -width 13 -variable syncsource -command setsyncsource -value 4 -selectcolor blue -font times
-
-pack .control.sync.src.input4 .control.sync.src.input3 .control.sync.src.input2 .control.sync.src.input1 .control.sync.src.text -side bottom
-
-pack .control.sync.mode .control.sync.space .control.sync.src -side top -fill y -padx 3 -expand 1
-
-label .control.space -text "" -width 10
-
-# Buffer Size
-
-frame .control.buf
-label .control.buf.text -text "Buffer Size (Latency)" -justify left
-radiobutton .control.buf.b1 -selectcolor red -text "64 (1.5 ms)" -width 13 -anchor nw -variable ssrate -value 1 -font times
-radiobutton .control.buf.b2 -selectcolor red -text "128 (3 ms)" -width 13 -anchor nw -variable ssrate -value 2 -font times
-radiobutton .control.buf.b3 -selectcolor red -text "256 (6 ms)" -width 13 -anchor nw -variable ssrate -value 3 -font times
-radiobutton .control.buf.b4 -selectcolor red -text "512 (12 ms)" -width 13 -anchor nw -variable ssrate -value 4 -font times
-radiobutton .control.buf.b5 -selectcolor red -text "1024 (23 ms)" -width 13 -anchor nw -variable ssrate -value 5 -font times
-radiobutton .control.buf.b6 -selectcolor red -text "2048 (46 ms)" -width 13 -anchor nw -variable ssrate -value 6 -font times
-radiobutton .control.buf.b7 -selectcolor red -text "4096 (93 ms)" -width 13 -anchor nw -variable ssrate -value 7 -font times
-radiobutton .control.buf.b8 -selectcolor red -text "8192 (186 ms)" -width 13 -anchor nw -variable ssrate -value 8 -font times
-
-pack .control.buf.text .control.buf.b1 .control.buf.b2 .control.buf.b3 .control.buf.b4 .control.buf.b5 .control.buf.b6 .control.buf.b7 .control.buf.b8 -side top -padx 3 
-
-# Offset
-
-frame .control.offset
-
-frame .control.offset.in
-label .control.offset.in.text -text "Offset In" -justify left
-label .control.offset.in.off0 -text "dev\#0: -" -anchor nw -width 10 -font times
-label .control.offset.in.off1 -text "dev\#1: -" -anchor nw -width 10 -font times
-label .control.offset.in.off2 -text "dev\#2: -" -anchor nw -width 10 -font times
-label .control.offset.in.off3 -text "dev\#3: -" -anchor nw -width 10 -font times
-
-pack .control.offset.in.text .control.offset.in.off0 .control.offset.in.off1 .control.offset.in.off2 .control.offset.in.off3
-
-label .control.offset.space
-
-frame .control.offset.out
-label .control.offset.out.text -text "Offset Out" -justify left
-label .control.offset.out.off0 -text "dev\#0: -" -anchor nw -width 10 -font times
-label .control.offset.out.off1 -text "dev\#1: -" -anchor nw -width 10 -font times
-label .control.offset.out.off2 -text "dev\#2: -" -anchor nw -width 10 -font times
-label .control.offset.out.off3 -text "dev\#3: -" -anchor nw -width 10 -font times
-
-pack .control.offset.out.off3 .control.offset.out.off2 .control.offset.out.off1 .control.offset.out.off0 .control.offset.out.text -side bottom
-
-pack .control.offset.in .control.offset.space .control.offset.out -side top -fill y -padx 3 -expand 1
-
-
-pack .control.spdif .control.sync .control.space .control.buf .control.offset -side left -fill both -anchor n -expand 1
-
-
-label .statustext -text Status -justify center -relief ridge
-label .controltext -text Control -justify center -relief ridge
-
-label .statusspace
-label .controlspace
-
-pack .statustext .status .statusspace .controltext .control .controlspace -side top -anchor nw -fill both -expand 1
-
-
-proc get_bit {output sstr} {
-    set idx1 [string last [concat $sstr 1] $output]
-    set idx1 [expr $idx1 != -1]
-    return $idx1
-}
-
-proc get_val {output sstr} {
-    set val [string wordend $output [string last $sstr $output]] 
-    set val [string range $output $val [expr $val+1]]
-    return $val
-}
-
-proc get_val2 {output sstr} {
-    set val [string wordend $output [string first $sstr $output]] 
-    set val [string range $output $val [expr $val+2]]
-    return $val
-}
-
-proc get_control {} {
-    global spprof
-    global spemph
-    global spnoaud
-    global spoptical
-    global spdifin
-    global ssrate
-    global master
-    global wordclock
-    global syncsource
-    global CTRLPROG
-
-    set f [open "| $CTRLPROG control" r+]
-    set ooo [read $f 1000]
-    close $f
-#    puts $ooo
-
-    set spprof [ get_bit $ooo "pro"]
-    set spemph [ get_bit $ooo "emphasis"]
-    set spnoaud [ get_bit $ooo "dolby"]
-    set spoptical [ get_bit $ooo "opt_out"]
-    set spdifin [ expr [ get_val $ooo "spdif_in"] + 1]
-    set ssrate [ expr [ get_val $ooo "latency"] + 1]
-    set master [ expr [ get_val $ooo "master"]]
-    set wordclock [ expr [ get_val $ooo "wordclock"]]
-    set syncsource [ expr [ get_val $ooo "sync_ref"] + 1]
-}
-
-proc get_status {} {
-    global srate
-    global ctrlcom
-
-    global adatlock1
-    global adatlock2
-    global adatlock3
-
-    global adatsync1
-    global adatsync2
-    global adatsync3
-
-    global tcbusy
-    global tcout
-    global tcvalid
-
-    global spdiferr
-    global crystal
-    global .status.spdif.text
-    global CTRLPROG
-
-
-    set f [open "| $CTRLPROG status" r+]
-    set ooo [read $f 1000]
-    close $f
-#    puts $ooo
-
-# samplerate
-
-    set idx1 [string last "sr48 1" $ooo]
-    set idx2 [string last "doublespeed 1" $ooo]
-    if {$idx1 >= 0} {
-       set fact1 48000
-    } else {
-       set fact1 44100
-    }
-
-    if {$idx2 >= 0} {
-       set fact2 2
-    } else {
-       set fact2 1
-    }
-    set srate [expr $fact1 * $fact2]
-#   ADAT lock
-
-    set val [get_val $ooo lockmask]
-    set adatlock1 0
-    set adatlock2 0
-    set adatlock3 0
-    if {[expr $val & 1]} {
-       set adatlock3 1
-    }
-    if {[expr $val & 2]} {
-       set adatlock2 1
-    }
-    if {[expr $val & 4]} {
-       set adatlock1 1
-    }
-
-#  ADAT sync
-    set val [get_val $ooo syncmask]
-    set adatsync1 0
-    set adatsync2 0
-    set adatsync3 0
-
-    if {[expr $val & 1]} {
-       set adatsync3 1
-    }
-    if {[expr $val & 2]} {
-       set adatsync2 1
-    }
-    if {[expr $val & 4]} {
-       set adatsync1 1
-    }
-
-# TC busy
-
-    set tcbusy [get_bit $ooo "busy"]
-    set tcout [get_bit $ooo "out"]
-    set tcvalid [get_bit $ooo "valid"]
-    set spdiferr [expr [get_bit $ooo "spdif_error"] == 0]
-
-#  000=64kHz, 100=88.2kHz, 011=96kHz
-#  111=32kHz, 110=44.1kHz, 101=48kHz
-
-    set val [get_val $ooo crystalrate]
-
-    set crystal "--.- kHz"
-    if {$val == 0} {
-        set crystal "64 kHz"
-    }
-    if {$val == 4} {
-        set crystal "88.2 kHz"
-    }
-    if {$val == 3} {
-        set crystal "96 kHz"
-    }
-    if {$val == 7} {
-        set crystal "32 kHz"
-    }
-    if {$val == 6} {
-        set crystal "44.1 kHz"
-    }
-    if {$val == 5} {
-        set crystal "48 kHz"
-    }
-    .status.spdif.sr configure -text $crystal
-}
-
-proc get_offset {} {
-    global inoffset
-    global outoffset
-    global CTRLPROG
-
-    set f [open "| $CTRLPROG mix" r+]
-    set ooo [read $f 1000]
-    close $f
-#    puts $ooo
-
-    if { [string match "*devnr*" $ooo] } {
-       set ooo [string range $ooo [string wordend $ooo [string first devnr $ooo]] end]
-       set val [get_val2 $ooo i_offset]
-       .control.offset.in.off0 configure -text "dev\#0: $val"
-       set val [get_val2 $ooo o_offset]
-       .control.offset.out.off0 configure -text "dev\#0: $val"
-    } else {
-       .control.offset.in.off0 configure -text "dev\#0: -"
-       .control.offset.out.off0 configure -text "dev\#0: -"
-    }
-    if { [string match "*devnr*" $ooo] } {
-       set ooo [string range $ooo [string wordend $ooo [string first devnr $ooo]] end]
-       set val [get_val2 $ooo i_offset]
-       .control.offset.in.off1 configure -text "dev\#1: $val"
-       set val [get_val2 $ooo o_offset]
-       .control.offset.out.off1 configure -text "dev\#1: $val"
-    } else {
-       .control.offset.in.off1 configure -text "dev\#1: -"
-       .control.offset.out.off1 configure -text "dev\#1: -"
-    }
-    if { [string match "*devnr*" $ooo] } {
-       set ooo [string range $ooo [string wordend $ooo [string first devnr $ooo]] end]
-       set val [get_val2 $ooo i_offset]
-       .control.offset.in.off2 configure -text "dev\#2: $val"
-       set val [get_val2 $ooo o_offset]
-       .control.offset.out.off2 configure -text "dev\#2: $val"
-    } else {
-       .control.offset.in.off2 configure -text "dev\#2: -"
-       .control.offset.out.off2 configure -text "dev\#2: -"
-    }
-    if { [string match "*devnr*" $ooo] } {
-       set ooo [string range $ooo [string wordend $ooo [string first devnr $ooo]] end]
-       set val [get_val2 $ooo i_offset]
-       .control.offset.in.off3 configure -text "dev\#3: $val"
-       set val [get_val2 $ooo o_offset]
-       .control.offset.out.off3 configure -text "dev\#3: $val"
-    } else {
-       .control.offset.in.off3 configure -text "dev\#3: -"
-       .control.offset.out.off3 configure -text "dev\#3: -"
-    }
-}
-
-
-proc get_all {} {
-get_status
-get_control
-get_offset
-}
-
-# main
-while {1} {
-  after 200
-  get_all
-  update
-}
diff --git a/Documentation/sound/oss/solo1 b/Documentation/sound/oss/solo1
deleted file mode 100644 (file)
index 95c4c83..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-Recording
----------
-
-Recording does not work on the author's card, but there
-is at least one report of it working on later silicon.
-The chip behaves differently than described in the data sheet,
-likely due to a chip bug. Working around this would require
-the help of ESS (for example by publishing an errata sheet),
-but ESS has not done so far.
-
-Also, the chip only supports 24 bit addresses for recording,
-which means it cannot work on some Alpha mainboards.
-
-
-/proc/sound, /dev/sndstat
--------------------------
-
-/proc/sound and /dev/sndstat is not supported by the
-driver. To find out whether the driver succeeded loading,
-check the kernel log (dmesg).
-
-
-ALaw/uLaw sample formats
-------------------------
-
-This driver does not support the ALaw/uLaw sample formats.
-ALaw is the default mode when opening a sound device
-using OSS/Free. The reason for the lack of support is
-that the hardware does not support these formats, and adding
-conversion routines to the kernel would lead to very ugly
-code in the presence of the mmap interface to the driver.
-And since xquake uses mmap, mmap is considered important :-)
-and no sane application uses ALaw/uLaw these days anyway.
-In short, playing a Sun .au file as follows:
-
-cat my_file.au > /dev/dsp
-
-does not work. Instead, you may use the play script from
-Chris Bagwell's sox-12.14 package (or later, available from the URL
-below) to play many different audio file formats.
-The script automatically determines the audio format
-and does do audio conversions if necessary.
-http://home.sprynet.com/sprynet/cbagwell/projects.html
-
-
-Blocking vs. nonblocking IO
----------------------------
-
-Unlike OSS/Free this driver honours the O_NONBLOCK file flag
-not only during open, but also during read and write.
-This is an effort to make the sound driver interface more
-regular. Timidity has problems with this; a patch
-is available from http://www.ife.ee.ethz.ch/~sailer/linux/pciaudio.html.
-(Timidity patched will also run on OSS/Free).
-
-
-MIDI UART
----------
-
-The driver supports a simple MIDI UART interface, with
-no ioctl's supported.
-
-
-MIDI synthesizer
-----------------
-
-The card has an OPL compatible FM synthesizer.
-
-Thomas Sailer
-t.sailer@alumni.ethz.ch
diff --git a/Documentation/sound/oss/sonicvibes b/Documentation/sound/oss/sonicvibes
deleted file mode 100644 (file)
index 84dee2e..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/proc/sound, /dev/sndstat
--------------------------
-
-/proc/sound and /dev/sndstat is not supported by the
-driver. To find out whether the driver succeeded loading,
-check the kernel log (dmesg).
-
-
-ALaw/uLaw sample formats
-------------------------
-
-This driver does not support the ALaw/uLaw sample formats.
-ALaw is the default mode when opening a sound device
-using OSS/Free. The reason for the lack of support is
-that the hardware does not support these formats, and adding
-conversion routines to the kernel would lead to very ugly
-code in the presence of the mmap interface to the driver.
-And since xquake uses mmap, mmap is considered important :-)
-and no sane application uses ALaw/uLaw these days anyway.
-In short, playing a Sun .au file as follows:
-
-cat my_file.au > /dev/dsp
-
-does not work. Instead, you may use the play script from
-Chris Bagwell's sox-12.14 package (available from the URL
-below) to play many different audio file formats.
-The script automatically determines the audio format
-and does do audio conversions if necessary.
-http://home.sprynet.com/sprynet/cbagwell/projects.html
-
-
-Blocking vs. nonblocking IO
----------------------------
-
-Unlike OSS/Free this driver honours the O_NONBLOCK file flag
-not only during open, but also during read and write.
-This is an effort to make the sound driver interface more
-regular. Timidity has problems with this; a patch
-is available from http://www.ife.ee.ethz.ch/~sailer/linux/pciaudio.html.
-(Timidity patched will also run on OSS/Free).
-
-
-MIDI UART
----------
-
-The driver supports a simple MIDI UART interface, with
-no ioctl's supported.
-
-
-MIDI synthesizer
-----------------
-
-The card both has an OPL compatible FM synthesizer as well as
-a wavetable synthesizer.
-
-I haven't managed so far to get the OPL synth running.
-
-Using the wavetable synthesizer requires allocating
-1-4MB of physically contiguous memory, which isn't possible
-currently on Linux without ugly hacks like the bigphysarea
-patch. Therefore, the driver doesn't support wavetable
-synthesis.
-
-
-No support from S3
-------------------
-
-I do not get any support from S3. Therefore, the driver
-still has many problems. For example, although the manual
-states that the chip should be able to access the sample
-buffer anywhere in 32bit address space, I haven't managed to
-get it working with buffers above 16M. Therefore, the card
-has the same disadvantages as ISA soundcards.
-
-Given that the card is also very noisy, and if you haven't
-already bought it, you should strongly opt for one of the
-comparatively priced Ensoniq products.
-
-
-Thomas Sailer
-t.sailer@alumni.ethz.ch
index fb10f71..8c35b3c 100644 (file)
@@ -1900,11 +1900,6 @@ M:       rroesler@syskonnect.de
 W:     http://www.syskonnect.com
 S:     Supported
 
-MAESTRO PCI SOUND DRIVERS
-P:     Zach Brown
-M:     zab@zabbo.net
-S:     Odd Fixes
-
 MAN-PAGES: MANUAL PAGES FOR LINUX -- Sections 2, 3, 4, 5, and 7
 P: Michael Kerrisk
 M: mtk-manpages@gmx.net
@@ -3402,12 +3397,6 @@ M:       Henk.Vergonet@gmail.com
 L:     usbb2k-api-dev@nongnu.org
 S:     Maintained
 
-YMFPCI YAMAHA PCI SOUND (Use ALSA instead)
-P:     Pete Zaitcev
-M:     zaitcev@yahoo.com
-L:     linux-kernel@vger.kernel.org
-S:     Obsolete
-
 Z8530 DRIVER FOR AX.25
 P:     Joerg Reuter
 M:     jreuter@yaina.de
index 9e8bcb5..7d564b6 100644 (file)
@@ -160,7 +160,6 @@ header-y += video_decoder.h
 header-y += video_encoder.h
 header-y += videotext.h
 header-y += vt.h
-header-y += wavefront.h
 header-y += wireless.h
 header-y += xattr.h
 header-y += x25.h
index 2ed2fd8..22eb936 100644 (file)
@@ -331,8 +331,6 @@ extern int ac97_read_proc (char *page_out, char **start, off_t off,
 extern int ac97_probe_codec(struct ac97_codec *);
 extern unsigned int ac97_set_adc_rate(struct ac97_codec *codec, unsigned int rate);
 extern unsigned int ac97_set_dac_rate(struct ac97_codec *codec, unsigned int rate);
-extern int ac97_save_state(struct ac97_codec *codec);
-extern int ac97_restore_state(struct ac97_codec *codec);
 
 extern struct ac97_codec *ac97_alloc_codec(void);
 extern void ac97_release_codec(struct ac97_codec *codec);
@@ -346,9 +344,6 @@ struct ac97_driver {
        void (*remove) (struct ac97_codec *codec, struct ac97_driver *driver);
 };
 
-extern int ac97_register_driver(struct ac97_driver *driver);
-extern void ac97_unregister_driver(struct ac97_driver *driver);
-
 /* quirk types */
 enum {
        AC97_TUNE_DEFAULT = -1, /* use default from quirk list (not valid in list) */
index f63d834..9e2a94f 100644 (file)
@@ -35,10 +35,8 @@ extern int register_sound_special_device(const struct file_operations *fops, int
 extern int register_sound_mixer(const struct file_operations *fops, int dev);
 extern int register_sound_midi(const struct file_operations *fops, int dev);
 extern int register_sound_dsp(const struct file_operations *fops, int dev);
-extern int register_sound_synth(const struct file_operations *fops, int dev);
 
 extern void unregister_sound_special(int unit);
 extern void unregister_sound_mixer(int unit);
 extern void unregister_sound_midi(int unit);
 extern void unregister_sound_dsp(int unit);
-extern void unregister_sound_synth(int unit);
diff --git a/include/linux/wavefront.h b/include/linux/wavefront.h
deleted file mode 100644 (file)
index 51ab3c9..0000000
+++ /dev/null
@@ -1,675 +0,0 @@
-#ifndef __wavefront_h__
-#define __wavefront_h__
-
-/* WaveFront header file.
- *   
- * Copyright (C) by Paul Barton-Davis 1998
- *
- * This program is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
- * Version 2 (June 1991). See the "COPYING" file distributed with this software
- * for more info.  
- */
-
-#if (!defined(__GNUC__) && !defined(__GNUG__))
-
-     You will not be able to compile this file correctly without gcc, because
-     it is necessary to pack the "wavefront_alias" structure to a size
-     of 22 bytes, corresponding to 16-bit alignment (as would have been
-     the case on the original platform, MS-DOS). If this is not done,
-     then WavePatch-format files cannot be read/written correctly.
-     The method used to do this here ("__attribute__((packed)") is
-     completely compiler dependent.
-     
-     All other wavefront_* types end up aligned to 32 bit values and
-     still have the same (correct) size.
-
-#else
-
-     /* However, note that as of G++ 2.7.3.2, g++ was unable to
-       correctly parse *type* __attribute__ tags. It will do the
-       right thing if we use the "packed" attribute on each struct
-       member, which has the same semantics anyway. 
-     */
-
-#endif /* __GNUC__ */
-
-/***************************** WARNING ********************************
-  PLEASE DO NOT MODIFY THIS FILE IN ANY WAY THAT AFFECTS ITS ABILITY TO 
-  BE USED WITH EITHER C *OR* C++.
- **********************************************************************/
-
-#ifndef NUM_MIDIKEYS 
-#define NUM_MIDIKEYS 128
-#endif  /* NUM_MIDIKEYS */
-
-#ifndef NUM_MIDICHANNELS
-#define NUM_MIDICHANNELS 16
-#endif  /* NUM_MIDICHANNELS */
-
-/* These are very useful/important. the original wavefront interface
-   was developed on a 16 bit system, where sizeof(int) = 2
-   bytes. Defining things like this makes the code much more portable, and
-   easier to understand without having to toggle back and forth
-   between a 16-bit view of the world and a 32-bit one. 
- */   
-
-typedef short INT16;
-typedef unsigned short UINT16;
-typedef int INT32;
-typedef unsigned int UINT32;
-typedef char CHAR8;
-typedef unsigned char UCHAR8;
-
-/* Pseudo-commands not part of the WaveFront command set.
-   These are used for various driver controls and direct
-   hardware control.
- */
-
-#define WFC_DEBUG_DRIVER                0
-#define WFC_FX_IOCTL                    1
-#define WFC_PATCH_STATUS                2
-#define WFC_PROGRAM_STATUS              3
-#define WFC_SAMPLE_STATUS               4
-#define WFC_DISABLE_INTERRUPTS          5
-#define WFC_ENABLE_INTERRUPTS           6
-#define WFC_INTERRUPT_STATUS            7
-#define WFC_ROMSAMPLES_RDONLY           8
-#define WFC_IDENTIFY_SLOT_TYPE          9
-
-/* Wavefront synth commands
- */
-
-#define WFC_DOWNLOAD_SAMPLE            0x80
-#define WFC_DOWNLOAD_BLOCK             0x81
-#define WFC_DOWNLOAD_MULTISAMPLE       0x82
-#define WFC_DOWNLOAD_SAMPLE_ALIAS      0x83
-#define WFC_DELETE_SAMPLE              0x84
-#define WFC_REPORT_FREE_MEMORY         0x85
-#define WFC_DOWNLOAD_PATCH             0x86
-#define WFC_DOWNLOAD_PROGRAM           0x87
-#define WFC_SET_SYNTHVOL               0x89
-#define WFC_SET_NVOICES                        0x8B
-#define WFC_DOWNLOAD_DRUM              0x90
-#define WFC_GET_SYNTHVOL               0x92
-#define WFC_GET_NVOICES                        0x94
-#define WFC_DISABLE_CHANNEL            0x9A
-#define WFC_ENABLE_CHANNEL             0x9B
-#define WFC_MISYNTH_OFF                        0x9D
-#define WFC_MISYNTH_ON                 0x9E
-#define WFC_FIRMWARE_VERSION           0x9F
-#define WFC_GET_NSAMPLES               0xA0
-#define WFC_DISABLE_DRUM_PROGRAM       0xA2
-#define WFC_UPLOAD_PATCH               0xA3
-#define WFC_UPLOAD_PROGRAM             0xA4
-#define WFC_SET_TUNING                 0xA6
-#define WFC_GET_TUNING                 0xA7
-#define WFC_VMIDI_ON                   0xA8
-#define WFC_VMIDI_OFF                  0xA9
-#define WFC_MIDI_STATUS                        0xAA
-#define WFC_GET_CHANNEL_STATUS         0xAB
-#define WFC_DOWNLOAD_SAMPLE_HEADER     0xAC
-#define WFC_UPLOAD_SAMPLE_HEADER       0xAD
-#define WFC_UPLOAD_MULTISAMPLE         0xAE
-#define WFC_UPLOAD_SAMPLE_ALIAS                0xAF
-#define WFC_IDENTIFY_SAMPLE_TYPE       0xB0
-#define WFC_DOWNLOAD_EDRUM_PROGRAM     0xB1
-#define WFC_UPLOAD_EDRUM_PROGRAM       0xB2
-#define WFC_SET_EDRUM_CHANNEL          0xB3
-#define WFC_INSTOUT_LEVELS             0xB4
-#define WFC_PEAKOUT_LEVELS             0xB5
-#define WFC_REPORT_CHANNEL_PROGRAMS    0xB6
-#define WFC_HARDWARE_VERSION           0xCF
-#define WFC_UPLOAD_SAMPLE_PARAMS       0xD7
-#define WFC_DOWNLOAD_OS                        0xF1
-#define WFC_NOOP                        0xFF
-
-#define WF_MAX_SAMPLE   512
-#define WF_MAX_PATCH    256
-#define WF_MAX_PROGRAM  128
-
-#define WF_SECTION_MAX  44   /* longest OS section length */
-
-/* # of bytes we send to the board when sending it various kinds of
-   substantive data, such as samples, patches and programs.
-*/
-
-#define WF_PROGRAM_BYTES 32
-#define WF_PATCH_BYTES 132
-#define WF_SAMPLE_BYTES 27
-#define WF_SAMPLE_HDR_BYTES 25
-#define WF_ALIAS_BYTES 25
-#define WF_DRUM_BYTES 9
-#define WF_MSAMPLE_BYTES 259 /* (MIDI_KEYS * 2) + 3 */
-
-#define WF_ACK     0x80
-#define WF_DMA_ACK 0x81
-
-/* OR-values for MIDI status bits */
-
-#define WF_MIDI_VIRTUAL_ENABLED 0x1
-#define WF_MIDI_VIRTUAL_IS_EXTERNAL 0x2
-#define WF_MIDI_IN_TO_SYNTH_DISABLED 0x4
-
-/* slot indexes for struct address_info: makes code a little more mnemonic */
-
-#define WF_SYNTH_SLOT         0
-#define WF_INTERNAL_MIDI_SLOT 1
-#define WF_EXTERNAL_MIDI_SLOT 2
-
-/* Magic MIDI bytes used to switch I/O streams on the ICS2115 MPU401
-   emulation. Note these NEVER show up in output from the device and
-   should NEVER be used in input unless Virtual MIDI mode has been 
-   disabled. If they do show up as input, the results are unpredictable.
-*/
-
-#define WF_EXTERNAL_SWITCH  0xFD
-#define WF_INTERNAL_SWITCH  0xF9
-
-/* Debugging flags */
-
-#define WF_DEBUG_CMD 0x1
-#define WF_DEBUG_DATA 0x2
-#define WF_DEBUG_LOAD_PATCH 0x4
-#define WF_DEBUG_IO 0x8
-
-/* WavePatch file format stuff */
-
-#define WF_WAVEPATCH_VERSION     120;  /*  Current version number (1.2)  */
-#define WF_MAX_COMMENT           64    /*  Comment length */
-#define WF_NUM_LAYERS            4
-#define WF_NAME_LENGTH           32
-#define WF_SOURCE_LENGTH         260
-
-#define BankFileID     "Bank"
-#define DrumkitFileID  "DrumKit"
-#define ProgramFileID  "Program"
-
-struct wf_envelope
-{
-    UCHAR8 attack_time:7;
-    UCHAR8 Unused1:1;
-
-    UCHAR8 decay1_time:7;
-    UCHAR8 Unused2:1;
-
-    UCHAR8 decay2_time:7;
-    UCHAR8 Unused3:1;
-
-    UCHAR8 sustain_time:7;
-    UCHAR8 Unused4:1;
-
-    UCHAR8 release_time:7;
-    UCHAR8 Unused5:1;
-
-    UCHAR8 release2_time:7;
-    UCHAR8 Unused6:1;
-
-    CHAR8 attack_level;
-    CHAR8 decay1_level;
-    CHAR8 decay2_level;
-    CHAR8 sustain_level;
-    CHAR8 release_level;
-
-    UCHAR8 attack_velocity:7;
-    UCHAR8 Unused7:1;
-
-    UCHAR8 volume_velocity:7;
-    UCHAR8 Unused8:1;
-
-    UCHAR8 keyboard_scaling:7;
-    UCHAR8 Unused9:1;
-};
-typedef struct wf_envelope wavefront_envelope;
-
-struct wf_lfo
-{
-    UCHAR8 sample_number;
-
-    UCHAR8 frequency:7;
-    UCHAR8 Unused1:1;
-
-    UCHAR8 am_src:4;
-    UCHAR8 fm_src:4;
-
-    CHAR8 fm_amount;
-    CHAR8 am_amount;
-    CHAR8 start_level;
-    CHAR8 end_level;
-
-    UCHAR8 ramp_delay:7;
-    UCHAR8 wave_restart:1; /* for LFO2 only */
-
-    UCHAR8 ramp_time:7;
-    UCHAR8 Unused2:1;
-};
-typedef struct wf_lfo wavefront_lfo;
-
-struct wf_patch
-{
-    INT16  frequency_bias;         /*  ** THIS IS IN MOTOROLA FORMAT!! ** */
-
-    UCHAR8 amplitude_bias:7;
-    UCHAR8 Unused1:1;
-
-    UCHAR8 portamento:7;
-    UCHAR8 Unused2:1;
-
-    UCHAR8 sample_number;
-
-    UCHAR8 pitch_bend:4;
-    UCHAR8 sample_msb:1;
-    UCHAR8 Unused3:3;
-
-    UCHAR8 mono:1;
-    UCHAR8 retrigger:1;
-    UCHAR8 nohold:1;
-    UCHAR8 restart:1;
-    UCHAR8 filterconfig:2; /* SDK says "not used" */
-    UCHAR8 reuse:1;
-    UCHAR8 reset_lfo:1;    
-
-    UCHAR8 fm_src2:4;
-    UCHAR8 fm_src1:4;   
-
-    CHAR8 fm_amount1;
-    CHAR8 fm_amount2;
-
-    UCHAR8 am_src:4;
-    UCHAR8 Unused4:4;
-
-    CHAR8 am_amount;
-
-    UCHAR8 fc1_mode:4;
-    UCHAR8 fc2_mode:4;
-
-    CHAR8 fc1_mod_amount;
-    CHAR8 fc1_keyboard_scaling;
-    CHAR8 fc1_bias;
-    CHAR8 fc2_mod_amount;
-    CHAR8 fc2_keyboard_scaling;
-    CHAR8 fc2_bias;
-
-    UCHAR8 randomizer:7;
-    UCHAR8 Unused5:1;
-
-    struct wf_envelope envelope1;
-    struct wf_envelope envelope2;
-    struct wf_lfo lfo1;
-    struct wf_lfo lfo2;
-};
-typedef struct wf_patch wavefront_patch;
-
-struct wf_layer
-{
-    UCHAR8 patch_number;
-
-    UCHAR8 mix_level:7;
-    UCHAR8 mute:1;
-
-    UCHAR8 split_point:7;
-    UCHAR8 play_below:1;
-
-    UCHAR8 pan_mod_src:2;
-    UCHAR8 pan_or_mod:1;
-    UCHAR8 pan:4;
-    UCHAR8 split_type:1;
-};
-typedef struct wf_layer wavefront_layer;
-
-struct wf_program
-{
-    struct wf_layer layer[WF_NUM_LAYERS];
-};
-typedef struct wf_program wavefront_program;
-
-struct wf_sample_offset
-{
-    INT32 Fraction:4;
-    INT32 Integer:20;
-    INT32 Unused:8;
-};
-typedef struct wf_sample_offset wavefront_sample_offset;          
-     
-/* Sample slot types */
-
-#define WF_ST_SAMPLE      0
-#define WF_ST_MULTISAMPLE 1
-#define WF_ST_ALIAS       2
-#define WF_ST_EMPTY       3
-
-/* pseudo's */
-
-#define WF_ST_DRUM        4
-#define WF_ST_PROGRAM     5
-#define WF_ST_PATCH       6
-#define WF_ST_SAMPLEHDR   7
-
-#define WF_ST_MASK        0xf
-
-/* Flags for slot status. These occupy the upper bits of the same byte
-   as a sample type.
-*/
-
-#define WF_SLOT_USED      0x80   /* XXX don't rely on this being accurate */
-#define WF_SLOT_FILLED    0x40
-#define WF_SLOT_ROM       0x20
-
-#define WF_SLOT_MASK      0xf0
-
-/* channel constants */
-
-#define WF_CH_MONO  0
-#define WF_CH_LEFT  1
-#define WF_CH_RIGHT 2
-
-/* Sample formats */
-
-#define LINEAR_16BIT 0
-#define WHITE_NOISE  1
-#define LINEAR_8BIT  2
-#define MULAW_8BIT   3
-
-#define WF_SAMPLE_IS_8BIT(smpl) ((smpl)->SampleResolution&2)
-
-
-/* 
-
-  Because most/all of the sample data we pass in via pointers has
-  never been copied (just mmap-ed into user space straight from the
-  disk), it would be nice to allow handling of multi-channel sample
-  data without forcing user-level extraction of the relevant bytes.
-  
-  So, we need a way of specifying which channel to use (the WaveFront
-  only handles mono samples in a given slot), and the only way to do
-  this without using some struct other than wavefront_sample as the
-  interface is the awful hack of using the unused bits in a
-  wavefront_sample:
-  
-  Val      Meaning
-  ---      -------
-  0        no channel selection (use channel 1, sample is MONO)
-  1        use first channel, and skip one
-  2        use second channel, and skip one
-  3        use third channel, and skip two
-  4        use fourth channel, skip three
-  5        use fifth channel, skip four
-  6        use six channel, skip five
-
-
-  This can handle up to 4 channels, and anyone downloading >4 channels
-  of sample data just to select one of them needs to find some tools
-  like sox ...
-
-  NOTE: values 0, 1 and 2 correspond to WF_CH_* above. This is 
-  important.
-
-*/
-
-#define WF_SET_CHANNEL(samp,chn) \
- (samp)->Unused1 = chn & 0x1; \
- (samp)->Unused2 = chn & 0x2; \
- (samp)->Unused3 = chn & 0x4 
-  
-#define WF_GET_CHANNEL(samp) \
-  (((samp)->Unused3 << 2)|((samp)->Unused2<<1)|(samp)->Unused1)
-  
-typedef struct wf_sample {
-    struct wf_sample_offset sampleStartOffset;
-    struct wf_sample_offset loopStartOffset;
-    struct wf_sample_offset loopEndOffset;
-    struct wf_sample_offset sampleEndOffset;
-    INT16 FrequencyBias;
-    UCHAR8 SampleResolution:2;  /* sample_format */
-    UCHAR8 Unused1:1;
-    UCHAR8 Loop:1;
-    UCHAR8 Bidirectional:1;
-    UCHAR8 Unused2:1;
-    UCHAR8 Reverse:1;
-    UCHAR8 Unused3:1;
-} wavefront_sample;
-
-typedef struct wf_multisample {
-    INT16 NumberOfSamples;   /* log2 of the number of samples */
-    INT16 SampleNumber[NUM_MIDIKEYS];
-} wavefront_multisample;
-
-typedef struct wf_alias {
-    INT16 OriginalSample;
-
-    struct wf_sample_offset sampleStartOffset;
-    struct wf_sample_offset loopStartOffset;
-    struct wf_sample_offset sampleEndOffset;
-    struct wf_sample_offset loopEndOffset;
-
-    INT16  FrequencyBias;
-
-    UCHAR8 SampleResolution:2;
-    UCHAR8 Unused1:1;
-    UCHAR8 Loop:1;
-    UCHAR8 Bidirectional:1;
-    UCHAR8 Unused2:1;
-    UCHAR8 Reverse:1;
-    UCHAR8 Unused3:1;
-    
-    /* This structure is meant to be padded only to 16 bits on their
-       original. Of course, whoever wrote their documentation didn't
-       realize that sizeof(struct) can be >=
-       sum(sizeof(struct-fields)) and so thought that giving a C level
-       description of the structs used in WavePatch files was
-       sufficient. I suppose it was, as long as you remember the 
-       standard 16->32 bit issues.
-    */
-
-    UCHAR8 sixteen_bit_padding;
-} __attribute__((packed)) wavefront_alias;
-
-typedef struct wf_drum {
-    UCHAR8 PatchNumber;
-    UCHAR8 MixLevel:7;
-    UCHAR8 Unmute:1;
-    UCHAR8 Group:4;
-    UCHAR8 Unused1:4;
-    UCHAR8 PanModSource:2;
-    UCHAR8 PanModulated:1;
-    UCHAR8 PanAmount:4;
-    UCHAR8 Unused2:1;
-} wavefront_drum;
-
-typedef struct wf_drumkit {
-    struct wf_drum drum[NUM_MIDIKEYS];
-} wavefront_drumkit;
-
-typedef struct wf_channel_programs {
-    UCHAR8 Program[NUM_MIDICHANNELS];
-} wavefront_channel_programs;
-
-/* How to get MIDI channel status from the data returned by
-   a WFC_GET_CHANNEL_STATUS command (a struct wf_channel_programs)
-*/
-
-#define WF_CHANNEL_STATUS(ch,wcp) (wcp)[(ch/7)] & (1<<((ch)%7))
-
-typedef union wf_any {
-    wavefront_sample s;
-    wavefront_multisample ms;
-    wavefront_alias a;
-    wavefront_program pr;
-    wavefront_patch p;
-    wavefront_drum d;
-} wavefront_any;
-
-/* Hannu Solvainen hoped that his "patch_info" struct in soundcard.h
-   might work for other wave-table based patch loading situations.
-   Alas, his fears were correct. The WaveFront doesn't even come with
-   just "patches", but several different kind of structures that
-   control the sound generation process.
- */
-
-typedef struct wf_patch_info {
-    
-    /* the first two fields are used by the OSS "patch loading" interface
-       only, and are unused by the current user-level library.
-    */
-
-    INT16   key;               /* Use WAVEFRONT_PATCH here */
-    UINT16  devno;             /* fill in when sending */
-    UCHAR8  subkey;            /* WF_ST_{SAMPLE,ALIAS,etc.} */
-
-#define WAVEFRONT_FIND_FREE_SAMPLE_SLOT 999
-
-    UINT16  number;            /* patch/sample/prog number */
-
-    UINT32  size;              /* size of any data included in 
-                                 one of the fields in `hdrptr', or
-                                 as `dataptr'.
-
-                                 NOTE: for actual samples, this is
-                                 the size of the *SELECTED CHANNEL*
-                                 even if more data is actually available.
-                                 
-                                 So, a stereo sample (2 channels) of
-                                 6000 bytes total has `size' = 3000.
-
-                                 See the macros and comments for
-                                 WF_{GET,SET}_CHANNEL above.
-
-                              */
-    wavefront_any __user *hdrptr;      /* user-space ptr to hdr bytes */
-    UINT16 __user *dataptr;            /* actual sample data */
-
-    wavefront_any hdr;          /* kernel-space copy of hdr bytes */         
-} wavefront_patch_info;
-
-/* The maximum number of bytes we will ever move to or from user space
-   in response to a WFC_* command.  This obviously doesn't cover
-   actual sample data.
-*/
-
-#define WF_MAX_READ sizeof(wavefront_multisample)
-#define WF_MAX_WRITE sizeof(wavefront_multisample)
-
-/*
-   This allows us to execute any WF command except the download/upload
-   ones, which are handled differently due to copyin/copyout issues as
-   well as data-nybbling to/from the card.
- */
-
-typedef struct wavefront_control {
-    int cmd;                           /* WFC_* */
-    char status;                       /* return status to user-space */
-    unsigned char rbuf[WF_MAX_READ];   /* bytes read from card */
-    unsigned char wbuf[WF_MAX_WRITE];  /* bytes written to card */
-} wavefront_control;
-
-#define WFCTL_WFCMD    0x1
-#define WFCTL_LOAD_SPP 0x2
-
-/* Modulator table */
-
-#define WF_MOD_LFO1      0
-#define WF_MOD_LFO2      1
-#define WF_MOD_ENV1      2
-#define WF_MOD_ENV2      3
-#define WF_MOD_KEYBOARD  4
-#define WF_MOD_LOGKEY    5
-#define WF_MOD_VELOCITY  6
-#define WF_MOD_LOGVEL    7
-#define WF_MOD_RANDOM    8
-#define WF_MOD_PRESSURE  9
-#define WF_MOD_MOD_WHEEL 10
-#define WF_MOD_1         WF_MOD_MOD_WHEEL 
-#define WF_MOD_BREATH    11
-#define WF_MOD_2         WF_MOD_BREATH
-#define WF_MOD_FOOT      12
-#define WF_MOD_4         WF_MOD_FOOT
-#define WF_MOD_VOLUME    13
-#define WF_MOD_7         WF_MOD_VOLUME
-#define WF_MOD_PAN       14
-#define WF_MOD_10        WF_MOD_PAN
-#define WF_MOD_EXPR      15
-#define WF_MOD_11        WF_MOD_EXPR
-
-/* FX-related material */
-
-typedef struct wf_fx_info {
-    int request;             /* see list below */
-    int data[4];             /* we don't need much */
-} wavefront_fx_info;
-
-/* support for each of these will be forthcoming once I or someone 
-   else has figured out which of the addresses on page 6 and page 7 of 
-   the YSS225 control each parameter. Incidentally, these come from
-   the Windows driver interface, but again, Turtle Beach didn't
-   document the API to use them.
-*/
-
-#define WFFX_SETOUTGAIN                        0
-#define WFFX_SETSTEREOOUTGAIN          1
-#define WFFX_SETREVERBIN1GAIN          2
-#define WFFX_SETREVERBIN2GAIN          3
-#define WFFX_SETREVERBIN3GAIN          4
-#define WFFX_SETCHORUSINPORT           5
-#define WFFX_SETREVERBIN1PORT          6
-#define WFFX_SETREVERBIN2PORT          7
-#define WFFX_SETREVERBIN3PORT          8
-#define WFFX_SETEFFECTPORT             9
-#define WFFX_SETAUXPORT                        10
-#define WFFX_SETREVERBTYPE             11
-#define WFFX_SETREVERBDELAY            12
-#define WFFX_SETCHORUSLFO              13
-#define WFFX_SETCHORUSPMD              14
-#define WFFX_SETCHORUSAMD              15
-#define WFFX_SETEFFECT                 16
-#define WFFX_SETBASEALL                        17
-#define WFFX_SETREVERBALL              18
-#define WFFX_SETCHORUSALL              20
-#define WFFX_SETREVERBDEF              22
-#define WFFX_SETCHORUSDEF              23
-#define WFFX_DELAYSETINGAIN            24
-#define WFFX_DELAYSETFBGAIN            25
-#define WFFX_DELAYSETFBLPF             26
-#define WFFX_DELAYSETGAIN              27
-#define WFFX_DELAYSETTIME              28
-#define WFFX_DELAYSETFBTIME            29
-#define WFFX_DELAYSETALL               30
-#define WFFX_DELAYSETDEF               32
-#define WFFX_SDELAYSETINGAIN           33
-#define WFFX_SDELAYSETFBGAIN           34
-#define WFFX_SDELAYSETFBLPF            35
-#define WFFX_SDELAYSETGAIN             36
-#define WFFX_SDELAYSETTIME             37
-#define WFFX_SDELAYSETFBTIME           38
-#define WFFX_SDELAYSETALL              39
-#define WFFX_SDELAYSETDEF              41
-#define WFFX_DEQSETINGAIN              42
-#define WFFX_DEQSETFILTER              43
-#define WFFX_DEQSETALL                 44
-#define WFFX_DEQSETDEF                 46
-#define WFFX_MUTE                      47
-#define WFFX_FLANGESETBALANCE          48      
-#define WFFX_FLANGESETDELAY            49
-#define WFFX_FLANGESETDWFFX_TH         50
-#define WFFX_FLANGESETFBGAIN           51
-#define WFFX_FLANGESETINGAIN           52
-#define WFFX_FLANGESETLFO              53
-#define WFFX_FLANGESETALL              54
-#define WFFX_FLANGESETDEF              56
-#define WFFX_PITCHSETSHIFT             57
-#define WFFX_PITCHSETBALANCE           58
-#define WFFX_PITCHSETALL               59
-#define WFFX_PITCHSETDEF               61
-#define WFFX_SRSSETINGAIN              62
-#define WFFX_SRSSETSPACE               63
-#define WFFX_SRSSETCENTER              64
-#define WFFX_SRSSETGAIN                        65
-#define WFFX_SRSSETMODE                        66
-#define WFFX_SRSSETDEF                 68
-
-/* Allow direct user-space control over FX memory/coefficient data.
-   In theory this could be used to download the FX microprogram,
-   but it would be a little slower, and involve some weird code.
- */
-
-#define WFFX_MEMSET              69
-
-#endif /* __wavefront_h__ */
index 8681179..8313757 100644 (file)
@@ -15,71 +15,42 @@ obj-$(CONFIG_SOUND_HAL2)    += hal2.o
 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
 obj-$(CONFIG_SOUND_SSCAPE)     += sscape.o ad1848.o mpu401.o
-obj-$(CONFIG_SOUND_MAD16)      += mad16.o ad1848.o sb_lib.o uart401.o
 obj-$(CONFIG_SOUND_CS4232)     += cs4232.o uart401.o
 obj-$(CONFIG_SOUND_MSS)                += ad1848.o
 obj-$(CONFIG_SOUND_OPL3SA2)    += opl3sa2.o ad1848.o mpu401.o
 obj-$(CONFIG_SOUND_PAS)                += pas2.o sb.o sb_lib.o uart401.o
 obj-$(CONFIG_SOUND_SB)         += sb.o sb_lib.o uart401.o
 obj-$(CONFIG_SOUND_KAHLUA)     += kahlua.o
-obj-$(CONFIG_SOUND_WAVEFRONT)  += wavefront.o
-obj-$(CONFIG_SOUND_MAUI)       += maui.o mpu401.o
 obj-$(CONFIG_SOUND_MPU401)     += mpu401.o
 obj-$(CONFIG_SOUND_UART6850)   += uart6850.o
-obj-$(CONFIG_SOUND_GUS)                += gus.o ad1848.o
 obj-$(CONFIG_SOUND_ADLIB)      += adlib_card.o opl3.o
 obj-$(CONFIG_SOUND_YM3812)     += opl3.o
 obj-$(CONFIG_SOUND_VMIDI)      += v_midi.o
 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_AD1889)     += ad1889.o ac97_codec.o
 obj-$(CONFIG_SOUND_ACI_MIXER)  += aci.o
-obj-$(CONFIG_SOUND_AWE32_SYNTH)        += awe_wave.o
 
 obj-$(CONFIG_SOUND_VIA82CXXX)  += via82cxxx_audio.o ac97_codec.o
 ifeq ($(CONFIG_MIDI_VIA82CXXX),y)
   obj-$(CONFIG_SOUND_VIA82CXXX) += sound.o uart401.o
 endif
-obj-$(CONFIG_SOUND_YMFPCI)     += ymfpci.o ac97_codec.o
-ifeq ($(CONFIG_SOUND_YMFPCI_LEGACY),y)
-  obj-$(CONFIG_SOUND_YMFPCI)    += opl3.o uart401.o
-endif
 obj-$(CONFIG_SOUND_MSNDCLAS)   += msnd.o msnd_classic.o
 obj-$(CONFIG_SOUND_MSNDPIN)    += msnd.o msnd_pinnacle.o
 obj-$(CONFIG_SOUND_VWSND)      += vwsnd.o
 obj-$(CONFIG_SOUND_NM256)      += nm256_audio.o ac97.o
 obj-$(CONFIG_SOUND_ICH)                += i810_audio.o ac97_codec.o
-obj-$(CONFIG_SOUND_SONICVIBES) += sonicvibes.o
-obj-$(CONFIG_SOUND_CMPCI)      += cmpci.o
-ifeq ($(CONFIG_SOUND_CMPCI_FM),y)
-  obj-$(CONFIG_SOUND_CMPCI)     += sound.o opl3.o
-endif
-ifeq ($(CONFIG_SOUND_CMPCI_MIDI),y)
-  obj-$(CONFIG_SOUND_CMPCI)     += sound.o mpu401.o
-endif
-obj-$(CONFIG_SOUND_ES1370)     += es1370.o
 obj-$(CONFIG_SOUND_ES1371)     += es1371.o ac97_codec.o
 obj-$(CONFIG_SOUND_VRC5477)    += nec_vrc5477.o ac97_codec.o
-obj-$(CONFIG_SOUND_AU1000)     += au1000.o ac97_codec.o
 obj-$(CONFIG_SOUND_AU1550_AC97)        += au1550_ac97.o ac97_codec.o
-obj-$(CONFIG_SOUND_ESSSOLO1)   += esssolo1.o
 obj-$(CONFIG_SOUND_FUSION)     += cs46xx.o ac97_codec.o
-obj-$(CONFIG_SOUND_MAESTRO)    += maestro.o
-obj-$(CONFIG_SOUND_MAESTRO3)   += maestro3.o ac97_codec.o
 obj-$(CONFIG_SOUND_TRIDENT)    += trident.o ac97_codec.o
-obj-$(CONFIG_SOUND_HARMONY)    += harmony.o
 obj-$(CONFIG_SOUND_EMU10K1)    += ac97_codec.o
 obj-$(CONFIG_SOUND_BCM_CS4297A)        += swarm_cs4297a.o
-obj-$(CONFIG_SOUND_RME96XX)     += rme96xx.o
 obj-$(CONFIG_SOUND_BT878)      += btaudio.o
-obj-$(CONFIG_SOUND_ALI5455)    += ali5455.o ac97_codec.o
-obj-$(CONFIG_SOUND_FORTE)      += forte.o ac97_codec.o
 
-obj-$(CONFIG_SOUND_AD1980)     += ac97_plugin_ad1980.o ac97_codec.o
 obj-$(CONFIG_SOUND_WM97XX)     += ac97_plugin_wm97xx.o
 
 ifeq ($(CONFIG_MIDI_EMU10K1),y)
@@ -87,7 +58,6 @@ ifeq ($(CONFIG_MIDI_EMU10K1),y)
 endif
 
 obj-$(CONFIG_SOUND_EMU10K1)    += emu10k1/
-obj-$(CONFIG_SOUND_CS4281)     += cs4281/
 obj-$(CONFIG_DMASOUND)         += dmasound/
 
 # Declare multi-part drivers.
@@ -98,17 +68,15 @@ sound-objs  :=                                                      \
     midi_syms.o midi_synth.o midibuf.o                                 \
     sequencer.o sequencer_syms.o sound_timer.o sys_timer.o
 
-gus-objs       := gus_card.o gus_midi.o gus_vol.o gus_wave.o ics2101.o
 pas2-objs      := pas2_card.o pas2_midi.o pas2_mixer.o pas2_pcm.o
 sb-objs                := sb_card.o
 sb_lib-objs    := sb_common.o sb_audio.o sb_midi.o sb_mixer.o sb_ess.o
 vidc_mod-objs  := vidc.o vidc_fill.o
-wavefront-objs  := wavfront.o wf_midi.o yss225.o
 
 hostprogs-y    := bin2hex hex2hex
 
 # Files generated that shall be removed upon make clean
-clean-files := maui_boot.h msndperm.c msndinit.c pndsperm.c pndspini.c \
+clean-files := msndperm.c msndinit.c pndsperm.c pndspini.c \
                pss_boot.h trix_boot.h
 
 # Firmware files that need translation
@@ -118,21 +86,6 @@ clean-files := maui_boot.h msndperm.c msndinit.c pndsperm.c pndspini.c \
 # will be forced to be remade.
 #
 
-# Turtle Beach Maui / Tropez
-
-$(obj)/maui.o: $(obj)/maui_boot.h
-
-ifeq ($(CONFIG_MAUI_HAVE_BOOT),y)
-    $(obj)/maui_boot.h: $(patsubst "%", %, $(CONFIG_MAUI_BOOT_FILE)) $(obj)/bin2hex
-       $(obj)/bin2hex -i maui_os < $< > $@
-else
-    $(obj)/maui_boot.h:
-       (                                                       \
-           echo 'static unsigned char * maui_os = NULL;';      \
-           echo 'static int maui_osLen = 0;';                  \
-       ) > $@
-endif
-
 # Turtle Beach MultiSound
 
 ifeq ($(CONFIG_MSNDCLAS_HAVE_BOOT),y)
index 3ba6d91..72cf4ed 100644 (file)
@@ -112,25 +112,6 @@ ac97_init (struct ac97_hwint *dev)
     return 0;
 }
 
-/* Reset the mixer to the currently saved settings.  */
-int
-ac97_reset (struct ac97_hwint *dev)
-{
-    int x;
-
-    if (dev->reset_device (dev))
-       return -1;
-
-    /* Now set the registers back to their last-written values. */
-    for (x = 0; mixerRegs[x].ac97_regnum != -1; x++) {
-       int regnum = mixerRegs[x].ac97_regnum;
-       int value = dev->last_written_mixer_values [regnum / 2];
-       if (value >= 0)
-           ac97_put_register (dev, regnum, value);
-    }
-    return 0;
-}
-
 /* Return the contents of register REG; use the cache if the value in it
    is valid.  Returns a negative error code on failure. */
 static int
@@ -441,7 +422,6 @@ EXPORT_SYMBOL(ac97_init);
 EXPORT_SYMBOL(ac97_set_values);
 EXPORT_SYMBOL(ac97_put_register);
 EXPORT_SYMBOL(ac97_mixer_ioctl);
-EXPORT_SYMBOL(ac97_reset);
 MODULE_LICENSE("GPL");
 
 \f
index 77d454e..01837a9 100644 (file)
@@ -192,9 +192,6 @@ extern int ac97_put_register (struct ac97_hwint *dev, u8 reg, u16 value);
 extern int ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd,
                             void __user * arg);
 
-/* Do a complete reset on the AC97 mixer, restoring all mixer registers to
-   the current values.  Normally used after an APM resume event.  */
-extern int ac97_reset (struct ac97_hwint *dev);
 #endif
 \f
 /*
index 972327c..602db49 100644 (file)
@@ -1399,95 +1399,6 @@ unsigned int ac97_set_adc_rate(struct ac97_codec *codec, unsigned int rate)
 
 EXPORT_SYMBOL(ac97_set_adc_rate);
 
-int ac97_save_state(struct ac97_codec *codec)
-{
-       return 0;       
-}
-
-EXPORT_SYMBOL(ac97_save_state);
-
-int ac97_restore_state(struct ac97_codec *codec)
-{
-       int i;
-       unsigned int left, right, val;
-
-       for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
-               if (!supported_mixer(codec, i)) 
-                       continue;
-
-               val = codec->mixer_state[i];
-               right = val >> 8;
-               left = val  & 0xff;
-               codec->write_mixer(codec, i, left, right);
-       }
-       return 0;
-}
-
-EXPORT_SYMBOL(ac97_restore_state);
-
-/**
- *     ac97_register_driver    -       register a codec helper
- *     @driver: Driver handler
- *
- *     Register a handler for codecs matching the codec id. The handler
- *     attach function is called for all present codecs and will be 
- *     called when new codecs are discovered.
- */
-int ac97_register_driver(struct ac97_driver *driver)
-{
-       struct list_head *l;
-       struct ac97_codec *c;
-       
-       mutex_lock(&codec_mutex);
-       INIT_LIST_HEAD(&driver->list);
-       list_add(&driver->list, &codec_drivers);
-       
-       list_for_each(l, &codecs)
-       {
-               c = list_entry(l, struct ac97_codec, list);
-               if(c->driver != NULL || ((c->model ^ driver->codec_id) & driver->codec_mask))
-                       continue;
-               if(driver->probe(c, driver))
-                       continue;
-               c->driver = driver;
-       }
-       mutex_unlock(&codec_mutex);
-       return 0;
-}
-
-EXPORT_SYMBOL_GPL(ac97_register_driver);
-
-/**
- *     ac97_unregister_driver  -       unregister a codec helper
- *     @driver: Driver handler
- *
- *     Unregister a handler for codecs matching the codec id. The handler
- *     remove function is called for all matching codecs.
- */
-void ac97_unregister_driver(struct ac97_driver *driver)
-{
-       struct list_head *l;
-       struct ac97_codec *c;
-       
-       mutex_lock(&codec_mutex);
-       list_del_init(&driver->list);
-
-       list_for_each(l, &codecs)
-       {
-               c = list_entry(l, struct ac97_codec, list);
-               if (c->driver == driver) {
-                       driver->remove(c, driver);
-                       c->driver = NULL;
-               }
-       }
-       
-       mutex_unlock(&codec_mutex);
-}
-
-EXPORT_SYMBOL_GPL(ac97_unregister_driver);
-
 static int swap_headphone(int remove_master)
 {
        struct list_head *l;
diff --git a/sound/oss/ac97_plugin_ad1980.c b/sound/oss/ac97_plugin_ad1980.c
deleted file mode 100644 (file)
index 24a9acd..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
-    ac97_plugin_ad1980.c  Copyright (C) 2003 Red Hat, Inc. All rights reserved.
-
-   The contents of this file are subject to the Open Software License version 1.1
-   that can be found at http://www.opensource.org/licenses/osl-1.1.txt and is 
-   included herein by reference. 
-   
-   Alternatively, the contents of this file may be used under the
-   terms of the GNU General Public License version 2 (the "GPL") as 
-   distributed in the kernel source COPYING file, in which
-   case the provisions of the GPL are applicable instead of the
-   above.  If you wish to allow the use of your version of this file
-   only under the terms of the GPL and not to allow others to use
-   your version of this file under the OSL, indicate your decision
-   by deleting the provisions above and replace them with the notice
-   and other provisions required by the GPL.  If you do not delete
-   the provisions above, a recipient may use your version of this
-   file under either the OSL or the GPL.
-   
-   Authors:    Alan Cox <alan@redhat.com>
-
-   This is an example codec plugin. This one switches the connections
-   around to match the setups some vendors use with audio switched to
-   non standard front connectors not the normal rear ones
-
-   This code primarily exists to demonstrate how to use the codec
-   interface
-
-*/
-
-#include <linux/config.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/ac97_codec.h>
-
-/**
- *     ad1980_remove           -       codec remove callback
- *     @codec: The codec that is being removed
- *
- *     This callback occurs when an AC97 codec is being removed. A
- *     codec remove call will not occur for a codec during that codec
- *     probe callback.
- *
- *     Most drivers will need to lock their remove versus their 
- *     use of the codec after the probe function.
- */
-static void __devexit ad1980_remove(struct ac97_codec *codec, struct ac97_driver *driver)
-{
-       /* Nothing to do in the simple example */
-}
-
-
-/**
- *     ad1980_probe            -       codec found callback
- *     @codec: ac97 codec matching the idents
- *     @driver: ac97_driver it matched
- *
- *     This entry point is called when a codec is found which matches
- *     the driver. At the point it is called the codec is basically
- *     operational, mixer operations have been initialised and can
- *     be overriden. Called in process context. The field driver_private
- *     is available for the driver to use to store stuff.
- *
- *     The caller can claim the device by returning zero, or return
- *     a negative error code. 
- */
-static int ad1980_probe(struct ac97_codec *codec, struct ac97_driver *driver)
-{
-       u16 control;
-
-#define AC97_AD_MISC   0x76
-
-       /* Switch the inputs/outputs over (from Dell code) */
-       control = codec->codec_read(codec, AC97_AD_MISC);
-       codec->codec_write(codec, AC97_AD_MISC, control | 0x4420);
-       
-       /* We could refuse the device since we dont need to hang around,
-          but we will claim it */
-       return 0;
-}
-       
-static struct ac97_driver ad1980_driver = {
-       .codec_id       = 0x41445370,
-       .codec_mask     = 0xFFFFFFFF,
-       .name           = "AD1980 example",
-       .probe          = ad1980_probe,
-       .remove         = __devexit_p(ad1980_remove),
-};
-
-/**
- *     ad1980_exit             -       module exit path
- *
- *     Our module is being unloaded. At this point unregister_driver
- *     will call back our remove handler for any existing codecs. You
- *     may not unregister_driver from interrupt context or from a 
- *     probe/remove callback.
- */
-
-static void ad1980_exit(void)
-{
-       ac97_unregister_driver(&ad1980_driver);
-}
-
-/**
- *     ad1980_init             -       set up ad1980 handlers
- *
- *     After we call the register function it will call our probe
- *     function for each existing matching device before returning to us.
- *     Any devices appearing afterwards whose id's match the codec_id
- *     will also cause the probe function to be called.
- *     You may not register_driver from interrupt context or from a 
- *     probe/remove callback.
- */
-static int ad1980_init(void)
-{
-       return ac97_register_driver(&ad1980_driver);
-}
-
-module_init(ad1980_init);
-module_exit(ad1980_exit);
-MODULE_LICENSE("GPL");
index f6b6b88..257b753 100644 (file)
@@ -195,6 +195,7 @@ static void     ad1848_halt(int dev);
 static void     ad1848_halt_input(int dev);
 static void     ad1848_halt_output(int dev);
 static void     ad1848_trigger(int dev, int bits);
+static irqreturn_t adintr(int irq, void *dev_id, struct pt_regs *dummy);
 
 #ifndef EXCLUDE_TIMERS
 static int ad1848_tmr_install(int dev);
@@ -2195,7 +2196,7 @@ void ad1848_unload(int io_base, int irq, int dma_playback, int dma_capture, int
                printk(KERN_ERR "ad1848: Can't find device to be unloaded. Base=%x\n", io_base);
 }
 
-irqreturn_t adintr(int irq, void *dev_id, struct pt_regs *dummy)
+static irqreturn_t adintr(int irq, void *dev_id, struct pt_regs *dummy)
 {
        unsigned char status;
        ad1848_info *devc;
@@ -2802,7 +2803,6 @@ EXPORT_SYMBOL(ad1848_detect);
 EXPORT_SYMBOL(ad1848_init);
 EXPORT_SYMBOL(ad1848_unload);
 EXPORT_SYMBOL(ad1848_control);
-EXPORT_SYMBOL(adintr);
 EXPORT_SYMBOL(probe_ms_sound);
 EXPORT_SYMBOL(attach_ms_sound);
 EXPORT_SYMBOL(unload_ms_sound);
index d0573b0..b95ebe2 100644 (file)
@@ -18,7 +18,6 @@ void ad1848_unload (int io_base, int irq, int dma_playback, int dma_capture, int
 int ad1848_detect (struct resource *ports, int *flags, int *osp);
 int ad1848_control(int cmd, int arg);
 
-irqreturn_t adintr(int irq, void *dev_id, struct pt_regs * dummy);
 void attach_ms_sound(struct address_info * hw_config, struct resource *ports, struct module * owner);
 
 int probe_ms_sound(struct address_info *hw_config, struct resource *ports);
diff --git a/sound/oss/ali5455.c b/sound/oss/ali5455.c
deleted file mode 100644 (file)
index 70dcd70..0000000
+++ /dev/null
@@ -1,3735 +0,0 @@
-/*
- *     ALI  ali5455 and friends ICH driver for Linux
- *     LEI HU <Lei_Hu@ali.com.tw>
- *
- *  Built from:
- *     drivers/sound/i810_audio
- *
- *     The ALi 5455 is similar but not quite identical to the Intel ICH
- *     series of controllers. Its easier to keep the driver separated from
- *     the i810 driver.
- *
- *     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.
- *
- *
- *     ALi 5455 theory of operation
- *
- *     The chipset provides three DMA channels that talk to an AC97
- *     CODEC (AC97 is a digital/analog mixer standard). At its simplest
- *     you get 48Khz audio with basic volume and mixer controls. At the
- *     best you get rate adaption in the codec. We set the card up so
- *     that we never take completion interrupts but instead keep the card
- *     chasing its tail around a ring buffer. This is needed for mmap
- *     mode audio and happens to work rather well for non-mmap modes too.
- *
- *     The board has one output channel for PCM audio (supported) and
- *     a stereo line in and mono microphone input. Again these are normally
- *     locked to 48Khz only. Right now recording is not finished.
- *
- *     There is no midi support, no synth support. Use timidity. To get
- *     esd working you need to use esd -r 48000 as it won't probe 48KHz
- *     by default. mpg123 can't handle 48Khz only audio so use xmms.
- *
- *     If you need to force a specific rate set the clocking= option
- *
- */
-
-#include <linux/module.h>
-#include <linux/string.h>
-#include <linux/ctype.h>
-#include <linux/ioport.h>
-#include <linux/sched.h>
-#include <linux/delay.h>
-#include <linux/sound.h>
-#include <linux/slab.h>
-#include <linux/soundcard.h>
-#include <linux/pci.h>
-#include <asm/io.h>
-#include <asm/dma.h>
-#include <linux/init.h>
-#include <linux/poll.h>
-#include <linux/spinlock.h>
-#include <linux/smp_lock.h>
-#include <linux/ac97_codec.h>
-#include <linux/interrupt.h>
-#include <linux/mutex.h>
-
-#include <asm/uaccess.h>
-
-#ifndef PCI_DEVICE_ID_ALI_5455
-#define PCI_DEVICE_ID_ALI_5455 0x5455
-#endif
-
-#ifndef PCI_VENDOR_ID_ALI
-#define PCI_VENDOR_ID_ALI      0x10b9
-#endif
-
-static int strict_clocking = 0;
-static unsigned int clocking = 0;
-static unsigned int codec_pcmout_share_spdif_locked = 0;
-static unsigned int codec_independent_spdif_locked = 0;
-static unsigned int controller_pcmout_share_spdif_locked = 0;
-static unsigned int controller_independent_spdif_locked = 0;
-static unsigned int globel = 0;
-
-#define ADC_RUNNING    1
-#define DAC_RUNNING    2
-#define CODEC_SPDIFOUT_RUNNING 8
-#define CONTROLLER_SPDIFOUT_RUNNING 4
-
-#define SPDIF_ENABLE_OUTPUT    4       /* bits 0,1 are PCM */
-
-#define ALI5455_FMT_16BIT      1
-#define ALI5455_FMT_STEREO     2
-#define ALI5455_FMT_MASK       3
-
-#define SPDIF_ON       0x0004
-#define SURR_ON                0x0010
-#define CENTER_LFE_ON  0x0020
-#define VOL_MUTED      0x8000
-
-
-#define ALI_SPDIF_OUT_CH_STATUS 0xbf
-/* the 810's array of pointers to data buffers */
-
-struct sg_item {
-#define BUSADDR_MASK   0xFFFFFFFE
-       u32 busaddr;
-#define CON_IOC        0x80000000      /* interrupt on completion */
-#define CON_BUFPAD     0x40000000      /* pad underrun with last sample, else 0 */
-#define CON_BUFLEN_MASK        0x0000ffff      /* buffer length in samples */
-       u32 control;
-};
-
-/* an instance of the ali channel */
-#define SG_LEN 32
-struct ali_channel {
-       /* these sg guys should probably be allocated
-          separately as nocache. Must be 8 byte aligned */
-       struct sg_item sg[SG_LEN];      /* 32*8 */
-       u32 offset;             /* 4 */
-       u32 port;               /* 4 */
-       u32 used;
-       u32 num;
-};
-
-/*
- * we have 3 separate dma engines.  pcm in, pcm out, and mic.
- * each dma engine has controlling registers.  These goofy
- * names are from the datasheet, but make it easy to write
- * code while leafing through it.
- */
-
-#define ENUM_ENGINE(PRE,DIG)                                                                   \
-enum {                                                                                         \
-       PRE##_BDBAR =   0x##DIG##0,             /* Buffer Descriptor list Base Address */       \
-       PRE##_CIV =     0x##DIG##4,             /* Current Index Value */                       \
-       PRE##_LVI =     0x##DIG##5,             /* Last Valid Index */                          \
-       PRE##_SR =      0x##DIG##6,             /* Status Register */                           \
-       PRE##_PICB =    0x##DIG##8,             /* Position In Current Buffer */                \
-       PRE##_CR =      0x##DIG##b              /* Control Register */                          \
-}
-
-ENUM_ENGINE(OFF, 0);           /* Offsets */
-ENUM_ENGINE(PI, 4);            /* PCM In */
-ENUM_ENGINE(PO, 5);            /* PCM Out */
-ENUM_ENGINE(MC, 6);            /* Mic In */
-ENUM_ENGINE(CODECSPDIFOUT, 7); /* CODEC SPDIF OUT  */
-ENUM_ENGINE(CONTROLLERSPDIFIN, A);     /* CONTROLLER SPDIF In */
-ENUM_ENGINE(CONTROLLERSPDIFOUT, B);    /* CONTROLLER SPDIF OUT */
-
-
-enum {
-       ALI_SCR = 0x00,         /* System Control Register */
-       ALI_SSR = 0x04,         /* System Status Register  */
-       ALI_DMACR = 0x08,       /* DMA Control Register    */
-       ALI_FIFOCR1 = 0x0c,     /* FIFO Control Register 1  */
-       ALI_INTERFACECR = 0x10, /* Interface Control Register */
-       ALI_INTERRUPTCR = 0x14, /* Interrupt control Register */
-       ALI_INTERRUPTSR = 0x18, /* Interrupt  Status Register */
-       ALI_FIFOCR2 = 0x1c,     /* FIFO Control Register 2   */
-       ALI_CPR = 0x20,         /* Command Port Register     */
-       ALI_SPR = 0x24,         /* Status Port Register      */
-       ALI_FIFOCR3 = 0x2c,     /* FIFO Control Register 3  */
-       ALI_TTSR = 0x30,        /* Transmit Tag Slot Register */
-       ALI_RTSR = 0x34,        /* Receive Tag Slot  Register */
-       ALI_CSPSR = 0x38,       /* Command/Status Port Status Register */
-       ALI_CAS = 0x3c,         /* Codec Write Semaphore Register */
-       ALI_SPDIFCSR = 0xf8,    /* spdif channel status register  */
-       ALI_SPDIFICS = 0xfc     /* spdif interface control/status  */
-};
-
-// x-status register(x:pcm in ,pcm out, mic in,)
-/* interrupts for a dma engine */
-#define DMA_INT_FIFO           (1<<4)  /* fifo under/over flow */
-#define DMA_INT_COMPLETE       (1<<3)  /* buffer read/write complete and ioc set */
-#define DMA_INT_LVI            (1<<2)  /* last valid done */
-#define DMA_INT_CELV           (1<<1)  /* last valid is current */
-#define DMA_INT_DCH            (1)     /* DMA Controller Halted (happens on LVI interrupts) */ //not eqult intel
-#define DMA_INT_MASK (DMA_INT_FIFO|DMA_INT_COMPLETE|DMA_INT_LVI)
-
-/* interrupts for the whole chip */// by interrupt status register finish
-
-#define INT_SPDIFOUT   (1<<23) /* controller spdif out INTERRUPT */
-#define INT_SPDIFIN   (1<<22)
-#define INT_CODECSPDIFOUT   (1<<19)
-#define INT_MICIN   (1<<18)
-#define INT_PCMOUT   (1<<17)
-#define INT_PCMIN   (1<<16)
-#define INT_CPRAIS   (1<<7)
-#define INT_SPRAIS   (1<<5)
-#define INT_GPIO    (1<<1)
-#define INT_MASK   (INT_SPDIFOUT|INT_CODECSPDIFOUT|INT_MICIN|INT_PCMOUT|INT_PCMIN)
-
-#define DRIVER_VERSION "0.02ac"
-
-/* magic numbers to protect our data structures */
-#define ALI5455_CARD_MAGIC             0x5072696E      /* "Prin" */
-#define ALI5455_STATE_MAGIC            0x63657373      /* "cess" */
-#define ALI5455_DMA_MASK               0xffffffff      /* DMA buffer mask for pci_alloc_consist */
-#define NR_HW_CH                       5       //I think 5 channel
-
-/* maxinum number of AC97 codecs connected, AC97 2.0 defined 4 */
-#define NR_AC97                2
-
-/* Please note that an 8bit mono stream is not valid on this card, you must have a 16bit */
-/* stream at a minimum for this card to be happy */
-static const unsigned sample_size[] = { 1, 2, 2, 4 };
-/* Samples are 16bit values, so we are shifting to a word, not to a byte, hence shift */
-/* values are one less than might be expected */
-static const unsigned sample_shift[] = { -1, 0, 0, 1 };
-
-#define ALI5455
-static char *card_names[] = {
-       "ALI 5455"
-};
-
-static struct pci_device_id ali_pci_tbl[] = {
-       {PCI_VENDOR_ID_ALI, PCI_DEVICE_ID_ALI_5455,
-        PCI_ANY_ID, PCI_ANY_ID, 0, 0, ALI5455},
-       {0,}
-};
-
-MODULE_DEVICE_TABLE(pci, ali_pci_tbl);
-
-#ifdef CONFIG_PM
-#define PM_SUSPENDED(card) (card->pm_suspended)
-#else
-#define PM_SUSPENDED(card) (0)
-#endif
-
-/* "software" or virtual channel, an instance of opened /dev/dsp */
-struct ali_state {
-       unsigned int magic;
-       struct ali_card *card;  /* Card info */
-
-       /* single open lock mechanism, only used for recording */
-       struct mutex open_mutex;
-       wait_queue_head_t open_wait;
-
-       /* file mode */
-       mode_t open_mode;
-
-       /* virtual channel number */
-       int virt;
-
-#ifdef CONFIG_PM
-       unsigned int pm_saved_dac_rate, pm_saved_adc_rate;
-#endif
-       struct dmabuf {
-               /* wave sample stuff */
-               unsigned int rate;
-               unsigned char fmt, enable, trigger;
-
-               /* hardware channel */
-               struct ali_channel *read_channel;
-               struct ali_channel *write_channel;
-               struct ali_channel *codec_spdifout_channel;
-               struct ali_channel *controller_spdifout_channel;
-
-               /* OSS buffer management stuff */
-               void *rawbuf;
-               dma_addr_t dma_handle;
-               unsigned buforder;
-               unsigned numfrag;
-               unsigned fragshift;
-
-               /* our buffer acts like a circular ring */
-               unsigned hwptr; /* where dma last started, updated by update_ptr */
-               unsigned swptr; /* where driver last clear/filled, updated by read/write */
-               int count;      /* bytes to be consumed or been generated by dma machine */
-               unsigned total_bytes;   /* total bytes dmaed by hardware */
-
-               unsigned error; /* number of over/underruns */
-               wait_queue_head_t wait; /* put process on wait queue when no more space in buffer */
-
-               /* redundant, but makes calculations easier */
-               /* what the hardware uses */
-               unsigned dmasize;
-               unsigned fragsize;
-               unsigned fragsamples;
-
-               /* what we tell the user to expect */
-               unsigned userfrags;
-               unsigned userfragsize;
-
-               /* OSS stuff */
-               unsigned mapped:1;
-               unsigned ready:1;
-               unsigned update_flag;
-               unsigned ossfragsize;
-               unsigned ossmaxfrags;
-               unsigned subdivision;
-       } dmabuf;
-};
-
-
-struct ali_card {
-       struct ali_channel channel[5];
-       unsigned int magic;
-
-       /* We keep ali5455 cards in a linked list */
-       struct ali_card *next;
-
-       /* The ali has a certain amount of cross channel interaction
-          so we use a single per card lock */
-       spinlock_t lock;
-       spinlock_t ac97_lock;
-
-       /* PCI device stuff */
-       struct pci_dev *pci_dev;
-       u16 pci_id;
-#ifdef CONFIG_PM
-       u16 pm_suspended;
-       int pm_saved_mixer_settings[SOUND_MIXER_NRDEVICES][NR_AC97];
-#endif
-       /* soundcore stuff */
-       int dev_audio;
-
-       /* structures for abstraction of hardware facilities, codecs, banks and channels */
-       struct ac97_codec *ac97_codec[NR_AC97];
-       struct ali_state *states[NR_HW_CH];
-
-       u16 ac97_features;
-       u16 ac97_status;
-       u16 channels;
-
-       /* hardware resources */
-       unsigned long iobase;
-
-       u32 irq;
-
-       /* Function support */
-       struct ali_channel *(*alloc_pcm_channel) (struct ali_card *);
-       struct ali_channel *(*alloc_rec_pcm_channel) (struct ali_card *);
-       struct ali_channel *(*alloc_rec_mic_channel) (struct ali_card *);
-       struct ali_channel *(*alloc_codec_spdifout_channel) (struct ali_card *);
-       struct ali_channel *(*alloc_controller_spdifout_channel) (struct  ali_card *);
-       void (*free_pcm_channel) (struct ali_card *, int chan);
-
-       /* We have a *very* long init time possibly, so use this to block */
-       /* attempts to open our devices before we are ready (stops oops'es) */
-       int initializing;
-};
-
-
-static struct ali_card *devs = NULL;
-
-static int ali_open_mixdev(struct inode *inode, struct file *file);
-static int ali_ioctl_mixdev(struct inode *inode, struct file *file,
-                           unsigned int cmd, unsigned long arg);
-static u16 ali_ac97_get(struct ac97_codec *dev, u8 reg);
-static void ali_ac97_set(struct ac97_codec *dev, u8 reg, u16 data);
-
-static struct ali_channel *ali_alloc_pcm_channel(struct ali_card *card)
-{
-       if (card->channel[1].used == 1)
-               return NULL;
-       card->channel[1].used = 1;
-       return &card->channel[1];
-}
-
-static struct ali_channel *ali_alloc_rec_pcm_channel(struct ali_card *card)
-{
-       if (card->channel[0].used == 1)
-               return NULL;
-       card->channel[0].used = 1;
-       return &card->channel[0];
-}
-
-static struct ali_channel *ali_alloc_rec_mic_channel(struct ali_card *card)
-{
-       if (card->channel[2].used == 1)
-               return NULL;
-       card->channel[2].used = 1;
-       return &card->channel[2];
-}
-
-static struct ali_channel *ali_alloc_codec_spdifout_channel(struct ali_card *card)
-{
-       if (card->channel[3].used == 1)
-               return NULL;
-       card->channel[3].used = 1;
-       return &card->channel[3];
-}
-
-static struct ali_channel *ali_alloc_controller_spdifout_channel(struct ali_card *card)
-{
-       if (card->channel[4].used == 1)
-               return NULL;
-       card->channel[4].used = 1;
-       return &card->channel[4];
-}
-static void ali_free_pcm_channel(struct ali_card *card, int channel)
-{
-       card->channel[channel].used = 0;
-}
-
-
-//add support  codec spdif out 
-static int ali_valid_spdif_rate(struct ac97_codec *codec, int rate)
-{
-       unsigned long id = 0L;
-
-       id = (ali_ac97_get(codec, AC97_VENDOR_ID1) << 16);
-       id |= ali_ac97_get(codec, AC97_VENDOR_ID2) & 0xffff;
-       switch (id) {
-       case 0x41445361:        /* AD1886 */
-               if (rate == 48000) {
-                       return 1;
-               }
-               break;
-       case 0x414c4720:        /* ALC650 */
-               if (rate == 48000) {
-                       return 1;
-               }
-               break;
-       default:                /* all other codecs, until we know otherwiae */
-               if (rate == 48000 || rate == 44100 || rate == 32000) {
-                       return 1;
-               }
-               break;
-       }
-       return (0);
-}
-
-/* ali_set_spdif_output
- * 
- *  Configure the S/PDIF output transmitter. When we turn on
- *  S/PDIF, we turn off the analog output. This may not be
- *  the right thing to do.
- *
- *  Assumptions:
- *     The DSP sample rate must already be set to a supported
- *     S/PDIF rate (32kHz, 44.1kHz, or 48kHz) or we abort.
- */
-static void ali_set_spdif_output(struct ali_state *state, int slots,
-                                int rate)
-{
-       int vol;
-       int aud_reg;
-       struct ac97_codec *codec = state->card->ac97_codec[0];
-
-       if (!(state->card->ac97_features & 4)) {
-               state->card->ac97_status &= ~SPDIF_ON;
-       } else {
-               if (slots == -1) {      /* Turn off S/PDIF */
-                       aud_reg = ali_ac97_get(codec, AC97_EXTENDED_STATUS);
-                       ali_ac97_set(codec, AC97_EXTENDED_STATUS, (aud_reg & ~AC97_EA_SPDIF));
-
-                       /* If the volume wasn't muted before we turned on S/PDIF, unmute it */
-                       if (!(state->card->ac97_status & VOL_MUTED)) {
-                               aud_reg = ali_ac97_get(codec, AC97_MASTER_VOL_STEREO);
-                               ali_ac97_set(codec, AC97_MASTER_VOL_STEREO,
-                                            (aud_reg & ~VOL_MUTED));
-                       }
-                       state->card->ac97_status &= ~(VOL_MUTED | SPDIF_ON);
-                       return;
-               }
-
-               vol = ali_ac97_get(codec, AC97_MASTER_VOL_STEREO);
-               state->card->ac97_status = vol & VOL_MUTED;
-
-               /* Set S/PDIF transmitter sample rate */
-               aud_reg = ali_ac97_get(codec, AC97_SPDIF_CONTROL);
-               switch (rate) {
-               case 32000:
-                       aud_reg = (aud_reg & AC97_SC_SPSR_MASK) | AC97_SC_SPSR_32K;
-                       break;
-               case 44100:
-                       aud_reg = (aud_reg & AC97_SC_SPSR_MASK) | AC97_SC_SPSR_44K;
-                       break;
-               case 48000:
-                       aud_reg = (aud_reg & AC97_SC_SPSR_MASK) | AC97_SC_SPSR_48K;
-                       break;
-               default:
-                       /* turn off S/PDIF */
-                       aud_reg = ali_ac97_get(codec, AC97_EXTENDED_STATUS);
-                       ali_ac97_set(codec, AC97_EXTENDED_STATUS, (aud_reg & ~AC97_EA_SPDIF));
-                       state->card->ac97_status &= ~SPDIF_ON;
-                       return;
-               }
-
-               ali_ac97_set(codec, AC97_SPDIF_CONTROL, aud_reg);
-
-               aud_reg = ali_ac97_get(codec, AC97_EXTENDED_STATUS);
-               aud_reg = (aud_reg & AC97_EA_SLOT_MASK) | slots | AC97_EA_SPDIF;
-               ali_ac97_set(codec, AC97_EXTENDED_STATUS, aud_reg);
-
-               aud_reg = ali_ac97_get(codec, AC97_POWER_CONTROL);
-               aud_reg |= 0x0002;
-               ali_ac97_set(codec, AC97_POWER_CONTROL, aud_reg);
-               udelay(1);
-
-               state->card->ac97_status |= SPDIF_ON;
-
-               /* Check to make sure the configuration is valid */
-               aud_reg = ali_ac97_get(codec, AC97_EXTENDED_STATUS);
-               if (!(aud_reg & 0x0400)) {
-                       /* turn off S/PDIF */
-                       ali_ac97_set(codec, AC97_EXTENDED_STATUS, (aud_reg & ~AC97_EA_SPDIF));
-                       state->card->ac97_status &= ~SPDIF_ON;
-                       return;
-               }
-               if (codec_independent_spdif_locked > 0) {
-                       aud_reg = ali_ac97_get(codec, 0x6a);
-                       ali_ac97_set(codec, 0x6a, (aud_reg & 0xefff));
-               }
-               /* Mute the analog output */
-               /* Should this only mute the PCM volume??? */
-       }
-}
-
-/* ali_set_dac_channels
- *
- *  Configure the codec's multi-channel DACs
- *
- *  The logic is backwards. Setting the bit to 1 turns off the DAC. 
- *
- *  What about the ICH? We currently configure it using the
- *  SNDCTL_DSP_CHANNELS ioctl.  If we're turnning on the DAC, 
- *  does that imply that we want the ICH set to support
- *  these channels?
- *  
- *  TODO:
- *    vailidate that the codec really supports these DACs
- *    before turning them on. 
- */
-static void ali_set_dac_channels(struct ali_state *state, int channel)
-{
-       int aud_reg;
-       struct ac97_codec *codec = state->card->ac97_codec[0];
-
-       aud_reg = ali_ac97_get(codec, AC97_EXTENDED_STATUS);
-       aud_reg |= AC97_EA_PRI | AC97_EA_PRJ | AC97_EA_PRK;
-       state->card->ac97_status &= ~(SURR_ON | CENTER_LFE_ON);
-
-       switch (channel) {
-       case 2:         /* always enabled */
-               break;
-       case 4:
-               aud_reg &= ~AC97_EA_PRJ;
-               state->card->ac97_status |= SURR_ON;
-               break;
-       case 6:
-               aud_reg &= ~(AC97_EA_PRJ | AC97_EA_PRI | AC97_EA_PRK);
-               state->card->ac97_status |= SURR_ON | CENTER_LFE_ON;
-               break;
-       default:
-               break;
-       }
-       ali_ac97_set(codec, AC97_EXTENDED_STATUS, aud_reg);
-
-}
-
-/* set playback sample rate */
-static unsigned int ali_set_dac_rate(struct ali_state *state,
-                                    unsigned int rate)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       u32 new_rate;
-       struct ac97_codec *codec = state->card->ac97_codec[0];
-
-       if (!(state->card->ac97_features & 0x0001)) {
-               dmabuf->rate = clocking;
-               return clocking;
-       }
-
-       if (rate > 48000)
-               rate = 48000;
-       if (rate < 8000)
-               rate = 8000;
-       dmabuf->rate = rate;
-
-       /*
-        *      Adjust for misclocked crap
-        */
-
-       rate = (rate * clocking) / 48000;
-
-       if (strict_clocking && rate < 8000) {
-               rate = 8000;
-               dmabuf->rate = (rate * 48000) / clocking;
-       }
-
-       new_rate = ac97_set_dac_rate(codec, rate);
-       if (new_rate != rate) {
-               dmabuf->rate = (new_rate * 48000) / clocking;
-       }
-       rate = new_rate;
-       return dmabuf->rate;
-}
-
-/* set recording sample rate */
-static unsigned int ali_set_adc_rate(struct ali_state *state,
-                                    unsigned int rate)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       u32 new_rate;
-       struct ac97_codec *codec = state->card->ac97_codec[0];
-
-       if (!(state->card->ac97_features & 0x0001)) {
-               dmabuf->rate = clocking;
-               return clocking;
-       }
-
-       if (rate > 48000)
-               rate = 48000;
-       if (rate < 8000)
-               rate = 8000;
-       dmabuf->rate = rate;
-
-       /*
-        *      Adjust for misclocked crap
-        */
-
-       rate = (rate * clocking) / 48000;
-       if (strict_clocking && rate < 8000) {
-               rate = 8000;
-               dmabuf->rate = (rate * 48000) / clocking;
-       }
-
-       new_rate = ac97_set_adc_rate(codec, rate);
-
-       if (new_rate != rate) {
-               dmabuf->rate = (new_rate * 48000) / clocking;
-               rate = new_rate;
-       }
-       return dmabuf->rate;
-}
-
-/* set codec independent spdifout sample rate */
-static unsigned int ali_set_codecspdifout_rate(struct ali_state *state,
-                                              unsigned int rate)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-
-       if (!(state->card->ac97_features & 0x0001)) {
-               dmabuf->rate = clocking;
-               return clocking;
-       }
-
-       if (rate > 48000)
-               rate = 48000;
-       if (rate < 8000)
-               rate = 8000;
-       dmabuf->rate = rate;
-
-       return dmabuf->rate;
-}
-
-/* set  controller independent spdif out function sample rate */
-static void ali_set_spdifout_rate(struct ali_state *state,
-                                 unsigned int rate)
-{
-       unsigned char ch_st_sel;
-       unsigned short status_rate;
-
-       switch (rate) {
-       case 44100:
-               status_rate = 0;
-               break;
-       case 32000:
-               status_rate = 0x300;
-               break;
-       case 48000:
-       default:
-               status_rate = 0x200;
-               break;
-       }
-
-       ch_st_sel = inb(state->card->iobase + ALI_SPDIFICS) & ALI_SPDIF_OUT_CH_STATUS;  //select spdif_out
-
-       ch_st_sel |= 0x80;      //select right
-       outb(ch_st_sel, (state->card->iobase + ALI_SPDIFICS));
-       outb(status_rate | 0x20, (state->card->iobase + ALI_SPDIFCSR + 2));
-
-       ch_st_sel &= (~0x80);   //select left
-       outb(ch_st_sel, (state->card->iobase + ALI_SPDIFICS));
-       outw(status_rate | 0x10, (state->card->iobase + ALI_SPDIFCSR + 2));
-}
-
-/* get current playback/recording dma buffer pointer (byte offset from LBA),
-   called with spinlock held! */
-
-static inline unsigned ali_get_dma_addr(struct ali_state *state, int rec)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       unsigned int civ, offset, port, port_picb;
-       unsigned int data;
-
-       if (!dmabuf->enable)
-               return 0;
-
-       if (rec == 1)
-               port = state->card->iobase + dmabuf->read_channel->port;
-       else if (rec == 2)
-               port = state->card->iobase + dmabuf->codec_spdifout_channel->port;
-       else if (rec == 3)
-               port = state->card->iobase + dmabuf->controller_spdifout_channel->port;
-       else
-               port = state->card->iobase + dmabuf->write_channel->port;
-
-       port_picb = port + OFF_PICB;
-
-       do {
-               civ = inb(port + OFF_CIV) & 31;
-               offset = inw(port_picb);
-               /* Must have a delay here! */
-               if (offset == 0)
-                       udelay(1);
-
-               /* Reread both registers and make sure that that total
-                * offset from the first reading to the second is 0.
-                * There is an issue with SiS hardware where it will count
-                * picb down to 0, then update civ to the next value,
-                * then set the new picb to fragsize bytes.  We can catch
-                * it between the civ update and the picb update, making
-                * it look as though we are 1 fragsize ahead of where we
-                * are.  The next to we get the address though, it will
-                * be back in thdelay is more than long enough
-                * that we won't have to worry about the chip still being
-                * out of sync with reality ;-)
-                */
-       } while (civ != (inb(port + OFF_CIV) & 31) || offset != inw(port_picb));
-
-       data = ((civ + 1) * dmabuf->fragsize - (2 * offset)) % dmabuf->dmasize;
-       if (inw(port_picb) == 0)
-               data -= 2048;
-
-       return data;
-}
-
-/* Stop recording (lock held) */
-static inline void __stop_adc(struct ali_state *state)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       struct ali_card *card = state->card;
-
-       dmabuf->enable &= ~ADC_RUNNING;
-
-       outl((1 << 18) | (1 << 16), card->iobase + ALI_DMACR);
-       udelay(1);
-
-       outb(0, card->iobase + PI_CR);
-       while (inb(card->iobase + PI_CR) != 0);
-
-       // now clear any latent interrupt bits (like the halt bit)
-       outb(inb(card->iobase + PI_SR) | 0x001e, card->iobase + PI_SR);
-       outl(inl(card->iobase + ALI_INTERRUPTSR) & INT_PCMIN, card->iobase + ALI_INTERRUPTSR);
-}
-
-static void stop_adc(struct ali_state *state)
-{
-       struct ali_card *card = state->card;
-       unsigned long flags;
-       spin_lock_irqsave(&card->lock, flags);
-       __stop_adc(state);
-       spin_unlock_irqrestore(&card->lock, flags);
-}
-
-static inline void __start_adc(struct ali_state *state)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-
-       if (dmabuf->count < dmabuf->dmasize && dmabuf->ready
-           && !dmabuf->enable && (dmabuf->trigger & PCM_ENABLE_INPUT)) {
-               dmabuf->enable |= ADC_RUNNING;
-               outb((1 << 4) | (1 << 2), state->card->iobase + PI_CR);
-               if (state->card->channel[0].used == 1)
-                       outl(1, state->card->iobase + ALI_DMACR);       // DMA CONTROL REGISTRER
-               udelay(100);
-               if (state->card->channel[2].used == 1)
-                       outl((1 << 2), state->card->iobase + ALI_DMACR);        //DMA CONTROL REGISTER
-               udelay(100);
-       }
-}
-
-static void start_adc(struct ali_state *state)
-{
-       struct ali_card *card = state->card;
-       unsigned long flags;
-
-       spin_lock_irqsave(&card->lock, flags);
-       __start_adc(state);
-       spin_unlock_irqrestore(&card->lock, flags);
-}
-
-/* stop playback (lock held) */
-static inline void __stop_dac(struct ali_state *state)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       struct ali_card *card = state->card;
-
-       dmabuf->enable &= ~DAC_RUNNING;
-       outl(0x00020000, card->iobase + 0x08);
-       outb(0, card->iobase + PO_CR);
-       while (inb(card->iobase + PO_CR) != 0)
-               cpu_relax();
-
-       outb(inb(card->iobase + PO_SR) | 0x001e, card->iobase + PO_SR);
-
-       outl(inl(card->iobase + ALI_INTERRUPTSR) & INT_PCMOUT, card->iobase + ALI_INTERRUPTSR);
-}
-
-static void stop_dac(struct ali_state *state)
-{
-       struct ali_card *card = state->card;
-       unsigned long flags;
-       spin_lock_irqsave(&card->lock, flags);
-       __stop_dac(state);
-       spin_unlock_irqrestore(&card->lock, flags);
-}
-
-static inline void __start_dac(struct ali_state *state)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       if (dmabuf->count > 0 && dmabuf->ready && !dmabuf->enable &&
-           (dmabuf->trigger & PCM_ENABLE_OUTPUT)) {
-               dmabuf->enable |= DAC_RUNNING;
-               outb((1 << 4) | (1 << 2), state->card->iobase + PO_CR);
-               outl((1 << 1), state->card->iobase + 0x08);     //dma control register
-       }
-}
-
-static void start_dac(struct ali_state *state)
-{
-       struct ali_card *card = state->card;
-       unsigned long flags;
-       spin_lock_irqsave(&card->lock, flags);
-       __start_dac(state);
-       spin_unlock_irqrestore(&card->lock, flags);
-}
-
-/* stop codec and controller spdif out  (lock held) */
-static inline void __stop_spdifout(struct ali_state *state)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       struct ali_card *card = state->card;
-
-       if (codec_independent_spdif_locked > 0) {
-               dmabuf->enable &= ~CODEC_SPDIFOUT_RUNNING;
-               outl((1 << 19), card->iobase + 0x08);
-               outb(0, card->iobase + CODECSPDIFOUT_CR);
-
-               while (inb(card->iobase + CODECSPDIFOUT_CR) != 0)
-                       cpu_relax();
-
-               outb(inb(card->iobase + CODECSPDIFOUT_SR) | 0x001e, card->iobase + CODECSPDIFOUT_SR);
-               outl(inl(card->iobase + ALI_INTERRUPTSR) & INT_CODECSPDIFOUT, card->iobase + ALI_INTERRUPTSR);
-       } else {
-               if (controller_independent_spdif_locked > 0) {
-                       dmabuf->enable &= ~CONTROLLER_SPDIFOUT_RUNNING;
-                       outl((1 << 23), card->iobase + 0x08);
-                       outb(0, card->iobase + CONTROLLERSPDIFOUT_CR);
-                       while (inb(card->iobase + CONTROLLERSPDIFOUT_CR) != 0)
-                               cpu_relax();
-                       outb(inb(card->iobase + CONTROLLERSPDIFOUT_SR) | 0x001e, card->iobase + CONTROLLERSPDIFOUT_SR);
-                       outl(inl(card->iobase + ALI_INTERRUPTSR) & INT_SPDIFOUT, card->iobase + ALI_INTERRUPTSR);
-               }
-       }
-}
-
-static void stop_spdifout(struct ali_state *state)
-{
-       struct ali_card *card = state->card;
-       unsigned long flags;
-       spin_lock_irqsave(&card->lock, flags);
-       __stop_spdifout(state);
-       spin_unlock_irqrestore(&card->lock, flags);
-}
-
-static inline void __start_spdifout(struct ali_state *state)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       if (dmabuf->count > 0 && dmabuf->ready && !dmabuf->enable &&
-           (dmabuf->trigger & SPDIF_ENABLE_OUTPUT)) {
-               if (codec_independent_spdif_locked > 0) {
-                       dmabuf->enable |= CODEC_SPDIFOUT_RUNNING;
-                       outb((1 << 4) | (1 << 2), state->card->iobase + CODECSPDIFOUT_CR);
-                       outl((1 << 3), state->card->iobase + 0x08);     //dma control register
-               } else {
-                       if (controller_independent_spdif_locked > 0) {
-                               dmabuf->enable |= CONTROLLER_SPDIFOUT_RUNNING;
-                               outb((1 << 4) | (1 << 2), state->card->iobase + CONTROLLERSPDIFOUT_CR);
-                               outl((1 << 7), state->card->iobase + 0x08);     //dma control register
-                       }
-               }
-       }
-}
-
-static void start_spdifout(struct ali_state *state)
-{
-       struct ali_card *card = state->card;
-       unsigned long flags;
-       spin_lock_irqsave(&card->lock, flags);
-       __start_spdifout(state);
-       spin_unlock_irqrestore(&card->lock, flags);
-}
-
-#define DMABUF_DEFAULTORDER (16-PAGE_SHIFT)
-#define DMABUF_MINORDER 1
-
-/* allocate DMA buffer, playback , recording,spdif out  buffer should be allocated separately */
-static int alloc_dmabuf(struct ali_state *state)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       void *rawbuf = NULL;
-       int order, size;
-       struct page *page, *pend;
-
-       /* If we don't have any oss frag params, then use our default ones */
-       if (dmabuf->ossmaxfrags == 0)
-               dmabuf->ossmaxfrags = 4;
-       if (dmabuf->ossfragsize == 0)
-               dmabuf->ossfragsize = (PAGE_SIZE << DMABUF_DEFAULTORDER) / dmabuf->ossmaxfrags;
-       size = dmabuf->ossfragsize * dmabuf->ossmaxfrags;
-
-       if (dmabuf->rawbuf && (PAGE_SIZE << dmabuf->buforder) == size)
-               return 0;
-       /* alloc enough to satisfy the oss params */
-       for (order = DMABUF_DEFAULTORDER; order >= DMABUF_MINORDER; order--) {
-               if ((PAGE_SIZE << order) > size)
-                       continue;
-               if ((rawbuf = pci_alloc_consistent(state->card->pci_dev,
-                                                  PAGE_SIZE << order,
-                                                  &dmabuf->dma_handle)))
-                       break;
-       }
-       if (!rawbuf)
-               return -ENOMEM;
-
-       dmabuf->ready = dmabuf->mapped = 0;
-       dmabuf->rawbuf = rawbuf;
-       dmabuf->buforder = order;
-
-       /* now mark the pages as reserved; otherwise remap_pfn_range doesn't do what we want */
-       pend = virt_to_page(rawbuf + (PAGE_SIZE << order) - 1);
-       for (page = virt_to_page(rawbuf); page <= pend; page++)
-               SetPageReserved(page);
-       return 0;
-}
-
-/* free DMA buffer */
-static void dealloc_dmabuf(struct ali_state *state)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       struct page *page, *pend;
-
-       if (dmabuf->rawbuf) {
-               /* undo marking the pages as reserved */
-               pend = virt_to_page(dmabuf->rawbuf + (PAGE_SIZE << dmabuf->buforder) - 1);
-               for (page = virt_to_page(dmabuf->rawbuf); page <= pend; page++)
-                       ClearPageReserved(page);
-               pci_free_consistent(state->card->pci_dev,
-                                   PAGE_SIZE << dmabuf->buforder,
-                                   dmabuf->rawbuf, dmabuf->dma_handle);
-       }
-       dmabuf->rawbuf = NULL;
-       dmabuf->mapped = dmabuf->ready = 0;
-}
-
-static int prog_dmabuf(struct ali_state *state, unsigned rec)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       struct ali_channel *c = NULL;
-       struct sg_item *sg;
-       unsigned long flags;
-       int ret;
-       unsigned fragint;
-       int i;
-
-       spin_lock_irqsave(&state->card->lock, flags);
-       if (dmabuf->enable & DAC_RUNNING)
-               __stop_dac(state);
-       if (dmabuf->enable & ADC_RUNNING)
-               __stop_adc(state);
-       if (dmabuf->enable & CODEC_SPDIFOUT_RUNNING)
-               __stop_spdifout(state);
-       if (dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING)
-               __stop_spdifout(state);
-
-       dmabuf->total_bytes = 0;
-       dmabuf->count = dmabuf->error = 0;
-       dmabuf->swptr = dmabuf->hwptr = 0;
-       spin_unlock_irqrestore(&state->card->lock, flags);
-
-       /* allocate DMA buffer, let alloc_dmabuf determine if we are already
-        * allocated well enough or if we should replace the current buffer
-        * (assuming one is already allocated, if it isn't, then allocate it).
-        */
-       if ((ret = alloc_dmabuf(state)))
-               return ret;
-
-       /* FIXME: figure out all this OSS fragment stuff */
-       /* I did, it now does what it should according to the OSS API.  DL */
-       /* We may not have realloced our dmabuf, but the fragment size to
-        * fragment number ratio may have changed, so go ahead and reprogram
-        * things
-        */
-
-       dmabuf->dmasize = PAGE_SIZE << dmabuf->buforder;
-       dmabuf->numfrag = SG_LEN;
-       dmabuf->fragsize = dmabuf->dmasize / dmabuf->numfrag;
-       dmabuf->fragsamples = dmabuf->fragsize >> 1;
-       dmabuf->userfragsize = dmabuf->ossfragsize;
-       dmabuf->userfrags = dmabuf->dmasize / dmabuf->ossfragsize;
-
-       memset(dmabuf->rawbuf, 0, dmabuf->dmasize);
-
-       if (dmabuf->ossmaxfrags == 4) {
-               fragint = 8;
-               dmabuf->fragshift = 2;
-       } else if (dmabuf->ossmaxfrags == 8) {
-               fragint = 4;
-               dmabuf->fragshift = 3;
-       } else if (dmabuf->ossmaxfrags == 16) {
-               fragint = 2;
-               dmabuf->fragshift = 4;
-       } else {
-               fragint = 1;
-               dmabuf->fragshift = 5;
-       }
-       /*
-        *      Now set up the ring 
-        */
-
-       if (rec == 1)
-               c = dmabuf->read_channel;
-       else if (rec == 2)
-               c = dmabuf->codec_spdifout_channel;
-       else if (rec == 3)
-               c = dmabuf->controller_spdifout_channel;
-       else if (rec == 0)
-               c = dmabuf->write_channel;
-       if (c != NULL) {
-               sg = &c->sg[0];
-               /*
-                *      Load up 32 sg entries and take an interrupt at half
-                *      way (we might want more interrupts later..) 
-                */
-               for (i = 0; i < dmabuf->numfrag; i++) {
-                       sg->busaddr =
-                           virt_to_bus(dmabuf->rawbuf +
-                                       dmabuf->fragsize * i);
-                       // the card will always be doing 16bit stereo
-                       sg->control = dmabuf->fragsamples;
-                       sg->control |= CON_BUFPAD;      //I modify
-                       // set us up to get IOC interrupts as often as needed to
-                       // satisfy numfrag requirements, no more
-                       if (((i + 1) % fragint) == 0) {
-                               sg->control |= CON_IOC;
-                       }
-                       sg++;
-               }
-               spin_lock_irqsave(&state->card->lock, flags);
-               outb(2, state->card->iobase + c->port + OFF_CR);        /* reset DMA machine */
-               outl(virt_to_bus(&c->sg[0]), state->card->iobase + c->port + OFF_BDBAR);
-               outb(0, state->card->iobase + c->port + OFF_CIV);
-               outb(0, state->card->iobase + c->port + OFF_LVI);
-               spin_unlock_irqrestore(&state->card->lock, flags);
-       }
-       /* set the ready flag for the dma buffer */
-       dmabuf->ready = 1;
-       return 0;
-}
-
-static void __ali_update_lvi(struct ali_state *state, int rec)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       int x, port;
-       port = state->card->iobase;
-       if (rec == 1)
-               port += dmabuf->read_channel->port;
-       else if (rec == 2)
-               port += dmabuf->codec_spdifout_channel->port;
-       else if (rec == 3)
-               port += dmabuf->controller_spdifout_channel->port;
-       else if (rec == 0)
-               port += dmabuf->write_channel->port;
-       /* if we are currently stopped, then our CIV is actually set to our
-        * *last* sg segment and we are ready to wrap to the next.  However,
-        * if we set our LVI to the last sg segment, then it won't wrap to
-        * the next sg segment, it won't even get a start.  So, instead, when
-        * we are stopped, we set both the LVI value and also we increment
-        * the CIV value to the next sg segment to be played so that when
-        * we call start_{dac,adc}, things will operate properly
-        */
-       if (!dmabuf->enable && dmabuf->ready) {
-               if (rec && dmabuf->count < dmabuf->dmasize && (dmabuf->trigger & PCM_ENABLE_INPUT)) {
-                       outb((inb(port + OFF_CIV) + 1) & 31, port + OFF_LVI);
-                       __start_adc(state);
-                       while (! (inb(port + OFF_CR) & ((1 << 4) | (1 << 2))))
-                               cpu_relax();
-               } else if (!rec && dmabuf->count && (dmabuf->trigger & PCM_ENABLE_OUTPUT)) {
-                       outb((inb(port + OFF_CIV) + 1) & 31, port + OFF_LVI);
-                       __start_dac(state);
-                       while (!(inb(port + OFF_CR) & ((1 << 4) | (1 << 2))))
-                               cpu_relax();
-               } else if (rec && dmabuf->count && (dmabuf->trigger & SPDIF_ENABLE_OUTPUT)) {
-                       if (codec_independent_spdif_locked > 0) {
-                               // outb((inb(port+OFF_CIV))&31, port+OFF_LVI);
-                               outb((inb(port + OFF_CIV) + 1) & 31, port + OFF_LVI);
-                               __start_spdifout(state);
-                               while (!(inb(port + OFF_CR) & ((1 << 4) | (1 << 2))))
-                                       cpu_relax();
-                       } else {
-                               if (controller_independent_spdif_locked > 0) {
-                                       outb((inb(port + OFF_CIV) + 1) & 31, port + OFF_LVI);
-                                       __start_spdifout(state);
-                                       while (!(inb(port + OFF_CR) & ((1 << 4) | (1 << 2))))
-                                               cpu_relax();
-                               }
-                       }
-               }
-       }
-
-       /* swptr - 1 is the tail of our transfer */
-       x = (dmabuf->dmasize + dmabuf->swptr - 1) % dmabuf->dmasize;
-       x /= dmabuf->fragsize;
-       outb(x, port + OFF_LVI);
-}
-
-static void ali_update_lvi(struct ali_state *state, int rec)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       unsigned long flags;
-       if (!dmabuf->ready)
-               return;
-       spin_lock_irqsave(&state->card->lock, flags);
-       __ali_update_lvi(state, rec);
-       spin_unlock_irqrestore(&state->card->lock, flags);
-}
-
-/* update buffer manangement pointers, especially, dmabuf->count and dmabuf->hwptr */
-static void ali_update_ptr(struct ali_state *state)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       unsigned hwptr;
-       int diff;
-       
-       /* error handling and process wake up for DAC */
-       if (dmabuf->enable == ADC_RUNNING) {
-               /* update hardware pointer */
-               hwptr = ali_get_dma_addr(state, 1);
-               diff = (dmabuf->dmasize + hwptr - dmabuf->hwptr) % dmabuf->dmasize;
-               dmabuf->hwptr = hwptr;
-               dmabuf->total_bytes += diff;
-               dmabuf->count += diff;
-               if (dmabuf->count > dmabuf->dmasize) {
-                       /* buffer underrun or buffer overrun */
-                       /* this is normal for the end of a read */
-                       /* only give an error if we went past the */
-                       /* last valid sg entry */
-                       if ((inb(state->card->iobase + PI_CIV) & 31) != (inb(state->card->iobase + PI_LVI) & 31)) {
-                               printk(KERN_WARNING "ali_audio: DMA overrun on read\n");
-                               dmabuf->error++;
-                       }
-               }
-               if (dmabuf->count > dmabuf->userfragsize)
-                       wake_up(&dmabuf->wait);
-       }
-       /* error handling and process wake up for DAC */
-       if (dmabuf->enable == DAC_RUNNING) {
-               /* update hardware pointer */
-               hwptr = ali_get_dma_addr(state, 0);
-               diff =
-                   (dmabuf->dmasize + hwptr -
-                    dmabuf->hwptr) % dmabuf->dmasize;
-#if defined(DEBUG_INTERRUPTS) || defined(DEBUG_MMAP)
-               printk("DAC HWP %d,%d,%d\n", hwptr, dmabuf->hwptr, diff);
-#endif
-               dmabuf->hwptr = hwptr;
-               dmabuf->total_bytes += diff;
-               dmabuf->count -= diff;
-               if (dmabuf->count < 0) {
-                       /* buffer underrun or buffer overrun */
-                       /* this is normal for the end of a write */
-                       /* only give an error if we went past the */
-                       /* last valid sg entry */
-                       if ((inb(state->card->iobase + PO_CIV) & 31) != (inb(state->card->iobase + PO_LVI) & 31)) {
-                               printk(KERN_WARNING "ali_audio: DMA overrun on write\n");
-                               printk(KERN_DEBUG "ali_audio: CIV %d, LVI %d, hwptr %x, count %d\n",
-                                                       inb(state->card->iobase + PO_CIV) & 31,
-                                                       inb(state->card->iobase + PO_LVI) & 31, 
-                                                       dmabuf->hwptr,
-                                                       dmabuf->count);
-                               dmabuf->error++;
-                       }
-               }
-               if (dmabuf->count < (dmabuf->dmasize - dmabuf->userfragsize))
-                       wake_up(&dmabuf->wait);
-       }
-
-       /* error handling and process wake up for CODEC SPDIF OUT */
-       if (dmabuf->enable == CODEC_SPDIFOUT_RUNNING) {
-               /* update hardware pointer */
-               hwptr = ali_get_dma_addr(state, 2);
-               diff = (dmabuf->dmasize + hwptr - dmabuf->hwptr) % dmabuf->dmasize;
-               dmabuf->hwptr = hwptr;
-               dmabuf->total_bytes += diff;
-               dmabuf->count -= diff;
-               if (dmabuf->count < 0) {
-                       /* buffer underrun or buffer overrun */
-                       /* this is normal for the end of a write */
-                       /* only give an error if we went past the */
-                       /* last valid sg entry */
-                       if ((inb(state->card->iobase + CODECSPDIFOUT_CIV) & 31) != (inb(state->card->iobase + CODECSPDIFOUT_LVI) & 31)) {
-                               printk(KERN_WARNING "ali_audio: DMA overrun on write\n");
-                               printk(KERN_DEBUG "ali_audio: CIV %d, LVI %d, hwptr %x, count %d\n", 
-                                       inb(state->card->iobase + CODECSPDIFOUT_CIV) & 31,
-                                       inb(state->card->iobase + CODECSPDIFOUT_LVI) & 31,
-                                       dmabuf->hwptr, dmabuf->count);
-                               dmabuf->error++;
-                       }
-               }
-               if (dmabuf->count < (dmabuf->dmasize - dmabuf->userfragsize))
-                       wake_up(&dmabuf->wait);
-       }
-       /* error handling and process wake up for CONTROLLER SPDIF OUT */
-       if (dmabuf->enable == CONTROLLER_SPDIFOUT_RUNNING) {
-               /* update hardware pointer */
-               hwptr = ali_get_dma_addr(state, 3);
-               diff = (dmabuf->dmasize + hwptr - dmabuf->hwptr) % dmabuf->dmasize;
-               dmabuf->hwptr = hwptr;
-               dmabuf->total_bytes += diff;
-               dmabuf->count -= diff;
-               if (dmabuf->count < 0) {
-                       /* buffer underrun or buffer overrun */
-                       /* this is normal for the end of a write */
-                       /* only give an error if we went past the */
-                       /* last valid sg entry */
-                       if ((inb(state->card->iobase + CONTROLLERSPDIFOUT_CIV) & 31) != (inb(state->card->iobase + CONTROLLERSPDIFOUT_LVI) & 31)) {
-                               printk(KERN_WARNING
-                                      "ali_audio: DMA overrun on write\n");
-                               printk("ali_audio: CIV %d, LVI %d, hwptr %x, "
-                                       "count %d\n",
-                                               inb(state->card->iobase + CONTROLLERSPDIFOUT_CIV) & 31,
-                                               inb(state->card->iobase + CONTROLLERSPDIFOUT_LVI) & 31,
-                                               dmabuf->hwptr, dmabuf->count);
-                               dmabuf->error++;
-                       }
-               }
-               if (dmabuf->count < (dmabuf->dmasize - dmabuf->userfragsize))
-                       wake_up(&dmabuf->wait);
-       }
-}
-
-static inline int ali_get_free_write_space(struct
-                                          ali_state
-                                          *state)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       int free;
-
-       if (dmabuf->count < 0) {
-               dmabuf->count = 0;
-               dmabuf->swptr = dmabuf->hwptr;
-       }
-       free = dmabuf->dmasize - dmabuf->swptr;
-       if ((dmabuf->count + free) > dmabuf->dmasize){
-               free = dmabuf->dmasize - dmabuf->count;
-       }
-       return free;
-}
-
-static inline int ali_get_available_read_data(struct
-                                             ali_state
-                                             *state)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       int avail;
-       ali_update_ptr(state);
-       // catch overruns during record
-       if (dmabuf->count > dmabuf->dmasize) {
-               dmabuf->count = dmabuf->dmasize;
-               dmabuf->swptr = dmabuf->hwptr;
-       }
-       avail = dmabuf->count;
-       avail -= (dmabuf->hwptr % dmabuf->fragsize);
-       if (avail < 0)
-               return (0);
-       return (avail);
-}
-
-static int drain_dac(struct ali_state *state, int signals_allowed)
-{
-
-       DECLARE_WAITQUEUE(wait, current);
-       struct dmabuf *dmabuf = &state->dmabuf;
-       unsigned long flags;
-       unsigned long tmo;
-       int count;
-       if (!dmabuf->ready)
-               return 0;
-       if (dmabuf->mapped) {
-               stop_dac(state);
-               return 0;
-       }
-       add_wait_queue(&dmabuf->wait, &wait);
-       for (;;) {
-
-               spin_lock_irqsave(&state->card->lock, flags);
-               ali_update_ptr(state);
-               count = dmabuf->count;
-               spin_unlock_irqrestore(&state->card->lock, flags);
-               if (count <= 0)
-                       break;
-               /* 
-                * This will make sure that our LVI is correct, that our
-                * pointer is updated, and that the DAC is running.  We
-                * have to force the setting of dmabuf->trigger to avoid
-                * any possible deadlocks.
-                */
-               if (!dmabuf->enable) {
-                       dmabuf->trigger = PCM_ENABLE_OUTPUT;
-                       ali_update_lvi(state, 0);
-               }
-               if (signal_pending(current) && signals_allowed) {
-                       break;
-               }
-
-               /* It seems that we have to set the current state to
-                * TASK_INTERRUPTIBLE every time to make the process
-                * really go to sleep.  This also has to be *after* the
-                * update_ptr() call because update_ptr is likely to
-                * do a wake_up() which will unset this before we ever
-                * try to sleep, resuling in a tight loop in this code
-                * instead of actually sleeping and waiting for an
-                * interrupt to wake us up!
-                */
-               set_current_state(TASK_INTERRUPTIBLE);
-               /*
-                * set the timeout to significantly longer than it *should*
-                * take for the DAC to drain the DMA buffer
-                */
-               tmo = (count * HZ) / (dmabuf->rate);
-               if (!schedule_timeout(tmo >= 2 ? tmo : 2)) {
-                       printk(KERN_ERR "ali_audio: drain_dac, dma timeout?\n");
-                       count = 0;
-                       break;
-               }
-       }
-       set_current_state(TASK_RUNNING);
-       remove_wait_queue(&dmabuf->wait, &wait);
-       if (count > 0 && signal_pending(current) && signals_allowed)
-               return -ERESTARTSYS;
-       stop_dac(state);
-       return 0;
-}
-
-
-static int drain_spdifout(struct ali_state *state, int signals_allowed)
-{
-
-       DECLARE_WAITQUEUE(wait, current);
-       struct dmabuf *dmabuf = &state->dmabuf;
-       unsigned long flags;
-       unsigned long tmo;
-       int count;
-       if (!dmabuf->ready)
-               return 0;
-       if (dmabuf->mapped) {
-               stop_spdifout(state);
-               return 0;
-       }
-       add_wait_queue(&dmabuf->wait, &wait);
-       for (;;) {
-
-               spin_lock_irqsave(&state->card->lock, flags);
-               ali_update_ptr(state);
-               count = dmabuf->count;
-               spin_unlock_irqrestore(&state->card->lock, flags);
-               if (count <= 0)
-                       break;
-               /* 
-                * This will make sure that our LVI is correct, that our
-                * pointer is updated, and that the DAC is running.  We
-                * have to force the setting of dmabuf->trigger to avoid
-                * any possible deadlocks.
-                */
-               if (!dmabuf->enable) {
-                       if (codec_independent_spdif_locked > 0) {
-                               dmabuf->trigger = SPDIF_ENABLE_OUTPUT;
-                               ali_update_lvi(state, 2);
-                       } else {
-                               if (controller_independent_spdif_locked > 0) {
-                                       dmabuf->trigger = SPDIF_ENABLE_OUTPUT;
-                                       ali_update_lvi(state, 3);
-                               }
-                       }
-               }
-               if (signal_pending(current) && signals_allowed) {
-                       break;
-               }
-
-               /* It seems that we have to set the current state to
-                * TASK_INTERRUPTIBLE every time to make the process
-                * really go to sleep.  This also has to be *after* the
-                * update_ptr() call because update_ptr is likely to
-                * do a wake_up() which will unset this before we ever
-                * try to sleep, resuling in a tight loop in this code
-                * instead of actually sleeping and waiting for an
-                * interrupt to wake us up!
-                */
-               set_current_state(TASK_INTERRUPTIBLE);
-               /*
-                * set the timeout to significantly longer than it *should*
-                * take for the DAC to drain the DMA buffer
-                */
-               tmo = (count * HZ) / (dmabuf->rate);
-               if (!schedule_timeout(tmo >= 2 ? tmo : 2)) {
-                       printk(KERN_ERR "ali_audio: drain_spdifout, dma timeout?\n");
-                       count = 0;
-                       break;
-               }
-       }
-       set_current_state(TASK_RUNNING);
-       remove_wait_queue(&dmabuf->wait, &wait);
-       if (count > 0 && signal_pending(current) && signals_allowed)
-               return -ERESTARTSYS;
-       stop_spdifout(state);
-       return 0;
-}
-
-static void ali_channel_interrupt(struct ali_card *card)
-{
-       int i, count;
-       
-       for (i = 0; i < NR_HW_CH; i++) {
-               struct ali_state *state = card->states[i];
-               struct ali_channel *c = NULL;
-               struct dmabuf *dmabuf;
-               unsigned long port = card->iobase;
-               u16 status;
-               if (!state)
-                       continue;
-               if (!state->dmabuf.ready)
-                       continue;
-               dmabuf = &state->dmabuf;
-               if (codec_independent_spdif_locked > 0) {
-                       if (dmabuf->enable & CODEC_SPDIFOUT_RUNNING) {
-                               c = dmabuf->codec_spdifout_channel;
-                       }
-               } else {
-                       if (controller_independent_spdif_locked > 0) {
-                               if (dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING)
-                                       c = dmabuf->controller_spdifout_channel;
-                       } else {
-                               if (dmabuf->enable & DAC_RUNNING) {
-                                       c = dmabuf->write_channel;
-                               } else if (dmabuf->enable & ADC_RUNNING) {
-                                       c = dmabuf->read_channel;
-                               } else
-                                       continue;
-                       }
-               }
-               port += c->port;
-
-               status = inw(port + OFF_SR);
-
-               if (status & DMA_INT_COMPLETE) {
-                       /* only wake_up() waiters if this interrupt signals
-                        * us being beyond a userfragsize of data open or
-                        * available, and ali_update_ptr() does that for
-                        * us
-                        */
-                       ali_update_ptr(state);
-               }
-
-               if (status & DMA_INT_LVI) {
-                       ali_update_ptr(state);
-                       wake_up(&dmabuf->wait);
-
-                       if (dmabuf->enable & DAC_RUNNING)
-                               count = dmabuf->count;
-                       else if (dmabuf->enable & ADC_RUNNING)
-                               count = dmabuf->dmasize - dmabuf->count;
-                       else if (dmabuf->enable & CODEC_SPDIFOUT_RUNNING)
-                               count = dmabuf->count;
-                       else if (dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING)
-                               count = dmabuf->count;
-                       else count = 0;
-
-                       if (count > 0) {
-                               if (dmabuf->enable & DAC_RUNNING)
-                                       outl((1 << 1), state->card->iobase + ALI_DMACR);
-                               else if (dmabuf->enable & CODEC_SPDIFOUT_RUNNING)
-                                               outl((1 << 3), state->card->iobase + ALI_DMACR);
-                               else if (dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING)
-                                       outl((1 << 7), state->card->iobase + ALI_DMACR);
-                       } else {
-                               if (dmabuf->enable & DAC_RUNNING)
-                                       __stop_dac(state);
-                               if (dmabuf->enable & ADC_RUNNING)
-                                       __stop_adc(state);
-                               if (dmabuf->enable & CODEC_SPDIFOUT_RUNNING)
-                                       __stop_spdifout(state);
-                               if (dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING)
-                                       __stop_spdifout(state);
-                               dmabuf->enable = 0;
-                               wake_up(&dmabuf->wait);
-                       }
-
-               }
-               if (!(status & DMA_INT_DCH)) {
-                       ali_update_ptr(state);
-                       wake_up(&dmabuf->wait);
-                       if (dmabuf->enable & DAC_RUNNING)
-                               count = dmabuf->count;
-                       else if (dmabuf->enable & ADC_RUNNING)
-                               count = dmabuf->dmasize - dmabuf->count;
-                       else if (dmabuf->enable & CODEC_SPDIFOUT_RUNNING)
-                               count = dmabuf->count;
-                       else if (dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING)
-                               count = dmabuf->count;
-                       else
-                               count = 0;
-
-                       if (count > 0) {
-                               if (dmabuf->enable & DAC_RUNNING)
-                                       outl((1 << 1), state->card->iobase + ALI_DMACR);
-                               else if (dmabuf->enable & CODEC_SPDIFOUT_RUNNING)
-                                       outl((1 << 3), state->card->iobase + ALI_DMACR);
-                               else if (dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING)
-                                       outl((1 << 7), state->card->iobase + ALI_DMACR);
-                       } else {
-                               if (dmabuf->enable & DAC_RUNNING)
-                                       __stop_dac(state);
-                               if (dmabuf->enable & ADC_RUNNING)
-                                       __stop_adc(state);
-                               if (dmabuf->enable & CODEC_SPDIFOUT_RUNNING)
-                                       __stop_spdifout(state);
-                               if (dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING)
-                                       __stop_spdifout(state);
-                               dmabuf->enable = 0;
-                               wake_up(&dmabuf->wait);
-                       }
-               }
-               outw(status & DMA_INT_MASK, port + OFF_SR);
-       }
-}
-
-static irqreturn_t ali_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-       struct ali_card *card = (struct ali_card *) dev_id;
-       u32 status;
-       u16 status2;
-
-       spin_lock(&card->lock);
-       status = inl(card->iobase + ALI_INTERRUPTSR);
-       if (!(status & INT_MASK)) {
-               spin_unlock(&card->lock);
-               return IRQ_NONE;                /* not for us */
-       }
-
-       if (codec_independent_spdif_locked > 0) {
-               if (globel == 0) {
-                       globel += 1;
-                       status2 = inw(card->iobase + 0x76);
-                       outw(status2 | 0x000c, card->iobase + 0x76);
-               } else {
-                       if (status & (INT_PCMOUT | INT_PCMIN | INT_MICIN | INT_SPDIFOUT | INT_CODECSPDIFOUT))
-                               ali_channel_interrupt(card);
-               }
-       } else {
-               if (status & (INT_PCMOUT | INT_PCMIN | INT_MICIN | INT_SPDIFOUT | INT_CODECSPDIFOUT))
-                       ali_channel_interrupt(card);
-       }
-
-       /* clear 'em */
-       outl(status & INT_MASK, card->iobase + ALI_INTERRUPTSR);
-       spin_unlock(&card->lock);
-       return IRQ_HANDLED;
-}
-
-/* in this loop, dmabuf.count signifies the amount of data that is
-   waiting to be copied to the user's buffer.  It is filled by the dma
-   machine and drained by this loop. */
-
-static ssize_t ali_read(struct file *file, char __user *buffer,
-                       size_t count, loff_t * ppos)
-{
-       struct ali_state *state = (struct ali_state *) file->private_data;
-       struct ali_card *card = state ? state->card : NULL;
-       struct dmabuf *dmabuf = &state->dmabuf;
-       ssize_t ret;
-       unsigned long flags;
-       unsigned int swptr;
-       int cnt;
-       DECLARE_WAITQUEUE(waita, current);
-#ifdef DEBUG2
-       printk("ali_audio: ali_read called, count = %d\n", count);
-#endif
-       if (dmabuf->mapped)
-               return -ENXIO;
-       if (dmabuf->enable & DAC_RUNNING)
-               return -ENODEV;
-       if (!dmabuf->read_channel) {
-               dmabuf->ready = 0;
-               dmabuf->read_channel = card->alloc_rec_pcm_channel(card);
-               if (!dmabuf->read_channel) {
-                       return -EBUSY;
-               }
-       }
-       if (!dmabuf->ready && (ret = prog_dmabuf(state, 1)))
-               return ret;
-       if (!access_ok(VERIFY_WRITE, buffer, count))
-               return -EFAULT;
-       ret = 0;
-       add_wait_queue(&dmabuf->wait, &waita);
-       while (count > 0) {
-               set_current_state(TASK_INTERRUPTIBLE);
-               spin_lock_irqsave(&card->lock, flags);
-               if (PM_SUSPENDED(card)) {
-                       spin_unlock_irqrestore(&card->lock, flags);
-                       schedule();
-                       if (signal_pending(current)) {
-                               if (!ret)
-                                       ret = -EAGAIN;
-                               break;
-                       }
-                       continue;
-               }
-               swptr = dmabuf->swptr;
-               cnt = ali_get_available_read_data(state);
-               // this is to make the copy_to_user simpler below
-               if (cnt > (dmabuf->dmasize - swptr))
-                       cnt = dmabuf->dmasize - swptr;
-               spin_unlock_irqrestore(&card->lock, flags);
-               if (cnt > count)
-                       cnt = count;
-               /* Lop off the last two bits to force the code to always
-                * write in full samples.  This keeps software that sets
-                * O_NONBLOCK but doesn't check the return value of the
-                * write call from getting things out of state where they
-                * think a full 4 byte sample was written when really only
-                * a portion was, resulting in odd sound and stereo
-                * hysteresis.
-                */
-               cnt &= ~0x3;
-               if (cnt <= 0) {
-                       unsigned long tmo;
-                       /*
-                        * Don't let us deadlock.  The ADC won't start if
-                        * dmabuf->trigger isn't set.  A call to SETTRIGGER
-                        * could have turned it off after we set it to on
-                        * previously.
-                        */
-                       dmabuf->trigger = PCM_ENABLE_INPUT;
-                       /*
-                        * This does three things.  Updates LVI to be correct,
-                        * makes sure the ADC is running, and updates the
-                        * hwptr.
-                        */
-                       ali_update_lvi(state, 1);
-                       if (file->f_flags & O_NONBLOCK) {
-                               if (!ret)
-                                       ret = -EAGAIN;
-                               goto done;
-                       }
-                       /* Set the timeout to how long it would take to fill
-                        * two of our buffers.  If we haven't been woke up
-                        * by then, then we know something is wrong.
-                        */
-                       tmo = (dmabuf->dmasize * HZ * 2) / (dmabuf->rate * 4);
-                           
-                       /* There are two situations when sleep_on_timeout returns, one is when
-                          the interrupt is serviced correctly and the process is waked up by
-                          ISR ON TIME. Another is when timeout is expired, which means that
-                          either interrupt is NOT serviced correctly (pending interrupt) or it
-                          is TOO LATE for the process to be scheduled to run (scheduler latency)
-                          which results in a (potential) buffer overrun. And worse, there is
-                          NOTHING we can do to prevent it. */
-                       if (!schedule_timeout(tmo >= 2 ? tmo : 2)) {
-                               printk(KERN_ERR
-                                      "ali_audio: recording schedule timeout, "
-                                      "dmasz %u fragsz %u count %i hwptr %u swptr %u\n",
-                                      dmabuf->dmasize, dmabuf->fragsize,
-                                      dmabuf->count, dmabuf->hwptr,
-                                      dmabuf->swptr);
-                               /* a buffer overrun, we delay the recovery until next time the
-                                  while loop begin and we REALLY have space to record */
-                       }
-                       if (signal_pending(current)) {
-                               ret = ret ? ret : -ERESTARTSYS;
-                               goto done;
-                       }
-                       continue;
-               }
-
-               if (copy_to_user(buffer, dmabuf->rawbuf + swptr, cnt)) {
-                       if (!ret)
-                               ret = -EFAULT;
-                       goto done;
-               }
-
-               swptr = (swptr + cnt) % dmabuf->dmasize;
-               spin_lock_irqsave(&card->lock, flags);
-               if (PM_SUSPENDED(card)) {
-                       spin_unlock_irqrestore(&card->lock, flags);
-                       continue;
-               }
-               dmabuf->swptr = swptr;
-               dmabuf->count -= cnt;
-               spin_unlock_irqrestore(&card->lock, flags);
-               count -= cnt;
-               buffer += cnt;
-               ret += cnt;
-       }
-done:
-       ali_update_lvi(state, 1);
-       set_current_state(TASK_RUNNING);
-       remove_wait_queue(&dmabuf->wait, &waita);
-       return ret;
-}
-
-/* in this loop, dmabuf.count signifies the amount of data that is waiting to be dma to
-   the soundcard.  it is drained by the dma machine and filled by this loop. */
-static ssize_t ali_write(struct file *file,
-                        const char __user *buffer, size_t count, loff_t * ppos)
-{
-       struct ali_state *state = (struct ali_state *) file->private_data;
-       struct ali_card *card = state ? state->card : NULL;
-       struct dmabuf *dmabuf = &state->dmabuf;
-       ssize_t ret;
-       unsigned long flags;
-       unsigned int swptr = 0;
-       int cnt, x;
-       DECLARE_WAITQUEUE(waita, current);
-#ifdef DEBUG2
-       printk("ali_audio: ali_write called, count = %d\n", count);
-#endif
-       if (dmabuf->mapped)
-               return -ENXIO;
-       if (dmabuf->enable & ADC_RUNNING)
-               return -ENODEV;
-       if (codec_independent_spdif_locked > 0) {
-               if (!dmabuf->codec_spdifout_channel) {
-                       dmabuf->ready = 0;
-                       dmabuf->codec_spdifout_channel = card->alloc_codec_spdifout_channel(card);
-                       if (!dmabuf->codec_spdifout_channel)
-                               return -EBUSY;
-               }
-       } else {
-               if (controller_independent_spdif_locked > 0) {
-                       if (!dmabuf->controller_spdifout_channel) {
-                               dmabuf->ready = 0;
-                               dmabuf->controller_spdifout_channel = card->alloc_controller_spdifout_channel(card);
-                               if (!dmabuf->controller_spdifout_channel)
-                                       return -EBUSY;
-                       }
-               } else {
-                       if (!dmabuf->write_channel) {
-                               dmabuf->ready = 0;
-                               dmabuf->write_channel =
-                                   card->alloc_pcm_channel(card);
-                               if (!dmabuf->write_channel)
-                                       return -EBUSY;
-                       }
-               }
-       }
-
-       if (codec_independent_spdif_locked > 0) {
-               if (!dmabuf->ready && (ret = prog_dmabuf(state, 2)))
-                       return ret;
-       } else {
-               if (controller_independent_spdif_locked > 0) {
-                       if (!dmabuf->ready && (ret = prog_dmabuf(state, 3)))
-                               return ret;
-               } else {
-
-                       if (!dmabuf->ready && (ret = prog_dmabuf(state, 0)))
-                               return ret;
-               }
-       }
-       if (!access_ok(VERIFY_READ, buffer, count))
-               return -EFAULT;
-       ret = 0;
-       add_wait_queue(&dmabuf->wait, &waita);
-       while (count > 0) {
-               set_current_state(TASK_INTERRUPTIBLE);
-               spin_lock_irqsave(&state->card->lock, flags);
-               if (PM_SUSPENDED(card)) {
-                       spin_unlock_irqrestore(&card->lock, flags);
-                       schedule();
-                       if (signal_pending(current)) {
-                               if (!ret)
-                                       ret = -EAGAIN;
-                               break;
-                       }
-                       continue;
-               }
-
-               swptr = dmabuf->swptr;
-               cnt = ali_get_free_write_space(state);
-               /* Bound the maximum size to how much we can copy to the
-                * dma buffer before we hit the end.  If we have more to
-                * copy then it will get done in a second pass of this
-                * loop starting from the beginning of the buffer.
-                */
-               if (cnt > (dmabuf->dmasize - swptr))
-                       cnt = dmabuf->dmasize - swptr;
-               spin_unlock_irqrestore(&state->card->lock, flags);
-#ifdef DEBUG2
-               printk(KERN_INFO
-                      "ali_audio: ali_write: %d bytes available space\n",
-                      cnt);
-#endif
-               if (cnt > count)
-                       cnt = count;
-               /* Lop off the last two bits to force the code to always
-                * write in full samples.  This keeps software that sets
-                * O_NONBLOCK but doesn't check the return value of the
-                * write call from getting things out of state where they
-                * think a full 4 byte sample was written when really only
-                * a portion was, resulting in odd sound and stereo
-                * hysteresis.
-                */
-               cnt &= ~0x3;
-               if (cnt <= 0) {
-                       unsigned long tmo;
-                       // There is data waiting to be played
-                       /*
-                        * Force the trigger setting since we would
-                        * deadlock with it set any other way
-                        */
-                       if (codec_independent_spdif_locked > 0) {
-                               dmabuf->trigger = SPDIF_ENABLE_OUTPUT;
-                               ali_update_lvi(state, 2);
-                       } else {
-                               if (controller_independent_spdif_locked > 0) {
-                                       dmabuf->trigger = SPDIF_ENABLE_OUTPUT;
-                                       ali_update_lvi(state, 3);
-                               } else {
-
-                                       dmabuf->trigger = PCM_ENABLE_OUTPUT;
-                                       ali_update_lvi(state, 0);
-                               }
-                       }
-                       if (file->f_flags & O_NONBLOCK) {
-                               if (!ret)
-                                       ret = -EAGAIN;
-                               goto ret;
-                       }
-                       /* Not strictly correct but works */
-                       tmo = (dmabuf->dmasize * HZ * 2) / (dmabuf->rate * 4);
-                       /* There are two situations when sleep_on_timeout returns, one is when
-                          the interrupt is serviced correctly and the process is waked up by
-                          ISR ON TIME. Another is when timeout is expired, which means that
-                          either interrupt is NOT serviced correctly (pending interrupt) or it
-                          is TOO LATE for the process to be scheduled to run (scheduler latency)
-                          which results in a (potential) buffer underrun. And worse, there is
-                          NOTHING we can do to prevent it. */
-                          
-                       /* FIXME - do timeout handling here !! */
-                       schedule_timeout(tmo >= 2 ? tmo : 2);
-
-                       if (signal_pending(current)) {
-                               if (!ret)
-                                       ret = -ERESTARTSYS;
-                               goto ret;
-                       }
-                       continue;
-               }
-               if (copy_from_user(dmabuf->rawbuf + swptr, buffer, cnt)) {
-                       if (!ret)
-                               ret = -EFAULT;
-                       goto ret;
-               }
-
-               swptr = (swptr + cnt) % dmabuf->dmasize;
-               spin_lock_irqsave(&state->card->lock, flags);
-               if (PM_SUSPENDED(card)) {
-                       spin_unlock_irqrestore(&card->lock, flags);
-                       continue;
-               }
-
-               dmabuf->swptr = swptr;
-               dmabuf->count += cnt;
-               count -= cnt;
-               buffer += cnt;
-               ret += cnt;
-               spin_unlock_irqrestore(&state->card->lock, flags);
-       }
-       if (swptr % dmabuf->fragsize) {
-               x = dmabuf->fragsize - (swptr % dmabuf->fragsize);
-               memset(dmabuf->rawbuf + swptr, '\0', x);
-       }
-ret:
-       if (codec_independent_spdif_locked > 0) {
-               ali_update_lvi(state, 2);
-       } else {
-               if (controller_independent_spdif_locked > 0) {
-                       ali_update_lvi(state, 3);
-               } else {
-                       ali_update_lvi(state, 0);
-               }
-       }
-       set_current_state(TASK_RUNNING);
-       remove_wait_queue(&dmabuf->wait, &waita);
-       return ret;
-}
-
-/* No kernel lock - we have our own spinlock */
-static unsigned int ali_poll(struct file *file, struct poll_table_struct
-                            *wait)
-{
-       struct ali_state *state = (struct ali_state *) file->private_data;
-       struct dmabuf *dmabuf = &state->dmabuf;
-       unsigned long flags;
-       unsigned int mask = 0;
-       if (!dmabuf->ready)
-               return 0;
-       poll_wait(file, &dmabuf->wait, wait);
-       spin_lock_irqsave(&state->card->lock, flags);
-       ali_update_ptr(state);
-       if (file->f_mode & FMODE_READ && dmabuf->enable & ADC_RUNNING) {
-               if (dmabuf->count >= (signed) dmabuf->fragsize)
-                       mask |= POLLIN | POLLRDNORM;
-       }
-       if (file->f_mode & FMODE_WRITE  && (dmabuf->enable & (DAC_RUNNING|CODEC_SPDIFOUT_RUNNING|CONTROLLER_SPDIFOUT_RUNNING))) {
-               if ((signed) dmabuf->dmasize >= dmabuf->count + (signed) dmabuf->fragsize)
-                       mask |= POLLOUT | POLLWRNORM;
-       }
-       spin_unlock_irqrestore(&state->card->lock, flags);
-       return mask;
-}
-
-static int ali_mmap(struct file *file, struct vm_area_struct *vma)
-{
-       struct ali_state *state = (struct ali_state *) file->private_data;
-       struct dmabuf *dmabuf = &state->dmabuf;
-       int ret = -EINVAL;
-       unsigned long size;
-       lock_kernel();
-       if (vma->vm_flags & VM_WRITE) {
-               if (!dmabuf->write_channel && (dmabuf->write_channel = state->card->alloc_pcm_channel(state->card)) == NULL) {
-                       ret = -EBUSY;
-                       goto out;
-               }
-       }
-       if (vma->vm_flags & VM_READ) {
-               if (!dmabuf->read_channel && (dmabuf->read_channel = state->card->alloc_rec_pcm_channel(state->card)) == NULL) {
-                       ret = -EBUSY;
-                       goto out;
-               }
-       }
-       if ((ret = prog_dmabuf(state, 0)) != 0)
-               goto out;
-       ret = -EINVAL;
-       if (vma->vm_pgoff != 0)
-               goto out;
-       size = vma->vm_end - vma->vm_start;
-       if (size > (PAGE_SIZE << dmabuf->buforder))
-               goto out;
-       ret = -EAGAIN;
-       if (remap_pfn_range(vma, vma->vm_start,
-                               virt_to_phys(dmabuf->rawbuf) >> PAGE_SHIFT,
-                               size, vma->vm_page_prot))
-               goto out;
-       dmabuf->mapped = 1;
-       dmabuf->trigger = 0;
-       ret = 0;
-out:
-       unlock_kernel();
-       return ret;
-}
-
-static int ali_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
-{
-       struct ali_state *state = (struct ali_state *) file->private_data;
-       struct ali_channel *c = NULL;
-       struct dmabuf *dmabuf = &state->dmabuf;
-       unsigned long flags;
-       audio_buf_info abinfo;
-       count_info cinfo;
-       unsigned int i_scr;
-       int val = 0, ret;
-       struct ac97_codec *codec = state->card->ac97_codec[0];
-       void __user *argp = (void __user *)arg;
-       int __user *p = argp;
-
-#ifdef DEBUG
-       printk("ali_audio: ali_ioctl, arg=0x%x, cmd=",
-              arg ? *p : 0);
-#endif
-       switch (cmd) {
-       case OSS_GETVERSION:
-#ifdef DEBUG
-               printk("OSS_GETVERSION\n");
-#endif
-               return put_user(SOUND_VERSION, p);
-       case SNDCTL_DSP_RESET:
-#ifdef DEBUG
-               printk("SNDCTL_DSP_RESET\n");
-#endif
-               spin_lock_irqsave(&state->card->lock, flags);
-               if (dmabuf->enable == DAC_RUNNING) {
-                       c = dmabuf->write_channel;
-                       __stop_dac(state);
-               }
-               if (dmabuf->enable == ADC_RUNNING) {
-                       c = dmabuf->read_channel;
-                       __stop_adc(state);
-               }
-               if (dmabuf->enable == CODEC_SPDIFOUT_RUNNING) {
-                       c = dmabuf->codec_spdifout_channel;
-                       __stop_spdifout(state);
-               }
-               if (dmabuf->enable == CONTROLLER_SPDIFOUT_RUNNING) {
-                       c = dmabuf->controller_spdifout_channel;
-                       __stop_spdifout(state);
-               }
-               if (c != NULL) {
-                       outb(2, state->card->iobase + c->port + OFF_CR);        /* reset DMA machine */
-                       outl(virt_to_bus(&c->sg[0]),
-                            state->card->iobase + c->port + OFF_BDBAR);
-                       outb(0, state->card->iobase + c->port + OFF_CIV);
-                       outb(0, state->card->iobase + c->port + OFF_LVI);
-               }
-
-               spin_unlock_irqrestore(&state->card->lock, flags);
-               synchronize_irq(state->card->pci_dev->irq);
-               dmabuf->ready = 0;
-               dmabuf->swptr = dmabuf->hwptr = 0;
-               dmabuf->count = dmabuf->total_bytes = 0;
-               return 0;
-       case SNDCTL_DSP_SYNC:
-#ifdef DEBUG
-               printk("SNDCTL_DSP_SYNC\n");
-#endif
-               if (codec_independent_spdif_locked > 0) {
-                       if (dmabuf->enable != CODEC_SPDIFOUT_RUNNING
-                           || file->f_flags & O_NONBLOCK)
-                               return 0;
-                       if ((val = drain_spdifout(state, 1)))
-                               return val;
-               } else {
-                       if (controller_independent_spdif_locked > 0) {
-                               if (dmabuf->enable !=
-                                   CONTROLLER_SPDIFOUT_RUNNING
-                                   || file->f_flags & O_NONBLOCK)
-                                       return 0;
-                               if ((val = drain_spdifout(state, 1)))
-                                       return val;
-                       } else {
-                               if (dmabuf->enable != DAC_RUNNING
-                                   || file->f_flags & O_NONBLOCK)
-                                       return 0;
-                               if ((val = drain_dac(state, 1)))
-                                       return val;
-                       }
-               }
-               dmabuf->total_bytes = 0;
-               return 0;
-       case SNDCTL_DSP_SPEED:  /* set smaple rate */
-#ifdef DEBUG
-               printk("SNDCTL_DSP_SPEED\n");
-#endif
-               if (get_user(val, p))
-                       return -EFAULT;
-               if (val >= 0) {
-                       if (file->f_mode & FMODE_WRITE) {
-                               if ((state->card->ac97_status & SPDIF_ON)) {    /* S/PDIF Enabled */
-                                       /* RELTEK ALC650 only support 48000, need to check that */
-                                       if (ali_valid_spdif_rate(codec, val)) {
-                                               if (codec_independent_spdif_locked > 0) {
-                                                       ali_set_spdif_output(state, -1, 0);
-                                                       stop_spdifout(state);
-                                                       dmabuf->ready = 0;
-                                                       /* I add test codec independent spdif out */
-                                                       spin_lock_irqsave(&state->card->lock, flags);
-                                                       ali_set_codecspdifout_rate(state, val); // I modified
-                                                       spin_unlock_irqrestore(&state->card->lock, flags);
-                                                       /* Set S/PDIF transmitter rate. */
-                                                       i_scr = inl(state->card->iobase + ALI_SCR);
-                                                       if ((i_scr & 0x00300000) == 0x00100000) {
-                                                               ali_set_spdif_output(state, AC97_EA_SPSA_7_8, codec_independent_spdif_locked);
-                                                       } else {
-                                                               if ((i_scr&0x00300000)  == 0x00200000)
-                                                               {
-                                                                       ali_set_spdif_output(state, AC97_EA_SPSA_6_9, codec_independent_spdif_locked);
-                                                               } else {
-                                                                       if ((i_scr & 0x00300000) == 0x00300000) {
-                                                                               ali_set_spdif_output(state, AC97_EA_SPSA_10_11, codec_independent_spdif_locked);
-                                                                       } else {
-                                                                               ali_set_spdif_output(state, AC97_EA_SPSA_7_8, codec_independent_spdif_locked);
-                                                                       }
-                                                               }
-                                                       }
-
-                                                       if (!(state->card->ac97_status & SPDIF_ON)) {
-                                                               val = dmabuf->rate;
-                                                       }
-                                               } else {
-                                                       if (controller_independent_spdif_locked > 0) 
-                                                       {
-                                                               stop_spdifout(state);
-                                                               dmabuf->ready = 0;
-                                                               spin_lock_irqsave(&state->card->lock, flags);
-                                                               ali_set_spdifout_rate(state, controller_independent_spdif_locked);
-                                                               spin_unlock_irqrestore(&state->card->lock, flags);
-                                                       } else {
-                                                               /* Set DAC rate */
-                                                               ali_set_spdif_output(state, -1, 0);
-                                                               stop_dac(state);
-                                                               dmabuf->ready = 0;
-                                                               spin_lock_irqsave(&state->card->lock, flags);
-                                                               ali_set_dac_rate(state, val);
-                                                               spin_unlock_irqrestore(&state->card->lock, flags);
-                                                               /* Set S/PDIF transmitter rate. */
-                                                               ali_set_spdif_output(state, AC97_EA_SPSA_3_4, val);
-                                                               if (!(state->card->ac97_status & SPDIF_ON))
-                                                               {
-                                                                       val = dmabuf->rate;
-                                                               }
-                                                       }
-                                               }
-                                       } else {        /* Not a valid rate for S/PDIF, ignore it */
-                                               val = dmabuf->rate;
-                                       }
-                               } else {
-                                       stop_dac(state);
-                                       dmabuf->ready = 0;
-                                       spin_lock_irqsave(&state->card->lock, flags);
-                                       ali_set_dac_rate(state, val);
-                                       spin_unlock_irqrestore(&state->card->lock, flags);
-                               }
-                       }
-                       if (file->f_mode & FMODE_READ) {
-                               stop_adc(state);
-                               dmabuf->ready = 0;
-                               spin_lock_irqsave(&state->card->lock, flags);
-                               ali_set_adc_rate(state, val);
-                               spin_unlock_irqrestore(&state->card->lock, flags);
-                       }
-               }
-               return put_user(dmabuf->rate, p);
-       case SNDCTL_DSP_STEREO: /* set stereo or mono channel */
-#ifdef DEBUG
-               printk("SNDCTL_DSP_STEREO\n");
-#endif
-               if (dmabuf->enable & DAC_RUNNING) {
-                       stop_dac(state);
-               }
-               if (dmabuf->enable & ADC_RUNNING) {
-                       stop_adc(state);
-               }
-               if (dmabuf->enable & CODEC_SPDIFOUT_RUNNING) {
-                       stop_spdifout(state);
-               }
-               if (dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING) {
-                       stop_spdifout(state);
-               }
-               return put_user(1, p);
-       case SNDCTL_DSP_GETBLKSIZE:
-               if (file->f_mode & FMODE_WRITE) {
-                       if (codec_independent_spdif_locked > 0) {
-                               if (!dmabuf->ready && (val = prog_dmabuf(state, 2)))
-                                       return val;
-                       } else {
-                               if (controller_independent_spdif_locked > 0) {
-                                       if (!dmabuf->ready && (val = prog_dmabuf(state, 3)))
-                                               return val;
-                               } else {
-                                       if (!dmabuf->ready && (val = prog_dmabuf(state, 0)))
-                                               return val;
-                               }
-                       }
-               }
-
-               if (file->f_mode & FMODE_READ) {
-                       if (!dmabuf->ready && (val = prog_dmabuf(state, 1)))
-                               return val;
-               }
-#ifdef DEBUG
-               printk("SNDCTL_DSP_GETBLKSIZE %d\n", dmabuf->userfragsize);
-#endif
-               return put_user(dmabuf->userfragsize, p);
-       case SNDCTL_DSP_GETFMTS:        /* Returns a mask of supported sample format */
-#ifdef DEBUG
-               printk("SNDCTL_DSP_GETFMTS\n");
-#endif
-               return put_user(AFMT_S16_LE, p);
-       case SNDCTL_DSP_SETFMT: /* Select sample format */
-#ifdef DEBUG
-               printk("SNDCTL_DSP_SETFMT\n");
-#endif
-               return put_user(AFMT_S16_LE, p);
-       case SNDCTL_DSP_CHANNELS:       // add support 4,6 channel 
-#ifdef DEBUG
-               printk("SNDCTL_DSP_CHANNELS\n");
-#endif
-               if (get_user(val, p))
-                       return -EFAULT;
-               if (val > 0) {
-                       if (dmabuf->enable & DAC_RUNNING) {
-                               stop_dac(state);
-                       }
-                       if (dmabuf->enable & CODEC_SPDIFOUT_RUNNING) {
-                               stop_spdifout(state);
-                       }
-                       if (dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING) {
-                               stop_spdifout(state);
-                       }
-                       if (dmabuf->enable & ADC_RUNNING) {
-                               stop_adc(state);
-                       }
-               } else {
-                       return put_user(state->card->channels, p);
-               }
-
-               i_scr = inl(state->card->iobase + ALI_SCR);
-               /* Current # of channels enabled */
-               if (i_scr & 0x00000100)
-                       ret = 4;
-               else if (i_scr & 0x00000200)
-                       ret = 6;
-               else
-                       ret = 2;
-               switch (val) {
-               case 2: /* 2 channels is always supported */
-                       if (codec_independent_spdif_locked > 0) {
-                               outl(((i_scr & 0xfffffcff) | 0x00100000), (state->card->iobase + ALI_SCR));
-                       } else
-                               outl((i_scr & 0xfffffcff), (state->card->iobase + ALI_SCR));
-                       /* Do we need to change mixer settings????  */
-                       break;
-               case 4: /* Supported on some chipsets, better check first */
-                       if (codec_independent_spdif_locked > 0) {
-                               outl(((i_scr & 0xfffffcff) | 0x00000100 | 0x00200000), (state->card->iobase + ALI_SCR));
-                       } else
-                               outl(((i_scr & 0xfffffcff) | 0x00000100), (state->card->iobase + ALI_SCR));
-                       break;
-               case 6: /* Supported on some chipsets, better check first */
-                       if (codec_independent_spdif_locked > 0) {
-                               outl(((i_scr & 0xfffffcff) | 0x00000200 | 0x00008000 | 0x00300000), (state->card->iobase + ALI_SCR));
-                       } else
-                               outl(((i_scr & 0xfffffcff) | 0x00000200 | 0x00008000), (state->card->iobase + ALI_SCR));
-                       break;
-               default:        /* nothing else is ever supported by the chipset */
-                       val = ret;
-                       break;
-               }
-               return put_user(val, p);
-       case SNDCTL_DSP_POST:   /* the user has sent all data and is notifying us */
-               /* we update the swptr to the end of the last sg segment then return */
-#ifdef DEBUG
-               printk("SNDCTL_DSP_POST\n");
-#endif
-               if (codec_independent_spdif_locked > 0) {
-                       if (!dmabuf->ready || (dmabuf->enable != CODEC_SPDIFOUT_RUNNING))
-                               return 0;
-               } else {
-                       if (controller_independent_spdif_locked > 0) {
-                               if (!dmabuf->ready || (dmabuf->enable != CONTROLLER_SPDIFOUT_RUNNING))
-                                       return 0;
-                       } else {
-                               if (!dmabuf->ready || (dmabuf->enable != DAC_RUNNING))
-                                       return 0;
-                       }
-               }
-               if ((dmabuf->swptr % dmabuf->fragsize) != 0) {
-                       val = dmabuf->fragsize - (dmabuf->swptr % dmabuf->fragsize);
-                       dmabuf->swptr += val;
-                       dmabuf->count += val;
-               }
-               return 0;
-       case SNDCTL_DSP_SUBDIVIDE:
-               if (dmabuf->subdivision)
-                       return -EINVAL;
-               if (get_user(val, p))
-                       return -EFAULT;
-               if (val != 1 && val != 2 && val != 4)
-                       return -EINVAL;
-#ifdef DEBUG
-               printk("SNDCTL_DSP_SUBDIVIDE %d\n", val);
-#endif
-               dmabuf->subdivision = val;
-               dmabuf->ready = 0;
-               return 0;
-       case SNDCTL_DSP_SETFRAGMENT:
-               if (get_user(val, p))
-                       return -EFAULT;
-               dmabuf->ossfragsize = 1 << (val & 0xffff);
-               dmabuf->ossmaxfrags = (val >> 16) & 0xffff;
-               if (!dmabuf->ossfragsize || !dmabuf->ossmaxfrags)
-                       return -EINVAL;
-               /*
-                * Bound the frag size into our allowed range of 256 - 4096
-                */
-               if (dmabuf->ossfragsize < 256)
-                       dmabuf->ossfragsize = 256;
-               else if (dmabuf->ossfragsize > 4096)
-                       dmabuf->ossfragsize = 4096;
-               /*
-                * The numfrags could be something reasonable, or it could
-                * be 0xffff meaning "Give me as much as possible".  So,
-                * we check the numfrags * fragsize doesn't exceed our
-                * 64k buffer limit, nor is it less than our 8k minimum.
-                * If it fails either one of these checks, then adjust the
-                * number of fragments, not the size of them.  It's OK if
-                * our number of fragments doesn't equal 32 or anything
-                * like our hardware based number now since we are using
-                * a different frag count for the hardware.  Before we get
-                * into this though, bound the maxfrags to avoid overflow
-                * issues.  A reasonable bound would be 64k / 256 since our
-                * maximum buffer size is 64k and our minimum frag size is
-                * 256.  On the other end, our minimum buffer size is 8k and
-                * our maximum frag size is 4k, so the lower bound should
-                * be 2.
-                */
-               if (dmabuf->ossmaxfrags > 256)
-                       dmabuf->ossmaxfrags = 256;
-               else if (dmabuf->ossmaxfrags < 2)
-                       dmabuf->ossmaxfrags = 2;
-               val = dmabuf->ossfragsize * dmabuf->ossmaxfrags;
-               while (val < 8192) {
-                       val <<= 1;
-                       dmabuf->ossmaxfrags <<= 1;
-               }
-               while (val > 65536) {
-                       val >>= 1;
-                       dmabuf->ossmaxfrags >>= 1;
-               }
-               dmabuf->ready = 0;
-#ifdef DEBUG
-               printk("SNDCTL_DSP_SETFRAGMENT 0x%x, %d, %d\n", val,
-                      dmabuf->ossfragsize, dmabuf->ossmaxfrags);
-#endif
-               return 0;
-       case SNDCTL_DSP_GETOSPACE:
-               if (!(file->f_mode & FMODE_WRITE))
-                       return -EINVAL;
-               if (codec_independent_spdif_locked > 0) {
-                       if (!dmabuf->ready && (val = prog_dmabuf(state, 2)) != 0)
-                               return val;
-               } else {
-                       if (controller_independent_spdif_locked > 0) {
-                               if (!dmabuf->ready && (val = prog_dmabuf(state, 3)) != 0)
-                                       return val;
-                       } else {
-                               if (!dmabuf->ready && (val = prog_dmabuf(state, 0)) != 0)
-                                       return val;
-                       }
-               }
-               spin_lock_irqsave(&state->card->lock, flags);
-               ali_update_ptr(state);
-               abinfo.fragsize = dmabuf->userfragsize;
-               abinfo.fragstotal = dmabuf->userfrags;
-               if (dmabuf->mapped)
-                       abinfo.bytes = dmabuf->dmasize;
-               else
-                       abinfo.bytes = ali_get_free_write_space(state);
-               abinfo.fragments = abinfo.bytes / dmabuf->userfragsize;
-               spin_unlock_irqrestore(&state->card->lock, flags);
-#if defined(DEBUG) || defined(DEBUG_MMAP)
-               printk("SNDCTL_DSP_GETOSPACE %d, %d, %d, %d\n",
-                      abinfo.bytes, abinfo.fragsize, abinfo.fragments,
-                      abinfo.fragstotal);
-#endif
-               return copy_to_user(argp, &abinfo,
-                                   sizeof(abinfo)) ? -EFAULT : 0;
-       case SNDCTL_DSP_GETOPTR:
-               if (!(file->f_mode & FMODE_WRITE))
-                       return -EINVAL;
-               if (codec_independent_spdif_locked > 0) {
-                       if (!dmabuf->ready && (val = prog_dmabuf(state, 2)) != 0)
-                               return val;
-               } else {
-                       if (controller_independent_spdif_locked > 0) {
-                               if (!dmabuf->ready && (val = prog_dmabuf(state, 3)) != 0)
-                                       return val;
-                       } else {
-                               if (!dmabuf->ready && (val = prog_dmabuf(state, 0)) != 0)
-                                       return val;
-                       }
-               }
-               spin_lock_irqsave(&state->card->lock, flags);
-               val = ali_get_free_write_space(state);
-               cinfo.bytes = dmabuf->total_bytes;
-               cinfo.ptr = dmabuf->hwptr;
-               cinfo.blocks = val / dmabuf->userfragsize;
-               if (codec_independent_spdif_locked > 0) {
-                       if (dmabuf->mapped && (dmabuf->trigger & SPDIF_ENABLE_OUTPUT)) {
-                               dmabuf->count += val;
-                               dmabuf->swptr = (dmabuf->swptr + val) % dmabuf->dmasize;
-                               __ali_update_lvi(state, 2);
-                       }
-               } else {
-                       if (controller_independent_spdif_locked > 0) {
-                               if (dmabuf->mapped && (dmabuf->trigger & SPDIF_ENABLE_OUTPUT)) {
-                                       dmabuf->count += val;
-                                       dmabuf->swptr = (dmabuf->swptr + val) % dmabuf->dmasize;
-                                       __ali_update_lvi(state, 3);
-                               }
-                       } else {
-                               if (dmabuf->mapped && (dmabuf->trigger & PCM_ENABLE_OUTPUT)) {
-                                       dmabuf->count += val;
-                                       dmabuf->swptr = (dmabuf->swptr + val) % dmabuf->dmasize;
-                                       __ali_update_lvi(state, 0);
-                               }
-                       }
-               }
-               spin_unlock_irqrestore(&state->card->lock, flags);
-#if defined(DEBUG) || defined(DEBUG_MMAP)
-               printk("SNDCTL_DSP_GETOPTR %d, %d, %d, %d\n", cinfo.bytes,
-                      cinfo.blocks, cinfo.ptr, dmabuf->count);
-#endif
-               return copy_to_user(argp, &cinfo, sizeof(cinfo))? -EFAULT : 0;
-       case SNDCTL_DSP_GETISPACE:
-               if (!(file->f_mode & FMODE_READ))
-                       return -EINVAL;
-               if (!dmabuf->ready && (val = prog_dmabuf(state, 1)) != 0)
-                       return val;
-               spin_lock_irqsave(&state->card->lock, flags);
-               abinfo.bytes = ali_get_available_read_data(state);
-               abinfo.fragsize = dmabuf->userfragsize;
-               abinfo.fragstotal = dmabuf->userfrags;
-               abinfo.fragments = abinfo.bytes / dmabuf->userfragsize;
-               spin_unlock_irqrestore(&state->card->lock, flags);
-#if defined(DEBUG) || defined(DEBUG_MMAP)
-               printk("SNDCTL_DSP_GETISPACE %d, %d, %d, %d\n",
-                      abinfo.bytes, abinfo.fragsize, abinfo.fragments,
-                      abinfo.fragstotal);
-#endif
-               return copy_to_user(argp, &abinfo,
-                                   sizeof(abinfo)) ? -EFAULT : 0;
-       case SNDCTL_DSP_GETIPTR:
-               if (!(file->f_mode & FMODE_READ))
-                       return -EINVAL;
-               if (!dmabuf->ready && (val = prog_dmabuf(state, 0)) != 0)
-                       return val;
-               spin_lock_irqsave(&state->card->lock, flags);
-               val = ali_get_available_read_data(state);
-               cinfo.bytes = dmabuf->total_bytes;
-               cinfo.blocks = val / dmabuf->userfragsize;
-               cinfo.ptr = dmabuf->hwptr;
-               if (dmabuf->mapped && (dmabuf->trigger & PCM_ENABLE_INPUT)) {
-                       dmabuf->count -= val;
-                       dmabuf->swptr = (dmabuf->swptr + val) % dmabuf->dmasize;
-                       __ali_update_lvi(state, 1);
-               }
-               spin_unlock_irqrestore(&state->card->lock, flags);
-#if defined(DEBUG) || defined(DEBUG_MMAP)
-               printk("SNDCTL_DSP_GETIPTR %d, %d, %d, %d\n", cinfo.bytes,
-                      cinfo.blocks, cinfo.ptr, dmabuf->count);
-#endif
-               return copy_to_user(argp, &cinfo, sizeof(cinfo))? -EFAULT: 0;
-       case SNDCTL_DSP_NONBLOCK:
-#ifdef DEBUG
-               printk("SNDCTL_DSP_NONBLOCK\n");
-#endif
-               file->f_flags |= O_NONBLOCK;
-               return 0;
-       case SNDCTL_DSP_GETCAPS:
-#ifdef DEBUG
-               printk("SNDCTL_DSP_GETCAPS\n");
-#endif
-               return put_user(DSP_CAP_REALTIME | DSP_CAP_TRIGGER |
-                               DSP_CAP_MMAP | DSP_CAP_BIND, p);
-       case SNDCTL_DSP_GETTRIGGER:
-               val = 0;
-#ifdef DEBUG
-               printk("SNDCTL_DSP_GETTRIGGER 0x%x\n", dmabuf->trigger);
-#endif
-               return put_user(dmabuf->trigger, p);
-       case SNDCTL_DSP_SETTRIGGER:
-               if (get_user(val, p))
-                       return -EFAULT;
-#if defined(DEBUG) || defined(DEBUG_MMAP)
-               printk("SNDCTL_DSP_SETTRIGGER 0x%x\n", val);
-#endif
-               if (!(val & PCM_ENABLE_INPUT) && dmabuf->enable == ADC_RUNNING) {
-                       stop_adc(state);
-               }
-               if (!(val & PCM_ENABLE_OUTPUT) && dmabuf->enable == DAC_RUNNING) {
-                       stop_dac(state);
-               }
-               if (!(val & SPDIF_ENABLE_OUTPUT) && dmabuf->enable == CODEC_SPDIFOUT_RUNNING) {
-                       stop_spdifout(state);
-               }
-               if (!(val & SPDIF_ENABLE_OUTPUT) && dmabuf->enable == CONTROLLER_SPDIFOUT_RUNNING) {
-                       stop_spdifout(state);
-               }
-               dmabuf->trigger = val;
-               if (val & PCM_ENABLE_OUTPUT && !(dmabuf->enable & DAC_RUNNING)) {
-                       if (!dmabuf->write_channel) {
-                               dmabuf->ready = 0;
-                               dmabuf->write_channel = state->card->alloc_pcm_channel(state->card);
-                               if (!dmabuf->write_channel)
-                                       return -EBUSY;
-                       }
-                       if (!dmabuf->ready && (ret = prog_dmabuf(state, 0)))
-                               return ret;
-                       if (dmabuf->mapped) {
-                               spin_lock_irqsave(&state->card->lock, flags);
-                               ali_update_ptr(state);
-                               dmabuf->count = 0;
-                               dmabuf->swptr = dmabuf->hwptr;
-                               dmabuf->count = ali_get_free_write_space(state);
-                               dmabuf->swptr = (dmabuf->swptr + dmabuf->count) % dmabuf->dmasize;
-                               __ali_update_lvi(state, 0);
-                               spin_unlock_irqrestore(&state->card->lock,
-                                                      flags);
-                       } else
-                               start_dac(state);
-               }
-               if (val & SPDIF_ENABLE_OUTPUT && !(dmabuf->enable & CODEC_SPDIFOUT_RUNNING)) {
-                       if (!dmabuf->codec_spdifout_channel) {
-                               dmabuf->ready = 0;
-                               dmabuf->codec_spdifout_channel = state->card->alloc_codec_spdifout_channel(state->card);
-                               if (!dmabuf->codec_spdifout_channel)
-                                       return -EBUSY;
-                       }
-                       if (!dmabuf->ready && (ret = prog_dmabuf(state, 2)))
-                               return ret;
-                       if (dmabuf->mapped) {
-                               spin_lock_irqsave(&state->card->lock, flags);
-                               ali_update_ptr(state);
-                               dmabuf->count = 0;
-                               dmabuf->swptr = dmabuf->hwptr;
-                               dmabuf->count = ali_get_free_write_space(state);
-                               dmabuf->swptr = (dmabuf->swptr + dmabuf->count) % dmabuf->dmasize;
-                               __ali_update_lvi(state, 2);
-                               spin_unlock_irqrestore(&state->card->lock,
-                                                      flags);
-                       } else
-                               start_spdifout(state);
-               }
-               if (val & SPDIF_ENABLE_OUTPUT && !(dmabuf->enable & CONTROLLER_SPDIFOUT_RUNNING)) {
-                       if (!dmabuf->controller_spdifout_channel) {
-                               dmabuf->ready = 0;
-                               dmabuf->controller_spdifout_channel = state->card->alloc_controller_spdifout_channel(state->card);
-                               if (!dmabuf->controller_spdifout_channel)
-                                       return -EBUSY;
-                       }
-                       if (!dmabuf->ready && (ret = prog_dmabuf(state, 3)))
-                               return ret;
-                       if (dmabuf->mapped) {
-                               spin_lock_irqsave(&state->card->lock, flags);
-                               ali_update_ptr(state);
-                               dmabuf->count = 0;
-                               dmabuf->swptr = dmabuf->hwptr;
-                               dmabuf->count = ali_get_free_write_space(state);
-                               dmabuf->swptr = (dmabuf->swptr + dmabuf->count) % dmabuf->dmasize;
-                               __ali_update_lvi(state, 3);
-                               spin_unlock_irqrestore(&state->card->lock, flags);
-                       } else
-                               start_spdifout(state);
-               }
-               if (val & PCM_ENABLE_INPUT && !(dmabuf->enable & ADC_RUNNING)) {
-                       if (!dmabuf->read_channel) {
-                               dmabuf->ready = 0;
-                               dmabuf->read_channel = state->card->alloc_rec_pcm_channel(state->card);
-                               if (!dmabuf->read_channel)
-                                       return -EBUSY;
-                       }
-                       if (!dmabuf->ready && (ret = prog_dmabuf(state, 1)))
-                               return ret;
-                       if (dmabuf->mapped) {
-                               spin_lock_irqsave(&state->card->lock,
-                                                 flags);
-                               ali_update_ptr(state);
-                               dmabuf->swptr = dmabuf->hwptr;
-                               dmabuf->count = 0;
-                               spin_unlock_irqrestore(&state->card->lock, flags);
-                       }
-                       ali_update_lvi(state, 1);
-                       start_adc(state);
-               }
-               return 0;
-       case SNDCTL_DSP_SETDUPLEX:
-#ifdef DEBUG
-               printk("SNDCTL_DSP_SETDUPLEX\n");
-#endif
-               return -EINVAL;
-       case SNDCTL_DSP_GETODELAY:
-               if (!(file->f_mode & FMODE_WRITE))
-                       return -EINVAL;
-               spin_lock_irqsave(&state->card->lock, flags);
-               ali_update_ptr(state);
-               val = dmabuf->count;
-               spin_unlock_irqrestore(&state->card->lock, flags);
-#ifdef DEBUG
-               printk("SNDCTL_DSP_GETODELAY %d\n", dmabuf->count);
-#endif
-               return put_user(val, p);
-       case SOUND_PCM_READ_RATE:
-#ifdef DEBUG
-               printk("SOUND_PCM_READ_RATE %d\n", dmabuf->rate);
-#endif
-               return put_user(dmabuf->rate, p);
-       case SOUND_PCM_READ_CHANNELS:
-#ifdef DEBUG
-               printk("SOUND_PCM_READ_CHANNELS\n");
-#endif
-               return put_user(2, p);
-       case SOUND_PCM_READ_BITS:
-#ifdef DEBUG
-               printk("SOUND_PCM_READ_BITS\n");
-#endif
-               return put_user(AFMT_S16_LE, p);
-       case SNDCTL_DSP_SETSPDIF:       /* Set S/PDIF Control register */
-#ifdef DEBUG
-               printk("SNDCTL_DSP_SETSPDIF\n");
-#endif
-               if (get_user(val, p))
-                       return -EFAULT;
-               /* Check to make sure the codec supports S/PDIF transmitter */
-               if ((state->card->ac97_features & 4)) {
-                       /* mask out the transmitter speed bits so the user can't set them */
-                       val &= ~0x3000;
-                       /* Add the current transmitter speed bits to the passed value */
-                       ret = ali_ac97_get(codec, AC97_SPDIF_CONTROL);
-                       val |= (ret & 0x3000);
-                       ali_ac97_set(codec, AC97_SPDIF_CONTROL, val);
-                       if (ali_ac97_get(codec, AC97_SPDIF_CONTROL) != val) {
-                               printk(KERN_ERR "ali_audio: Unable to set S/PDIF configuration to 0x%04x.\n", val);
-                               return -EFAULT;
-                       }
-               }
-#ifdef DEBUG
-               else
-                       printk(KERN_WARNING "ali_audio: S/PDIF transmitter not avalible.\n");
-#endif
-               return put_user(val, p);
-       case SNDCTL_DSP_GETSPDIF:       /* Get S/PDIF Control register */
-#ifdef DEBUG
-               printk("SNDCTL_DSP_GETSPDIF\n");
-#endif
-               if (get_user(val, p))
-                       return -EFAULT;
-               /* Check to make sure the codec supports S/PDIF transmitter */
-               if (!(state->card->ac97_features & 4)) {
-#ifdef DEBUG
-                       printk(KERN_WARNING "ali_audio: S/PDIF transmitter not avalible.\n");
-#endif
-                       val = 0;
-               } else {
-                       val = ali_ac97_get(codec, AC97_SPDIF_CONTROL);
-               }
-
-               return put_user(val, p);
-//end add support spdif out
-//add support 4,6 channel
-       case SNDCTL_DSP_GETCHANNELMASK:
-#ifdef DEBUG
-               printk("SNDCTL_DSP_GETCHANNELMASK\n");
-#endif
-               if (get_user(val, p))
-                       return -EFAULT;
-               /* Based on AC'97 DAC support, not ICH hardware */
-               val = DSP_BIND_FRONT;
-               if (state->card->ac97_features & 0x0004)
-                       val |= DSP_BIND_SPDIF;
-               if (state->card->ac97_features & 0x0080)
-                       val |= DSP_BIND_SURR;
-               if (state->card->ac97_features & 0x0140)
-                       val |= DSP_BIND_CENTER_LFE;
-               return put_user(val, p);
-       case SNDCTL_DSP_BIND_CHANNEL:
-#ifdef DEBUG
-               printk("SNDCTL_DSP_BIND_CHANNEL\n");
-#endif
-               if (get_user(val, p))
-                       return -EFAULT;
-               if (val == DSP_BIND_QUERY) {
-                       val = DSP_BIND_FRONT;   /* Always report this as being enabled */
-                       if (state->card->ac97_status & SPDIF_ON)
-                               val |= DSP_BIND_SPDIF;
-                       else {
-                               if (state->card->ac97_status & SURR_ON)
-                                       val |= DSP_BIND_SURR;
-                               if (state->card->
-                                   ac97_status & CENTER_LFE_ON)
-                                       val |= DSP_BIND_CENTER_LFE;
-                       }
-               } else {        /* Not a query, set it */
-                       if (!(file->f_mode & FMODE_WRITE))
-                               return -EINVAL;
-                       if (dmabuf->enable == DAC_RUNNING) {
-                               stop_dac(state);
-                       }
-                       if (val & DSP_BIND_SPDIF) {     /* Turn on SPDIF */
-                               /*  Ok, this should probably define what slots
-                                *  to use. For now, we'll only set it to the
-                                *  defaults:
-                                * 
-                                *   non multichannel codec maps to slots 3&4
-                                *   2 channel codec maps to slots 7&8
-                                *   4 channel codec maps to slots 6&9
-                                *   6 channel codec maps to slots 10&11
-                                *
-                                *  there should be some way for the app to
-                                *  select the slot assignment.
-                                */
-                               i_scr = inl(state->card->iobase + ALI_SCR);
-                               if (codec_independent_spdif_locked > 0) {
-
-                                       if ((i_scr & 0x00300000) == 0x00100000) {
-                                               ali_set_spdif_output(state, AC97_EA_SPSA_7_8, codec_independent_spdif_locked);
-                                       } else {
-                                               if ((i_scr & 0x00300000) == 0x00200000) {
-                                                       ali_set_spdif_output(state, AC97_EA_SPSA_6_9, codec_independent_spdif_locked);
-                                               } else {
-                                                       if ((i_scr & 0x00300000) == 0x00300000) {
-                                                               ali_set_spdif_output(state, AC97_EA_SPSA_10_11, codec_independent_spdif_locked);
-                                                       }
-                                               }
-                                       }
-                               } else {        /* codec spdif out (pcm out share ) */
-                                       ali_set_spdif_output(state, AC97_EA_SPSA_3_4, dmabuf->rate);    //I do not modify
-                               }
-
-                               if (!(state->card->ac97_status & SPDIF_ON))
-                                       val &= ~DSP_BIND_SPDIF;
-                       } else {
-                               int mask;
-                               int channels;
-                               /* Turn off S/PDIF if it was on */
-                               if (state->card->ac97_status & SPDIF_ON)
-                                       ali_set_spdif_output(state, -1, 0);
-                               mask =
-                                   val & (DSP_BIND_FRONT | DSP_BIND_SURR |
-                                          DSP_BIND_CENTER_LFE);
-                               switch (mask) {
-                               case DSP_BIND_FRONT:
-                                       channels = 2;
-                                       break;
-                               case DSP_BIND_FRONT | DSP_BIND_SURR:
-                                       channels = 4;
-                                       break;
-                               case DSP_BIND_FRONT | DSP_BIND_SURR | DSP_BIND_CENTER_LFE:
-                                       channels = 6;
-                                       break;
-                               default:
-                                       val = DSP_BIND_FRONT;
-                                       channels = 2;
-                                       break;
-                               }
-                               ali_set_dac_channels(state, channels);
-                               /* check that they really got turned on */
-                               if (!state->card->ac97_status & SURR_ON)
-                                       val &= ~DSP_BIND_SURR;
-                               if (!state->card->
-                                   ac97_status & CENTER_LFE_ON)
-                                       val &= ~DSP_BIND_CENTER_LFE;
-                       }
-               }
-               return put_user(val, p);
-       case SNDCTL_DSP_MAPINBUF:
-       case SNDCTL_DSP_MAPOUTBUF:
-       case SNDCTL_DSP_SETSYNCRO:
-       case SOUND_PCM_WRITE_FILTER:
-       case SOUND_PCM_READ_FILTER:
-               return -EINVAL;
-       }
-       return -EINVAL;
-}
-
-static int ali_open(struct inode *inode, struct file *file)
-{
-       int i = 0;
-       struct ali_card *card = devs;
-       struct ali_state *state = NULL;
-       struct dmabuf *dmabuf = NULL;
-       unsigned int i_scr;
-       
-       /* find an available virtual channel (instance of /dev/dsp) */
-       
-       while (card != NULL) {
-
-               /*
-                * If we are initializing and then fail, card could go
-                * away unuexpectedly while we are in the for() loop.
-                * So, check for card on each iteration before we check
-                * for card->initializing to avoid a possible oops.
-                * This usually only matters for times when the driver is
-                * autoloaded by kmod.
-                */
-               for (i = 0; i < 50 && card && card->initializing; i++) {
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(HZ / 20);
-               }
-
-               for (i = 0; i < NR_HW_CH && card && !card->initializing; i++) {
-                       if (card->states[i] == NULL) {
-                               state = card->states[i] = (struct ali_state *) kmalloc(sizeof(struct ali_state), GFP_KERNEL);
-                               if (state == NULL)
-                                       return -ENOMEM;
-                               memset(state, 0, sizeof(struct ali_state));
-                               dmabuf = &state->dmabuf;
-                               goto found_virt;
-                       }
-               }
-               card = card->next;
-       }
-
-       /* no more virtual channel avaiable */
-       if (!state)
-               return -ENODEV;
-found_virt:
-       /* initialize the virtual channel */
-
-       state->virt = i;
-       state->card = card;
-       state->magic = ALI5455_STATE_MAGIC;
-       init_waitqueue_head(&dmabuf->wait);
-       mutex_init(&state->open_mutex);
-       file->private_data = state;
-       dmabuf->trigger = 0;
-       /* allocate hardware channels */
-       if (file->f_mode & FMODE_READ) {
-               if ((dmabuf->read_channel =
-                    card->alloc_rec_pcm_channel(card)) == NULL) {
-                       kfree(card->states[i]);
-                       card->states[i] = NULL;
-                       return -EBUSY;
-               }
-               dmabuf->trigger |= PCM_ENABLE_INPUT;
-               ali_set_adc_rate(state, 8000);
-       }
-       if (file->f_mode & FMODE_WRITE) {
-               if (codec_independent_spdif_locked > 0) {
-                       if ((dmabuf->codec_spdifout_channel = card->alloc_codec_spdifout_channel(card)) == NULL) {
-                               kfree(card->states[i]);
-                               card->states[i] = NULL;
-                               return -EBUSY;
-                       }
-                       dmabuf->trigger |= SPDIF_ENABLE_OUTPUT;
-                       ali_set_codecspdifout_rate(state, codec_independent_spdif_locked);      //It must add
-                       i_scr = inl(state->card->iobase + ALI_SCR);
-                       if ((i_scr & 0x00300000) == 0x00100000) {
-                               ali_set_spdif_output(state, AC97_EA_SPSA_7_8, codec_independent_spdif_locked);
-                       } else {
-                               if ((i_scr & 0x00300000) == 0x00200000) {
-                                       ali_set_spdif_output(state, AC97_EA_SPSA_6_9, codec_independent_spdif_locked);
-                               } else {
-                                       if ((i_scr & 0x00300000) == 0x00300000) {
-                                               ali_set_spdif_output(state, AC97_EA_SPSA_10_11, codec_independent_spdif_locked);
-                                       } else {
-                                               ali_set_spdif_output(state, AC97_EA_SPSA_7_8, codec_independent_spdif_locked);
-                                       }
-                               }
-
-                       }
-               } else {
-                       if (controller_independent_spdif_locked > 0) {
-                               if ((dmabuf->controller_spdifout_channel = card->alloc_controller_spdifout_channel(card)) == NULL) {
-                                       kfree(card->states[i]);
-                                       card->states[i] = NULL;
-                                       return -EBUSY;
-                               }
-                               dmabuf->trigger |= SPDIF_ENABLE_OUTPUT;
-                               ali_set_spdifout_rate(state, controller_independent_spdif_locked);
-                       } else {
-                               if ((dmabuf->write_channel = card->alloc_pcm_channel(card)) == NULL) {
-                                       kfree(card->states[i]);
-                                       card->states[i] = NULL;
-                                       return -EBUSY;
-                               }
-                               /* Initialize to 8kHz?  What if we don't support 8kHz? */
-                               /*  Let's change this to check for S/PDIF stuff */
-
-                               dmabuf->trigger |= PCM_ENABLE_OUTPUT;
-                               if (codec_pcmout_share_spdif_locked) {
-                                       ali_set_dac_rate(state, codec_pcmout_share_spdif_locked);
-                                       ali_set_spdif_output(state, AC97_EA_SPSA_3_4, codec_pcmout_share_spdif_locked);
-                               } else {
-                                       ali_set_dac_rate(state, 8000);
-                               }
-                       }
-
-               }
-       }
-
-       /* set default sample format. According to OSS Programmer's Guide  /dev/dsp
-          should be default to unsigned 8-bits, mono, with sample rate 8kHz and
-          /dev/dspW will accept 16-bits sample, but we don't support those so we
-          set it immediately to stereo and 16bit, which is all we do support */
-       dmabuf->fmt |= ALI5455_FMT_16BIT | ALI5455_FMT_STEREO;
-       dmabuf->ossfragsize = 0;
-       dmabuf->ossmaxfrags = 0;
-       dmabuf->subdivision = 0;
-       state->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
-       outl(0x00000000, card->iobase + ALI_INTERRUPTCR);
-       outl(0x00000000, card->iobase + ALI_INTERRUPTSR);
-       return nonseekable_open(inode, file);
-}
-
-static int ali_release(struct inode *inode, struct file *file)
-{
-       struct ali_state *state = (struct ali_state *) file->private_data;
-       struct ali_card *card = state->card;
-       struct dmabuf *dmabuf = &state->dmabuf;
-       unsigned long flags;
-       lock_kernel();
-       
-       /* stop DMA state machine and free DMA buffers/channels */
-       if (dmabuf->trigger & PCM_ENABLE_OUTPUT)
-               drain_dac(state, 0);
-
-       if (dmabuf->trigger & SPDIF_ENABLE_OUTPUT)
-               drain_spdifout(state, 0);
-       
-       if (dmabuf->trigger & PCM_ENABLE_INPUT)
-               stop_adc(state);
-       
-       spin_lock_irqsave(&card->lock, flags);
-       dealloc_dmabuf(state);
-       if (file->f_mode & FMODE_WRITE) {
-               if (codec_independent_spdif_locked > 0) {
-                       state->card->free_pcm_channel(state->card, dmabuf->codec_spdifout_channel->num);
-               } else {
-                       if (controller_independent_spdif_locked > 0)
-                               state->card->free_pcm_channel(state->card,
-                                                             dmabuf->controller_spdifout_channel->num);
-                       else state->card->free_pcm_channel(state->card,
-                                                             dmabuf->write_channel->num);
-               }
-       }
-       if (file->f_mode & FMODE_READ)
-               state->card->free_pcm_channel(state->card, dmabuf->read_channel->num);
-
-       state->card->states[state->virt] = NULL;
-       kfree(state);
-       spin_unlock_irqrestore(&card->lock, flags);
-       unlock_kernel();
-       return 0;
-}
-
-static /*const */ struct file_operations ali_audio_fops = {
-       .owner          = THIS_MODULE, 
-       .llseek         = no_llseek, 
-       .read           = ali_read,
-       .write          = ali_write, 
-       .poll           = ali_poll,
-       .ioctl          = ali_ioctl,
-       .mmap           = ali_mmap,
-       .open           = ali_open,
-       .release        = ali_release,
-};
-
-/* Read AC97 codec registers */
-static u16 ali_ac97_get(struct ac97_codec *dev, u8 reg)
-{
-       struct ali_card *card = dev->private_data;
-       int count1 = 100;
-       char val;
-       unsigned short int data = 0, count, addr1, addr2 = 0;
-
-       spin_lock(&card->ac97_lock);
-       while (count1-- && (inl(card->iobase + ALI_CAS) & 0x80000000))
-               udelay(1);
-
-       addr1 = reg;
-       reg |= 0x0080;
-       for (count = 0; count < 0x7f; count++) {
-               val = inb(card->iobase + ALI_CSPSR);
-               if (val & 0x08)
-                       break;
-       }
-       if (count == 0x7f)
-       {
-               spin_unlock(&card->ac97_lock);
-               return -1;
-       }
-       outw(reg, (card->iobase + ALI_CPR) + 2);
-       for (count = 0; count < 0x7f; count++) {
-               val = inb(card->iobase + ALI_CSPSR);
-               if (val & 0x02) {
-                       data = inw(card->iobase + ALI_SPR);
-                       addr2 = inw((card->iobase + ALI_SPR) + 2);
-                       break;
-               }
-       }
-       spin_unlock(&card->ac97_lock);
-       if (count == 0x7f)
-               return -1;
-       if (addr2 != addr1)
-               return -1;
-       return ((u16) data);
-}
-
-/* write ac97 codec register   */
-
-static void ali_ac97_set(struct ac97_codec *dev, u8 reg, u16 data)
-{
-       struct ali_card *card = dev->private_data;
-       int count1 = 100;
-       char val;
-       unsigned short int count;
-
-       spin_lock(&card->ac97_lock);
-       while (count1-- && (inl(card->iobase + ALI_CAS) & 0x80000000))
-               udelay(1);
-
-       for (count = 0; count < 0x7f; count++) {
-               val = inb(card->iobase + ALI_CSPSR);
-               if (val & 0x08)
-                       break;
-       }
-       if (count == 0x7f) {
-               printk(KERN_WARNING "ali_ac97_set: AC97 codec register access timed out. \n");
-               spin_unlock(&card->ac97_lock);
-               return;
-       }
-       outw(data, (card->iobase + ALI_CPR));
-       outb(reg, (card->iobase + ALI_CPR) + 2);
-       for (count = 0; count < 0x7f; count++) {
-               val = inb(card->iobase + ALI_CSPSR);
-               if (val & 0x01)
-                       break;
-       }
-       spin_unlock(&card->ac97_lock);
-       if (count == 0x7f)
-               printk(KERN_WARNING "ali_ac97_set: AC97 codec register access timed out. \n");
-       return;
-}
-
-/* OSS /dev/mixer file operation methods */
-
-static int ali_open_mixdev(struct inode *inode, struct file *file)
-{
-       int i;
-       int minor = iminor(inode);
-       struct ali_card *card = devs;
-       for (card = devs; card != NULL; card = card->next) {
-               /*
-                * If we are initializing and then fail, card could go
-                * away unuexpectedly while we are in the for() loop.
-                * So, check for card on each iteration before we check
-                * for card->initializing to avoid a possible oops.
-                * This usually only matters for times when the driver is
-                * autoloaded by kmod.
-                */
-               for (i = 0; i < 50 && card && card->initializing; i++) {
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_timeout(HZ / 20);
-               }
-               for (i = 0; i < NR_AC97 && card && !card->initializing; i++)
-                       if (card->ac97_codec[i] != NULL
-                           && card->ac97_codec[i]->dev_mixer == minor) {
-                               file->private_data = card->ac97_codec[i];
-                               return nonseekable_open(inode, file);
-                       }
-       }
-       return -ENODEV;
-}
-
-static int ali_ioctl_mixdev(struct inode *inode,
-                           struct file *file,
-                           unsigned int cmd, unsigned long arg)
-{
-       struct ac97_codec *codec = (struct ac97_codec *) file->private_data;
-       return codec->mixer_ioctl(codec, cmd, arg);
-}
-
-static /*const */ struct file_operations ali_mixer_fops = {
-       .owner  = THIS_MODULE, 
-       .llseek = no_llseek, 
-       .ioctl  = ali_ioctl_mixdev,
-       .open   = ali_open_mixdev,
-};
-
-/* AC97 codec initialisation.  These small functions exist so we don't
-   duplicate code between module init and apm resume */
-
-static inline int ali_ac97_exists(struct ali_card *card, int ac97_number)
-{
-       unsigned int i = 1;
-       u32 reg = inl(card->iobase + ALI_RTSR);
-       if (ac97_number) {
-               while (i < 100) {
-
-                       reg = inl(card->iobase + ALI_RTSR);
-                       if (reg & 0x40) {
-                               break;
-                       } else {
-                               outl(reg | 0x00000040,
-                                    card->iobase + 0x34);
-                               udelay(1);
-                       }
-                       i++;
-               }
-
-       } else {
-               while (i < 100) {
-                       reg = inl(card->iobase + ALI_RTSR);
-                       if (reg & 0x80) {
-                               break;
-                       } else {
-                               outl(reg | 0x00000080,
-                                    card->iobase + 0x34);
-                               udelay(1);
-                       }
-                       i++;
-               }
-       }
-
-       if (ac97_number)
-               return reg & 0x40;
-       else
-               return reg & 0x80;
-}
-
-static inline int ali_ac97_enable_variable_rate(struct ac97_codec *codec)
-{
-       ali_ac97_set(codec, AC97_EXTENDED_STATUS, 9);
-       ali_ac97_set(codec, AC97_EXTENDED_STATUS, ali_ac97_get(codec, AC97_EXTENDED_STATUS) | 0xE800);
-       return (ali_ac97_get(codec, AC97_EXTENDED_STATUS) & 1);
-}
-
-
-static int ali_ac97_probe_and_powerup(struct ali_card *card, struct ac97_codec *codec)
-{
-       /* Returns 0 on failure */
-       int i;
-       u16 addr;
-       if (ac97_probe_codec(codec) == 0)
-               return 0;
-       /* ac97_probe_codec is success ,then begin to init codec */
-       ali_ac97_set(codec, AC97_RESET, 0xffff);
-       if (card->channel[0].used == 1) {
-               ali_ac97_set(codec, AC97_RECORD_SELECT, 0x0000);
-               ali_ac97_set(codec, AC97_LINEIN_VOL, 0x0808);
-               ali_ac97_set(codec, AC97_RECORD_GAIN, 0x0F0F);
-       }
-
-       if (card->channel[2].used == 1) //if MICin then init codec
-       {
-               ali_ac97_set(codec, AC97_RECORD_SELECT, 0x0000);
-               ali_ac97_set(codec, AC97_MIC_VOL, 0x8808);
-               ali_ac97_set(codec, AC97_RECORD_GAIN, 0x0F0F);
-               ali_ac97_set(codec, AC97_RECORD_GAIN_MIC, 0x0000);
-       }
-
-       ali_ac97_set(codec, AC97_MASTER_VOL_STEREO, 0x0000);
-       ali_ac97_set(codec, AC97_HEADPHONE_VOL, 0x0000);
-       ali_ac97_set(codec, AC97_PCMOUT_VOL, 0x0000);
-       ali_ac97_set(codec, AC97_CD_VOL, 0x0808);
-       ali_ac97_set(codec, AC97_VIDEO_VOL, 0x0808);
-       ali_ac97_set(codec, AC97_AUX_VOL, 0x0808);
-       ali_ac97_set(codec, AC97_PHONE_VOL, 0x8048);
-       ali_ac97_set(codec, AC97_PCBEEP_VOL, 0x0000);
-       ali_ac97_set(codec, AC97_GENERAL_PURPOSE, AC97_GP_MIX);
-       ali_ac97_set(codec, AC97_MASTER_VOL_MONO, 0x0000);
-       ali_ac97_set(codec, 0x38, 0x0000);
-       addr = ali_ac97_get(codec, 0x2a);
-       ali_ac97_set(codec, 0x2a, addr | 0x0001);
-       addr = ali_ac97_get(codec, 0x2a);
-       addr = ali_ac97_get(codec, 0x28);
-       ali_ac97_set(codec, 0x2c, 0xbb80);
-       addr = ali_ac97_get(codec, 0x2c);
-       /* power it all up */
-       ali_ac97_set(codec, AC97_POWER_CONTROL,
-                    ali_ac97_get(codec, AC97_POWER_CONTROL) & ~0x7f00);
-       /* wait for analog ready */
-       for (i = 10; i && ((ali_ac97_get(codec, AC97_POWER_CONTROL) & 0xf) != 0xf); i--) {
-               set_current_state(TASK_UNINTERRUPTIBLE);
-               schedule_timeout(HZ / 20);
-       }
-       /* FIXME !! */
-       i++;
-       return i;
-}
-
-
-/* I clone ali5455(2.4.7 )  not clone i810_audio(2.4.18)  */
-
-static int ali_reset_5455(struct ali_card *card)
-{
-       outl(0x80000003, card->iobase + ALI_SCR);
-       outl(0x83838383, card->iobase + ALI_FIFOCR1);
-       outl(0x83838383, card->iobase + ALI_FIFOCR2);
-       if (controller_pcmout_share_spdif_locked > 0) {
-               outl((inl(card->iobase + ALI_SPDIFICS) | 0x00000001),
-                    card->iobase + ALI_SPDIFICS);
-               outl(0x0408000a, card->iobase + ALI_INTERFACECR);
-       } else {
-               if (codec_independent_spdif_locked > 0) {
-                       outl((inl(card->iobase + ALI_SCR) | 0x00100000), card->iobase + ALI_SCR);       // now I select slot 7 & 8
-                       outl(0x00200000, card->iobase + ALI_INTERFACECR);       //enable codec independent spdifout 
-               } else
-                       outl(0x04080002, card->iobase + ALI_INTERFACECR);
-       }
-
-       outl(0x00000000, card->iobase + ALI_INTERRUPTCR);
-       outl(0x00000000, card->iobase + ALI_INTERRUPTSR);
-       if (controller_independent_spdif_locked > 0)
-               outl((inl(card->iobase + ALI_SPDIFICS) | 0x00000001),
-                    card->iobase + ALI_SPDIFICS);
-       return 1;
-}
-
-
-static int ali_ac97_random_init_stuff(struct ali_card
-                                     *card)
-{
-       u32 reg = inl(card->iobase + ALI_SCR);
-       int i = 0;
-       reg = inl(card->iobase + ALI_SCR);
-       if ((reg & 2) == 0)     /* Cold required */
-               reg |= 2;
-       else
-               reg |= 1;       /* Warm */
-       reg &= ~0x80000000;     /* ACLink on */
-       outl(reg, card->iobase + ALI_SCR);
-
-       while (i < 10) {
-               if ((inl(card->iobase + 0x18) & (1 << 1)) == 0)
-                       break;
-               current->state = TASK_UNINTERRUPTIBLE;
-               schedule_timeout(HZ / 20);
-               i++;
-       }
-       if (i == 10) {
-               printk(KERN_ERR "ali_audio: AC'97 reset failed.\n");
-               return 0;
-       }
-
-       set_current_state(TASK_UNINTERRUPTIBLE);
-       schedule_timeout(HZ / 2);
-       return 1;
-}
-
-/* AC97 codec initialisation. */
-
-static int __devinit ali_ac97_init(struct ali_card *card)
-{
-       int num_ac97 = 0;
-       int total_channels = 0;
-       struct ac97_codec *codec;
-       u16 eid;
-
-       if (!ali_ac97_random_init_stuff(card))
-               return 0;
-
-       /* Number of channels supported */
-       /* What about the codec?  Just because the ICH supports */
-       /* multiple channels doesn't mean the codec does.       */
-       /* we'll have to modify this in the codec section below */
-       /* to reflect what the codec has.                       */
-       /* ICH and ICH0 only support 2 channels so don't bother */
-       /* to check....                                         */
-       inl(card->iobase + ALI_CPR);
-       card->channels = 2;
-
-       for (num_ac97 = 0; num_ac97 < NR_AC97; num_ac97++) {
-
-               /* Assume codec isn't available until we go through the
-                * gauntlet below */
-               card->ac97_codec[num_ac97] = NULL;
-               /* The ICH programmer's reference says you should   */
-               /* check the ready status before probing. So we chk */
-               /*   What do we do if it's not ready?  Wait and try */
-               /*   again, or abort?                               */
-               if (!ali_ac97_exists(card, num_ac97)) {
-                       if (num_ac97 == 0)
-                               printk(KERN_ERR "ali_audio: Primary codec not ready.\n");
-                       break;
-               }
-
-               if ((codec = ac97_alloc_codec()) == NULL)
-                       return -ENOMEM;
-               /* initialize some basic codec information, other fields will be filled
-                  in ac97_probe_codec */
-               codec->private_data = card;
-               codec->id = num_ac97;
-               codec->codec_read = ali_ac97_get;
-               codec->codec_write = ali_ac97_set;
-               if (!ali_ac97_probe_and_powerup(card, codec)) {
-                       printk(KERN_ERR "ali_audio: timed out waiting for codec %d analog ready",
-                            num_ac97);
-                       kfree(codec);
-                       break;  /* it didn't work */
-               }
-               
-               /* Store state information about S/PDIF transmitter */
-               card->ac97_status = 0;
-               /* Don't attempt to get eid until powerup is complete */
-               eid = ali_ac97_get(codec, AC97_EXTENDED_ID);
-               if (eid == 0xFFFF) {
-                       printk(KERN_ERR "ali_audio: no codec attached ?\n");
-                       kfree(codec);
-                       break;
-               }
-
-               card->ac97_features = eid;
-               /* Now check the codec for useful features to make up for
-                  the dumbness of the ali5455 hardware engine */
-               if (!(eid & 0x0001))
-                       printk(KERN_WARNING
-                              "ali_audio: only 48Khz playback available.\n");
-               else {
-                       if (!ali_ac97_enable_variable_rate(codec)) {
-                               printk(KERN_WARNING
-                                      "ali_audio: Codec refused to allow VRA, using 48Khz only.\n");
-                               card->ac97_features &= ~1;
-                       }
-               }
-
-               /* Determine how many channels the codec(s) support   */
-               /*   - The primary codec always supports 2            */
-               /*   - If the codec supports AMAP, surround DACs will */
-               /*     automaticlly get assigned to slots.            */
-               /*     * Check for surround DACs and increment if     */
-               /*       found.                                       */
-               /*   - Else check if the codec is revision 2.2        */
-               /*     * If surround DACs exist, assign them to slots */
-               /*       and increment channel count.                 */
-
-               /* All of this only applies to ICH2 and above. ICH    */
-               /* and ICH0 only support 2 channels.  ICH2 will only  */
-               /* support multiple codecs in a "split audio" config. */
-               /* as described above.                                */
-
-               /* TODO: Remove all the debugging messages!           */
-
-               if ((eid & 0xc000) == 0)        /* primary codec */
-                       total_channels += 2;
-               if ((codec->dev_mixer = register_sound_mixer(&ali_mixer_fops, -1)) < 0) {
-                       printk(KERN_ERR "ali_audio: couldn't register mixer!\n");
-                       kfree(codec);
-                       break;
-               }
-               card->ac97_codec[num_ac97] = codec;
-       }
-       /* pick the minimum of channels supported by ICHx or codec(s) */
-       card->channels = (card->channels > total_channels) ? total_channels : card->channels;
-       return num_ac97;
-}
-
-static void __devinit ali_configure_clocking(void)
-{
-       struct ali_card *card;
-       struct ali_state *state;
-       struct dmabuf *dmabuf;
-       unsigned int i, offset, new_offset;
-       unsigned long flags;
-       card = devs;
-
-       /* We could try to set the clocking for multiple cards, but can you even have
-        * more than one ali in a machine?  Besides, clocking is global, so unless
-        * someone actually thinks more than one ali in a machine is possible and
-        * decides to rewrite that little bit, setting the rate for more than one card
-        * is a waste of time.
-        */
-       if (card != NULL) {
-               state = card->states[0] = (struct ali_state *)
-                   kmalloc(sizeof(struct ali_state), GFP_KERNEL);
-               if (state == NULL)
-                       return;
-               memset(state, 0, sizeof(struct ali_state));
-               dmabuf = &state->dmabuf;
-               dmabuf->write_channel = card->alloc_pcm_channel(card);
-               state->virt = 0;
-               state->card = card;
-               state->magic = ALI5455_STATE_MAGIC;
-               init_waitqueue_head(&dmabuf->wait);
-               mutex_init(&state->open_mutex);
-               dmabuf->fmt = ALI5455_FMT_STEREO | ALI5455_FMT_16BIT;
-               dmabuf->trigger = PCM_ENABLE_OUTPUT;
-               ali_set_dac_rate(state, 48000);
-               if (prog_dmabuf(state, 0) != 0)
-                       goto config_out_nodmabuf;
-               
-               if (dmabuf->dmasize < 16384)
-                       goto config_out;
-               
-               dmabuf->count = dmabuf->dmasize;
-               outb(31, card->iobase + dmabuf->write_channel->port + OFF_LVI);
-
-               local_irq_save(flags);
-               start_dac(state);
-               offset = ali_get_dma_addr(state, 0);
-               mdelay(50);
-               new_offset = ali_get_dma_addr(state, 0);
-               stop_dac(state);
-               
-               outb(2, card->iobase + dmabuf->write_channel->port + OFF_CR);
-               local_irq_restore(flags);
-
-               i = new_offset - offset;
-
-               if (i == 0)
-                       goto config_out;
-               i = i / 4 * 20;
-               if (i > 48500 || i < 47500) {
-                       clocking = clocking * clocking / i;
-               }
-config_out:
-               dealloc_dmabuf(state);
-config_out_nodmabuf:
-               state->card->free_pcm_channel(state->card, state->dmabuf. write_channel->num);
-               kfree(state);
-               card->states[0] = NULL;
-       }
-}
-
-/* install the driver, we do not allocate hardware channel nor DMA buffer now, they are defered 
-   until "ACCESS" time (in prog_dmabuf called by open/read/write/ioctl/mmap) */
-
-static int __devinit ali_probe(struct pci_dev *pci_dev,
-                              const struct pci_device_id *pci_id)
-{
-       struct ali_card *card;
-       if (pci_enable_device(pci_dev))
-               return -EIO;
-       if (pci_set_dma_mask(pci_dev, ALI5455_DMA_MASK)) {
-               printk(KERN_ERR "ali5455: architecture does not support"
-                      " 32bit PCI busmaster DMA\n");
-               return -ENODEV;
-       }
-
-       if ((card = kmalloc(sizeof(struct ali_card), GFP_KERNEL)) == NULL) {
-               printk(KERN_ERR "ali_audio: out of memory\n");
-               return -ENOMEM;
-       }
-       memset(card, 0, sizeof(*card));
-       card->initializing = 1;
-       card->iobase = pci_resource_start(pci_dev, 0);
-       card->pci_dev = pci_dev;
-       card->pci_id = pci_id->device;
-       card->irq = pci_dev->irq;
-       card->next = devs;
-       card->magic = ALI5455_CARD_MAGIC;
-#ifdef CONFIG_PM
-       card->pm_suspended = 0;
-#endif
-       spin_lock_init(&card->lock);
-       spin_lock_init(&card->ac97_lock);
-       devs = card;
-       pci_set_master(pci_dev);
-       printk(KERN_INFO "ali: %s found at IO 0x%04lx, IRQ %d\n",
-              card_names[pci_id->driver_data], card->iobase, card->irq);
-       card->alloc_pcm_channel = ali_alloc_pcm_channel;
-       card->alloc_rec_pcm_channel = ali_alloc_rec_pcm_channel;
-       card->alloc_rec_mic_channel = ali_alloc_rec_mic_channel;
-       card->alloc_codec_spdifout_channel = ali_alloc_codec_spdifout_channel;
-       card->alloc_controller_spdifout_channel = ali_alloc_controller_spdifout_channel;
-       card->free_pcm_channel = ali_free_pcm_channel;
-       card->channel[0].offset = 0;
-       card->channel[0].port = 0x40;
-       card->channel[0].num = 0;
-       card->channel[1].offset = 0;
-       card->channel[1].port = 0x50;
-       card->channel[1].num = 1;
-       card->channel[2].offset = 0;
-       card->channel[2].port = 0x60;
-       card->channel[2].num = 2;
-       card->channel[3].offset = 0;
-       card->channel[3].port = 0x70;
-       card->channel[3].num = 3;
-       card->channel[4].offset = 0;
-       card->channel[4].port = 0xb0;
-       card->channel[4].num = 4;
-       /* claim our iospace and irq */
-       request_region(card->iobase, 256, card_names[pci_id->driver_data]);
-       if (request_irq(card->irq, &ali_interrupt, IRQF_SHARED,
-                       card_names[pci_id->driver_data], card)) {
-               printk(KERN_ERR "ali_audio: unable to allocate irq %d\n",
-                      card->irq);
-               release_region(card->iobase, 256);
-               kfree(card);
-               return -ENODEV;
-       }
-
-       if (ali_reset_5455(card) <= 0) {
-               unregister_sound_dsp(card->dev_audio);
-               release_region(card->iobase, 256);
-               free_irq(card->irq, card);
-               kfree(card);
-               return -ENODEV;
-       }
-
-       /* initialize AC97 codec and register /dev/mixer */
-       if (ali_ac97_init(card) < 0) {
-               release_region(card->iobase, 256);
-               free_irq(card->irq, card);
-               kfree(card);
-               return -ENODEV;
-       }
-       
-       pci_set_drvdata(pci_dev, card);
-       
-       if (clocking == 0) {
-               clocking = 48000;
-               ali_configure_clocking();
-       }
-
-       /* register /dev/dsp */
-       if ((card->dev_audio = register_sound_dsp(&ali_audio_fops, -1)) < 0) {
-               int i;
-               printk(KERN_ERR"ali_audio: couldn't register DSP device!\n");
-               release_region(card->iobase, 256);
-               free_irq(card->irq, card);
-               for (i = 0; i < NR_AC97; i++)
-                       if (card->ac97_codec[i] != NULL) {
-                               unregister_sound_mixer(card->ac97_codec[i]->dev_mixer);
-                               kfree(card->ac97_codec[i]);
-                       }
-               kfree(card);
-               return -ENODEV;
-       }
-       card->initializing = 0;
-       return 0;
-}
-
-static void __devexit ali_remove(struct pci_dev *pci_dev)
-{
-       int i;
-       struct ali_card *card = pci_get_drvdata(pci_dev);
-       /* free hardware resources */
-       free_irq(card->irq, devs);
-       release_region(card->iobase, 256);
-       /* unregister audio devices */
-       for (i = 0; i < NR_AC97; i++)
-               if (card->ac97_codec[i] != NULL) {
-                       unregister_sound_mixer(card->ac97_codec[i]->
-                                              dev_mixer);
-                       ac97_release_codec(card->ac97_codec[i]);
-                       card->ac97_codec[i] = NULL;
-               }
-       unregister_sound_dsp(card->dev_audio);
-       kfree(card);
-}
-
-#ifdef CONFIG_PM
-static int ali_pm_suspend(struct pci_dev *dev, pm_message_t pm_state)
-{
-       struct ali_card *card = pci_get_drvdata(dev);
-       struct ali_state *state;
-       unsigned long flags;
-       struct dmabuf *dmabuf;
-       int i, num_ac97;
-
-       if (!card)
-               return 0;
-       spin_lock_irqsave(&card->lock, flags);
-       card->pm_suspended = 1;
-       for (i = 0; i < NR_HW_CH; i++) {
-               state = card->states[i];
-               if (!state)
-                       continue;
-               /* this happens only if there are open files */
-               dmabuf = &state->dmabuf;
-               if (dmabuf->enable & DAC_RUNNING ||
-                   (dmabuf->count
-                    && (dmabuf->trigger & PCM_ENABLE_OUTPUT))) {
-                       state->pm_saved_dac_rate = dmabuf->rate;
-                       stop_dac(state);
-               } else {
-                       state->pm_saved_dac_rate = 0;
-               }
-               if (dmabuf->enable & ADC_RUNNING) {
-                       state->pm_saved_adc_rate = dmabuf->rate;
-                       stop_adc(state);
-               } else {
-                       state->pm_saved_adc_rate = 0;
-               }
-               dmabuf->ready = 0;
-               dmabuf->swptr = dmabuf->hwptr = 0;
-               dmabuf->count = dmabuf->total_bytes = 0;
-       }
-
-       spin_unlock_irqrestore(&card->lock, flags);
-       /* save mixer settings */
-       for (num_ac97 = 0; num_ac97 < NR_AC97; num_ac97++) {
-               struct ac97_codec *codec = card->ac97_codec[num_ac97];
-               if (!codec)
-                       continue;
-               for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
-                       if ((supported_mixer(codec, i)) && (codec->read_mixer)) {
-                               card->pm_saved_mixer_settings[i][num_ac97] = codec->read_mixer(codec, i);
-                       }
-               }
-       }
-       pci_save_state(dev);    /* XXX do we need this? */
-       pci_disable_device(dev);        /* disable busmastering */
-       pci_set_power_state(dev, 3);    /* Zzz. */
-       return 0;
-}
-
-
-static int ali_pm_resume(struct pci_dev *dev)
-{
-       int num_ac97, i = 0;
-       struct ali_card *card = pci_get_drvdata(dev);
-       pci_enable_device(dev);
-       pci_restore_state(dev);
-       /* observation of a toshiba portege 3440ct suggests that the 
-          hardware has to be more or less completely reinitialized from
-          scratch after an apm suspend.  Works For Me.   -dan */
-       ali_ac97_random_init_stuff(card);
-       for (num_ac97 = 0; num_ac97 < NR_AC97; num_ac97++) {
-               struct ac97_codec *codec = card->ac97_codec[num_ac97];
-               /* check they haven't stolen the hardware while we were
-                  away */
-               if (!codec || !ali_ac97_exists(card, num_ac97)) {
-                       if (num_ac97)
-                               continue;
-                       else
-                               BUG();
-               }
-               if (!ali_ac97_probe_and_powerup(card, codec))
-                       BUG();
-               if ((card->ac97_features & 0x0001)) {
-                       /* at probe time we found we could do variable
-                          rates, but APM suspend has made it forget
-                          its magical powers */
-                       if (!ali_ac97_enable_variable_rate(codec))
-                               BUG();
-               }
-               /* we lost our mixer settings, so restore them */
-               for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
-                       if (supported_mixer(codec, i)) {
-                               int val = card->pm_saved_mixer_settings[i][num_ac97];
-                               codec->mixer_state[i] = val;
-                               codec->write_mixer(codec, i,
-                                                  (val & 0xff),
-                                                  ((val >> 8) & 0xff));
-                       }
-               }
-       }
-
-       /* we need to restore the sample rate from whatever it was */
-       for (i = 0; i < NR_HW_CH; i++) {
-               struct ali_state *state = card->states[i];
-               if (state) {
-                       if (state->pm_saved_adc_rate)
-                               ali_set_adc_rate(state, state->pm_saved_adc_rate);
-                       if (state->pm_saved_dac_rate)
-                               ali_set_dac_rate(state, state->pm_saved_dac_rate);
-               }
-       }
-
-       card->pm_suspended = 0;
-       /* any processes that were reading/writing during the suspend
-          probably ended up here */
-       for (i = 0; i < NR_HW_CH; i++) {
-               struct ali_state *state = card->states[i];
-               if (state)
-                       wake_up(&state->dmabuf.wait);
-       }
-       return 0;
-}
-#endif                         /* CONFIG_PM */
-
-MODULE_AUTHOR("");
-MODULE_DESCRIPTION("ALI 5455 audio support");
-MODULE_LICENSE("GPL");
-module_param(clocking, int, 0);
-/* FIXME: bool? */
-module_param(strict_clocking, uint, 0);
-module_param(codec_pcmout_share_spdif_locked, uint, 0);
-module_param(codec_independent_spdif_locked, uint, 0);
-module_param(controller_pcmout_share_spdif_locked, uint, 0);
-module_param(controller_independent_spdif_locked, uint, 0);
-#define ALI5455_MODULE_NAME "ali5455"
-static struct pci_driver ali_pci_driver = {
-       .name           = ALI5455_MODULE_NAME,
-       .id_table       = ali_pci_tbl,
-       .probe          = ali_probe,
-       .remove         = __devexit_p(ali_remove),
-#ifdef CONFIG_PM
-       .suspend        = ali_pm_suspend,
-       .resume         = ali_pm_resume,
-#endif                         /* CONFIG_PM */
-};
-
-static int __init ali_init_module(void)
-{
-       printk(KERN_INFO "ALI 5455 + AC97 Audio, version "
-              DRIVER_VERSION ", " __TIME__ " " __DATE__ "\n");
-
-       if (codec_independent_spdif_locked > 0) {
-               if (codec_independent_spdif_locked == 32000
-                   || codec_independent_spdif_locked == 44100
-                   || codec_independent_spdif_locked == 48000) {
-                       printk(KERN_INFO "ali_audio: Enabling S/PDIF at sample rate %dHz.\n", codec_independent_spdif_locked);
-               } else {
-                       printk(KERN_INFO "ali_audio: S/PDIF can only be locked to 32000, 44100, or 48000Hz.\n");
-                       codec_independent_spdif_locked = 0;
-               }
-       }
-       if (controller_independent_spdif_locked > 0) {
-               if (controller_independent_spdif_locked == 32000
-                   || controller_independent_spdif_locked == 44100
-                   || controller_independent_spdif_locked == 48000) {
-                       printk(KERN_INFO "ali_audio: Enabling S/PDIF at sample rate %dHz.\n", controller_independent_spdif_locked);
-               } else {
-                       printk(KERN_INFO "ali_audio: S/PDIF can only be locked to 32000, 44100, or 48000Hz.\n");
-                       controller_independent_spdif_locked = 0;
-               }
-       }
-
-       if (codec_pcmout_share_spdif_locked > 0) {
-               if (codec_pcmout_share_spdif_locked == 32000
-                   || codec_pcmout_share_spdif_locked == 44100
-                   || codec_pcmout_share_spdif_locked == 48000) {
-                       printk(KERN_INFO "ali_audio: Enabling S/PDIF at sample rate %dHz.\n", codec_pcmout_share_spdif_locked);
-               } else {
-                       printk(KERN_INFO "ali_audio: S/PDIF can only be locked to 32000, 44100, or 48000Hz.\n");
-                       codec_pcmout_share_spdif_locked = 0;
-               }
-       }
-       if (controller_pcmout_share_spdif_locked > 0) {
-               if (controller_pcmout_share_spdif_locked == 32000
-                   || controller_pcmout_share_spdif_locked == 44100
-                   || controller_pcmout_share_spdif_locked == 48000) {
-                       printk(KERN_INFO "ali_audio: Enabling controller S/PDIF at sample rate %dHz.\n", controller_pcmout_share_spdif_locked);
-               } else {
-                       printk(KERN_INFO "ali_audio: S/PDIF can only be locked to 32000, 44100, or 48000Hz.\n");
-                       controller_pcmout_share_spdif_locked = 0;
-               }
-       }
-       return pci_register_driver(&ali_pci_driver);
-}
-
-static void __exit ali_cleanup_module(void)
-{
-       pci_unregister_driver(&ali_pci_driver);
-}
-
-module_init(ali_init_module);
-module_exit(ali_cleanup_module);
-/*
-Local Variables:
-c-basic-offset: 8
-End:
-*/
diff --git a/sound/oss/au1000.c b/sound/oss/au1000.c
deleted file mode 100644 (file)
index e379623..0000000
+++ /dev/null
@@ -1,2216 +0,0 @@
-/*
- *      au1000.c  --  Sound driver for Alchemy Au1000 MIPS Internet Edge
- *                    Processor.
- *
- * Copyright 2001 MontaVista Software Inc.
- * Author: MontaVista Software, Inc.
- *             stevel@mvista.com or source@mvista.com
- *
- *  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  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  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.
- *
- *
- * Module command line parameters:
- *
- *  Supported devices:
- *  /dev/dsp    standard OSS /dev/dsp device
- *  /dev/mixer  standard OSS /dev/mixer device
- *
- * Notes:
- *
- *  1. Much of the OSS buffer allocation, ioctl's, and mmap'ing are
- *     taken, slightly modified or not at all, from the ES1371 driver,
- *     so refer to the credits in es1371.c for those. The rest of the
- *     code (probe, open, read, write, the ISR, etc.) is new.
- *
- *  Revision history
- *    06.27.2001  Initial version
- *    03.20.2002  Added mutex locks around read/write methods, to prevent
- *                simultaneous access on SMP or preemptible kernels. Also
- *                removed the counter/pointer fragment aligning at the end
- *                of read/write methods [stevel].
- *    03.21.2002  Add support for coherent DMA on the audio read/write DMA
- *                channels [stevel].
- *
- */
-#include <linux/module.h>
-#include <linux/string.h>
-#include <linux/ioport.h>
-#include <linux/sched.h>
-#include <linux/delay.h>
-#include <linux/sound.h>
-#include <linux/slab.h>
-#include <linux/soundcard.h>
-#include <linux/init.h>
-#include <linux/page-flags.h>
-#include <linux/poll.h>
-#include <linux/pci.h>
-#include <linux/bitops.h>
-#include <linux/proc_fs.h>
-#include <linux/spinlock.h>
-#include <linux/smp_lock.h>
-#include <linux/ac97_codec.h>
-#include <linux/interrupt.h>
-#include <linux/mutex.h>
-
-#include <asm/io.h>
-#include <asm/uaccess.h>
-#include <asm/mach-au1x00/au1000.h>
-#include <asm/mach-au1x00/au1000_dma.h>
-
-/* --------------------------------------------------------------------- */
-
-#undef OSS_DOCUMENTED_MIXER_SEMANTICS
-#undef AU1000_DEBUG
-#undef AU1000_VERBOSE_DEBUG
-
-#define AU1000_MODULE_NAME "Au1000 audio"
-#define PFX AU1000_MODULE_NAME