more scheduled OSS driver removal
Adrian Bunk [Mon, 16 Jul 2007 06:39:01 +0000 (23:39 -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.20.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

63 files changed:
Documentation/feature-removal-schedule.txt
Documentation/kernel-parameters.txt
Documentation/sound/oss/AD1816 [deleted file]
Documentation/sound/oss/NM256 [deleted file]
Documentation/sound/oss/OPL3-SA2 [deleted file]
Documentation/sound/oss/VIA-chipset [deleted file]
Documentation/sound/oss/cs46xx [deleted file]
MAINTAINERS
sound/oss/Makefile
sound/oss/ac97.c [deleted file]
sound/oss/ac97.h [deleted file]
sound/oss/aci.c [deleted file]
sound/oss/aci.h [deleted file]
sound/oss/ad1816.c [deleted file]
sound/oss/ad1889.c [deleted file]
sound/oss/ad1889.h [deleted file]
sound/oss/adlib_card.c [deleted file]
sound/oss/cs461x.h [deleted file]
sound/oss/cs461x_image.h [deleted file]
sound/oss/cs46xx.c [deleted file]
sound/oss/cs46xx_wrapper-24.h [deleted file]
sound/oss/cs46xxpm.h [deleted file]
sound/oss/emu10k1/8010.h [deleted file]
sound/oss/emu10k1/Makefile [deleted file]
sound/oss/emu10k1/audio.c [deleted file]
sound/oss/emu10k1/audio.h [deleted file]
sound/oss/emu10k1/cardmi.c [deleted file]
sound/oss/emu10k1/cardmi.h [deleted file]
sound/oss/emu10k1/cardmo.c [deleted file]
sound/oss/emu10k1/cardmo.h [deleted file]
sound/oss/emu10k1/cardwi.c [deleted file]
sound/oss/emu10k1/cardwi.h [deleted file]
sound/oss/emu10k1/cardwo.c [deleted file]
sound/oss/emu10k1/cardwo.h [deleted file]
sound/oss/emu10k1/ecard.c [deleted file]
sound/oss/emu10k1/ecard.h [deleted file]
sound/oss/emu10k1/efxmgr.c [deleted file]
sound/oss/emu10k1/efxmgr.h [deleted file]
sound/oss/emu10k1/emuadxmg.c [deleted file]
sound/oss/emu10k1/hwaccess.c [deleted file]
sound/oss/emu10k1/hwaccess.h [deleted file]
sound/oss/emu10k1/icardmid.h [deleted file]
sound/oss/emu10k1/icardwav.h [deleted file]
sound/oss/emu10k1/irqmgr.c [deleted file]
sound/oss/emu10k1/irqmgr.h [deleted file]
sound/oss/emu10k1/main.c [deleted file]
sound/oss/emu10k1/midi.c [deleted file]
sound/oss/emu10k1/midi.h [deleted file]
sound/oss/emu10k1/mixer.c [deleted file]
sound/oss/emu10k1/passthrough.c [deleted file]
sound/oss/emu10k1/passthrough.h [deleted file]
sound/oss/emu10k1/recmgr.c [deleted file]
sound/oss/emu10k1/recmgr.h [deleted file]
sound/oss/emu10k1/timer.c [deleted file]
sound/oss/emu10k1/timer.h [deleted file]
sound/oss/emu10k1/voicemgr.c [deleted file]
sound/oss/emu10k1/voicemgr.h [deleted file]
sound/oss/nm256.h [deleted file]
sound/oss/nm256_audio.c [deleted file]
sound/oss/nm256_coeff.h [deleted file]
sound/oss/opl3.c
sound/oss/opl3.h [deleted file]
sound/oss/opl3sa2.c [deleted file]

index 092c65d..4f69470 100644 (file)
@@ -119,13 +119,6 @@ Who:    Adrian Bunk <bunk@stusta.de>
 
 ---------------------------
 
-What:  drivers depending on OSS_OBSOLETE_DRIVER
-When:  options in 2.6.20, code in 2.6.22
-Why:   OSS drivers with ALSA replacements
-Who:   Adrian Bunk <bunk@stusta.de>
-
----------------------------
-
 What:  Unused EXPORT_SYMBOL/EXPORT_SYMBOL_GPL exports
        (temporary transition config option provided until then)
        The transition config option will also be removed at the same time.
index 8916410..182c6a3 100644 (file)
@@ -238,16 +238,9 @@ and is between 256 and 4096 characters. It is defined in the file
                        Disable PIN 1 of APIC timer
                        Can be useful to work around chipset bugs.
 
-       ad1816=         [HW,OSS]
-                       Format: <io>,<irq>,<dma>,<dma2>
-                       See also Documentation/sound/oss/AD1816.
-
        ad1848=         [HW,OSS]
                        Format: <io>,<irq>,<dma>,<dma2>,<type>
 
-       adlib=          [HW,OSS]
-                       Format: <io>
-
        advansys=       [HW,SCSI]
                        See header of drivers/scsi/advansys.c.
 
@@ -1206,9 +1199,6 @@ and is between 256 and 4096 characters. It is defined in the file
        opl3=           [HW,OSS]
                        Format: <io>
 
-       opl3sa2=        [HW,OSS] Format:
-                       <io>,<irq>,<dma>,<dma2>,<mss_io>,<mpu_io>,<ymode>,<loopback>[,<isapnp>,<multiple]
-
        oprofile.timer= [HW]
                        Use timer interrupt instead of performance counters
 
diff --git a/Documentation/sound/oss/AD1816 b/Documentation/sound/oss/AD1816
deleted file mode 100644 (file)
index 14bd8f2..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-Documentation for the AD1816(A) sound driver
-============================================
-
-Installation:
--------------
-
-To get your AD1816(A) based sound card work, you'll have to enable support for
-experimental code ("Prompt for development and/or incomplete code/drivers")
-and isapnp ("Plug and Play support", "ISA Plug and Play support"). Enable
-"Sound card support", "OSS modules support" and "Support for AD1816(A) based
-cards (EXPERIMENTAL)" in the sound configuration menu, too. Now build, install
-and reboot the new kernel as usual.
-
-Features:
----------
-
-List of features supported by this driver:
-- full-duplex support
-- supported audio formats: unsigned 8bit, signed 16bit little endian, 
-                           signed 16bit big endian, ยต-law, A-law
-- supported channels: mono and stereo
-- supported recording sources: Master, CD, Line, Line1, Line2, Mic
-- supports phat 3d stereo circuit (Line 3)
-
-
-Supported cards:
-----------------
-
-The following cards are known to work with this driver:
-- Terratec Base 1 
-- Terratec Base 64 
-- HP Kayak 
-- Acer FX-3D
-- SY-1816 
-- Highscreen Sound-Boostar 32 Wave 3D
-- Highscreen Sound-Boostar 16 
-- AVM Apex Pro card 
-- (Aztech SC-16 3D) 
-- (Newcom SC-16 3D) 
-- (Terratec EWS64S) 
-
-Cards listed in brackets are not supported reliable. If you have such a card 
-you should add the extra parameter:
-  options=1
-when loading the ad1816 module via modprobe. 
-
-
-Troubleshooting:
-----------------
-
-First of all you should check, if the driver has been loaded
-properly.
-
-If loading of the driver succeeds, but playback/capture fails, check
-if you used the correct values for irq, dma and dma2 when loading the module.
-If one of them is wrong you usually get the following error message:
-
-Nov  6 17:06:13 tek01 kernel: Sound: DMA (output) timed out - IRQ/DRQ config error?
-
-If playback/capture is too fast or to slow, you should have a look at
-the clock chip of your sound card. The AD1816 was designed for a 33MHz
-oscillator, however most sound card manufacturer use slightly
-different oscillators as they are cheaper than 33MHz oscillators. If
-you have such a card you have to adjust the ad1816_clockfreq parameter
-above. For example: For a card using a 32.875MHz oscillator use
-ad1816_clockfreq=32875 instead of ad1816_clockfreq=33000.
-
-
-Updates, bugfixes and bugreports:
---------------------------------
-
-As the driver is still experimental and under development, you should
-watch out for updates.  Updates of the driver are available on the
-Internet from one of my home pages:
-  http://www.student.informatik.tu-darmstadt.de/~tek/projects/linux.html
-or:
-  http://www.tu-darmstadt.de/~tek01/projects/linux.html
-
-Bugreports, bugfixes and related questions should be sent via E-Mail to:
-  tek@rbg.informatik.tu-darmstadt.de
-
-Thorsten Knabe <tek@rbg.informatik.tu-darmstadt.de>
-Christoph Hellwig <hch@infradead.org>
-       Last modified: 2000/09/20
diff --git a/Documentation/sound/oss/NM256 b/Documentation/sound/oss/NM256
deleted file mode 100644 (file)
index b503217..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-=======================================================
-Documentation for the NeoMagic 256AV/256ZX sound driver
-=======================================================
-
-You're looking at version 1.1 of the driver.  (Woohoo!) It has been
-successfully tested against the following laptop models:
-
-       Sony Z505S/Z505SX/Z505DX/Z505RX
-       Sony F150, F160, F180, F250, F270, F280, PCG-F26
-       Dell Latitude CPi, CPt (various submodels)
-
-There are a few caveats, which is why you should read the entirety of
-this document first.
-
-This driver was developed without any support or assistance from
-NeoMagic.  There is no warranty, expressed, implied, or otherwise.  It
-is free software in the public domain; feel free to use it, sell it,
-give it to your best friends, even claim that you wrote it (but why?!)
-but don't go whining to me, NeoMagic, Sony, Dell, or anyone else
-when it blows up your computer.
-
-Version 1.1 contains a change to try and detect non-AC97 versions of
-the hardware, and not install itself appropriately.  It should also
-reinitialize the hardware on an APM resume event, assuming that APM
-was configured into your kernel.
-
-============
-Installation
-============
-
-Enable the sound drivers, the OSS sound drivers, and then the NM256
-driver.  The NM256 driver *must* be configured as a module (it won't
-give you any other choice).
-
-Next, do the usual "make modules" and "make modules_install".
-Finally, insmod the soundcore, sound and nm256 modules.
-
-When the nm256 driver module is loaded, you should see a couple of
-confirmation messages in the kernel logfile indicating that it found
-the device (the device does *not* use any I/O ports or DMA channels).
-Now try playing a wav file, futz with the CD-ROM if you have one, etc.
-
-The NM256 is entirely a PCI-based device, and all the necessary
-information is automatically obtained from the card.  It can only be
-configured as a module in a vain attempt to prevent people from
-hurting themselves.  It works correctly if it shares an IRQ with
-another device (it normally shares IRQ 9 with the builtin eepro100
-ethernet on the Sony Z505 laptops). 
-
-It does not run the card in any sort of compatibility mode. It will
-not work on laptops that have the SB16-compatible, AD1848-compatible
-or CS4232-compatible codec/mixer; you will want to use the appropriate
-compatible OSS driver with these chipsets.  I cannot provide any
-assistance with machines using the SB16, AD1848 or CS4232 compatible
-versions.  (The driver now attempts to detect the mixer version, and
-will refuse to load if it believes the hardware is not
-AC97-compatible.)
-
-The sound support is very basic, but it does include simultaneous
-playback and record capability.  The mixer support is also quite
-simple, although this is in keeping with the rather limited
-functionality of the chipset.
-
-There is no hardware synthesizer available, as the Losedows OPL-3 and
-MIDI support is done via hardware emulation.
-
-Only three recording devices are available on the Sony: the
-microphone, the CD-ROM input, and the volume device (which corresponds
-to the stereo output).  (Other devices may be available on other
-models of laptops.)  The Z505 series does not have a builtin CD-ROM,
-so of course the CD-ROM input doesn't work.  It does work on laptops
-with a builtin CD-ROM drive.
-
-The mixer device does not appear to have any tone controls, at least
-on the Z505 series.  The mixer module checks for tone controls in the
-AC97 mixer, and will enable them if they are available.
-
-==============
-Known problems
-==============
-
-  * There are known problems with PCMCIA cards and the eepro100 ethernet 
-    driver on the Z505S/Z505SX/Z505DX.  Keep reading.
-
-  * There are also potential problems with using a virtual X display, and
-    also problems loading the module after the X server has been started. 
-    Keep reading.
-
-  * The volume control isn't anywhere near linear.  Sorry.  This will be
-    fixed eventually, when I get sufficiently annoyed with it.  (I doubt
-    it will ever be fixed now, since I've never gotten sufficiently
-    annoyed with it and nobody else seems to care.)
-
-  * There are reports that the CD-ROM volume is very low.  Since I do not
-    have a CD-ROM equipped laptop, I cannot test this (it's kinda hard to
-    do remotely).
-
-  * Only 8 fixed-rate speeds are supported.  This is mainly a chipset
-    limitation.  It may be possible to support other speeds in the future.
-
-  * There is no support for the telephone mixer/codec.  There is support
-    for a phonein/phoneout device in the mixer driver;  whether or not 
-    it does anything is anyone's guess.  (Reports on this would be
-    appreciated.  You'll have to figure out how to get the phone to
-    go off-hook before it'll work, tho.)
-
-  * This driver was not written with any cooperation or support from
-    NeoMagic.  If you have any questions about this, see their website
-    for their official stance on supporting open source drivers.
-
-============
-Video memory
-============
-
-The NeoMagic sound engine uses a portion of the display memory to hold
-the sound buffer.  (Crazy, eh?)  The NeoMagic video BIOS sets up a
-special pointer at the top of video RAM to indicate where the top of
-the audio buffer should be placed.
-
-At the present time XFree86 is apparently not aware of this.  It will
-thus write over either the pointer or the sound buffer with abandon.
-(Accelerated-X seems to do a better job here.)
-
-This implies a few things:
-
-  * Sometimes the NM256 driver has to guess at where the buffer 
-    should be placed, especially if the module is loaded after the
-    X server is started.  It's usually correct, but it will consistently
-    fail on the Sony F250.
-
-  * Virtual screens greater than 1024x768x16 under XFree86 are
-    problematic on laptops with only 2.5MB of screen RAM. This
-    includes all of the 256AV-equipped laptops.  (Virtual displays
-    may or may not work on the 256ZX, which has at least 4MB of
-    video RAM.)
-
-If you start having problems with random noise being output either
-constantly (this is the usual symptom on the F250), or when windows
-are moved around (this is the usual symptom when using a virtual
-screen), the best fix is to
-
-  * Don't use a virtual frame buffer.
-  * Make sure you load the NM256 module before the X server is
-    started.
-
-On the F250, it is possible to force the driver to load properly even
-after the XFree86 server is started by doing:
-
-       insmod nm256 buffertop=0x25a800
-
-This forces the audio buffers to the correct offset in screen RAM.
-
-One user has reported a similar problem on the Sony F270, although
-others apparently aren't seeing any problems.  His suggested command
-is
-
-       insmod nm256 buffertop=0x272800
-
-=================
-Official WWW site
-=================
-
-The official site for the NM256 driver is:
-
-       http://www.uglx.org/sony.html
-
-You should always be able to get the latest version of the driver there,
-and the driver will be supported for the foreseeable future.
-
-==============
-Z505RX and IDE
-==============
-
-There appears to be a problem with the IDE chipset on the Z505RX; one
-of the symptoms is that sound playback periodically hangs (when the
-disk is accessed).  The user reporting the problem also reported that
-enabling all of the IDE chipset workarounds in the kernel solved the
-problem, tho obviously only one of them should be needed--if someone
-can give me more details I would appreciate it.
-
-==============================
-Z505S/Z505SX on-board Ethernet
-==============================
-
-If you're using the on-board Ethernet Pro/100 ethernet support on the Z505
-series, I strongly encourage you to download the latest eepro100 driver from
-Donald Becker's site:
-
-       ftp://cesdis.gsfc.nasa.gov/pub/linux/drivers/test/eepro100.c
-
-There was a reported problem on the Z505SX that if the ethernet
-interface is disabled and reenabled while the sound driver is loaded,
-the machine would lock up.  I have included a workaround that is
-working satisfactorily.  However, you may occasionally see a message
-about "Releasing interrupts, over 1000 bad interrupts" which indicates
-that the workaround is doing its job.
-
-==================================
-PCMCIA and the Z505S/Z505SX/Z505DX
-==================================
-
-There is also a known problem with the Sony Z505S and Z505SX hanging
-if a PCMCIA card is inserted while the ethernet driver is loaded, or
-in some cases if the laptop is suspended.  This is caused by tons of
-spurious IRQ 9s, probably generated from the PCMCIA or ACPI bridges.
-
-There is currently no fix for the problem that works in every case.
-The only known workarounds are to disable the ethernet interface
-before inserting or removing a PCMCIA card, or with some cards
-disabling the PCMCIA card before ejecting it will also help the
-problem with the laptop hanging when the card is ejected.
-
-One user has reported that setting the tcic's cs_irq to some value
-other than 9 (like 11) fixed the problem.  This doesn't work on my
-Z505S, however--changing the value causes the cardmgr to stop seeing
-card insertions and removals, cards don't seem to work correctly, and
-I still get hangs if a card is inserted when the kernel is booted.
-
-Using the latest ethernet driver and pcmcia package allows me to
-insert an Adaptec 1480A SlimScsi card without the laptop hanging,
-although I still have to shut down the card before ejecting or
-powering down the laptop.  However, similar experiments with a DE-660
-ethernet card still result in hangs when the card is inserted.  I am
-beginning to think that the interrupts are CardBus-related, since the
-Adaptec card is a CardBus card, and the DE-660 is not; however, I
-don't have any other CardBus cards to test with.
-
-======
-Thanks
-======
-
-First, I want to thank everyone (except NeoMagic of course) for their
-generous support and encouragement.  I'd like to list everyone's name
-here that replied during the development phase, but the list is
-amazingly long.
-
-I will be rather unfair and single out a few people, however:
-
-       Justin Maurer, for being the first random net.person to try it,
-       and for letting me login to his Z505SX to get it working there
-
-       Edi Weitz for trying out several different versions, and giving
-       me a lot of useful feedback
-
-       Greg Rumple for letting me login remotely to get the driver 
-       functional on the 256ZX, for his assistance on tracking
-       down all sorts of random stuff, and for trying out Accel-X
-
-       Zach Brown, for the initial AC97 mixer interface design
-
-       Jeff Garzik, for various helpful suggestions on the AC97
-       interface
-
-       "Mr. Bumpy" for feedback on the Z505RX
-
-       Bill Nottingham, for generous assistance in getting the mixer ID
-       code working
-
-=================
-Previous versions
-=================
-
-Versions prior to 0.3 (aka `noname') had problems with weird artifacts
-in the output and failed to set the recording rate properly.  These
-problems have long since been fixed.
-
-Versions prior to 0.5 had problems with clicks in the output when
-anything other than 16-bit stereo sound was being played, and also had
-periodic clicks when recording.
-
-Version 0.7 first incorporated support for the NM256ZX chipset, which
-is found on some Dell Latitude laptops (the CPt, and apparently
-some CPi models as well).  It also included the generic AC97
-mixer module.
-
-Version 0.75 renamed all the functions and files with slightly more
-generic names.
-
-Note that previous versions of this document claimed that recording was
-8-bit only; it actually has been working for 16-bits all along.
diff --git a/Documentation/sound/oss/OPL3-SA2 b/Documentation/sound/oss/OPL3-SA2
deleted file mode 100644 (file)
index d8b6d2b..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-Documentation for the OPL3-SA2, SA3, and SAx driver (opl3sa2.o)
----------------------------------------------------------------
-
-Scott Murray, scott@spiteful.org
-January 7, 2001
-
-NOTE: All trade-marked terms mentioned below are properties of their
-      respective owners.
-
-
-Supported Devices
------------------
-
-This driver is for PnP soundcards based on the following Yamaha audio
-controller chipsets:
-
-YMF711 aka OPL3-SA2
-YMF715 and YMF719 aka OPL3-SA3
-
-Up until recently (December 2000), I'd thought the 719 to be a
-different chipset, the OPL3-SAx.  After an email exhange with
-Yamaha, however, it turns out that the 719 is just a re-badged
-715, and the chipsets are identical.  The chipset detection code
-has been updated to reflect this.
-
-Anyways, all of these chipsets implement the following devices:
-
-OPL3 FM synthesizer
-Soundblaster Pro
-Microsoft/Windows Sound System
-MPU401 MIDI interface
-
-Note that this driver uses the MSS device, and to my knowledge these
-chipsets enforce an either/or situation with the Soundblaster Pro
-device and the MSS device.  Since the MSS device has better
-capabilities, I have implemented the driver to use it.
-
-
-Mixer Channels
---------------
-
-Older versions of this driver (pre-December 2000) had two mixers,
-an OPL3-SA2 or SA3 mixer and a MSS mixer.  The OPL3-SA[23] mixer
-device contained a superset of mixer channels consisting of its own
-channels and all of the MSS mixer channels.  To simplify the driver
-considerably, and to partition functionality better, the OPL3-SA[23]
-mixer device now contains has its own specific mixer channels.  They
-are:
-
-Volume     - Hardware master volume control
-Bass       - SA3 only, now supports left and right channels
-Treble     - SA3 only, now supports left and right channels
-Microphone - Hardware microphone input volume control
-Digital1   - Yamaha 3D enhancement "Wide" mixer
-
-All other mixer channels (e.g. "PCM", "CD", etc.) now have to be
-controlled via the "MS Sound System (CS4231)" mixer.  To facilitate
-this, the mixer device creation order has been switched so that
-the MSS mixer is created first.  This allows accessing the majority
-of the useful mixer channels even via single mixer-aware tools
-such as "aumix".
-
-
-Plug 'n Play
-------------
-
-In previous kernels (2.2.x), some configuration was required to
-get the driver to talk to the card.  Being the new millennium and
-all, the 2.4.x kernels now support auto-configuration if ISA PnP
-support is configured in.  Theoretically, the driver even supports
-having more than one card in this case.
-
-With the addition of PnP support to the driver, two new parameters
-have been added to control it:
-
-isapnp   - set to 0 to disable ISA PnP card detection
-
-multiple - set to 0 to disable multiple PnP card detection
-
-
-Optional Parameters
--------------------
-
-Recent (December 2000) additions to the driver (based on a patch
-provided by Peter Englmaier) are two new parameters:
-
-ymode -    Set Yamaha 3D enhancement mode:
-           0 = Desktop/Normal  5-12 cm speakers
-           1 = Notebook PC (1) 3 cm speakers
-           2 = Notebook PC (2) 1.5 cm speakers
-           3 = Hi-Fi           16-38 cm speakers
-
-loopback - Set A/D input source. Useful for echo cancellation:
-           0 = Mic Right channel (default)
-           1 = Mono output loopback
-
-The ymode parameter has been tested and does work.  The loopback
-parameter, however, is untested.  Any feedback on its usefulness
-would be appreciated.
-
-
-Manual Configuration
---------------------
-
-If for some reason you decide not to compile ISA PnP support into
-your kernel, or disabled the driver's usage of it by setting the
-isapnp parameter as discussed above, then you will need to do some
-manual configuration.  There are two ways of doing this.  The most
-common is to use the isapnptools package to initialize the card, and
-use the kernel module form of the sound subsystem and sound drivers.
-Alternatively, some BIOS's allow manual configuration of installed
-PnP devices in a BIOS menu, which should allow using the non-modular
-sound drivers, i.e. built into the kernel.
-
-I personally use isapnp and modules, and do not have access to a PnP
-BIOS machine to test.  If you have such a beast, configuring the
-driver to be built into the kernel should just work (thanks to work
-done by David Luyer <luyer@ucs.uwa.edu.au>).  You will still need
-to specify settings, which can be done by adding:
-
-opl3sa2=<io>,<irq>,<dma>,<dma2>,<mssio>,<mpuio>
-
-to the kernel command line.  For example:
-
-opl3sa2=0x370,5,0,1,0x530,0x330
-
-If you are instead using the isapnp tools (as most people have been
-before Linux 2.4.x), follow the directions in their documentation to
-produce a configuration file.  Here is the relevant excerpt I used to
-use for my SA3 card from my isapnp.conf:
-
-(CONFIGURE YMH0800/-1 (LD 0
-
-# NOTE: IO 0 is for the unused SoundBlaster part of the chipset.
-(IO 0 (BASE 0x0220))
-(IO 1 (BASE 0x0530))
-(IO 2 (BASE 0x0388))
-(IO 3 (BASE 0x0330))
-(IO 4 (BASE 0x0370))
-(INT 0 (IRQ 5 (MODE +E)))
-(DMA 0 (CHANNEL 0))
-(DMA 1 (CHANNEL 1))
-
-Here, note that:
-
-Port  Acceptable Range  Purpose
-----  ----------------  -------
-IO 0  0x0220 - 0x0280   SB base address, unused.
-IO 1  0x0530 - 0x0F48   MSS base address
-IO 2  0x0388 - 0x03F8   OPL3 base address
-IO 3  0x0300 - 0x0334   MPU base address
-IO 4  0x0100 - 0x0FFE   card's own base address for its control I/O ports
-
-The IRQ and DMA values can be any that are considered acceptable for a
-MSS.  Assuming you've got isapnp all happy, then you should be able to
-do something like the following (which matches up with the isapnp
-configuration above):
-
-modprobe mpu401
-modprobe ad1848
-modprobe opl3sa2 io=0x370 mss_io=0x530 mpu_io=0x330 irq=5 dma=0 dma2=1
-modprobe opl3 io=0x388
-
-See the section "Automatic Module Loading" below for how to set up
-/etc/modprobe.conf to automate this.
-
-An important thing to remember that the opl3sa2 module's io argument is
-for it's own control port, which handles the card's master mixer for
-volume (on all cards), and bass and treble (on SA3 cards).
-
-
-Troubleshooting
----------------
-
-If all goes well and you see no error messages, you should be able to
-start using the sound capabilities of your system.  If you get an
-error message while trying to insert the opl3sa2 module, then make
-sure that the values of the various arguments match what you specified
-in your isapnp configuration file, and that there is no conflict with
-another device for an I/O port or interrupt.  Checking the contents of
-/proc/ioports and /proc/interrupts can be useful to see if you're
-butting heads with another device.
-
-If you still cannot get the module to load, look at the contents of
-your system log file, usually /var/log/messages.  If you see the
-message "opl3sa2: Unknown Yamaha audio controller version", then you
-have a different chipset version than I've encountered so far.  Look
-for all messages in the log file that start with "opl3sa2: " and see
-if they provide any clues.  If you do not see the chipset version
-message, and none of the other messages present in the system log are
-helpful, email me some details and I'll try my best to help.
-
-
-Automatic Module Loading
-------------------------
-
-Lastly, if you're using modules and want to set up automatic module
-loading with kmod, the kernel module loader, here is the section I
-currently use in my modprobe.conf file:
-
-# Sound
-alias sound-slot-0 opl3sa2
-options opl3sa2 io=0x370 mss_io=0x530 mpu_io=0x330 irq=7 dma=0 dma2=3
-options opl3 io=0x388
-
-That's all it currently takes to get an OPL3-SA3 card working on my
-system.  Once again, if you have any other problems, email me at the
-address listed above.
-
-Scott
diff --git a/Documentation/sound/oss/VIA-chipset b/Documentation/sound/oss/VIA-chipset
deleted file mode 100644 (file)
index 3786523..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-Running sound cards on VIA chipsets
-
-o      There are problems with VIA chipsets and sound cards that appear to
-       lock the hardware solidly. Test programs under DOS have verified the
-       problem exists on at least some (but apparently not all) VIA boards
-
-o      VIA have so far failed to bother to answer support mail on the subject
-       so if you are a VIA engineer feeling aggrieved as you read this 
-       document go chase your own people. If there is a workaround please
-       let us know so we can implement it.
-
-
-Certain patterns of ISA DMA access used for most PC sound cards cause the
-VIA chipsets to lock up. From the collected reports this appears to cover a
-wide range of boards. Some also lock up with sound cards under Win* as well.
-
-Linux implements a workaround providing your chipset is PCI and you compiled
-with PCI Quirks enabled. If so you will see a message
-       "Activating ISA DMA bug workarounds"
-
-during booting. If you have a VIA PCI chipset that hangs when you use the
-sound and is not generating this message even with PCI quirks enabled
-please report the information to the linux-kernel list (see REPORTING-BUGS).
-
-If you are one of the tiny number of unfortunates with a 486 ISA/VLB VIA
-chipset board you need to do the following to build a special kernel for
-your board
-
-       edit linux/include/asm-i386/dma.h
-
-change
-
-#define isa_dma_bridge_buggy   (0)
-
-to
-
-#define isa_dma_bridge_buggy   (1)
-
-and rebuild a kernel without PCI quirk support.
-
-
-Other than this particular glitch the VIA [M]VP* chipsets appear to work
-perfectly with Linux.
diff --git a/Documentation/sound/oss/cs46xx b/Documentation/sound/oss/cs46xx
deleted file mode 100644 (file)
index b544327..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-
-Documentation for the Cirrus Logic/Crystal SoundFusion cs46xx/cs4280 audio 
-controller chips (2001/05/11)
-
-The cs46xx audio driver supports the DSP line of Cirrus controllers. 
-Specifically, the cs4610, cs4612, cs4614, cs4622, cs4624, cs4630 and the cs4280
-products.  This driver uses the generic ac97_codec driver for AC97 codec
-support.  
-
-
-Features:
-
-Full Duplex Playback/Capture supported from 8k-48k.
-16Bit Signed LE & 8Bit Unsigned, with Mono or Stereo supported.
-
-APM/PM - 2.2.x PM is enabled and functional. APM can also
-be enabled for 2.4.x by modifying the CS46XX_ACPI_SUPPORT macro
-definition.
-
-DMA playback buffer size is configurable from 16k (defaultorder=2) up to 2Meg 
-(defaultorder=11).  DMA capture buffer size is fixed at a single 4k page as
-two 2k fragments.
-
-MMAP seems to work well with QuakeIII, and test XMMS plugin.
-
-Myth2 works, but the polling logic is not fully correct, but is functional.
-
-The 2.4.4-ac6 gameport code in the cs461x joystick driver has been tested 
-with a Microsoft Sidewinder joystick (cs461x.o and sidewinder.o).  This 
-audio driver must be loaded prior to the joystick driver to enable the
-DSP task image supporting the joystick device.
-
-
-Limitations:
-
-SPDIF is currently not supported.
-
-Primary codec support only.  No secondary codec support is implemented.
-
-
-
-NOTES:
-
-Hercules Game Theatre XP - the EGPIO2 pin controls the external Amp,
-and has been tested.
-Module parameter hercules_egpio_disable set to 1, will force a 0 to EGPIODR
-to disable the external amplifier.
-
-VTB Santa Cruz - the GPIO7/GPIO8 on the Secondary Codec control
-the external amplifier for the "back" speakers, since we do not
-support the secondary codec then this external amp is not
-turned on.  The primary codec external amplifier is supported but
-note that the AC97 EAPD bit is inverted logic (amp_voyetra()).
-
-DMA buffer size - there are issues with many of the Linux applications
-concerning the optimal buffer size.  Several applications request a 
-certain fragment size and number and then do not verify that the driver
-has the ability to support the requested configuration.  
-SNDCTL_DSP_SETFRAGMENT ioctl is used to request a fragment size and
-number of fragments.  Some applications exit if an error is returned
-on this particular ioctl. Therefore, in alignment with the other OSS audio 
-drivers, no error is returned when a SETFRAGs IOCTL is received, but the 
-values passed from the app are not used in any buffer calculation 
-(ossfragshift/ossmaxfrags are not used).
-Use the "defaultorder=N" module parameter to change the buffer size if
-you have an application that requires a specific number of fragments
-or a specific buffer size (see below).
-
-Debug Interface
----------------
-There is an ioctl debug interface to allow runtime modification of the 
-debug print levels.  This debug interface code can be disabled from the 
-compilation process with commenting the following define:
-#define CSDEBUG_INTERFACE 1
-There is also a debug print methodolgy to select printf statements from
-different areas of the driver.  A debug print level is also used to allow
-additional printfs to be active.  Comment out the following line in the
-driver to disable compilation of the CS_DBGOUT print statements:
-#define CSDEBUG 1
-Please see the definitions for cs_debuglevel and cs_debugmask for additional
-information on the debug levels and sections.
-
-There is also a csdbg executable to allow runtime manipulation of these 
-parameters.  for a copy email: twoller@crystal.cirrus.com
-
-
-
-MODULE_PARMS definitions
-------------------------
-module_param(defaultorder, ulong, 0);
-defaultorder=N
-where N is a value from 1 to 12
-The buffer order determines the size of the dma buffer for the driver.
-under Linux, a smaller buffer allows more responsiveness from many of the 
-applications (e.g. games).  A larger buffer allows some of the apps (esound) 
-to not underrun the dma buffer as easily.  As default, use 32k (order=3)
-rather than 64k as some of the games work more responsively.
-(2^N) * PAGE_SIZE = allocated buffer size
-
-module_param(cs_debuglevel, ulong, 0644);
-module_param(cs_debugmask, ulong, 0644);
-cs_debuglevel=N
-cs_debugmask=0xMMMMMMMM
-where N is a value from 0 (no debug printfs), to 9 (maximum)
-0xMMMMMMMM is a debug mask corresponding to the CS_xxx bits (see driver source).
-
-module_param(hercules_egpio_disable, ulong, 0);
-hercules_egpio_disable=N
-where N is a 0 (enable egpio), or a 1 (disable egpio support)
-
-module_param(initdelay, ulong, 0);
-initdelay=N
-This value is used to determine the millescond delay during the initialization
-code prior to powering up the PLL.  On laptops this value can be used to
-assist with errors on resume, mostly with IBM laptops.  Basically, if the 
-system is booted under battery power then the mdelay()/udelay() functions fail to 
-properly delay the required time.  Also, if the system is booted under AC power
-and then the power removed, the mdelay()/udelay() functions will not delay properly.
-module_param(powerdown, ulong, 0);
-powerdown=N
-where N is 0 (disable any powerdown of the internal blocks) or 1 (enable powerdown)
-
-
-module_param(external_amp, bool, 0);
-external_amp=1
-if N is set to 1, then force enabling the EAPD support in the primary AC97 codec.
-override the detection logic and force the external amp bit in the AC97 0x26 register
-to be reset (0).  EAPD should be 0 for powerup, and 1 for powerdown.  The VTB Santa Cruz
-card has inverted logic, so there is a special function for these cards.
-
-module_param(thinkpad, bool, 0);
-thinkpad=1
-if N is set to 1, then force enabling the clkrun functionality.
-Currently, when the part is being used, then clkrun is disabled for the entire system,
-but re-enabled when the driver is released or there is no outstanding open count.
-
index 76ac08e..da9e60a 100644 (file)
@@ -194,13 +194,6 @@ M: jes@trained-monkey.org
 L:     linux-acenic@sunsite.dk
 S:     Maintained
 
-ACI MIXER DRIVER
-P:     Robert Siemer
-M:     Robert.Siemer@gmx.de
-L:     linux-sound@vger.kernel.org
-W:     http://www.stud.uni-karlsruhe.de/~uh1b/
-S:     Maintained
-
 IPS SCSI RAID DRIVER
 P:     Adaptec OEM Raid Solutions
 M:     aacraid@adaptec.com
@@ -272,21 +265,6 @@ L: linux-acpi@vger.kernel.org
 W:     http://acpi.sourceforge.net/
 S:     Supported
 
-AD1816 SOUND DRIVER
-P:     Thorsten Knabe
-M:     Thorsten Knabe <linux@thorsten-knabe.de>
-W:     http://linux.thorsten-knabe.de
-S:     Maintained
-
-AD1889 SOUND DRIVER
-P:     Kyle McMartin
-M:     kyle@parisc-linux.org
-P:     Thibaut Varene
-M:     T-Bone@parisc-linux.org
-W:     http://wiki.parisc-linux.org/AD1889
-L:     parisc-linux@lists.parisc-linux.org
-S:     Maintained
-
 ADM1025 HARDWARE MONITOR DRIVER
 P:     Jean Delvare
 M:     khali@linux-fr.org
@@ -1404,13 +1382,6 @@ M:       raisch@de.ibm.com
 L:     general@lists.openfabrics.org
 S:     Supported
 
-EMU10K1 SOUND DRIVER
-P:     James Courtier-Dutton
-M:     James@superbug.demon.co.uk
-L:     emu10k1-devel@lists.sourceforge.net
-W:     http://sourceforge.net/projects/emu10k1/
-S:     Maintained
-
 EMULEX LPFC FC SCSI DRIVER
 P:     James Smart
 M:     james.smart@emulex.com
@@ -2730,12 +2701,6 @@ L:       osst-users@lists.sourceforge.net
 L:     linux-scsi@vger.kernel.org
 S:     Maintained
 
-OPL3-SA2, SA3, and SAx DRIVER
-P:     Zwane Mwaikambo
-M:     zwane@arm.linux.org.uk
-L:     linux-sound@vger.kernel.org
-S:     Maintained
-
 OPROFILE
 P:     Philippe Elie
 M:     phil.el@wanadoo.fr
index 2489bd6..7a2f9ae 100644 (file)
@@ -18,20 +18,15 @@ obj-$(CONFIG_SOUND_TRIX)    += trix.o ad1848.o sb_lib.o uart401.o
 obj-$(CONFIG_SOUND_SSCAPE)     += sscape.o ad1848.o mpu401.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_MPU401)     += mpu401.o
 obj-$(CONFIG_SOUND_UART6850)   += uart6850.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_AD1816)     += ad1816.o
-obj-$(CONFIG_SOUND_AD1889)     += ad1889.o ac97_codec.o
-obj-$(CONFIG_SOUND_ACI_MIXER)  += aci.o
 
 obj-$(CONFIG_SOUND_VIA82CXXX)  += via82cxxx_audio.o ac97_codec.o
 ifeq ($(CONFIG_MIDI_VIA82CXXX),y)
@@ -40,24 +35,16 @@ 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_ES1371)     += es1371.o ac97_codec.o
 obj-$(CONFIG_SOUND_VRC5477)    += nec_vrc5477.o ac97_codec.o
 obj-$(CONFIG_SOUND_AU1550_AC97)        += au1550_ac97.o ac97_codec.o
-obj-$(CONFIG_SOUND_FUSION)     += cs46xx.o ac97_codec.o
 obj-$(CONFIG_SOUND_TRIDENT)    += trident.o ac97_codec.o
-obj-$(CONFIG_SOUND_EMU10K1)    += ac97_codec.o
 obj-$(CONFIG_SOUND_BCM_CS4297A)        += swarm_cs4297a.o
 obj-$(CONFIG_SOUND_BT878)      += btaudio.o
 
 obj-$(CONFIG_SOUND_WM97XX)     += ac97_plugin_wm97xx.o
 
-ifeq ($(CONFIG_MIDI_EMU10K1),y)
-  obj-$(CONFIG_SOUND_EMU10K1)  += sound.o
-endif
-
-obj-$(CONFIG_SOUND_EMU10K1)    += emu10k1/
 obj-$(CONFIG_DMASOUND)         += dmasound/
 
 # Declare multi-part drivers.
diff --git a/sound/oss/ac97.c b/sound/oss/ac97.c
deleted file mode 100644 (file)
index 72cf4ed..0000000
+++ /dev/null
@@ -1,432 +0,0 @@
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include "ac97.h"
-
-/* Flag for mono controls. */
-#define MO 0
-/* And for stereo. */
-#define ST 1
-
-/* Whether or not the bits in the channel are inverted. */
-#define INV 1
-#define NINV 0
-
-static struct ac97_chn_desc {
-    int ac97_regnum;
-    int oss_channel;
-    int maxval;
-    int is_stereo;
-    int oss_mask;
-    int recordNum;
-    u16 regmask;
-    int is_inverted;
-} mixerRegs[] = {
-    { AC97_MASTER_VOL_STEREO, SOUND_MIXER_VOLUME,   0x3f, ST, SOUND_MASK_VOLUME,   5, 0x0000, INV  },
-    { AC97_MASTER_VOL_MONO,   SOUND_MIXER_PHONEOUT, 0x3f, MO, SOUND_MASK_PHONEOUT, 6, 0x0000, INV  },
-    { AC97_MASTER_TONE,       SOUND_MIXER_TREBLE,   0x0f, MO, SOUND_MASK_TREBLE,  -1, 0x00ff, INV  },
-    { AC97_MASTER_TONE,       SOUND_MIXER_BASS,     0x0f, MO, SOUND_MASK_BASS,    -1, 0xff00, INV  },
-    { AC97_PCBEEP_VOL,        SOUND_MIXER_SPEAKER,  0x0f, MO, SOUND_MASK_SPEAKER, -1, 0x001e, INV  },
-    { AC97_PHONE_VOL,         SOUND_MIXER_PHONEIN,  0x1f, MO, SOUND_MASK_PHONEIN,  7, 0x0000, INV  },
-    { AC97_MIC_VOL,           SOUND_MIXER_MIC,      0x1f, MO, SOUND_MASK_MIC,      0, 0x0000, INV  },
-    { AC97_LINEIN_VOL,        SOUND_MIXER_LINE,     0x1f, ST, SOUND_MASK_LINE,     4, 0x0000, INV  },
-    { AC97_CD_VOL,            SOUND_MIXER_CD,       0x1f, ST, SOUND_MASK_CD,       1, 0x0000, INV  },
-    { AC97_VIDEO_VOL,         SOUND_MIXER_VIDEO,    0x1f, ST, SOUND_MASK_VIDEO,    2, 0x0000, INV  },
-    { AC97_AUX_VOL,           SOUND_MIXER_LINE1,    0x1f, ST, SOUND_MASK_LINE1,           3, 0x0000, INV  },
-    { AC97_PCMOUT_VOL,        SOUND_MIXER_PCM,      0x1f, ST, SOUND_MASK_PCM,     -1, 0x0000, INV  },
-    { AC97_RECORD_GAIN,       SOUND_MIXER_IGAIN,    0x0f, ST, SOUND_MASK_IGAIN,   -1, 0x0000, NINV },
-    { -1,                    -1,                   0xff, 0,  0,                  -1, 0x0000, 0    },
-};
-
-static struct ac97_chn_desc *
-ac97_find_chndesc (struct ac97_hwint *dev, int oss_channel)
-{
-    int x;
-
-    for (x = 0; mixerRegs[x].oss_channel != -1; x++) {
-       if (mixerRegs[x].oss_channel == oss_channel)
-           return mixerRegs + x;
-    }
-
-    return NULL;
-}
-
-static inline int
-ac97_is_valid_channel (struct ac97_hwint *dev, struct ac97_chn_desc *chn)
-{
-    return (dev->last_written_mixer_values[chn->ac97_regnum / 2]
-           != AC97_REG_UNSUPPORTED);
-}
-
-int
-ac97_init (struct ac97_hwint *dev)
-{
-    int x;
-    int reg0;
-
-    /* Clear out the arrays of cached values. */
-    for (x = 0; x < AC97_REG_CNT; x++)
-       dev->last_written_mixer_values[x] = AC97_REGVAL_UNKNOWN;
-
-    for (x = 0; x < SOUND_MIXER_NRDEVICES; x++)
-       dev->last_written_OSS_values[x] = AC97_REGVAL_UNKNOWN;
-
-    /* Clear the device masks.  */
-    dev->mixer_devmask = 0;
-    dev->mixer_stereomask = 0;
-    dev->mixer_recmask = 0;
-
-    /* ??? Do a "standard reset" via register 0? */
-
-    /* Hardware-dependent reset.  */
-    if (dev->reset_device (dev))
-       return -1;
-
-    /* Check the mixer device capabilities.  */
-    reg0 = dev->read_reg (dev, AC97_RESET);
-
-    if (reg0 < 0)
-       return -1;
-
-    /* Check for support for treble/bass controls.  */
-    if (! (reg0 & 4)) {
-       dev->last_written_mixer_values[AC97_MASTER_TONE / 2] 
-           = AC97_REG_UNSUPPORTED;
-    }
-
-    /* ??? There may be other tests here? */
-
-    /* Fill in the device masks.  */
-    for (x = 0; mixerRegs[x].ac97_regnum != -1; x++) {
-       if (ac97_is_valid_channel (dev, mixerRegs + x)) {
-           dev->mixer_devmask |= mixerRegs[x].oss_mask;
-
-           if (mixerRegs[x].is_stereo)
-               dev->mixer_stereomask |= mixerRegs[x].oss_mask;
-
-           if (mixerRegs[x].recordNum != -1)
-               dev->mixer_recmask |= mixerRegs[x].oss_mask;
-       }
-    }
-
-    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
-ac97_get_register (struct ac97_hwint *dev, u8 reg) 
-{
-    if (reg > 127 || (reg & 1))
-       return -EINVAL;
-
-    /* See if it's in the cache, or if it's just plain invalid.  */
-    switch (dev->last_written_mixer_values[reg / 2]) {
-    case AC97_REG_UNSUPPORTED:
-       return -EINVAL;
-       break;
-    case AC97_REGVAL_UNKNOWN:
-       dev->last_written_mixer_values[reg / 2] = dev->read_reg (dev, reg);
-       break;
-    default:
-       break;
-    }
-    return dev->last_written_mixer_values[reg / 2];
-}
-
-/* Write VALUE to AC97 register REG, and cache its value in the last-written
-   cache.  Returns a negative error code on failure, or 0 on success. */
-int
-ac97_put_register (struct ac97_hwint *dev, u8 reg, u16 value)
-{
-    if (reg > 127 || (reg & 1))
-       return -EINVAL;
-
-    if (dev->last_written_mixer_values[reg / 2] == AC97_REG_UNSUPPORTED)
-       return -EINVAL;
-    else {
-       int res = dev->write_reg (dev, reg, value);
-       if (res >= 0) {
-           dev->last_written_mixer_values[reg / 2] = value;
-           return 0;
-       }
-       else
-           return res;
-    }
-}
-
-/* Scale VALUE (a value fro 0 to MAXVAL) to a value from 0-100.  If
-   IS_STEREO is set, VALUE is a stereo value; the left channel value
-   is in the lower 8 bits, and the right channel value is in the upper
-   8 bits.
-
-   A negative error code is returned on failure, or the unsigned
-   scaled value on success.  */
-
-static int
-ac97_scale_to_oss_val (int value, int maxval, int is_stereo, int inv)
-{
-    /* Muted?  */
-    if (value & AC97_MUTE)
-       return 0;
-
-    if (is_stereo)
-       return (ac97_scale_to_oss_val (value & 255, maxval, 0, inv) << 8)
-       | (ac97_scale_to_oss_val ((value >> 8) & 255, maxval, 0, inv) << 0);
-    else {
-       int i;
-       
-       /* Inverted. */
-       if (inv)
-           value = maxval - value;
-
-       i = (value * 100 + (maxval / 2)) / maxval;
-       if (i > 100)
-            i = 100;
-       if (i < 0)
-           i = 0;
-       return i;
-    }
-}
-
-static int
-ac97_scale_from_oss_val (int value, int maxval, int is_stereo, int inv)
-{
-    if (is_stereo)
-       return (ac97_scale_from_oss_val (value & 255, maxval, 0, inv) << 8)
-       | (ac97_scale_from_oss_val ((value >> 8) & 255, maxval, 0, inv) << 0);
-    else {
-       int i = ((value & 255) * maxval + 50) / 100;
-       if (inv)
-           i = maxval - i;
-       if (i < 0)
-           i = 0;
-       if (i > maxval)
-           i = maxval;
-       return i;
-    }
-}
-
-static int
-ac97_set_mixer (struct ac97_hwint *dev, int oss_channel, u16 oss_value)
-{
-    int scaled_value;
-    struct ac97_chn_desc *channel = ac97_find_chndesc (dev, oss_channel);
-    int result;
-
-    if (channel == NULL)
-       return -ENODEV;
-    if (! ac97_is_valid_channel (dev, channel))
-       return -ENODEV;
-    scaled_value = ac97_scale_from_oss_val (oss_value, channel->maxval,
-                                           channel->is_stereo, 
-                                           channel->is_inverted);
-    if (scaled_value < 0)
-       return scaled_value;
-
-    if (channel->regmask != 0) {
-       int mv;
-
-       int oldval = ac97_get_register (dev, channel->ac97_regnum);
-       if (oldval < 0)
-           return oldval;
-
-       for (mv = channel->regmask; ! (mv & 1); mv >>= 1)
-           scaled_value <<= 1;
-
-       scaled_value &= channel->regmask;
-       scaled_value |= (oldval & ~channel->regmask);
-    }
-    result = ac97_put_register (dev, channel->ac97_regnum, scaled_value);
-    if (result == 0)
-       dev->last_written_OSS_values[oss_channel] = oss_value;
-    return result;
-}
-
-static int
-ac97_get_mixer_scaled (struct ac97_hwint *dev, int oss_channel)
-{
-    struct ac97_chn_desc *channel = ac97_find_chndesc (dev, oss_channel);
-    int regval;
-
-    if (channel == NULL)
-       return -ENODEV;
-
-    if (! ac97_is_valid_channel (dev, channel))
-       return -ENODEV;
-
-    regval = ac97_get_register (dev, channel->ac97_regnum);
-
-    if (regval < 0)
-       return regval;
-
-    if (channel->regmask != 0) {
-       int mv;
-
-       regval &= channel->regmask;
-
-       for (mv = channel->regmask; ! (mv & 1); mv >>= 1)
-           regval >>= 1;
-    }
-    return ac97_scale_to_oss_val (regval, channel->maxval,
-                                 channel->is_stereo, 
-                                 channel->is_inverted);
-}
-
-static int
-ac97_get_recmask (struct ac97_hwint *dev)
-{
-    int recReg = ac97_get_register (dev, AC97_RECORD_SELECT);
-
-    if (recReg < 0)
-       return recReg;
-    else {
-       int x;
-       for (x = 0; mixerRegs[x].ac97_regnum >= 0; x++) {
-           if (mixerRegs[x].recordNum == (recReg & 7))
-               return mixerRegs[x].oss_mask;
-       }
-       return -ENODEV;
-    }
-}
-
-static int
-ac97_set_recmask (struct ac97_hwint *dev, int oss_recmask)
-{
-    int x;
-
-    if (oss_recmask == 0)
-       oss_recmask = SOUND_MIXER_MIC;
-
-    for (x = 0; mixerRegs[x].ac97_regnum >= 0; x++) { 
-       if ((mixerRegs[x].recordNum >= 0)
-            && (oss_recmask & mixerRegs[x].oss_mask))
-           break;
-    }
-    if (mixerRegs[x].ac97_regnum < 0)
-       return -ENODEV;
-    else {
-       int regval = (mixerRegs[x].recordNum << 8) | mixerRegs[x].recordNum;
-       int res = ac97_put_register (dev, AC97_RECORD_SELECT, regval);
-       if (res == 0)
-           return ac97_get_recmask (dev);
-       else
-           return res;
-    }
-}
-
-/* Set the mixer DEV to the list of values in VALUE_LIST.  Return 0 on
-   success, or a negative error code.  */
-int
-ac97_set_values (struct ac97_hwint *dev, 
-                struct ac97_mixer_value_list *value_list)
-{
-    int x;
-
-    for (x = 0; value_list[x].oss_channel != -1; x++) {
-       int chnum = value_list[x].oss_channel;
-       struct ac97_chn_desc *chent = ac97_find_chndesc (dev, chnum);
-       if (chent != NULL) {
-           u16 val;
-           int res;
-
-           if (chent->is_stereo)
-               val = (value_list[x].value.stereo.right << 8) 
-                     | value_list[x].value.stereo.left;
-           else {
-               /* We do this so the returned value looks OK in the
-                  mixer app.  It's not necessary otherwise.  */
-               val = (value_list[x].value.mono << 8) 
-                     | value_list[x].value.mono;
-           }
-           res = ac97_set_mixer (dev, chnum, val);
-           if (res < 0)
-               return res;
-       }
-       else
-           return -ENODEV;
-    }
-    return 0;
-}
-
-int
-ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd, void __user *arg)
-{
-    int ret;
-
-    switch (cmd) {
-    case SOUND_MIXER_READ_RECSRC:
-       ret = ac97_get_recmask (dev);
-       break;
-
-    case SOUND_MIXER_WRITE_RECSRC:
-       {
-           if (get_user (ret, (int __user *) arg))
-               ret = -EFAULT;
-           else
-               ret = ac97_set_recmask (dev, ret);
-       }
-       break;
-
-    case SOUND_MIXER_READ_CAPS:
-       ret = SOUND_CAP_EXCL_INPUT;
-       break;
-
-    case SOUND_MIXER_READ_DEVMASK:
-       ret = dev->mixer_devmask;
-       break;
-
-    case SOUND_MIXER_READ_RECMASK:
-       ret = dev->mixer_recmask;
-       break;
-
-    case SOUND_MIXER_READ_STEREODEVS:
-       ret = dev->mixer_stereomask;
-       break;
-
-    default:
-       /* Read or write request. */
-       ret = -EINVAL;
-       if (_IOC_TYPE (cmd) == 'M') {
-           int dir = _SIOC_DIR (cmd);
-           int channel = _IOC_NR (cmd);
-
-           if (channel >= 0 && channel < SOUND_MIXER_NRDEVICES) {
-               ret = 0;
-               if (dir & _SIOC_WRITE) {
-                   int val;
-                   if (get_user (val, (int __user *) arg) == 0)
-                       ret = ac97_set_mixer (dev, channel, val);
-                   else
-                       ret = -EFAULT;
-               }
-               if (ret >= 0 && (dir & _SIOC_READ)) {
-                   if (dev->last_written_OSS_values[channel]
-                       == AC97_REGVAL_UNKNOWN)
-                       dev->last_written_OSS_values[channel]
-                           = ac97_get_mixer_scaled (dev, channel);
-                   ret = dev->last_written_OSS_values[channel];
-               }
-           }
-       }
-       break;
-    }
-
-    if (ret < 0)
-       return ret;
-    else
-       return put_user(ret, (int __user *) arg);
-}
-
-EXPORT_SYMBOL(ac97_init);
-EXPORT_SYMBOL(ac97_set_values);
-EXPORT_SYMBOL(ac97_put_register);
-EXPORT_SYMBOL(ac97_mixer_ioctl);
-MODULE_LICENSE("GPL");
-
-\f
-/*
- * Local variables:
- *  c-basic-offset: 4
- * End:
- */
diff --git a/sound/oss/ac97.h b/sound/oss/ac97.h
deleted file mode 100644 (file)
index 01837a9..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * ac97.h 
- * 
- * definitions for the AC97, Intel's Audio Codec 97 Spec
- * also includes support for a generic AC97 interface
- */
-
-#ifndef _AC97_H_
-#define _AC97_H_
-#include "sound_config.h"
-#include "sound_calls.h"
-
-#define  AC97_RESET              0x0000      //
-#define  AC97_MASTER_VOL_STEREO  0x0002      // Line Out
-#define  AC97_HEADPHONE_VOL      0x0004      // 
-#define  AC97_MASTER_VOL_MONO    0x0006      // TAD Output
-#define  AC97_MASTER_TONE        0x0008      //
-#define  AC97_PCBEEP_VOL         0x000a      // none
-#define  AC97_PHONE_VOL          0x000c      // TAD Input (mono)
-#define  AC97_MIC_VOL            0x000e      // MIC Input (mono)
-#define  AC97_LINEIN_VOL         0x0010      // Line Input (stereo)
-#define  AC97_CD_VOL             0x0012      // CD Input (stereo)
-#define  AC97_VIDEO_VOL          0x0014      // none
-#define  AC97_AUX_VOL            0x0016      // Aux Input (stereo)
-#define  AC97_PCMOUT_VOL         0x0018      // Wave Output (stereo)
-#define  AC97_RECORD_SELECT      0x001a      //
-#define  AC97_RECORD_GAIN        0x001c
-#define  AC97_RECORD_GAIN_MIC    0x001e
-#define  AC97_GENERAL_PURPOSE    0x0020
-#define  AC97_3D_CONTROL         0x0022
-#define  AC97_MODEM_RATE         0x0024
-#define  AC97_POWER_CONTROL      0x0026
-
-/* registers 0x0028 - 0x0058 are reserved */
-
-/* AC'97 2.0 */
-#define AC97_EXTENDED_ID       0x0028  /* Extended Audio ID */
-#define AC97_EXTENDED_STATUS   0x002A  /* Extended Audio Status */
-#define AC97_PCM_FRONT_DAC_RATE 0x002C  /* PCM Front DAC Rate */
-#define AC97_PCM_SURR_DAC_RATE  0x002E  /* PCM Surround DAC Rate */
-#define AC97_PCM_LFE_DAC_RATE   0x0030  /* PCM LFE DAC Rate */
-#define AC97_PCM_LR_ADC_RATE   0x0032  /* PCM LR DAC Rate */
-#define AC97_PCM_MIC_ADC_RATE   0x0034  /* PCM MIC ADC Rate */
-#define AC97_CENTER_LFE_MASTER  0x0036  /* Center + LFE Master Volume */
-#define AC97_SURROUND_MASTER    0x0038  /* Surround (Rear) Master Volume */
-#define AC97_RESERVED_3A       0x003A  /* Reserved */
-/* range 0x3c-0x58 - MODEM */
-
-/* registers 0x005a - 0x007a are vendor reserved */
-
-#define  AC97_VENDOR_ID1         0x007c
-#define  AC97_VENDOR_ID2         0x007e
-
-/* volume control bit defines */
-
-#define AC97_MUTE                0x8000
-#define AC97_MICBOOST            0x0040
-#define AC97_LEFTVOL             0x3f00
-#define AC97_RIGHTVOL            0x003f
-
-/* record mux defines */
-
-#define AC97_RECMUX_MIC          0x0000
-#define AC97_RECMUX_CD           0x0101
-#define AC97_RECMUX_VIDEO        0x0202      /* not used */
-#define AC97_RECMUX_AUX          0x0303      
-#define AC97_RECMUX_LINE         0x0404      
-#define AC97_RECMUX_STEREO_MIX   0x0505
-#define AC97_RECMUX_MONO_MIX     0x0606
-#define AC97_RECMUX_PHONE        0x0707
-
-
-/* general purpose register bit defines */
-
-#define AC97_GP_LPBK             0x0080      /* Loopback mode */
-#define AC97_GP_MS               0x0100      /* Mic Select 0=Mic1, 1=Mic2 */
-#define AC97_GP_MIX              0x0200      /* Mono output select 0=Mix, 1=Mic */
-#define AC97_GP_RLBK             0x0400      /* Remote Loopback - Modem line codec */
-#define AC97_GP_LLBK             0x0800      /* Local Loopback - Modem Line codec */
-#define AC97_GP_LD               0x1000      /* Loudness 1=on */
-#define AC97_GP_3D               0x2000      /* 3D Enhancement 1=on */
-#define AC97_GP_ST               0x4000      /* Stereo Enhancement 1=on */
-#define AC97_GP_POP              0x8000      /* Pcm Out Path, 0=pre 3D, 1=post 3D */
-
-
-/* powerdown control and status bit defines */
-
-/* status */
-#define AC97_PWR_MDM             0x0010      /* Modem section ready */
-#define AC97_PWR_REF             0x0008      /* Vref nominal */
-#define AC97_PWR_ANL             0x0004      /* Analog section ready */
-#define AC97_PWR_DAC             0x0002      /* DAC section ready */
-#define AC97_PWR_ADC             0x0001      /* ADC section ready */
-
-/* control */
-#define AC97_PWR_PR0             0x0100      /* ADC and Mux powerdown */
-#define AC97_PWR_PR1             0x0200      /* DAC powerdown */
-#define AC97_PWR_PR2             0x0400      /* Output mixer powerdown (Vref on) */
-#define AC97_PWR_PR3             0x0800      /* Output mixer powerdown (Vref off) */
-#define AC97_PWR_PR4             0x1000      /* AC-link powerdown */
-#define AC97_PWR_PR5             0x2000      /* Internal Clk disable */
-#define AC97_PWR_PR6             0x4000      /* HP amp powerdown */
-#define AC97_PWR_PR7             0x8000      /* Modem off - if supported */
-
-/* useful power states */
-#define AC97_PWR_D0              0x0000      /* everything on */
-#define AC97_PWR_D1              AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR4
-#define AC97_PWR_D2              AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR2|AC97_PWR_PR3|AC97_PWR_PR4
-#define AC97_PWR_D3              AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR2|AC97_PWR_PR3|AC97_PWR_PR4
-#define AC97_PWR_ANLOFF          AC97_PWR_PR2|AC97_PWR_PR3  /* analog section off */
-
-/* Total number of defined registers.  */
-#define AC97_REG_CNT 64
-
-/* Generic AC97 mixer interface. */
-
-/* Structure describing access to the hardware. */
-struct ac97_hwint
-{
-    /* Perform any hardware-specific reset and initialization.  Returns
-     0 on success, or a negative error code.  */
-    int (*reset_device) (struct ac97_hwint *dev);
-
-    /* Returns the contents of the specified register REG.  The caller
-       should check to see if the desired contents are available in
-       the cache first, if applicable. Returns a positive unsigned value
-       representing the contents of the register, or a negative error
-       code.  */
-    int (*read_reg) (struct ac97_hwint *dev, u8 reg);
-
-    /* Writes VALUE to register REG.  Returns 0 on success, or a
-       negative error code.  */
-    int (*write_reg) (struct ac97_hwint *dev, u8 reg, u16 value);
-
-    /* Hardware-specific information. */
-    void *driver_private;
-
-    /* Three OSS masks. */
-    int mixer_devmask;
-    int mixer_stereomask;
-    int mixer_recmask;
-
-    /* The mixer cache. The indices correspond to the AC97 hardware register
-       number / 2, since the register numbers are always an even number.
-
-       Unknown values are set to -1; unsupported registers contain a
-       -2.  */
-    int last_written_mixer_values[AC97_REG_CNT];
-
-    /* A cache of values written via OSS; we need these so we can return
-       the values originally written by the user.
-
-       Why the original user values?  Because the real-world hardware
-       has less precision, and some existing applications assume that
-       they will get back the exact value that they wrote (aumix).
-
-       A -1 value indicates that no value has been written to this mixer
-       channel via OSS.  */
-    int last_written_OSS_values[SOUND_MIXER_NRDEVICES];
-};
-
-/* Values stored in the register cache.  */
-#define AC97_REGVAL_UNKNOWN -1
-#define AC97_REG_UNSUPPORTED -2
-
-struct ac97_mixer_value_list
-{
-    /* Mixer channel to set.  List is terminated by a value of -1.  */
-    int oss_channel;
-    /* The scaled value to set it to; values generally range from 0-100. */
-    union {
-       struct {
-           u8 left, right;
-       } stereo;
-       u8 mono;
-    } value;
-};
-
-/* Initialize the ac97 mixer by resetting it.  */
-extern int ac97_init (struct ac97_hwint *dev);
-
-/* Sets the mixer DEV to the values in VALUE_LIST.  Returns 0 on success,
-   or a negative error code.  */
-extern int ac97_set_values (struct ac97_hwint *dev,
-                           struct ac97_mixer_value_list *value_list);
-
-/* Writes the specified VALUE to the AC97 register REG in the mixer.
-   Takes care of setting the last-written cache as well.  */
-extern int ac97_put_register (struct ac97_hwint *dev, u8 reg, u16 value);
-
-/* Default ioctl. */
-extern int ac97_mixer_ioctl (struct ac97_hwint *dev, unsigned int cmd,
-                            void __user * arg);
-
-#endif
-\f
-/*
- * Local variables:
- *  c-basic-offset: 4
- * End:
- */
diff --git a/sound/oss/aci.c b/sound/oss/aci.c
deleted file mode 100644 (file)
index 3bfac37..0000000
+++ /dev/null
@@ -1,712 +0,0 @@
-/*
- * Audio Command Interface (ACI) driver (sound/aci.c)
- *
- * ACI is a protocol used to communicate with the microcontroller on
- * some sound cards produced by miro, e.g. the miroSOUND PCM12 and
- * PCM20. The ACI has been developed for miro by Norberto Pellicci
- * <pellicci@home.com>. Special thanks to both him and miro for
- * providing the ACI specification.
- *
- * The main function of the ACI is to control the mixer and to get a
- * product identification. On the PCM20, ACI also controls the radio
- * tuner on this card, this is supported in the Video for Linux 
- * miropcm20 driver.
- * -
- * This is a fullfeatured implementation. Unsupported features
- * are bugs... (:
- *
- * It is not longer necessary to load the mad16 module first. The
- * user is currently responsible to set the mad16 mixer correctly.
- *
- * To toggle the solo mode for full duplex operation just use the OSS
- * record switch for the pcm ('wave') controller.           Robert
- * -
- *
- * Revision history:
- *
- *   1995-11-10  Markus Kuhn <mskuhn@cip.informatik.uni-erlangen.de>
- *        First version written.
- *   1995-12-31  Markus Kuhn
- *        Second revision, general code cleanup.
- *   1996-05-16         Hannu Savolainen
- *       Integrated with other parts of the driver.
- *   1996-05-28  Markus Kuhn
- *        Initialize CS4231A mixer, make ACI first mixer,
- *        use new private mixer API for solo mode.
- *   1998-08-18  Ruurd Reitsma <R.A.Reitsma@wbmt.tudelft.nl>
- *       Small modification to export ACI functions and 
- *       complete modularisation.
- *   2000-06-20  Robert Siemer <Robert.Siemer@gmx.de>
- *        Don't initialize the CS4231A mixer anymore, so the code is
- *        working again, and other small changes to fit in todays
- *        kernels.
- *   2000-08-26  Robert Siemer
- *        Clean up and rewrite for 2.4.x. Maybe it's SMP safe now... (:
- *        ioctl bugfix, and integration of solo-mode into OSS-API,
- *        added (OSS-limited) equalizer support, return value bugfix,
- *        changed param aci_reset to reset, new params: ide, wss.
- *   2001-04-20  Robert Siemer
- *        even more cleanups...
- *   2001-10-08  Arnaldo Carvalho de Melo <acme@conectiva.com.br>
- *       Get rid of check_region, .bss optimizations, use set_current_state
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/module.h> 
-#include <linux/proc_fs.h>
-#include <linux/slab.h>
-#include <linux/mutex.h>
-
-#include <asm/io.h>
-#include <asm/uaccess.h>
-#include "sound_config.h"
-
-int aci_port;  /* as determined by bit 4 in the OPTi 929 MC4 register */
-static int aci_idcode[2];      /* manufacturer and product ID */
-int aci_version;       /* ACI firmware version */
-
-EXPORT_SYMBOL(aci_port);
-EXPORT_SYMBOL(aci_version);
-
-#include "aci.h"
-
-
-static int aci_solo;   /* status bit of the card that can't be         *
-                        * checked with ACI versions prior to 0xb0      */
-static int aci_amp;   /* status bit for power-amp/line-out level
-                          but I have no docs about what is what... */
-static int aci_micpreamp=3; /* microphone preamp-level that can't be    *
-                        * checked with ACI versions prior to 0xb0      */
-
-static int mixer_device;
-static struct mutex aci_mutex;
-
-#ifdef MODULE
-static int reset;
-module_param(reset, bool, 0);
-MODULE_PARM_DESC(reset,"When set to 1, reset aci mixer.");
-#else
-static int reset = 1;
-#endif
-
-static int ide=-1;
-module_param(ide, int, 0);
-MODULE_PARM_DESC(ide,"1 enable, 0 disable ide-port - untested"
-                " default: do nothing");
-static int wss=-1;
-module_param(wss, int, 0);
-MODULE_PARM_DESC(wss,"change between ACI/WSS-mixer; use 0 and 1 - untested"
-                " default: do nothing; for PCM1-pro only");
-
-#ifdef DEBUG
-static void print_bits(unsigned char c)
-{
-       int j;
-       printk(KERN_DEBUG "aci: ");
-
-       for (j=7; j>=0; j--) {
-               printk("%d", (c >> j) & 0x1);
-       }
-
-       printk("\n");
-}
-#endif
-
-/*
- * This busy wait code normally requires less than 15 loops and
- * practically always less than 100 loops on my i486/DX2 66 MHz.
- *
- * Warning: Waiting on the general status flag after reseting the MUTE
- * function can take a VERY long time, because the PCM12 does some kind
- * of fade-in effect. For this reason, access to the MUTE function has
- * not been implemented at all.
- *
- * - The OSS interface has no mute option. It takes about 3 seconds to
- * fade-in on my PCM20. busy_wait() handles it great now...     Robert
- */
-
-static int busy_wait(void)
-{
-       #define MINTIME 500
-       long timeout;
-       unsigned char byte;
-
-       for (timeout = 1; timeout <= MINTIME+30; timeout++) {
-               if (((byte=inb(BUSY_REGISTER)) & 1) == 0) {
-                       if (timeout >= MINTIME)
-                               printk(KERN_DEBUG "aci: Got READYFLAG in round %ld.\n", timeout-MINTIME);
-                       return byte;
-               }
-               if (timeout >= MINTIME) {
-                       long out=10*HZ;
-                       switch (timeout-MINTIME) {
-                       case 0 ... 9:
-                               out /= 10;
-                       case 10 ... 19:
-                               out /= 10;
-                       case 20 ... 30:
-                               out /= 10;
-                       default:
-                               set_current_state(TASK_UNINTERRUPTIBLE);
-                               schedule_timeout(out);
-                               break;
-                       }
-               }
-       }
-       printk(KERN_WARNING "aci: busy_wait() time out.\n");
-       return -EBUSY;
-}
-
-/* The four ACI command types are fucked up. [-:
- * implied is: 1w      - special case for INIT
- * write   is: 2w1r
- * read    is: x(1w1r) where x is 1 or 2 (1 CHECK_SIG, 1 CHECK_STER,
- *                                        1 VERSION, 2 IDCODE)
- *  the command is only in the first write, rest is protocol overhead
- *
- * indexed is technically a write and used for STATUS
- * and the special case for TUNE is: 3w1r
- * 
- * Here the new general sheme: TUNE --> aci_rw_cmd(x,  y,  z)
- *                indexed and write --> aci_rw_cmd(x,  y, -1)
- *           implied and read (x=1) --> aci_rw_cmd(x, -1, -1)
- *
- * Read (x>=2) is not implemented (only used during initialization).
- * Use aci_idcode[2] and aci_version...                    Robert
- */
-
-/* Some notes for error detection: theoretically it is possible.
- * But it doubles the I/O-traffic from ww(r) to wwwrw(r) in the normal 
- * case and doesn't seem to be designed for that...        Robert
- */
-
-static inline int aci_rawwrite(unsigned char byte)
-{
-       if (busy_wait() >= 0) {
-#ifdef DEBUG
-               printk(KERN_DEBUG "aci_rawwrite(%d)\n", byte);
-#endif
-               outb(byte, COMMAND_REGISTER);
-               return 0;
-       } else
-               return -EBUSY;
-}
-
-static inline int aci_rawread(void)
-{
-       unsigned char byte;
-
-       if (busy_wait() >= 0) {
-               byte=inb(STATUS_REGISTER);
-#ifdef DEBUG
-               printk(KERN_DEBUG "%d = aci_rawread()\n", byte);
-#endif
-               return byte;
-       } else
-               return -EBUSY;
-}
-
-
-int aci_rw_cmd(int write1, int write2, int write3)
-{
-       int write[] = {write1, write2, write3};
-       int read = -EINTR, i;
-
-       if (mutex_lock_interruptible(&aci_mutex))
-               goto out;
-
-       for (i=0; i<3; i++) {
-               if (write[i]< 0 || write[i] > 255)
-                       break;
-               else {
-                       read = aci_rawwrite(write[i]);
-                       if (read < 0)
-                               goto out_up;
-               }
-               
-       }
-       
-       read = aci_rawread();
-out_up:        mutex_unlock(&aci_mutex);
-out:   return read;
-}
-
-EXPORT_SYMBOL(aci_rw_cmd);
-
-static int setvolume(int __user *arg, 
-                    unsigned char left_index, unsigned char right_index)
-{
-       int vol, ret, uservol, buf;
-
-       __get_user(uservol, arg);
-
-       /* left channel */
-       vol = uservol & 0xff;
-       if (vol > 100)
-               vol = 100;
-       vol = SCALE(100, 0x20, vol);
-       if ((buf=aci_write_cmd(left_index, 0x20 - vol))<0)
-               return buf;
-       ret = SCALE(0x20, 100, vol);
-
-
-       /* right channel */
-       vol = (uservol >> 8) & 0xff;
-       if (vol > 100)
-               vol = 100;
-       vol = SCALE(100, 0x20, vol);
-       if ((buf=aci_write_cmd(right_index, 0x20 - vol))<0)
-               return buf;
-       ret |= SCALE(0x20, 100, vol) << 8;
-       __put_user(ret, arg);
-
-       return 0;
-}
-
-static int getvolume(int __user *arg,
-                    unsigned char left_index, unsigned char right_index)
-{
-       int vol;
-       int buf;
-
-       /* left channel */
-       if ((buf=aci_indexed_cmd(ACI_STATUS, left_index))<0)
-               return buf;
-       vol = SCALE(0x20, 100, buf < 0x20 ? 0x20-buf : 0);
-       
-       /* right channel */
-       if ((buf=aci_indexed_cmd(ACI_STATUS, right_index))<0)
-               return buf;
-       vol |= SCALE(0x20, 100, buf < 0x20 ? 0x20-buf : 0) << 8;
-
-       __put_user(vol, arg);
-
-       return 0;
-}
-
-
-/* The equalizer is somewhat strange on the ACI. From -12dB to +12dB
- * write:  0xff..down.to..0x80==0x00..up.to..0x7f
- */
-
-static inline unsigned int eq_oss2aci(unsigned int vol)
-{
-       int boost=0;
-       unsigned int ret;
-
-       if (vol > 100)
-               vol = 100;
-       if (vol > 50) {
-               vol -= 51;
-               boost=1;
-       }
-       if (boost)
-               ret=SCALE(49, 0x7e, vol)+1;
-       else
-               ret=0xff - SCALE(50, 0x7f, vol);
-       return ret;
-}
-
-static inline unsigned int eq_aci2oss(unsigned int vol)
-{
-       if (vol < 0x80)
-               return SCALE(0x7f, 50, vol) + 50;
-       else
-               return SCALE(0x7f, 50, 0xff-vol);
-}
-
-
-static int setequalizer(int __user *arg, 
-                       unsigned char left_index, unsigned char right_index)
-{
-       int buf;
-       unsigned int vol;
-
-       __get_user(vol, arg);
-
-       /* left channel */
-       if ((buf=aci_write_cmd(left_index, eq_oss2aci(vol & 0xff)))<0)
-               return buf;
-
-       /* right channel */
-       if ((buf=aci_write_cmd(right_index, eq_oss2aci((vol>>8) & 0xff)))<0)
-               return buf;
-
-       /* the ACI equalizer is more precise */
-       return 0;
-}
-
-static int getequalizer(int __user *arg,
-                       unsigned char left_index, unsigned char right_index)
-{
-       int buf;
-       unsigned int vol;
-
-       /* left channel */
-       if ((buf=aci_indexed_cmd(ACI_STATUS, left_index))<0)
-               return buf;
-       vol = eq_aci2oss(buf);
-       
-       /* right channel */
-       if ((buf=aci_indexed_cmd(ACI_STATUS, right_index))<0)
-               return buf;
-       vol |= eq_aci2oss(buf) << 8;
-
-       __put_user(vol, arg);
-
-       return 0;
-}
-
-static int aci_mixer_ioctl (int dev, unsigned int cmd, void __user * arg)
-{
-       int vol, buf;
-       int __user *p = arg;
-
-       switch (cmd) {
-       case SOUND_MIXER_WRITE_VOLUME:
-               return setvolume(p, 0x01, 0x00);
-       case SOUND_MIXER_WRITE_CD:
-               return setvolume(p, 0x3c, 0x34);
-       case SOUND_MIXER_WRITE_MIC:
-               return setvolume(p, 0x38, 0x30);
-       case SOUND_MIXER_WRITE_LINE:
-               return setvolume(p, 0x39, 0x31);
-       case SOUND_MIXER_WRITE_SYNTH:
-               return setvolume(p, 0x3b, 0x33);
-       case SOUND_MIXER_WRITE_PCM:
-               return setvolume(p, 0x3a, 0x32);
-       case MIXER_WRITE(SOUND_MIXER_RADIO): /* fall through */
-       case SOUND_MIXER_WRITE_LINE1:  /* AUX1 or radio */
-               return setvolume(p, 0x3d, 0x35);
-       case SOUND_MIXER_WRITE_LINE2:  /* AUX2 */
-               return setvolume(p, 0x3e, 0x36);
-       case SOUND_MIXER_WRITE_BASS:   /* set band one and two */
-               if (aci_idcode[1]=='C') {
-                       if ((buf=setequalizer(p, 0x48, 0x40)) || 
-                           (buf=setequalizer(p, 0x49, 0x41)));
-                       return buf;
-               }
-               break;
-       case SOUND_MIXER_WRITE_TREBLE: /* set band six and seven */
-               if (aci_idcode[1]=='C') {
-                       if ((buf=setequalizer(p, 0x4d, 0x45)) || 
-                           (buf=setequalizer(p, 0x4e, 0x46)));
-                       return buf;
-               }
-               break;
-       case SOUND_MIXER_WRITE_IGAIN:  /* MIC pre-amp */
-               if (aci_idcode[1]=='B' || aci_idcode[1]=='C') {
-                       __get_user(vol, p);
-                       vol = vol & 0xff;
-                       if (vol > 100)
-                               vol = 100;
-                       vol = SCALE(100, 3, vol);
-                       if ((buf=aci_write_cmd(ACI_WRITE_IGAIN, vol))<0)
-                               return buf;
-                       aci_micpreamp = vol;
-                       vol = SCALE(3, 100, vol);
-                       vol |= (vol << 8);
-                       __put_user(vol, p);
-                       return 0;
-               }
-               break;
-       case SOUND_MIXER_WRITE_OGAIN:  /* Power-amp/line-out level */
-               if (aci_idcode[1]=='A' || aci_idcode[1]=='B') {
-                       __get_user(buf, p);
-                       buf = buf & 0xff;
-                       if (buf > 50)
-                               vol = 1;
-                       else
-                               vol = 0;
-                       if ((buf=aci_write_cmd(ACI_SET_POWERAMP, vol))<0)
-                               return buf;
-                       aci_amp = vol;
-                       if (aci_amp)
-                               buf = (100 || 100<<8);
-                       else
-                               buf = 0;
-                       __put_user(buf, p);
-                       return 0;
-               }
-               break;
-       case SOUND_MIXER_WRITE_RECSRC:
-               /* handle solo mode control */
-               __get_user(buf, p);
-               /* unset solo when RECSRC for PCM is requested */
-               if (aci_idcode[1]=='B' || aci_idcode[1]=='C') {
-                       vol = !(buf & SOUND_MASK_PCM);
-                       if ((buf=aci_write_cmd(ACI_SET_SOLOMODE, vol))<0)
-                               return buf;
-                       aci_solo = vol;
-               }
-               buf = (SOUND_MASK_CD| SOUND_MASK_MIC| SOUND_MASK_LINE|
-                      SOUND_MASK_SYNTH| SOUND_MASK_LINE2);
-               if (aci_idcode[1] == 'C') /* PCM20 radio */
-                       buf |= SOUND_MASK_RADIO;
-               else
-                       buf |= SOUND_MASK_LINE1;
-               if (!aci_solo)
-                       buf |= SOUND_MASK_PCM;
-               __put_user(buf, p);
-               return 0;
-       case SOUND_MIXER_READ_DEVMASK:
-               buf = (SOUND_MASK_VOLUME | SOUND_MASK_CD    |
-                      SOUND_MASK_MIC    | SOUND_MASK_LINE  |
-                      SOUND_MASK_SYNTH  | SOUND_MASK_PCM   |
-                      SOUND_MASK_LINE2);
-               switch (aci_idcode[1]) {
-               case 'C': /* PCM20 radio */
-                       buf |= (SOUND_MASK_RADIO | SOUND_MASK_IGAIN |
-                               SOUND_MASK_BASS  | SOUND_MASK_TREBLE);
-                       break;
-               case 'B': /* PCM12 */
-                       buf |= (SOUND_MASK_LINE1 | SOUND_MASK_IGAIN |
-                               SOUND_MASK_OGAIN);
-                       break;
-               case 'A': /* PCM1-pro */
-                       buf |= (SOUND_MASK_LINE1 | SOUND_MASK_OGAIN);
-                       break;
-               default:
-                       buf |= SOUND_MASK_LINE1;
-               }
-               __put_user(buf, p);
-               return 0;
-       case SOUND_MIXER_READ_STEREODEVS:
-               buf = (SOUND_MASK_VOLUME | SOUND_MASK_CD    |
-                      SOUND_MASK_MIC    | SOUND_MASK_LINE  |
-                      SOUND_MASK_SYNTH  | SOUND_MASK_PCM   |
-                      SOUND_MASK_LINE2);
-               switch (aci_idcode[1]) {
-               case 'C': /* PCM20 radio */
-                       buf |= (SOUND_MASK_RADIO |
-                               SOUND_MASK_BASS  | SOUND_MASK_TREBLE);
-                       break;
-               default:
-                       buf |= SOUND_MASK_LINE1;
-               }
-               __put_user(buf, p);
-               return 0;
-       case SOUND_MIXER_READ_RECMASK:
-               buf = (SOUND_MASK_CD| SOUND_MASK_MIC| SOUND_MASK_LINE|
-                      SOUND_MASK_SYNTH| SOUND_MASK_LINE2| SOUND_MASK_PCM);
-               if (aci_idcode[1] == 'C') /* PCM20 radio */
-                       buf |= SOUND_MASK_RADIO;
-               else
-                       buf |= SOUND_MASK_LINE1;
-
-               __put_user(buf, p);
-               return 0;
-       case SOUND_MIXER_READ_RECSRC:
-               buf = (SOUND_MASK_CD    | SOUND_MASK_MIC   | SOUND_MASK_LINE  |
-                      SOUND_MASK_SYNTH | SOUND_MASK_LINE2);
-               /* do we need aci_solo or can I get it from the ACI? */
-               switch (aci_idcode[1]) {
-               case 'B': /* PCM12 */
-               case 'C': /* PCM20 radio */
-                       if (aci_version >= 0xb0) {
-                               if ((vol=aci_rw_cmd(ACI_STATUS,
-                                                   ACI_S_GENERAL, -1))<0)
-                                       return vol;
-                               if (vol & 0x20)
-                                       buf |= SOUND_MASK_PCM;
-                       }
-                       else
-                               if (!aci_solo)
-                                       buf |= SOUND_MASK_PCM;
-                       break;
-               default:
-                       buf |= SOUND_MASK_PCM;
-               }
-               if (aci_idcode[1] == 'C') /* PCM20 radio */
-                       buf |= SOUND_MASK_RADIO;
-               else
-                       buf |= SOUND_MASK_LINE1;
-
-               __put_user(buf, p);
-               return 0;
-       case SOUND_MIXER_READ_CAPS:
-               __put_user(0, p);
-               return 0;
-       case SOUND_MIXER_READ_VOLUME:
-               return getvolume(p, 0x04, 0x03);
-       case SOUND_MIXER_READ_CD:
-               return getvolume(p, 0x0a, 0x09);
-       case SOUND_MIXER_READ_MIC:
-               return getvolume(p, 0x06, 0x05);
-       case SOUND_MIXER_READ_LINE:
-               return getvolume(p, 0x08, 0x07);
-       case SOUND_MIXER_READ_SYNTH:
-               return getvolume(p, 0x0c, 0x0b);
-       case SOUND_MIXER_READ_PCM:
-               return getvolume(p, 0x0e, 0x0d);
-       case MIXER_READ(SOUND_MIXER_RADIO): /* fall through */
-       case SOUND_MIXER_READ_LINE1:  /* AUX1 */
-               return getvolume(p, 0x11, 0x10);
-       case SOUND_MIXER_READ_LINE2:  /* AUX2 */
-               return getvolume(p, 0x13, 0x12);
-       case SOUND_MIXER_READ_BASS:   /* get band one */
-               if (aci_idcode[1]=='C') {
-                       return getequalizer(p, 0x23, 0x22);
-               }
-               break;
-       case SOUND_MIXER_READ_TREBLE: /* get band seven */
-               if (aci_idcode[1]=='C') {
-                       return getequalizer(p, 0x2f, 0x2e);
-               }
-               break;
-       case SOUND_MIXER_READ_IGAIN:  /* MIC pre-amp */
-               if (aci_idcode[1]=='B' || aci_idcode[1]=='C') {
-                       /* aci_micpreamp or ACI? */
-                       if (aci_version >= 0xb0) {
-                               if ((buf=aci_indexed_cmd(ACI_STATUS,
-                                                        ACI_S_READ_IGAIN))<0)
-                                       return buf;
-                       }
-                       else
-                               buf=aci_micpreamp;
-                       vol = SCALE(3, 100, buf <= 3 ? buf : 3);
-                       vol |= vol << 8;
-                       __put_user(vol, p);
-                       return 0;
-               }
-               break;
-       case SOUND_MIXER_READ_OGAIN:
-               if (aci_amp)
-                       buf = (100 || 100<<8);
-               else
-                       buf = 0;
-               __put_user(buf, p);
-               return 0;
-       }
-       return -EINVAL;
-}
-
-static struct mixer_operations aci_mixer_operations =
-{
-       .owner = THIS_MODULE,
-       .id    = "ACI",
-       .ioctl = aci_mixer_ioctl
-};
-
-/*
- * There is also an internal mixer in the codec (CS4231A or AD1845),
- * that deserves no purpose in an ACI based system which uses an
- * external ACI controlled stereo mixer. Make sure that this codec
- * mixer has the AUX1 input selected as the recording source, that the
- * input gain is set near maximum and that the other channels going
- * from the inputs to the codec output are muted.
- */
-
-static int __init attach_aci(void)
-{
-       char *boardname;
-       int i, rc = -EBUSY;
-
-       mutex_init(&aci_mutex);
-
-       outb(0xE3, 0xf8f); /* Write MAD16 password */
-       aci_port = (inb(0xf90) & 0x10) ?
-               0x344: 0x354; /* Get aci_port from MC4_PORT */
-
-       if (!request_region(aci_port, 3, "sound mixer (ACI)")) {
-               printk(KERN_NOTICE
-                      "aci: I/O area 0x%03x-0x%03x already used.\n",
-                      aci_port, aci_port+2);
-               goto out;
-       }
-
-       /* force ACI into a known state */
-       rc = -EFAULT;
-       for (i=0; i<3; i++)
-               if (aci_rw_cmd(ACI_ERROR_OP, -1, -1)<0)
-                       goto out_release_region;
-
-       /* official this is one aci read call: */
-       rc = -EFAULT;
-       if ((aci_idcode[0]=aci_rw_cmd(ACI_READ_IDCODE, -1, -1))<0 ||
-           (aci_idcode[1]=aci_rw_cmd(ACI_READ_IDCODE, -1, -1))<0) {
-               printk(KERN_ERR "aci: Failed to read idcode on 0x%03x.\n",
-                      aci_port);
-               goto out_release_region;
-       }
-
-       if ((aci_version=aci_rw_cmd(ACI_READ_VERSION, -1, -1))<0) {
-               printk(KERN_ERR "aci: Failed to read version on 0x%03x.\n",
-                      aci_port);
-               goto out_release_region;
-       }
-
-       if (aci_idcode[0] == 'm') {
-               /* It looks like a miro sound card. */
-               switch (aci_idcode[1]) {
-               case 'A':
-                       boardname = "PCM1 pro / early PCM12";
-                       break;
-               case 'B':
-                       boardname = "PCM12";
-                       break;
-               case 'C':
-                       boardname = "PCM20 radio";
-                       break;
-               default:
-                       boardname = "unknown miro";
-               }
-       } else {
-               printk(KERN_WARNING "aci: Warning: unsupported card! - "
-                      "no hardware, no specs...\n");
-               boardname = "unknown Cardinal Technologies";
-       }
-
-       printk(KERN_INFO "<ACI 0x%02x, id %02x/%02x \"%c/%c\", (%s)> at 0x%03x\n",
-              aci_version,
-              aci_idcode[0], aci_idcode[1],
-              aci_idcode[0], aci_idcode[1],
-              boardname, aci_port);
-
-       rc = -EBUSY;
-       if (reset) {
-               /* first write()s after reset fail with my PCM20 */
-               if (aci_rw_cmd(ACI_INIT, -1, -1)<0 ||
-                   aci_rw_cmd(ACI_ERROR_OP, ACI_ERROR_OP, ACI_ERROR_OP)<0 ||
-                   aci_rw_cmd(ACI_ERROR_OP, ACI_ERROR_OP, ACI_ERROR_OP)<0)
-                       goto out_release_region;
-       }
-
-       /* the PCM20 is muted after reset (and reboot) */
-       if (aci_rw_cmd(ACI_SET_MUTE, 0x00, -1)<0)
-               goto out_release_region;
-
-       if (ide>=0)
-               if (aci_rw_cmd(ACI_SET_IDE, !ide, -1)<0)
-                       goto out_release_region;
-       
-       if (wss>=0 && aci_idcode[1]=='A')
-               if (aci_rw_cmd(ACI_SET_WSS, !!wss, -1)<0)
-                       goto out_release_region;
-
-       mixer_device = sound_install_mixer(MIXER_DRIVER_VERSION, boardname,
-                                          &aci_mixer_operations,
-                                          sizeof(aci_mixer_operations), NULL);
-       rc = 0;
-       if (mixer_device < 0) {
-               printk(KERN_ERR "aci: Failed to install mixer.\n");
-               rc = mixer_device;
-               goto out_release_region;
-       } /* else Maybe initialize the CS4231A mixer here... */
-out:   return rc;
-out_release_region:
-       release_region(aci_port, 3);
-       goto out;
-}
-
-static void __exit unload_aci(void)
-{
-       sound_unload_mixerdev(mixer_device);
-       release_region(aci_port, 3);
-}
-
-module_init(attach_aci);
-module_exit(unload_aci);
-MODULE_LICENSE("GPL");
diff --git a/sound/oss/aci.h b/sound/oss/aci.h
deleted file mode 100644 (file)
index 20102ee..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef _ACI_H_
-#define _ACI_H_
-
-extern int aci_port;
-extern int aci_version;                /* ACI firmware version */
-extern int aci_rw_cmd(int write1, int write2, int write3);
-
-#define aci_indexed_cmd(a, b) aci_rw_cmd(a, b, -1)
-#define aci_write_cmd(a, b)   aci_rw_cmd(a, b, -1)
-#define aci_read_cmd(a)       aci_rw_cmd(a,-1, -1)
-
-#define COMMAND_REGISTER    (aci_port)      /* write register */
-#define STATUS_REGISTER     (aci_port + 1)  /* read register */
-#define BUSY_REGISTER       (aci_port + 2)  /* also used for rds */
-
-#define RDS_REGISTER        BUSY_REGISTER
-
-#define ACI_SET_MUTE          0x0d
-#define ACI_SET_POWERAMP      0x0f
-#define ACI_SET_TUNERMUTE     0xa3
-#define ACI_SET_TUNERMONO     0xa4
-#define ACI_SET_IDE           0xd0
-#define ACI_SET_WSS           0xd1
-#define ACI_SET_SOLOMODE      0xd2
-#define ACI_WRITE_IGAIN       0x03
-#define ACI_WRITE_TUNE        0xa7
-#define ACI_READ_TUNERSTEREO  0xa8
-#define ACI_READ_TUNERSTATION 0xa9
-#define ACI_READ_VERSION      0xf1
-#define ACI_READ_IDCODE       0xf2
-#define ACI_INIT              0xff
-#define ACI_STATUS            0xf0
-#define     ACI_S_GENERAL     0x00
-#define     ACI_S_READ_IGAIN  0x21
-#define ACI_ERROR_OP          0xdf
-
-/*
- * The following macro SCALE can be used to scale one integer volume
- * value into another one using only integer arithmetic. If the input
- * value x is in the range 0 <= x <= xmax, then the result will be in
- * the range 0 <= SCALE(xmax,ymax,x) <= ymax.
- *
- * This macro has for all xmax, ymax > 0 and all 0 <= x <= xmax the
- * following nice properties:
- *
- * - SCALE(xmax,ymax,xmax) = ymax
- * - SCALE(xmax,ymax,0) = 0
- * - SCALE(xmax,ymax,SCALE(ymax,xmax,SCALE(xmax,ymax,x))) = SCALE(xmax,ymax,x)
- *
- * In addition, the rounding error is minimal and nicely distributed.
- * The proofs are left as an exercise to the reader.
- */
-
-#define SCALE(xmax,ymax,x) (((x)*(ymax)+(xmax)/2)/(xmax))
-
-
-#endif  /* _ACI_H_ */
diff --git a/sound/oss/ad1816.c b/sound/oss/ad1816.c
deleted file mode 100644 (file)
index caabf31..0000000
+++ /dev/null
@@ -1,1368 +0,0 @@
-/*
- *
- * AD1816 lowlevel sound driver for Linux 2.6.0 and above
- *
- * Copyright (C) 1998-2003 by Thorsten Knabe <linux@thorsten-knabe.de>
- *
- * Based on the CS4232/AD1848 driver Copyright (C) by Hannu Savolainen 1993-1996
- *
- *
- * version: 1.5
- * status: beta
- * date: 2003/07/15
- *
- * Changes:
- *     Oleg Drokin: Some cleanup of load/unload functions.     1998/11/24
- *     
- *     Thorsten Knabe: attach and unload rewritten, 
- *     some argument checks added                              1998/11/30
- *
- *     Thorsten Knabe: Buggy isa bridge workaround added       1999/01/16
- *     
- *     David Moews/Thorsten Knabe: Introduced options 
- *     parameter. Added slightly modified patch from 
- *     David Moews to disable dsp audio sources by setting 
- *     bit 0 of options parameter. This seems to be
- *     required by some Aztech/Newcom SC-16 cards.             1999/04/18
- *
- *     Christoph Hellwig: Adapted to module_init/module_exit.  2000/03/03
- *
- *     Christoph Hellwig: Added isapnp support                 2000/03/15
- *
- *     Arnaldo Carvalho de Melo: get rid of check_region       2001/10/07
- *      
- *      Thorsten Knabe: Compiling with CONFIG_PNP enabled
- *     works again. It is now possible to use more than one 
- *     AD1816 sound card. Sample rate now may be changed during
- *     playback/capture. printk() uses log levels everywhere.
- *     SMP fixes. DMA handling fixes.
- *     Other minor code cleanup.                               2003/07/15
- *
- */
-
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/isapnp.h>
-#include <linux/stddef.h>
-#include <linux/spinlock.h>
-#include "sound_config.h"
-
-#define DEBUGNOISE(x)
-
-#define CHECK_FOR_POWER { int timeout=100; \
-  while (timeout > 0 && (inb(devc->base)&0x80)!= 0x80) {\
-          timeout--; \
-  } \
-  if (timeout==0) {\
-          printk(KERN_WARNING "ad1816: Check for power failed in %s line: %d\n",__FILE__,__LINE__); \
-  } \
-}
-
-/* structure to hold device specific information */
-typedef struct
-{
-        int            base;          /* set in attach */
-       int            irq;
-       int            dma_playback;
-        int            dma_capture;
-  
-       int            opened;         /* open */
-        int            speed;  
-       int            channels;
-       int            audio_format;
-        int            audio_mode; 
-  
-        int            recmask;        /* setup */
-       unsigned char  format_bits;
-       int            supported_devices;
-       int            supported_rec_devices;
-       unsigned short levels[SOUND_MIXER_NRDEVICES];
-                                       /* misc */
-       struct pnp_dev *pnpdev;  /* configured via pnp */
-        int            dev_no;   /* this is the # in audio_devs and NOT 
-                                   in ad1816_info */
-       spinlock_t      lock;  
-} ad1816_info;
-
-static int nr_ad1816_devs;
-static int ad1816_clockfreq = 33000;
-static int options;
-
-/* supported audio formats */
-static int  ad_format_mask =
-AFMT_U8 | AFMT_S16_LE | AFMT_S16_BE | AFMT_MU_LAW | AFMT_A_LAW;
-
-/* array of device info structures */
-static ad1816_info dev_info[MAX_AUDIO_DEV];
-
-
-/* ------------------------------------------------------------------- */
-
-/* functions for easier access to inderect registers */
-
-static int ad_read (ad1816_info * devc, int reg)
-{
-       int result;
-       
-       CHECK_FOR_POWER;
-       outb ((unsigned char) (reg & 0x3f), devc->base+0);
-       result = inb(devc->base+2);
-       result+= inb(devc->base+3)<<8;
-       return (result);
-}
-
-
-static void ad_write (ad1816_info * devc, int reg, int data)
-{
-       CHECK_FOR_POWER;
-       outb ((unsigned char) (reg & 0xff), devc->base+0);
-       outb ((unsigned char) (data & 0xff),devc->base+2);
-       outb ((unsigned char) ((data>>8)&0xff),devc->base+3);
-}
-
-/* ------------------------------------------------------------------- */
-
-/* function interface required by struct audio_driver */
-
-static void ad1816_halt_input (int dev)
-{
-       unsigned long flags;
-       ad1816_info    *devc = (ad1816_info *) audio_devs[dev]->devc;
-       unsigned char buffer;
-       
-       DEBUGNOISE(printk(KERN_DEBUG "ad1816: halt_input called\n"));
-       
-       spin_lock_irqsave(&devc->lock,flags); 
-       
-       if(!isa_dma_bridge_buggy) {
-               disable_dma(audio_devs[dev]->dmap_in->dma);
-       }
-       
-       buffer=inb(devc->base+9);
-       if (buffer & 0x01) {
-               /* disable capture */
-               outb(buffer & ~0x01,devc->base+9); 
-       }
-
-       if(!isa_dma_bridge_buggy) {
-               enable_dma(audio_devs[dev]->dmap_in->dma);
-       }
-
-       /* Clear interrupt status */
-       outb (~0x40, devc->base+1);     
-       
-       devc->audio_mode &= ~PCM_ENABLE_INPUT;
-       spin_unlock_irqrestore(&devc->lock,flags);
-}
-
-static void ad1816_halt_output (int dev)
-{
-       unsigned long  flags;
-       ad1816_info    *devc = (ad1816_info *) audio_devs[dev]->devc;
-       
-       unsigned char buffer;
-
-       DEBUGNOISE(printk(KERN_DEBUG "ad1816: halt_output called!\n"));
-
-       spin_lock_irqsave(&devc->lock,flags); 
-       /* Mute pcm output */
-       ad_write(devc, 4, ad_read(devc,4)|0x8080);
-
-       if(!isa_dma_bridge_buggy) {
-               disable_dma(audio_devs[dev]->dmap_out->dma);
-       }
-
-       buffer=inb(devc->base+8);
-       if (buffer & 0x01) {
-               /* disable capture */
-               outb(buffer & ~0x01,devc->base+8); 
-       }
-
-       if(!isa_dma_bridge_buggy) {
-               enable_dma(audio_devs[dev]->dmap_out->dma);
-       }
-
-       /* Clear interrupt status */
-       outb ((unsigned char)~0x80, devc->base+1);      
-
-       devc->audio_mode &= ~PCM_ENABLE_OUTPUT;
-       spin_unlock_irqrestore(&devc->lock,flags);
-}
-
-static void ad1816_output_block (int dev, unsigned long buf, 
-                                int count, int intrflag)
-{
-       unsigned long flags;
-       unsigned long cnt;
-       ad1816_info    *devc = (ad1816_info *) audio_devs[dev]->devc;
-       
-       DEBUGNOISE(printk(KERN_DEBUG "ad1816: output_block called buf=%ld count=%d flags=%d\n",buf,count,intrflag));
-  
-       cnt = count/4 - 1;
-  
-       spin_lock_irqsave(&devc->lock,flags);
-       
-       /* set transfer count */
-       ad_write (devc, 8, cnt & 0xffff); 
-       
-       devc->audio_mode |= PCM_ENABLE_OUTPUT; 
-       spin_unlock_irqrestore(&devc->lock,flags);
-}
-
-
-static void ad1816_start_input (int dev, unsigned long buf, int count,
-                               int intrflag)
-{
-       unsigned long flags;
-       unsigned long  cnt;
-       ad1816_info    *devc = (ad1816_info *) audio_devs[dev]->devc;
-       
-       DEBUGNOISE(printk(KERN_DEBUG "ad1816: start_input called buf=%ld count=%d flags=%d\n",buf,count,intrflag));
-
-       cnt = count/4 - 1;
-
-       spin_lock_irqsave(&devc->lock,flags);
-
-       /* set transfer count */
-       ad_write (devc, 10, cnt & 0xffff); 
-       devc->audio_mode |= PCM_ENABLE_INPUT;
-       spin_unlock_irqrestore(&devc->lock,flags);
-}
-
-static int ad1816_prepare_for_input (int dev, int bsize, int bcount)
-{
-       unsigned long flags;
-       unsigned int freq;
-       ad1816_info    *devc = (ad1816_info *) audio_devs[dev]->devc;
-       unsigned char fmt_bits;
-       
-       DEBUGNOISE(printk(KERN_DEBUG "ad1816: prepare_for_input called: bsize=%d bcount=%d\n",bsize,bcount));
-
-       spin_lock_irqsave(&devc->lock,flags);
-       fmt_bits= (devc->format_bits&0x7)<<3;
-       
-       /* set mono/stereo mode */
-       if (devc->channels > 1) {
-               fmt_bits |=0x4;
-       }
-       /* set Mono/Stereo in playback/capture register */
-       outb( (inb(devc->base+8) & ~0x3C)|fmt_bits, devc->base+8); 
-       outb( (inb(devc->base+9) & ~0x3C)|fmt_bits, devc->base+9);
-
-       freq=((unsigned int)devc->speed*33000)/ad1816_clockfreq; 
-
-       /* write playback/capture speeds */
-       ad_write (devc, 2, freq & 0xffff);      
-       ad_write (devc, 3, freq & 0xffff);      
-
-       spin_unlock_irqrestore(&devc->lock,flags);
-
-       ad1816_halt_input(dev);
-       return 0;
-}
-
-static int ad1816_prepare_for_output (int dev, int bsize, int bcount)
-{
-       unsigned long flags;
-       unsigned int freq;
-       ad1816_info    *devc = (ad1816_info *) audio_devs[dev]->devc;
-       unsigned char fmt_bits;
-
-       DEBUGNOISE(printk(KERN_DEBUG "ad1816: prepare_for_output called: bsize=%d bcount=%d\n",bsize,bcount));
-
-       spin_lock_irqsave(&devc->lock,flags);
-
-       fmt_bits= (devc->format_bits&0x7)<<3;
-       /* set mono/stereo mode */
-       if (devc->channels > 1) {
-               fmt_bits |=0x4;
-       }
-
-       /* write format bits to playback/capture registers */
-       outb( (inb(devc->base+8) & ~0x3C)|fmt_bits, devc->base+8); 
-       outb( (inb(devc->base+9) & ~0x3C)|fmt_bits, devc->base+9);
-  
-       freq=((unsigned int)devc->speed*33000)/ad1816_clockfreq; 
-       
-       /* write playback/capture speeds */
-       ad_write (devc, 2, freq & 0xffff);
-       ad_write (devc, 3, freq & 0xffff);
-
-       spin_unlock_irqrestore(&devc->lock,flags);
-       
-       ad1816_halt_output(dev);
-       return 0;
-
-}
-
-static void ad1816_trigger (int dev, int state) 
-{
-       unsigned long flags;
-       ad1816_info    *devc = (ad1816_info *) audio_devs[dev]->devc;
-
-       DEBUGNOISE(printk(KERN_DEBUG "ad1816: trigger called! (devc=%d,devc->base=%d\n", devc, devc->base));
-
-       /* mode may have changed */
-
-       spin_lock_irqsave(&devc->lock,flags);
-
-       /* mask out modes not specified on open call */
-       state &= devc->audio_mode; 
-                               
-       /* setup soundchip to new io-mode */
-       if (state & PCM_ENABLE_INPUT) {
-               /* enable capture */
-               outb(inb(devc->base+9)|0x01, devc->base+9);
-       } else {
-               /* disable capture */
-               outb(inb(devc->base+9)&~0x01, devc->base+9);
-       }
-
-       if (state & PCM_ENABLE_OUTPUT) {
-               /* enable playback */
-               outb(inb(devc->base+8)|0x01, devc->base+8);
-               /* unmute pcm output */
-               ad_write(devc, 4, ad_read(devc,4)&~0x8080);
-       } else {
-               /* mute pcm output */
-               ad_write(devc, 4, ad_read(devc,4)|0x8080);
-               /* disable capture */
-               outb(inb(devc->base+8)&~0x01, devc->base+8);
-       }
-       spin_unlock_irqrestore(&devc->lock,flags);
-}
-
-
-/* halt input & output */
-static void ad1816_halt (int dev)
-{
-       ad1816_halt_input(dev);
-       ad1816_halt_output(dev);
-}
-
-static void ad1816_reset (int dev)
-{
-       ad1816_halt (dev);
-}
-
-/* set playback speed */
-static int ad1816_set_speed (int dev, int arg)
-{
-       unsigned long flags;
-       unsigned int freq;
-       int ret;
-
-       ad1816_info    *devc = (ad1816_info *) audio_devs[dev]->devc;
-       
-       spin_lock_irqsave(&devc->lock, flags);
-       if (arg == 0) {
-               ret = devc->speed;
-               spin_unlock_irqrestore(&devc->lock, flags);
-               return ret;
-       }
-       /* range checking */
-       if (arg < 4000) {
-               arg = 4000;
-       }
-       if (arg > 55000) {
-               arg = 55000;
-       }
-       devc->speed = arg;
-
-       /* change speed during playback */
-       freq=((unsigned int)devc->speed*33000)/ad1816_clockfreq; 
-       /* write playback/capture speeds */
-       ad_write (devc, 2, freq & 0xffff);      
-       ad_write (devc, 3, freq & 0xffff);      
-
-       ret = devc->speed;
-       spin_unlock_irqrestore(&devc->lock, flags);
-       return ret;
-
-}
-
-static unsigned int ad1816_set_bits (int dev, unsigned int arg)
-{
-       unsigned long flags;
-       ad1816_info    *devc = (ad1816_info *) audio_devs[dev]->devc;
-       
-       static struct format_tbl {
-               int             format;
-               unsigned char   bits;
-       } format2bits[] = {
-               { 0, 0 },
-               { AFMT_MU_LAW, 1 },
-               { AFMT_A_LAW, 3 },
-               { AFMT_IMA_ADPCM, 0 },
-               { AFMT_U8, 0 },
-               { AFMT_S16_LE, 2 },
-               { AFMT_S16_BE, 6 },
-               { AFMT_S8, 0 },
-               { AFMT_U16_LE, 0 },
-               { AFMT_U16_BE, 0 }
-       };
-
-       int  i, n = sizeof (format2bits) / sizeof (struct format_tbl);
-
-       spin_lock_irqsave(&devc->lock, flags);
-       /* return current format */
-       if (arg == 0) {
-               arg = devc->audio_format;
-               spin_unlock_irqrestore(&devc->lock, flags);
-               return arg;
-       }
-       devc->audio_format = arg;
-
-       /* search matching format bits */
-       for (i = 0; i < n; i++)
-               if (format2bits[i].format == arg) {
-                       devc->format_bits = format2bits[i].bits;
-                       devc->audio_format = arg;
-                       spin_unlock_irqrestore(&devc->lock, flags);
-                       return arg;
-               }
-
-       /* Still hanging here. Something must be terribly wrong */
-       devc->format_bits = 0;
-       devc->audio_format = AFMT_U8;
-       spin_unlock_irqrestore(&devc->lock, flags);
-       return(AFMT_U8); 
-}
-
-static short ad1816_set_channels (int dev, short arg)
-{
-       ad1816_info    *devc = (ad1816_info *) audio_devs[dev]->devc;
-
-       if (arg != 1 && arg != 2)
-               return devc->channels;
-
-       devc->channels = arg;
-       return arg;
-}
-
-/* open device */
-static int ad1816_open (int dev, int mode) 
-{
-       ad1816_info    *devc = NULL;
-       unsigned long   flags;
-
-       /* is device number valid ? */
-       if (dev < 0 || dev >= num_audiodevs)
-               return -(ENXIO);
-
-       /* get device info of this dev */
-       devc = (ad1816_info *) audio_devs[dev]->devc; 
-
-       /* make check if device already open atomic */
-       spin_lock_irqsave(&devc->lock,flags);
-
-       if (devc->opened) {
-               spin_unlock_irqrestore(&devc->lock,flags);
-               return -(EBUSY);
-       }
-
-       /* mark device as open */
-       devc->opened = 1; 
-
-       devc->audio_mode = 0;
-       devc->speed = 8000;
-       devc->audio_format=AFMT_U8;
-       devc->channels=1;
-       spin_unlock_irqrestore(&devc->lock,flags);
-       ad1816_reset(devc->dev_no); /* halt all pending output */
-       return 0;
-}
-
-static void ad1816_close (int dev) /* close device */
-{
-       unsigned long flags;
-       ad1816_info    *devc = (ad1816_info *) audio_devs[dev]->devc;
-
-       /* halt all pending output */
-       ad1816_reset(devc->dev_no); 
-
-       spin_lock_irqsave(&devc->lock,flags);
-       devc->opened = 0;
-       devc->audio_mode = 0;
-       devc->speed = 8000;
-       devc->audio_format=AFMT_U8;
-       devc->format_bits = 0;
-       spin_unlock_irqrestore(&devc->lock,flags);
-}
-
-
-/* ------------------------------------------------------------------- */
-
-/* Audio driver structure */
-
-static struct audio_driver ad1816_audio_driver =
-{
-       .owner                  = THIS_MODULE,
-       .open                   = ad1816_open,
-       .close                  = ad1816_close,
-       .output_block           = ad1816_output_block,
-       .start_input            = ad1816_start_input,
-       .prepare_for_input      = ad1816_prepare_for_input,
-       .prepare_for_output     = ad1816_prepare_for_output,
-       .halt_io                = ad1816_halt,
-       .halt_input             = ad1816_halt_input,
-       .halt_output            = ad1816_halt_output,
-       .trigger                = ad1816_trigger,
-       .set_speed              = ad1816_set_speed,
-       .set_bits               = ad1816_set_bits,
-       .set_channels           = ad1816_set_channels,
-};
-
-
-/* ------------------------------------------------------------------- */
-
-/* Interrupt handler */
-
-
-static irqreturn_t ad1816_interrupt (int irq, void *dev_id)
-{
-       unsigned char   status;
-       ad1816_info     *devc = (ad1816_info *)dev_id;
-       
-       if (irq < 0 || irq > 15) {
-               printk(KERN_WARNING "ad1816: Got bogus interrupt %d\n", irq);
-               return IRQ_NONE;
-       }
-
-       spin_lock(&devc->lock);
-
-       /* read interrupt register */
-       status = inb (devc->base+1); 
-       /* Clear all interrupt  */
-       outb (~status, devc->base+1);   
-
-       DEBUGNOISE(printk(KERN_DEBUG "ad1816: Got interrupt subclass %d\n",status));
-
-       if (status == 0) {
-               DEBUGNOISE(printk(KERN_DEBUG "ad1816: interrupt: Got interrupt, but no source.\n"));
-               spin_unlock(&devc->lock);
-               return IRQ_NONE;
-       }
-
-       if (devc->opened && (devc->audio_mode & PCM_ENABLE_INPUT) && (status&64))
-               DMAbuf_inputintr (devc->dev_no);
-
-       if (devc->opened && (devc->audio_mode & PCM_ENABLE_OUTPUT) && (status & 128))
-               DMAbuf_outputintr (devc->dev_no, 1);
-
-       spin_unlock(&devc->lock);
-       return IRQ_HANDLED;
-}
-
-/* ------------------------------------------------------------------- */
-
-/* Mixer stuff */
-
-struct mixer_def {
-       unsigned int regno: 7;
-       unsigned int polarity:1;        /* 0=normal, 1=reversed */
-       unsigned int bitpos:4;
-       unsigned int nbits:4;
-};
-
-static char mix_cvt[101] = {
-        0, 0, 3, 7,10,13,16,19,21,23,26,28,30,32,34,35,37,39,40,42,
-       43,45,46,47,49,50,51,52,53,55,56,57,58,59,60,61,62,63,64,65,
-       65,66,67,68,69,70,70,71,72,73,73,74,75,75,76,77,77,78,79,79,
-       80,81,81,82,82,83,84,84,85,85,86,86,87,87,88,88,89,89,90,90,
-       91,91,92,92,93,93,94,94,95,95,96,96,96,97,97,98,98,98,99,99,
-       100
-};
-
-typedef struct mixer_def mixer_ent;
-
-/*
- * Most of the mixer entries work in backwards. Setting the polarity field
- * makes them to work correctly.
- *
- * The channel numbering used by individual soundcards is not fixed. Some
- * cards have assigned different meanings for the AUX1, AUX2 and LINE inputs.
- * The current version doesn't try to compensate this.
- */
-
-#define MIX_ENT(name, reg_l, pola_l, pos_l, len_l, reg_r, pola_r, pos_r, len_r)        \
-  {{reg_l, pola_l, pos_l, len_l}, {reg_r, pola_r, pos_r, len_r}}
-
-
-static mixer_ent mix_devices[SOUND_MIXER_NRDEVICES][2] = {
-MIX_ENT(SOUND_MIXER_VOLUME,    14, 1, 8, 5,    14, 1, 0, 5),
-MIX_ENT(SOUND_MIXER_BASS,       0, 0, 0, 0,     0, 0, 0, 0),
-MIX_ENT(SOUND_MIXER_TREBLE,     0, 0, 0, 0,     0, 0, 0, 0),
-MIX_ENT(SOUND_MIXER_SYNTH,      5, 1, 8, 6,     5, 1, 0, 6),
-MIX_ENT(SOUND_MIXER_PCM,        4, 1, 8, 6,     4, 1, 0, 6),
-MIX_ENT(SOUND_MIXER_SPEAKER,    0, 0, 0, 0,     0, 0, 0, 0),
-MIX_ENT(SOUND_MIXER_LINE,      18, 1, 8, 5,    18, 1, 0, 5),
-MIX_ENT(SOUND_MIXER_MIC,       19, 1, 8, 5,    19, 1, 0, 5),
-MIX_ENT(SOUND_MIXER_CD,                15, 1, 8, 5,    15, 1, 0, 5),
-MIX_ENT(SOUND_MIXER_IMIX,       0, 0, 0, 0,     0, 0, 0, 0),
-MIX_ENT(SOUND_MIXER_ALTPCM,     0, 0, 0, 0,     0, 0, 0, 0),
-MIX_ENT(SOUND_MIXER_RECLEV,    20, 0, 8, 4,    20, 0, 0, 4),
-MIX_ENT(SOUND_MIXER_IGAIN,      0, 0, 0, 0,     0, 0, 0, 0),
-MIX_ENT(SOUND_MIXER_OGAIN,      0, 0, 0, 0,     0, 0, 0, 0),
-MIX_ENT(SOUND_MIXER_LINE1,     17, 1, 8, 5,    17, 1, 0, 5),
-MIX_ENT(SOUND_MIXER_LINE2,     16, 1, 8, 5,    16, 1, 0, 5),
-MIX_ENT(SOUND_MIXER_LINE3,      39, 0, 9, 4,    39, 1, 0, 5)
-};
-
-
-static unsigned short default_mixer_levels[SOUND_MIXER_NRDEVICES] =
-{
-       0x4343,         /* Master Volume */
-       0x3232,         /* Bass */
-       0x3232,         /* Treble */
-       0x0000,         /* FM */
-       0x4343,         /* PCM */
-       0x0000,         /* PC Speaker */
-       0x0000,         /* Ext Line */
-       0x0000,         /* Mic */
-       0x0000,         /* CD */
-       0x0000,         /* Recording monitor */
-       0x0000,         /* SB PCM */
-       0x0000,         /* Recording level */
-       0x0000,         /* Input gain */
-       0x0000,         /* Output gain */
-       0x0000,         /* Line1 */
-       0x0000,         /* Line2 */
-       0x0000          /* Line3 (usually line in)*/
-};
-
-#define LEFT_CHN       0
-#define RIGHT_CHN      1
-
-
-
-static int
-ad1816_set_recmask (ad1816_info * devc, int mask)
-{
-       unsigned long   flags;
-       unsigned char   recdev;
-       int             i, n;
-       
-       spin_lock_irqsave(&devc->lock, flags);
-       mask &= devc->supported_rec_devices;
-       
-       n = 0;
-       /* Count selected device bits */
-       for (i = 0; i < 32; i++)
-               if (mask & (1 << i))
-                       n++;
-       
-       if (n == 0)
-               mask = SOUND_MASK_MIC;
-       else if (n != 1) { /* Too many devices selected */
-               /* Filter out active settings */
-               mask &= ~devc->recmask; 
-               
-               n = 0;
-               /* Count selected device bits */
-               for (i = 0; i < 32; i++) 
-                       if (mask & (1 << i))
-                               n++;
-               
-               if (n != 1)
-                       mask = SOUND_MASK_MIC;
-       }
-       
-       switch (mask) {
-       case SOUND_MASK_MIC:
-               recdev = 5;
-               break;
-               
-       case SOUND_MASK_LINE:
-               recdev = 0;
-               break;
-               
-       case SOUND_MASK_CD:
-               recdev = 2;
-               break;
-               
-       case SOUND_MASK_LINE1:
-               recdev = 4;
-               break;
-               
-       case SOUND_MASK_LINE2:
-               recdev = 3;
-               break;
-               
-       case SOUND_MASK_VOLUME:
-               recdev = 1;
-               break;
-               
-       default:
-               mask = SOUND_MASK_MIC;
-               recdev = 5;
-       }
-       
-       recdev <<= 4;
-       ad_write (devc, 20, 
-                 (ad_read (devc, 20) & 0x8f8f) | recdev | (recdev<<8));
-
-       devc->recmask = mask;
-       spin_unlock_irqrestore(&devc->lock, flags);
-       return mask;
-}
-
-static void
-change_bits (int *regval, int dev, int chn, int newval)
-{
-       unsigned char   mask;
-       int             shift;
-  
-       /* Reverse polarity*/
-
-       if (mix_devices[dev][chn].polarity == 1) 
-               newval = 100 - newval;
-
-       mask = (1 << mix_devices[dev][chn].nbits) - 1;
-       shift = mix_devices[dev][chn].bitpos;
-       /* Scale it */
-       newval = (int) ((newval * mask) + 50) / 100;    
-       /* Clear bits */
-       *regval &= ~(mask << shift);    
-       /* Set new value */
-       *regval |= (newval & mask) << shift;    
-}
-
-static int
-ad1816_mixer_get (ad1816_info * devc, int dev)
-{
-       DEBUGNOISE(printk(KERN_DEBUG "ad1816: mixer_get called!\n"));
-       
-       /* range check + supported mixer check */
-       if (dev < 0 || dev >= SOUND_MIXER_NRDEVICES )
-               return (-(EINVAL));
-       if (!((1 << dev) & devc->supported_devices))
-               return -(EINVAL);
-       
-       return devc->levels[dev];
-}
-
-static int
-ad1816_mixer_set (ad1816_info * devc, int dev, int value)
-{
-       int   left = value & 0x000000ff;
-       int   right = (value & 0x0000ff00) >> 8;
-       int   retvol;
-
-       int   regoffs;
-       int   val;
-       int   valmute;
-       unsigned long flags;
-
-       DEBUGNOISE(printk(KERN_DEBUG "ad1816: mixer_set called!\n"));
-       
-       if (dev < 0 || dev >= SOUND_MIXER_NRDEVICES )
-               return -(EINVAL);
-
-       if (left > 100)
-               left = 100;
-       if (left < 0)
-               left = 0;
-       if (right > 100)
-               right = 100;
-       if (right < 0)
-               right = 0;
-       
-       /* Mono control */
-       if (mix_devices[dev][RIGHT_CHN].nbits == 0) 
-               right = left;
-       retvol = left | (right << 8);
-       
-       /* Scale it */
-       
-       left = mix_cvt[left];
-       right = mix_cvt[right];
-
-       /* reject all mixers that are not supported */
-       if (!(devc->supported_devices & (1 << dev)))
-               return -(EINVAL);
-       
-       /* sanity check */
-       if (mix_devices[dev][LEFT_CHN].nbits == 0)
-               return -(EINVAL);
-       spin_lock_irqsave(&devc->lock, flags);
-
-       /* keep precise volume internal */
-       devc->levels[dev] = retvol;
-
-       /* Set the left channel */
-       regoffs = mix_devices[dev][LEFT_CHN].regno;
-       val = ad_read (devc, regoffs);
-       change_bits (&val, dev, LEFT_CHN, left);
-
-       valmute=val;
-
-       /* Mute bit masking on some registers */
-       if ( regoffs==5 || regoffs==14 || regoffs==15 ||
-            regoffs==16 || regoffs==17 || regoffs==18 || 
-            regoffs==19 || regoffs==39) {
-               if (left==0)
-                       valmute |= 0x8000;
-               else
-                       valmute &= ~0x8000;
-       }
-       ad_write (devc, regoffs, valmute); /* mute */
-
-       /*
-        * Set the right channel
-        */
-       /* Was just a mono channel */
-       if (mix_devices[dev][RIGHT_CHN].nbits == 0) {
-               spin_unlock_irqrestore(&devc->lock, flags);
-               return retvol;          
-       }
-
-       regoffs = mix_devices[dev][RIGHT_CHN].regno;
-       val = ad_read (devc, regoffs);
-       change_bits (&val, dev, RIGHT_CHN, right);
-
-       valmute=val;
-       if ( regoffs==5 || regoffs==14 || regoffs==15 ||
-            regoffs==16 || regoffs==17 || regoffs==18 || 
-            regoffs==19 || regoffs==39) {
-               if (right==0)
-                       valmute |= 0x80;
-               else
-                       valmute &= ~0x80;
-       }
-       ad_write (devc, regoffs, valmute); /* mute */
-       spin_unlock_irqrestore(&devc->lock, flags);
-               return retvol;
-}
-
-#define MIXER_DEVICES ( SOUND_MASK_VOLUME | \
-                       SOUND_MASK_SYNTH | \
-                       SOUND_MASK_PCM | \
-                       SOUND_MASK_LINE | \
-                       SOUND_MASK_LINE1 | \
-                       SOUND_MASK_LINE2 | \
-                       SOUND_MASK_LINE3 | \
-                       SOUND_MASK_MIC | \
-                       SOUND_MASK_CD | \
-                       SOUND_MASK_RECLEV  \
-                       )
-#define REC_DEVICES ( SOUND_MASK_LINE2 |\
-                     SOUND_MASK_LINE |\
-                     SOUND_MASK_LINE1 |\
-                     SOUND_MASK_MIC |\
-                     SOUND_MASK_CD |\
-                     SOUND_MASK_VOLUME \
-                     )
-     
-static void
-ad1816_mixer_reset (ad1816_info * devc)
-{
-       int  i;
-
-       devc->supported_devices = MIXER_DEVICES;
-       
-       devc->supported_rec_devices = REC_DEVICES;
-
-       for (i = 0; i < SOUND_MIXER_NRDEVICES; i++)
-               if (devc->supported_devices & (1 << i))
-                       ad1816_mixer_set (devc, i, default_mixer_levels[i]);
-       ad1816_set_recmask (devc, SOUND_MASK_MIC);
-}
-
-static int
-ad1816_mixer_ioctl (int dev, unsigned int cmd, void __user * arg)
-{
-       ad1816_info    *devc = mixer_devs[dev]->devc;
-       int val;
-       int __user *p = arg;
-  
-       DEBUGNOISE(printk(KERN_DEBUG "ad1816: mixer_ioctl called!\n"));
-  
-       /* Mixer ioctl */
-       if (((cmd >> 8) & 0xff) == 'M') { 
-               
-               /* set ioctl */
-               if (_SIOC_DIR (cmd) & _SIOC_WRITE) { 
-                       switch (cmd & 0xff){
-                       case SOUND_MIXER_RECSRC:
-                               
-                               if (get_user(val, p))
-                                       return -EFAULT;
-                               val=ad1816_set_recmask (devc, val);
-                               return put_user(val, p);
-                               break;
-                               
-                       default:
-                               if (get_user(val, p))
-                                       return -EFAULT;
-                               if ((val=ad1816_mixer_set (devc, cmd & 0xff, val))<0)
-                                       return val;
-                               else
-                                       return put_user(val, p);
-                       }
-               } else { 
-                       /* read ioctl */
-                       switch (cmd & 0xff) {
-                               
-                       case SOUND_MIXER_RECSRC:
-                               val=devc->recmask;
-                               return put_user(val, p);
-                               break;
-                               
-                       case SOUND_MIXER_DEVMASK:
-                               val=devc->supported_devices;
-                               return put_user(val, p);
-                               break;
-
-                       case SOUND_MIXER_STEREODEVS:
-                               val=devc->supported_devices & ~(SOUND_MASK_SPEAKER | SOUND_MASK_IMIX);
-                               return put_user(val, p);
-                               break;
-                               
-                       case SOUND_MIXER_RECMASK:
-                               val=devc->supported_rec_devices;
-                               return put_user(val, p);
-                               break;
-                               
-                       case SOUND_MIXER_CAPS:
-                               val=SOUND_CAP_EXCL_INPUT;
-                               return put_user(val, p);
-                               break;
-                               
-                       default:
-                               if ((val=ad1816_mixer_get (devc, cmd & 0xff))<0)
-                                       return val;
-                               else
-                                       return put_user(val, p);
-                       }
-               }
-       } else
-               /* not for mixer */
-               return -(EINVAL);
-}
-
-/* ------------------------------------------------------------------- */
-
-/* Mixer structure */
-
-static struct mixer_operations ad1816_mixer_operations = {
-       .owner  = THIS_MODULE,
-       .id     = "AD1816",
-       .name   = "AD1816 Mixer",
-       .ioctl  = ad1816_mixer_ioctl
-};
-
-
-/* ------------------------------------------------------------------- */
-
-/* stuff for card recognition, init and unloading PNP ...*/
-
-
-/* check if AD1816 present at specified hw_config and register device with OS 
- * return 1 if initialization was successful, 0 otherwise
- */
-static int __init ad1816_init_card (struct address_info *hw_config, 
-       struct pnp_dev *pnp)
-{
-       ad1816_info    *devc = NULL;
-       int tmp;
-       int oss_devno = -1;
-
-       printk(KERN_INFO "ad1816: initializing card: io=0x%x, irq=%d, dma=%d, "
-                        "dma2=%d, clockfreq=%d, options=%d isadmabug=%d "
-                        "%s\n",
-              hw_config->io_base,
-              hw_config->irq,
-              hw_config->dma,
-              hw_config->dma2,
-              ad1816_clockfreq,
-              options,
-              isa_dma_bridge_buggy,
-              pnp?"(PNP)":"");
-
-       /* ad1816_info structure remaining ? */
-       if (nr_ad1816_devs >= MAX_AUDIO_DEV) {
-               printk(KERN_WARNING "ad1816: no more ad1816_info structures "
-                       "left\n");
-               goto out;
-       }
-
-       devc = &dev_info[nr_ad1816_devs];
-       devc->base = hw_config->io_base;
-       devc->irq = hw_config->irq;
-       devc->dma_playback=hw_config->dma;
-       devc->dma_capture=hw_config->dma2;
-       devc->opened = 0;
-       devc->pnpdev = pnp;
-       spin_lock_init(&devc->lock);
-
-       if (!request_region(devc->base, 16, "AD1816 Sound")) {
-               printk(KERN_WARNING "ad1816: I/O port 0x%03x not free\n",
-                                   devc->base);
-               goto out;
-       }
-
-       printk(KERN_INFO "ad1816: Examining AD1816 at address 0x%03x.\n", 
-               devc->base);
-       
-
-       /* tests for ad1816 */
-       /* base+0: bit 1 must be set but not 255 */
-       tmp=inb(devc->base);
-       if ( (tmp&0x80)==0 || tmp==255 ) {
-               printk (KERN_INFO "ad1816: Chip is not an AD1816 or chip "
-                       "is not active (Test 0)\n");
-               goto out_release_region;
-       }
-
-       /* writes to ireg 8 are copied to ireg 9 */
-       ad_write(devc,8,12345); 
-       if (ad_read(devc,9)!=12345) {
-               printk(KERN_INFO "ad1816: Chip is not an AD1816 (Test 1)\n");
-               goto out_release_region;
-       }
-  
-       /* writes to ireg 8 are copied to ireg 9 */
-       ad_write(devc,8,54321); 
-       if (ad_read(devc,9)!=54321) {
-               printk(KERN_INFO "ad1816: Chip is not an AD1816 (Test 2)\n");
-               goto out_release_region;
-       }
-
-       /* writes to ireg 10 are copied to ireg 11 */
-       ad_write(devc,10,54321); 
-       if (ad_read(devc,11)!=54321) {
-               printk (KERN_INFO "ad1816: Chip is not an AD1816 (Test 3)\n");
-               goto out_release_region;
-       }
-
-       /* writes to ireg 10 are copied to ireg 11 */
-       ad_write(devc,10,12345); 
-       if (ad_read(devc,11)!=12345) {
-               printk (KERN_INFO "ad1816: Chip is not an AD1816 (Test 4)\n");
-               goto out_release_region;
-       }
-
-       /* bit in base +1 cannot be set to 1 */
-       tmp=inb(devc->base+1);
-       outb(0xff,devc->base+1); 
-       if (inb(devc->base+1)!=tmp) {
-               printk(KERN_INFO "ad1816: Chip is not an AD1816 (Test 5)\n");
-               goto out_release_region;
-       }
-  
-       printk(KERN_INFO "ad1816: AD1816 (version %d) successfully detected!\n",
-               ad_read(devc,45));
-
-       /* disable all interrupts */
-       ad_write(devc,1,0);     
-
-       /* Clear pending interrupts */
-       outb (0, devc->base+1); 
-
-       /* allocate irq */
-       if (devc->irq < 0 || devc->irq > 15)
-               goto out_release_region;
-       if (request_irq(devc->irq, ad1816_interrupt,0,
-                       "SoundPort", devc) < 0) {
-               printk(KERN_WARNING "ad1816: IRQ in use\n");
-               goto out_release_region;
-       }
-
-       /* DMA stuff */
-       if (sound_alloc_dma (devc->dma_playback, "Sound System")) {
-               printk(KERN_WARNING "ad1816: Can't allocate DMA%d\n",
-                                   devc->dma_playback);
-               goto out_free_irq;
-       }
-       
-       if ( devc->dma_capture >= 0 && 
-               devc->dma_capture != devc->dma_playback) {
-               if (sound_alloc_dma(devc->dma_capture,
-                                   "Sound System (capture)")) {
-                       printk(KERN_WARNING "ad1816: Can't allocate DMA%d\n",
-                                           devc->dma_capture);
-                       goto out_free_dma;
-               }
-               devc->audio_mode=DMA_AUTOMODE|DMA_DUPLEX;
-       } else {
-               printk(KERN_WARNING "ad1816: Only one DMA channel "
-                       "available/configured. No duplex operation possible\n");
-               devc->audio_mode=DMA_AUTOMODE;
-       }
-
-       conf_printf2 ("AD1816 audio driver",
-                     devc->base, devc->irq, devc->dma_playback, 
-                     devc->dma_capture);
-
-       /* register device */
-       if ((oss_devno = sound_install_audiodrv (AUDIO_DRIVER_VERSION,
-                                             "AD1816 audio driver",
-                                             &ad1816_audio_driver,
-                                             sizeof (struct audio_driver),
-                                             devc->audio_mode,
-                                             ad_format_mask,
-                                             devc,
-                                             devc->dma_playback, 
-                                             devc->dma_capture)) < 0) {
-               printk(KERN_WARNING "ad1816: Can't install sound driver\n");
-               goto out_free_dma_2;
-       }
-
-
-       ad_write(devc,32,0x80f0); /* sound system mode */
-       if (options&1) {
-               ad_write(devc,33,0); /* disable all audiosources for dsp */
-       } else {
-               ad_write(devc,33,0x03f8); /* enable all audiosources for dsp */
-       }
-       ad_write(devc,4,0x8080);  /* default values for volumes (muted)*/
-       ad_write(devc,5,0x8080);
-       ad_write(devc,6,0x8080);
-       ad_write(devc,7,0x8080);
-       ad_write(devc,15,0x8888);
-       ad_write(devc,16,0x8888);
-       ad_write(devc,17,0x8888);
-       ad_write(devc,18,0x8888);
-       ad_write(devc,19,0xc888); /* +20db mic active */
-       ad_write(devc,14,0x0000); /* Master volume unmuted */
-       ad_write(devc,39,0x009f); /* 3D effect on 0% phone out muted */
-       ad_write(devc,44,0x0080); /* everything on power, 3d enabled for d/a */
-       outb(0x10,devc->base+8); /* set dma mode */
-       outb(0x10,devc->base+9);
-  
-       /* enable capture + playback interrupt */
-       ad_write(devc,1,0xc000); 
-       
-       /* set mixer defaults */
-       ad1816_mixer_reset (devc); 
-  
-       /* register mixer */
-       if ((audio_devs[oss_devno]->mixer_dev=sound_install_mixer(
-                                      MIXER_DRIVER_VERSION,
-                                      "AD1816 audio driver",
-                                      &ad1816_mixer_operations,
-                                      sizeof (struct mixer_operations),
-                                      devc)) < 0) {
-               printk(KERN_WARNING "Can't install mixer\n");
-       }
-       /* make ad1816_info active */
-       nr_ad1816_devs++;
-       printk(KERN_INFO "ad1816: card successfully installed!\n");
-       return 1;
-       /* error handling */
-out_free_dma_2:
-       if (devc->dma_capture >= 0 && devc->dma_capture != devc->dma_playback)
-               sound_free_dma(devc->dma_capture);
-out_free_dma:
-       sound_free_dma(devc->dma_playback);
-out_free_irq:
-       free_irq(devc->irq, devc);
-out_release_region:
-       release_region(devc->base, 16);
-out:
-       return 0;
-}
-
-static void __exit unload_card(ad1816_info *devc)
-{
-       int  mixer, dev = 0;
-       
-       if (devc != NULL) {
-               printk("ad1816: Unloading card at address 0x%03x\n",devc->base);
-               
-               dev = devc->dev_no;
-               mixer = audio_devs[dev]->mixer_dev;
-
-               /* unreg mixer*/
-               if(mixer>=0) {
-                       sound_unload_mixerdev(mixer);
-               }
-               /* unreg audiodev */
-               sound_unload_audiodev(dev);
-               
-               /* free dma channels */
-               if (devc->dma_capture>=0 && 
-                       devc->dma_capture != devc->dma_playback) {
-                       sound_free_dma(devc->dma_capture);
-               }
-               sound_free_dma (devc->dma_playback);
-               /* free irq */
-               free_irq(devc->irq, devc);
-               /* free io */
-               release_region (devc->base, 16);
-#ifdef __ISAPNP__
-               if (devc->pnpdev) {
-                       pnp_disable_dev(devc->pnpdev);
-                       pnp_device_detach(devc->pnpdev);
-               }
-#endif
-               
-       } else
-               printk(KERN_WARNING "ad1816: no device/card specified\n");
-}
-
-static int __initdata io = -1;
-static int __initdata irq = -1;
-static int __initdata dma = -1;
-static int __initdata dma2 = -1;
-
-#ifdef __ISAPNP__
-/* use isapnp for configuration */
-static int isapnp      = 1;
-static int isapnpjump;
-module_param(isapnp, bool, 0);
-module_param(isapnpjump, int, 0);
-#endif
-
-module_param(io, int, 0);
-module_param(irq, int, 0);
-module_param(dma, int, 0);
-module_param(dma2, int, 0);
-module_param(ad1816_clockfreq, int, 0);
-module_param(options, int, 0);
-
-#ifdef __ISAPNP__
-static struct {
-       unsigned short card_vendor, card_device;
-       unsigned short vendor;
-       unsigned short function;
-       struct ad1816_data *data;
-} isapnp_ad1816_list[] __initdata = {
-       {       ISAPNP_ANY_ID, ISAPNP_ANY_ID,
-               ISAPNP_VENDOR('A','D','S'), ISAPNP_FUNCTION(0x7150), 
-               NULL },
-       {       ISAPNP_ANY_ID, ISAPNP_ANY_ID,
-               ISAPNP_VENDOR('A','D','S'), ISAPNP_FUNCTION(0x7180),
-               NULL },
-       {0}
-};
-
-MODULE_DEVICE_TABLE(isapnp, isapnp_ad1816_list);
-
-
-static void __init ad1816_config_pnp_card(struct pnp_card *card,
-                                         unsigned short vendor,
-                                         unsigned short function)
-{
-       struct address_info cfg;
-       struct pnp_dev *card_dev = pnp_find_dev(card, vendor, function, NULL);
-       if (!card_dev) return;
-       if (pnp_device_attach(card_dev) < 0) {
-               printk(KERN_WARNING "ad1816: Failed to attach PnP device\n");
-               return;
-       }
-       if (pnp_activate_dev(card_dev) < 0) {
-               printk(KERN_WARNING "ad1816: Failed to activate PnP device\n");
-               pnp_device_detach(card_dev);
-               return;
-       }
-       cfg.io_base = pnp_port_start(card_dev, 2);
-       cfg.irq = pnp_irq(card_dev, 0);
-       cfg.dma = pnp_irq(card_dev, 0);
-       cfg.dma2 = pnp_irq(card_dev, 1);
-       if (!ad1816_init_card(&cfg, card_dev)) {
-               pnp_disable_dev(card_dev);
-               pnp_device_detach(card_dev);
-       }
-}
-
-static void __init ad1816_config_pnp_cards(void)
-{
-       int nr_pnp_cfg;
-       int i;
-       
-       /* Count entries in isapnp_ad1816_list */
-       for (nr_pnp_cfg = 0; isapnp_ad1816_list[nr_pnp_cfg].card_vendor != 0; 
-               nr_pnp_cfg++);
-       /* Check and adjust isapnpjump */
-       if( isapnpjump < 0 || isapnpjump >= nr_pnp_cfg) {
-               printk(KERN_WARNING 
-                       "ad1816: Valid range for isapnpjump is 0-%d. "
-                       "Adjusted to 0.\n", nr_pnp_cfg-1);
-               isapnpjump = 0;
-       }
-       for (i = isapnpjump; isapnp_ad1816_list[i].card_vendor != 0; i++) {
-               struct pnp_card *card = NULL;
-               /* iterate over all pnp cards */                
-               while ((card = pnp_find_card(isapnp_ad1816_list[i].card_vendor,
-                               isapnp_ad1816_list[i].card_device, card))) 
-                       ad1816_config_pnp_card(card, 
-                               isapnp_ad1816_list[i].vendor,
-                               isapnp_ad1816_list[i].function);
-       }
-}
-#endif
-
-/* module initialization */
-static int __init init_ad1816(void)
-{
-       printk(KERN_INFO "ad1816: AD1816 sounddriver "
-                        "Copyright (C) 1998-2003 by Thorsten Knabe and "
-                        "others\n");
-#ifdef AD1816_CLOCK 
-       /* set ad1816_clockfreq if set during compilation */
-       ad1816_clockfreq=AD1816_CLOCK;
-#endif
-       if (ad1816_clockfreq<5000 || ad1816_clockfreq>100000) {
-               ad1816_clockfreq=33000;
-       }
-
-#ifdef __ISAPNP__
-       /* configure PnP cards */
-       if(isapnp) ad1816_config_pnp_cards();
-#endif
-       /* configure card by module params */
-       if (io != -1 && irq != -1 && dma != -1) {
-               struct address_info cfg;
-               cfg.io_base = io;
-               cfg.irq = irq;
-               cfg.dma = dma;
-               cfg.dma2 = dma2;
-               ad1816_init_card(&cfg, NULL);
-       }
-       if (nr_ad1816_devs <= 0)
-               return -ENODEV;
-       return 0;
-}
-
-/* module cleanup */
-static void __exit cleanup_ad1816 (void)
-{
-       int          i;
-       ad1816_info  *devc = NULL;
-  
-       /* remove any soundcard */
-       for (i = 0;  i < nr_ad1816_devs; i++) {
-               devc = &dev_info[i];
-               unload_card(devc);
-       }     
-       nr_ad1816_devs=0;
-       printk(KERN_INFO "ad1816: driver unloaded!\n");
-}
-
-module_init(init_ad1816);
-module_exit(cleanup_ad1816);
-
-#ifndef MODULE
-/* kernel command line parameter evaluation */
-static int __init setup_ad1816(char *str)
-{
-       /* io, irq, dma, dma2 */
-       int ints[5];
-       
-       str = get_options(str, ARRAY_SIZE(ints), ints);
-       
-       io      = ints[1];
-       irq     = ints[2];
-       dma     = ints[3];
-       dma2    = ints[4];
-       return 1;
-}
-
-__setup("ad1816=", setup_ad1816);
-#endif
-MODULE_LICENSE("GPL");
diff --git a/sound/oss/ad1889.c b/sound/oss/ad1889.c
deleted file mode 100644 (file)
index c0730a3..0000000
+++ /dev/null
@@ -1,1101 +0,0 @@
-/*
- *  Copyright 2001-2004 Randolph Chung <tausq@debian.org>
- *
- *  Analog Devices 1889 PCI audio driver (AD1819 AC97-compatible codec)
- *
- *   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.
- *
- *   Notes:
- *   1. Only flat DMA is supported; s-g is not supported right now
- *
- *
-<jsm> tausq: Anyway, to set up sample rates for D to A, you just use the sample rate on the codec. For A to D, you need to set the codec always to 48K (using the split sample rate feature on the codec) and then set the resampler on the AD1889 to the sample rate you want.
-<jsm> Also, when changing the sample rate on the codec you need to power it down and re power it up for the change to take effect!
- *
- * $Id: ad1889.c,v 1.3 2002/10/19 21:31:44 grundler Exp $
- */
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
-#include <linux/pci.h>
-#include <linux/poll.h>
-#include <linux/proc_fs.h>
-#include <linux/slab.h>
-#include <linux/soundcard.h>
-#include <linux/ac97_codec.h>
-#include <linux/sound.h>
-#include <linux/interrupt.h>
-#include <linux/mutex.h>
-
-#include <asm/delay.h>
-#include <asm/io.h>
-#include <asm/dma.h>
-#include <asm/uaccess.h>
-
-#include "ad1889.h"
-
-#define DBG(fmt, arg...) printk(fmt, ##arg)
-#define DEVNAME "ad1889"
-
-#define NR_HW_CH       4
-#define DAC_RUNNING    1
-#define ADC_RUNNING    2
-
-#define UNDERRUN(dev)  (0)
-
-#define AD1889_READW(dev,reg) readw(dev->regbase + reg)
-#define AD1889_WRITEW(dev,reg,val) writew((val), dev->regbase + reg)
-#define AD1889_READL(dev,reg) readl(dev->regbase + reg)
-#define AD1889_WRITEL(dev,reg,val) writel((val), dev->regbase + reg)
-
-//now 100ms
-/* #define WAIT_10MS() schedule_timeout(HZ/10) */
-#define WAIT_10MS()    do { int __i; for (__i = 0; __i < 100; __i++) udelay(1000); } while(0)
-
-/* currently only support a single device */
-static ad1889_dev_t *ad1889_dev = NULL;
-
-/************************* helper routines ***************************** */
-static inline void ad1889_set_wav_rate(ad1889_dev_t *dev, int rate)
-{
-       struct ac97_codec *ac97_codec = dev->ac97_codec;
-
-       DBG("Setting WAV rate to %d\n", rate);
-       dev->state[AD_WAV_STATE].dmabuf.rate = rate;
-       AD1889_WRITEW(dev, AD_DS_WAS, rate);
-
-       /* Cycle the DAC to enable the new rate */
-       ac97_codec->codec_write(dev->ac97_codec, AC97_POWER_CONTROL, 0x0200);
-       WAIT_10MS();
-       ac97_codec->codec_write(dev->ac97_codec, AC97_POWER_CONTROL, 0);
-}
-
-static inline void ad1889_set_wav_fmt(ad1889_dev_t *dev, int fmt)
-{
-       u16 tmp;
-
-       DBG("Setting WAV format to 0x%x\n", fmt);
-
-       tmp = AD1889_READW(ad1889_dev, AD_DS_WSMC);
-       if (fmt & AFMT_S16_LE) {
-               //tmp |= 0x0100; /* set WA16 */
-               tmp |= 0x0300; /* set WA16 stereo */
-       } else if (fmt & AFMT_U8) {
-               tmp &= ~0x0100; /* clear WA16 */
-       } 
-       AD1889_WRITEW(ad1889_dev, AD_DS_WSMC, tmp);
-}
-
-static inline void ad1889_set_adc_fmt(ad1889_dev_t *dev, int fmt)
-{
-       u16 tmp;
-
-       DBG("Setting ADC format to 0x%x\n", fmt);
-
-       tmp = AD1889_READW(ad1889_dev, AD_DS_RAMC);
-       if (fmt & AFMT_S16_LE) {
-               tmp |= 0x0100; /* set WA16 */
-       } else if (fmt & AFMT_U8) {
-               tmp &= ~0x0100; /* clear WA16 */
-       } 
-       AD1889_WRITEW(ad1889_dev, AD_DS_RAMC, tmp);
-}
-
-static void ad1889_start_wav(ad1889_state_t *state)
-{
-       unsigned long flags;
-       struct dmabuf *dmabuf = &state->dmabuf;
-       int cnt;
-       u16 tmp;
-
-       spin_lock_irqsave(&state->card->lock, flags);
-
-       if (dmabuf->dma_len)    /* DMA already in flight */
-               goto skip_dma;
-
-       /* setup dma */
-       cnt = dmabuf->wr_ptr - dmabuf->rd_ptr;
-       if (cnt == 0)           /* done - don't need to do anything */
-               goto skip_dma;
-
-       /* If the wr_ptr has wrapped, only map to the end */
-       if (cnt < 0)
-               cnt = DMA_SIZE - dmabuf->rd_ptr;
-
-       dmabuf->dma_handle = pci_map_single(ad1889_dev->pci,
-                                       dmabuf->rawbuf + dmabuf->rd_ptr,
-                                       cnt, PCI_DMA_TODEVICE);
-       dmabuf->dma_len = cnt;
-       dmabuf->ready = 1;
-
-       DBG("Starting playback at 0x%p for %ld bytes\n", dmabuf->rawbuf +
-           dmabuf->rd_ptr, dmabuf->dma_len);
-
-        /* load up the current register set */
-       AD1889_WRITEL(ad1889_dev, AD_DMA_WAVCC, cnt);
-       AD1889_WRITEL(ad1889_dev, AD_DMA_WAVICC, cnt);
-       AD1889_WRITEL(ad1889_dev, AD_DMA_WAVCA, dmabuf->dma_handle);
-
-       /* TODO: for now we load the base registers with the same thing */
-       AD1889_WRITEL(ad1889_dev, AD_DMA_WAVBC, cnt);
-       AD1889_WRITEL(ad1889_dev, AD_DMA_WAVIBC, cnt);
-       AD1889_WRITEL(ad1889_dev, AD_DMA_WAVBA, dmabuf->dma_handle);
-
-       /* and we're off to the races... */
-       AD1889_WRITEL(ad1889_dev, AD_DMA_CHSS, 0x8);
-       tmp = AD1889_READW(ad1889_dev, AD_DS_WSMC);
-       tmp |= 0x0400; /* set WAEN */
-       AD1889_WRITEW(ad1889_dev, AD_DS_WSMC, tmp);
-       (void) AD1889_READW(ad1889_dev, AD_DS_WSMC); /* flush posted PCI write */
-
-       dmabuf->enable |= DAC_RUNNING;
-
-skip_dma:
-       spin_unlock_irqrestore(&state->card->lock, flags);
-}
-
-
-static void ad1889_stop_wav(ad1889_state_t *state)
-{
-       unsigned long flags;
-       struct dmabuf *dmabuf = &state->dmabuf;
-
-       spin_lock_irqsave(&state->card->lock, flags);
-
-       if (dmabuf->enable & DAC_RUNNING) {
-               u16 tmp;
-               unsigned long cnt = dmabuf->dma_len;
-
-               tmp = AD1889_READW(ad1889_dev, AD_DS_WSMC);
-               tmp &= ~0x0400; /* clear WAEN */
-               AD1889_WRITEW(ad1889_dev, AD_DS_WSMC, tmp);
-               (void) AD1889_READW(ad1889_dev, AD_DS_WSMC); /* flush posted PCI write */
-               pci_unmap_single(ad1889_dev->pci, dmabuf->dma_handle, 
-                               cnt, PCI_DMA_TODEVICE);
-
-               dmabuf->enable &= ~DAC_RUNNING;
-
-               /* update dma pointers */
-               dmabuf->rd_ptr += cnt;
-               dmabuf->rd_ptr &= (DMA_SIZE - 1);
-
-               dmabuf->dma_handle = 0;
-               dmabuf->dma_len = 0;
-               dmabuf->ready = 0;
-
-               wake_up(&dmabuf->wait);
-       }
-
-       spin_unlock_irqrestore(&state->card->lock, flags);
-}
-
-
-#if 0
-static void ad1889_startstop_adc(ad1889_state_t *state, int start)
-{
-       u16 tmp;
-       unsigned long flags;
-
-       spin_lock_irqsave(&state->card->lock, flags);
-       
-       tmp = AD1889_READW(ad1889_dev, AD_DS_RAMC);
-       if (start) {
-               state->dmabuf.enable |= ADC_RUNNING;
-               tmp |= 0x0004; /* set ADEN */
-       } else {
-               state->dmabuf.enable &= ~ADC_RUNNING;
-               tmp &= ~0x0004; /* clear ADEN */
-       }
-       AD1889_WRITEW(ad1889_dev, AD_DS_RAMC, tmp);
-
-       spin_unlock_irqrestore(&state->card->lock, flags);
-}
-#endif
-
-static ad1889_dev_t *ad1889_alloc_dev(struct pci_dev *pci)
-{
-       ad1889_dev_t *dev;
-       struct dmabuf *dmabuf;
-       int i;
-
-       if ((dev = kzalloc(sizeof(ad1889_dev_t), GFP_KERNEL)) == NULL)
-               return NULL;
-       spin_lock_init(&dev->lock);
-       dev->pci = pci;
-
-       for (i = 0; i < AD_MAX_STATES; i++) {
-               dev->state[i].card = dev;
-               mutex_init(&dev->state[i].mutex);
-               init_waitqueue_head(&dev->state[i].dmabuf.wait);
-       }
-
-       /* allocate dma buffer */
-
-       for (i = 0; i < AD_MAX_STATES; i++) {
-               dmabuf = &dev->state[i].dmabuf;
-               dmabuf->rawbuf = kmalloc(DMA_SIZE, GFP_KERNEL|GFP_DMA);
-               if (!dmabuf->rawbuf)
-                       goto err_free_dmabuf;
-               dmabuf->rawbuf_size = DMA_SIZE;
-               dmabuf->dma_handle = 0;
-               dmabuf->rd_ptr = dmabuf->wr_ptr = dmabuf->dma_len = 0UL;
-               dmabuf->ready = 0;
-               dmabuf->rate = 48000;
-       }
-       return dev;
-
-err_free_dmabuf:
-       while (--i >= 0)
-               kfree(dev->state[i].dmabuf.rawbuf);
-       kfree(dev);
-       return NULL;
-}
-
-static void ad1889_free_dev(ad1889_dev_t *dev)
-{
-       int j;
-       struct dmabuf *dmabuf;
-
-       if (dev == NULL) 
-               return;
-
-       if (dev->ac97_codec)
-               ac97_release_codec(dev->ac97_codec);
-
-       for (j = 0; j < AD_MAX_STATES; j++) {
-               dmabuf = &dev->state[j].dmabuf;
-               kfree(dmabuf->rawbuf);
-       }
-
-       kfree(dev);
-}
-
-static inline void ad1889_trigger_playback(ad1889_dev_t *dev)
-{
-#if 0
-       u32 val;
-       struct dmabuf *dmabuf = &dev->state[AD_WAV_STATE].dmabuf;
-#endif
-
-       ad1889_start_wav(&dev->state[AD_WAV_STATE]);
-}
-
-static int ad1889_read_proc (char *page, char **start, off_t off,
-                            int count, int *eof, void *data)
-{
-       char *out = page;
-       int len, i;
-       ad1889_dev_t *dev = data;
-       ad1889_reg_t regs[] = {
-               { "WSMC", AD_DS_WSMC, 16 },
-               { "RAMC", AD_DS_RAMC, 16 },
-               { "WADA", AD_DS_WADA, 16 },
-               { "SYDA", AD_DS_SYDA, 16 },
-               { "WAS", AD_DS_WAS, 16 },
-               { "RES", AD_DS_RES, 16 },
-               { "CCS", AD_DS_CCS, 16 },
-               { "ADCBA", AD_DMA_ADCBA, 32 },
-               { "ADCCA", AD_DMA_ADCCA, 32 },
-               { "ADCBC", AD_DMA_ADCBC, 32 },
-               { "ADCCC", AD_DMA_ADCCC, 32 },
-               { "ADCIBC", AD_DMA_ADCIBC, 32 },
-               { "ADCICC", AD_DMA_ADCICC, 32 },
-               { "ADCCTRL", AD_DMA_ADCCTRL, 16 },
-               { "WAVBA", AD_DMA_WAVBA, 32 },
-               { "WAVCA", AD_DMA_WAVCA, 32 },
-               { "WAVBC", AD_DMA_WAVBC, 32 },
-               { "WAVCC", AD_DMA_WAVCC, 32 },
-               { "WAVIBC", AD_DMA_WAVIBC, 32 },
-               { "WAVICC", AD_DMA_WAVICC, 32 },
-               { "WAVCTRL", AD_DMA_WAVCTRL, 16 },
-               { "DISR", AD_DMA_DISR, 32 },
-               { "CHSS", AD_DMA_CHSS, 32 },
-               { "IPC", AD_GPIO_IPC, 16 },
-               { "OP", AD_GPIO_OP, 16 },
-               { "IP", AD_GPIO_IP, 16 },
-               { "ACIC", AD_AC97_ACIC, 16 },
-               { "AC97_RESET", AD_AC97_BASE + AC97_RESET, 16 },
-               { "AC97_MASTER_VOL_STEREO", AD_AC97_BASE + AC97_MASTER_VOL_STEREO, 16 },
-               { "AC97_HEADPHONE_VOL", AD_AC97_BASE + AC97_HEADPHONE_VOL, 16 },
-               { "AC97_MASTER_VOL_MONO", AD_AC97_BASE + AC97_MASTER_VOL_MONO, 16 },
-               { "AC97_MASTER_TONE", AD_AC97_BASE + AC97_MASTER_TONE, 16 },
-               { "AC97_PCBEEP_VOL", AD_AC97_BASE + AC97_PCBEEP_VOL, 16 },
-               { "AC97_PHONE_VOL", AD_AC97_BASE + AC97_PHONE_VOL, 16 },
-               { "AC97_MIC_VOL", AD_AC97_BASE + AC97_MIC_VOL, 16 },
-               { "AC97_LINEIN_VOL", AD_AC97_BASE + AC97_LINEIN_VOL, 16 },
-               { "AC97_CD_VOL", AD_AC97_BASE + AC97_CD_VOL, 16 },
-               { "AC97_VIDEO_VOL", AD_AC97_BASE + AC97_VIDEO_VOL, 16 },
-               { "AC97_AUX_VOL", AD_AC97_BASE + AC97_AUX_VOL, 16 },
-               { "AC97_PCMOUT_VOL", AD_AC97_BASE + AC97_PCMOUT_VOL, 16 },
-               { "AC97_RECORD_SELECT", AD_AC97_BASE + AC97_RECORD_SELECT, 16 },
-               { "AC97_RECORD_GAIN", AD_AC97_BASE + AC97_RECORD_GAIN, 16 },
-               { "AC97_RECORD_GAIN_MIC", AD_AC97_BASE + AC97_RECORD_GAIN_MIC, 16 },
-               { "AC97_GENERAL_PURPOSE", AD_AC97_BASE + AC97_GENERAL_PURPOSE, 16 },
-               { "AC97_3D_CONTROL", AD_AC97_BASE + AC97_3D_CONTROL, 16 },
-               { "AC97_MODEM_RATE", AD_AC97_BASE + AC97_MODEM_RATE, 16 },
-               { "AC97_POWER_CONTROL", AD_AC97_BASE + AC97_POWER_CONTROL, 16 },
-               { NULL }
-       };
-
-       if (dev == NULL)
-               return -ENODEV;
-
-       for (i = 0; regs[i].name != 0; i++)
-               out += sprintf(out, "%s: 0x%0*x\n", regs[i].name, 
-                       regs[i].width >> 2, 
-                       (regs[i].width == 16 
-                               ? AD1889_READW(dev, regs[i].offset)
-                               : AD1889_READL(dev, regs[i].offset)));
-
-       for (i = 0; i < AD_MAX_STATES; i++) {
-               out += sprintf(out, "DMA status for %s:\n", 
-                       (i == AD_WAV_STATE ? "WAV" : "ADC")); 
-               out += sprintf(out, "\t\t0x%p (IOVA: 0x%llu)\n",
-                       dev->state[i].dmabuf.rawbuf,
-                       (unsigned long long)dev->state[i].dmabuf.dma_handle);
-
-               out += sprintf(out, "\tread ptr: offset %u\n", 
-                       (unsigned int)dev->state[i].dmabuf.rd_ptr);
-               out += sprintf(out, "\twrite ptr: offset %u\n", 
-                       (unsigned int)dev->state[i].dmabuf.wr_ptr);
-               out += sprintf(out, "\tdma len: offset %u\n", 
-                       (unsigned int)dev->state[i].dmabuf.dma_len);
-       }
-
-       len = out - page - off;
-       if (len < count) {
-               *eof = 1;
-               if (len <= 0) return 0;
-       } else {
-               len = count;
-       }
-       *start = page + off;
-       return len;
-}
-
-/***************************** DMA interfaces ************************** */
-#if 0
-static inline unsigned long ad1889_get_dma_addr(ad1889_state_t *state)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       u32 offset;
-
-       if (!(dmabuf->enable & (DAC_RUNNING | ADC_RUNNING))) {
-               printk(KERN_ERR DEVNAME ": get_dma_addr called without dma enabled\n");
-               return 0;
-       }
-       
-       if (dmabuf->enable & DAC_RUNNING)
-               offset = le32_to_cpu(AD1889_READL(state->card, AD_DMA_WAVBA));
-       else
-               offset = le32_to_cpu(AD1889_READL(state->card, AD_DMA_ADCBA));
-
-       return (unsigned long)bus_to_virt((unsigned long)offset) - (unsigned long)dmabuf->rawbuf;
-}
-
-static void ad1889_update_ptr(ad1889_dev_t *dev, int wake)
-{
-       ad1889_state_t *state;
-       struct dmabuf *dmabuf;
-       unsigned long hwptr;
-       int diff;
-
-       /* check ADC first */
-       state = &dev->adc_state;
-       dmabuf = &state->dmabuf;
-       if (dmabuf->enable & ADC_RUNNING) {
-               hwptr = ad1889_get_dma_addr(state);
-               diff = (dmabuf->dmasize + hwptr - dmabuf->hwptr) % dmabuf->dmasize;
-
-               dmabuf->hwptr = hwptr;
-               dmabuf->total_bytes += diff;
-               dmabuf->count += diff;
-               if (dmabuf->count > dmabuf->dmasize)
-                       dmabuf->count = dmabuf->dmasize;
-
-               if (dmabuf->mapped) {
-                       if (wake & dmabuf->count >= dmabuf->fragsize)
-                               wake_up(&dmabuf->wait);
-               } else {
-                       if (wake & dmabuf->count > 0)
-                               wake_up(&dmabuf->wait);
-               }
-       }
-
-       /* check DAC */
-       state = &dev->wav_state;
-       dmabuf = &state->dmabuf;
-       if (dmabuf->enable & DAC_RUNNING) {
-XXX
-
-}
-#endif
-
-/************************* /dev/dsp interfaces ************************* */
-
-static ssize_t ad1889_read(struct file *file, char __user *buffer, size_t count,
-       loff_t *ppos)
-{
-       return 0;
-}
-
-static ssize_t ad1889_write(struct file *file, const char __user *buffer, size_t count,
-       loff_t *ppos)
-{
-       ad1889_dev_t *dev = (ad1889_dev_t *)file->private_data;
-       ad1889_state_t *state = &dev->state[AD_WAV_STATE];
-       volatile struct dmabuf *dmabuf = &state->dmabuf;
-       ssize_t ret = 0;
-       DECLARE_WAITQUEUE(wait, current);
-
-       mutex_lock(&state->mutex);
-#if 0
-       if (dmabuf->mapped) {
-               ret = -ENXIO;
-               goto err1;
-       }
-#endif
-       if (!access_ok(VERIFY_READ, buffer, count)) {
-               ret = -EFAULT;
-               goto err1;
-       }
-
-       add_wait_queue(&state->dmabuf.wait, &wait);
-
-       /* start filling dma buffer.... */
-       while (count > 0) {
-               long rem;
-               long cnt = count;
-               unsigned long flags;
-
-               for (;;) {
-                       long used_bytes;
-                       long timeout;   /* max time for DMA in jiffies */
-
-                       /* buffer is full if wr catches up to rd */
-                       spin_lock_irqsave(&state->card->lock, flags);
-                       used_bytes = dmabuf->wr_ptr - dmabuf->rd_ptr;
-                       timeout = (dmabuf->dma_len * HZ) / dmabuf->rate;
-                       spin_unlock_irqrestore(&state->card->lock, flags);
-
-                       /* adjust for buffer wrap around */
-                       used_bytes = (used_bytes + DMA_SIZE) & (DMA_SIZE - 1);
-
-                       /* If at least one page unused */
-                       if (used_bytes < (DMA_SIZE - 0x1000))
-                               break;
-
-                       /* dma buffer full */
-
-                       if (file->f_flags & O_NONBLOCK) {
-                               ret = -EAGAIN;
-                               goto err2;
-                       }
-
-                       set_current_state(TASK_INTERRUPTIBLE);
-                       schedule_timeout(timeout + 1);
-                       if (signal_pending(current)) {
-                               ret = -ERESTARTSYS;
-                               goto err2;
-                       }
-               }
-
-               /* watch out for wrapping around static buffer */
-               spin_lock_irqsave(&state->card->lock, flags);
-               rem = DMA_SIZE - dmabuf->wr_ptr;
-               if (cnt > rem)
-                       cnt = rem;
-
-               rem = dmabuf->wr_ptr;
-
-               /* update dma pointers */
-               dmabuf->wr_ptr += cnt;
-               dmabuf->wr_ptr &= DMA_SIZE - 1; /* wrap ptr if necessary */
-               spin_unlock_irqrestore(&state->card->lock, flags);
-
-               /* transfer unwrapped chunk */
-               if (copy_from_user(dmabuf->rawbuf + rem, buffer, cnt)) {
-                       ret = -EFAULT;
-                       goto err2;
-               }
-
-               DBG("Writing 0x%lx bytes to +0x%lx\n", cnt, rem);
-
-               /* update counters */
-               count -= cnt;
-               buffer += cnt;
-               ret += cnt;
-
-               /* we have something to play - go play it! */
-               ad1889_trigger_playback(dev);
-       }
-
-err2:
-       remove_wait_queue(&state->dmabuf.wait, &wait);
-err1:
-       mutex_unlock(&state->mutex);
-       return ret;
-}
-
-static unsigned int ad1889_poll(struct file *file, struct poll_table_struct *wait)
-{
-       unsigned int mask = 0;
-#if 0
-       ad1889_dev_t *dev = (ad1889_dev_t *)file->private_data;
-       ad1889_state_t *state = NULL;
-       struct dmabuf *dmabuf;
-       unsigned long flags;
-       
-       if (!(file->f_mode & (FMODE_READ | FMODE_WRITE)))
-               return -EINVAL;
-
-       if (file->f_mode & FMODE_WRITE) {
-               state = &dev->state[AD_WAV_STATE];
-               if (!state) return 0;
-               dmabuf = &state->dmabuf;
-               poll_wait(file, &dmabuf->wait, wait);
-       }
-
-       if (file->f_mode & FMODE_READ) {
-               state = &dev->state[AD_ADC_STATE];
-               if (!state) return 0;
-               dmabuf = &state->dmabuf;
-               poll_wait(file, &dmabuf->wait, wait);
-       }
-
-       spin_lock_irqsave(&dev->lock, flags);
-       ad1889_update_ptr(dev, 0);
-
-       if (file->f_mode & FMODE_WRITE) {
-               state = &dev->state[WAV_STATE];
-               dmabuf = &state->dmabuf;
-               if (dmabuf->mapped) {
-                       if (dmabuf->count >= (int)dmabuf->fragsize)
-                               mask |= POLLOUT | POLLWRNORM;
-               } else {
-                       if ((int)dmabuf->dmasize >= dmabuf->count + 
-                               (int)dmabuf->fragsize)
-                               mask |= POLLOUT | POLLWRNORM;
-               }
-       }
-
-       if (file ->f_mode & FMODE_READ) {
-               state = &dev->state[AD_ADC_STATE];
-               dmabuf = &state->dmabuf;
-               if (dmabuf->count >= (int)dmabuf->fragsize)
-                       mask |= POLLIN | POLLRDNORM;
-       }
-       spin_unlock_irqrestore(&dev->lock, flags);
-
-#endif
-       return mask;
-}
-
-static int ad1889_mmap(struct file *file, struct vm_area_struct *vma)
-{
-       return 0;
-}
-
-static int ad1889_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-       unsigned long arg)
-{
-       int val = 0;
-       ad1889_dev_t *dev = (ad1889_dev_t *)file->private_data;
-       struct dmabuf *dmabuf;
-       audio_buf_info abinfo;
-       int __user *p = (int __user *)arg;
-
-       DBG("ad1889_ioctl cmd 0x%x arg %lu\n", cmd, arg);
-
-       switch (cmd)
-       {
-       case OSS_GETVERSION:
-               return put_user(SOUND_VERSION, p);
-
-       case SNDCTL_DSP_RESET:
-               break;
-
-       case SNDCTL_DSP_SYNC:
-               break;
-
-       case SNDCTL_DSP_SPEED:
-               /* set sampling rate */
-               if (get_user(val, p))
-                       return -EFAULT;
-               if (val > 5400 && val < 48000)
-               {
-                       if (file->f_mode & FMODE_WRITE)
-                               AD1889_WRITEW(ad1889_dev, AD_DS_WAS, val);
-                       if (file->f_mode & FMODE_READ)
-                               AD1889_WRITEW(ad1889_dev, AD_DS_RES, val);
-               }
-               return 0;
-
-       case SNDCTL_DSP_STEREO: /* undocumented? */
-               if (get_user(val, p))
-                       return -EFAULT;
-               if (file->f_mode & FMODE_READ) {
-                       val = AD1889_READW(ad1889_dev, AD_DS_WSMC);
-                       if (val) {
-                               val |= 0x0200;  /* set WAST */
-                       } else {
-                               val &= ~0x0200; /* clear WAST */
-                       }
-                       AD1889_WRITEW(ad1889_dev, AD_DS_WSMC, val);
-               }
-               if (file->f_mode & FMODE_WRITE) {
-                       val = AD1889_READW(ad1889_dev, AD_DS_RAMC);
-                       if (val) {
-                               val |= 0x0002;  /* set ADST */
-                       } else {
-                               val &= ~0x0002; /* clear ADST */
-                       }
-                       AD1889_WRITEW(ad1889_dev, AD_DS_RAMC, val);
-               }
-
-               return 0;
-
-       case SNDCTL_DSP_GETBLKSIZE:
-               return put_user(DMA_SIZE, p);
-
-       case SNDCTL_DSP_GETFMTS:
-               return put_user(AFMT_S16_LE|AFMT_U8, p);
-
-       case SNDCTL_DSP_SETFMT:
-               if (get_user(val, p))
-                       return -EFAULT;
-
-               if (val == 0) {
-                       if (file->f_mode & FMODE_READ) 
-                               ad1889_set_adc_fmt(dev, val);
-
-                       if (file->f_mode & FMODE_WRITE) 
-                               ad1889_set_wav_fmt(dev, val);
-               } else {
-                       val = AFMT_S16_LE | AFMT_U8;
-               }
-
-               return put_user(val, p);
-
-       case SNDCTL_DSP_CHANNELS:
-               break;
-
-       case SNDCTL_DSP_POST:
-               /* send all data to device */
-               break;
-
-       case SNDCTL_DSP_SUBDIVIDE:
-               break;
-
-       case SNDCTL_DSP_SETFRAGMENT:
-               /* not supported; uses fixed fragment sizes */
-               return put_user(DMA_SIZE, p);
-
-       case SNDCTL_DSP_GETOSPACE:
-       case SNDCTL_DSP_GETISPACE:
-               /* space left in dma buffers */
-               if (cmd == SNDCTL_DSP_GETOSPACE)
-                       dmabuf = &dev->state[AD_WAV_STATE].dmabuf;
-               else
-                       dmabuf = &dev->state[AD_ADC_STATE].dmabuf;
-               abinfo.fragments = 1;
-               abinfo.fragstotal = 1;
-               abinfo.fragsize = DMA_SIZE;
-               abinfo.bytes = DMA_SIZE;
-               return copy_to_user(p, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
-       case SNDCTL_DSP_NONBLOCK:
-               file->f_flags |= O_NONBLOCK;
-               return 0;
-
-       case SNDCTL_DSP_GETCAPS:
-               return put_user(0, p);
-
-       case SNDCTL_DSP_GETTRIGGER:
-       case SNDCTL_DSP_SETTRIGGER:
-               break;
-
-       case SNDCTL_DSP_GETIPTR:
-       case SNDCTL_DSP_GETOPTR:
-               break;
-
-       case SNDCTL_DSP_SETDUPLEX:
-               break;
-       
-       case SNDCTL_DSP_GETODELAY:
-               break;
-
-       case SOUND_PCM_READ_RATE:
-               return put_user(AD1889_READW(ad1889_dev, AD_DS_WAS), p);
-
-       case SOUND_PCM_READ_CHANNELS:
-       case SOUND_PCM_READ_BITS:
-               break;
-
-       case SNDCTL_DSP_MAPINBUF:
-       case SNDCTL_DSP_MAPOUTBUF:
-       case SNDCTL_DSP_SETSYNCRO:
-       case SOUND_PCM_WRITE_FILTER:
-       case SOUND_PCM_READ_FILTER:
-               break;
-
-       default:
-               break;
-       }
-
-       return -ENOTTY;
-}
-
-static int ad1889_open(struct inode *inode, struct file *file)
-{
-       /* check minor; only support /dev/dsp atm */
-       if (iminor(inode) != 3)
-               return -ENXIO;
-       
-       file->private_data = ad1889_dev;
-
-       ad1889_set_wav_rate(ad1889_dev, 48000);
-       ad1889_set_wav_fmt(ad1889_dev, AFMT_S16_LE);
-       AD1889_WRITEW(ad1889_dev, AD_DS_WADA, 0x0404); /* attenuation */
-       return nonseekable_open(inode, file);
-}
-
-static int ad1889_release(struct inode *inode, struct file *file)
-{
-       /* if we have state free it here */
-       return 0;
-}
-
-static const struct file_operations ad1889_fops = {
-       .owner          = THIS_MODULE,
-       .llseek         = no_llseek,
-       .read           = ad1889_read,
-       .write          = ad1889_write,
-       .poll           = ad1889_poll,
-       .ioctl          = ad1889_ioctl,
-       .mmap           = ad1889_mmap,
-       .open           = ad1889_open,
-       .release        = ad1889_release,
-};
-
-/************************* /dev/mixer interfaces ************************ */
-static int ad1889_mixer_open(struct inode *inode, struct file *file)
-{
-       if (ad1889_dev->ac97_codec->dev_mixer != iminor(inode))
-               return -ENODEV;
-
-       file->private_data = ad1889_dev->ac97_codec;
-       return 0;
-}
-
-static int ad1889_mixer_release(struct inode *inode, struct file *file)
-{
-       return 0;
-}
-
-static int ad1889_mixer_ioctl(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 ad1889_mixer_fops = {
-       .owner          = THIS_MODULE,
-       .llseek         = no_llseek,
-       .ioctl          = ad1889_mixer_ioctl,
-       .open           = ad1889_mixer_open,
-       .release        = ad1889_mixer_release,
-};
-
-/************************* AC97 interfaces ****************************** */
-static void ad1889_codec_write(struct ac97_codec *ac97, u8 reg, u16 val)
-{
-       ad1889_dev_t *dev = ac97->private_data;
-
-       //DBG("Writing 0x%x to 0x%lx\n", val, dev->regbase + AD_AC97_BASE + reg);
-       AD1889_WRITEW(dev, AD_AC97_BASE + reg, val);
-}
-
-static u16 ad1889_codec_read(struct ac97_codec *ac97, u8 reg)
-{
-       ad1889_dev_t *dev = ac97->private_data;
-       //DBG("Reading from 0x%lx\n", dev->regbase + AD_AC97_BASE + reg);
-       return AD1889_READW(dev, AD_AC97_BASE + reg);
-}      
-
-static int ad1889_ac97_init(ad1889_dev_t *dev, int id)
-{
-       struct ac97_codec *ac97;
-       u16 eid;
-
-       if ((ac97 = ac97_alloc_codec()) == NULL) 
-               return -ENOMEM;
-
-       ac97->private_data = dev;
-       ac97->id = id;
-
-       ac97->codec_read = ad1889_codec_read;
-       ac97->codec_write = ad1889_codec_write;
-
-       if (ac97_probe_codec(ac97) == 0) {
-               printk(DEVNAME ": ac97_probe_codec failed\n");
-               goto out_free;
-       }
-
-       eid = ad1889_codec_read(ac97, AC97_EXTENDED_ID);
-       if (eid == 0xffff) {
-               printk(KERN_WARNING DEVNAME ": no codec attached?\n");
-               goto out_free;
-       }
-
-       dev->ac97_features = eid;
-
-       if ((ac97->dev_mixer = register_sound_mixer(&ad1889_mixer_fops, -1)) < 0) {
-               printk(KERN_ERR DEVNAME ": cannot register mixer\n");
-               goto out_free;
-       }
-
-       dev->ac97_codec = ac97;
-       return 0;
-
-out_free:
-       ac97_release_codec(ac97);
-       return -ENODEV;
-}
-
-static int ad1889_aclink_reset(struct pci_dev * pcidev)
-{
-       u16 stat;
-       int retry = 200;
-       ad1889_dev_t *dev = pci_get_drvdata(pcidev);
-
-       AD1889_WRITEW(dev, AD_DS_CCS, 0x8000); /* turn on clock */
-       AD1889_READW(dev, AD_DS_CCS);
-
-       WAIT_10MS();
-
-       stat = AD1889_READW(dev, AD_AC97_ACIC);
-       stat |= 0x0002;                         /* Reset Disable */
-       AD1889_WRITEW(dev, AD_AC97_ACIC, stat);
-       (void) AD1889_READW(dev, AD_AC97_ACIC); /* flush posted write */
-
-       udelay(10);
-
-       stat = AD1889_READW(dev, AD_AC97_ACIC);
-       stat |= 0x0001;                         /* Interface Enable */
-       AD1889_WRITEW(dev, AD_AC97_ACIC, stat);
-
-       do {
-               if (AD1889_READW(dev, AD_AC97_ACIC) & 0x8000)   /* Ready */
-                       break;
-               WAIT_10MS();
-               retry--;
-       } while (retry > 0);
-
-       if (!retry) {
-               printk(KERN_ERR "ad1889_aclink_reset: codec is not ready [0x%x]\n",
-                           AD1889_READW(dev, AD_AC97_ACIC));
-               return -EBUSY;
-       }
-
-       /* TODO reset AC97 codec */
-       /* TODO set wave/adc pci ctrl status */
-
-       stat = AD1889_READW(dev, AD_AC97_ACIC);
-       stat |= 0x0004;                         /* Audio Stream Output Enable */
-       AD1889_WRITEW(dev, AD_AC97_ACIC, stat);
-       return 0;
-}
-
-/************************* PCI interfaces ****************************** */
-/* PCI device table */
-static struct pci_device_id ad1889_id_tbl[] = {
-       { PCI_VENDOR_ID_ANALOG_DEVICES, PCI_DEVICE_ID_AD1889JS, PCI_ANY_ID, 
-         PCI_ANY_ID, 0, 0, (unsigned long)DEVNAME },
-       { },
-};
-MODULE_DEVICE_TABLE(pci, ad1889_id_tbl);
-
-static irqreturn_t ad1889_interrupt(int irq, void *dev_id)
-{
-       u32 stat;
-       ad1889_dev_t *dev = (ad1889_dev_t *)dev_id;
-
-       stat = AD1889_READL(dev, AD_DMA_DISR);
-
-       /* clear ISR */
-       AD1889_WRITEL(dev, AD_DMA_DISR, stat);
-
-       if (stat & 0x8) {               /* WAVI */
-               DBG("WAV interrupt\n");
-               dev->stats.wav_intrs++;
-               if (dev->state[AD_WAV_STATE].dmabuf.ready) {
-                       ad1889_stop_wav(&dev->state[AD_WAV_STATE]);     /* clean up */
-                       ad1889_start_wav(&dev->state[AD_WAV_STATE]);    /* start new */
-               }
-       }
-
-       if ((stat & 0x2) && dev->state[AD_ADC_STATE].dmabuf.ready) { /* ADCI */
-               DBG("ADC interrupt\n");
-               dev->stats.adc_intrs++;
-       }
-       if(stat)
-               return IRQ_HANDLED;
-       return IRQ_NONE;
-}
-
-static void ad1889_initcfg(ad1889_dev_t *dev)
-{
-       u16 tmp16;
-       u32 tmp32;
-
-       /* make sure the interrupt bits are setup the way we want */
-       tmp32 = AD1889_READL(dev, AD_DMA_WAVCTRL);
-       tmp32 &= ~0xff; /* flat dma, no sg, mask out the intr bits */
-       tmp32 |= 0x6;  /* intr on count, loop */
-       AD1889_WRITEL(dev, AD_DMA_WAVCTRL, tmp32);
-
-       /* unmute... */
-       tmp16 = AD1889_READW(dev, AD_DS_WADA);
-       tmp16 &= ~0x8080;
-       AD1889_WRITEW(dev, AD_DS_WADA, tmp16);
-}
-
-static int __devinit ad1889_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
-{
-       int err;
-       ad1889_dev_t *dev;
-       unsigned long bar;
-       struct proc_dir_entry *proc_root = NULL;
-
-       if ((err = pci_enable_device(pcidev)) != 0) {
-               printk(KERN_ERR DEVNAME ": pci_enable_device failed\n");
-               return err;
-       }
-
-       pci_set_master(pcidev);
-       if ((dev = ad1889_alloc_dev(pcidev)) == NULL) {
-               printk(KERN_ERR DEVNAME ": cannot allocate memory for device\n");
-               return -ENOMEM;
-       }
-       pci_set_drvdata(pcidev, dev);
-       bar = pci_resource_start(pcidev, 0);
-       
-        if (!(pci_resource_flags(pcidev, 0) & IORESOURCE_MEM)) {
-               printk(KERN_ERR DEVNAME ": memory region not assigned\n");
-               goto out1;
-       }
-
-       if (pci_request_region(pcidev, 0, DEVNAME)) {
-               printk(KERN_ERR DEVNAME ": unable to request memory region\n");
-               goto out1;
-       }
-
-       dev->regbase = ioremap_nocache(bar, AD_DS_IOMEMSIZE);
-       if (!dev->regbase) {
-               printk(KERN_ERR DEVNAME ": unable to remap iomem\n");
-               goto out2;
-       }
-
-       if (request_irq(pcidev->irq, ad1889_interrupt, IRQF_SHARED, DEVNAME, dev) != 0) {
-               printk(KERN_ERR DEVNAME ": unable to request interrupt\n");
-               goto out3;
-       }
-
-       printk(KERN_INFO DEVNAME ": %s at %p IRQ %d\n",
-               (char *)ent->driver_data, dev->regbase, pcidev->irq);
-
-       if (ad1889_aclink_reset(pcidev) != 0)
-               goto out4;
-
-       /* register /dev/dsp */
-       if ((dev->dev_audio = register_sound_dsp(&ad1889_fops, -1)) < 0) {
-               printk(KERN_ERR DEVNAME ": cannot register /dev/dsp\n");
-               goto out4;
-       }
-
-       if ((err = ad1889_ac97_init(dev, 0)) != 0)
-               goto out5;
-
-       /* XXX: cleanups */
-       if (((proc_root = proc_mkdir("driver/ad1889", NULL)) == NULL) ||
-           create_proc_read_entry("ac97", S_IFREG|S_IRUGO, proc_root, ac97_read_proc, dev->ac97_codec) == NULL ||
-           create_proc_read_entry("info", S_IFREG|S_IRUGO, proc_root, ad1889_read_proc, dev) == NULL) 
-               goto out5;
-       
-       ad1889_initcfg(dev);
-
-       //DBG(DEVNAME ": Driver initialization done!\n");
-
-       ad1889_dev = dev;
-
-       return 0;
-
-out5:
-       unregister_sound_dsp(dev->dev_audio);
-out4:
-       free_irq(pcidev->irq, dev);
-out3:
-       iounmap(dev->regbase);
-out2:
-       pci_release_region(pcidev, 0);
-out1:
-       ad1889_free_dev(dev);
-       pci_set_drvdata(pcidev, NULL);
-
-       return -ENODEV;
-}
-
-static void __devexit ad1889_remove(struct pci_dev *pcidev)
-{
-       ad1889_dev_t *dev = pci_get_drvdata(pcidev);
-
-       if (dev == NULL) return;
-       
-       unregister_sound_mixer(dev->ac97_codec->dev_mixer);
-       unregister_sound_dsp(dev->dev_audio);
-       free_irq(pcidev->irq, dev);
-       iounmap(dev->regbase);
-       pci_release_region(pcidev, 0);
-
-       /* any hw programming needed? */
-       ad1889_free_dev(dev);
-       pci_set_drvdata(pcidev, NULL);
-}
-
-MODULE_AUTHOR("Randolph Chung");
-MODULE_DESCRIPTION("Analog Devices AD1889 PCI Audio");
-MODULE_LICENSE("GPL");
-
-static struct pci_driver ad1889_driver = {
-       .name           = DEVNAME,
-       .id_table       = ad1889_id_tbl,
-       .probe          = ad1889_probe,
-       .remove         = __devexit_p(ad1889_remove),
-};
-
-static int __init ad1889_init_module(void)
-{
-       return pci_register_driver(&ad1889_driver);
-}
-
-static void ad1889_exit_module(void)
-{
-       pci_unregister_driver(&ad1889_driver);
-       return;
-}
-
-module_init(ad1889_init_module);
-module_exit(ad1889_exit_module);
diff --git a/sound/oss/ad1889.h b/sound/oss/ad1889.h
deleted file mode 100644 (file)
index 0991376..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-#ifndef _AD1889_H_
-#define _AD1889_H_
-
-#define AD_DS_WSMC     0x00    /* DMA input wave/syn mixer control */
-#define AD_DS_RAMC     0x02    /* DMA output resamp/ADC mixer control */
-#define AD_DS_WADA     0x04    /* DMA input wave attenuation */
-#define AD_DS_SYDA     0x06    /* DMA input syn attentuation */
-#define AD_DS_WAS      0x08    /* wave input sample rate */
-#define AD_DS_RES      0x0a    /* resampler output sample rate */
-#define AD_DS_CCS      0x0c    /* chip control/status */
-
-#define AD_DMA_RESBA   0x40    /* RES base addr */
-#define AD_DMA_RESCA   0x44    /* RES current addr */
-#define AD_DMA_RESBC   0x48    /* RES base cnt */
-#define AD_DMA_RESCC   0x4c    /* RES current count */
-#define AD_DMA_ADCBA   0x50    /* ADC */
-#define AD_DMA_ADCCA   0x54
-#define AD_DMA_ADCBC   0x58
-#define AD_DMA_ADCCC   0x5c
-#define AD_DMA_SYNBA   0x60    /* SYN */
-#define AD_DMA_SYNCA   0x64
-#define AD_DMA_SYNBC   0x68
-#define AD_DMA_SYNCC   0x6c
-#define AD_DMA_WAVBA   0x70    /* WAV */
-#define AD_DMA_WAVCA   0x74
-#define AD_DMA_WAVBC   0x78
-#define AD_DMA_WAVCC   0x7c
-#define AD_DMA_RESICC  0x80    /* RES interrupt current count */
-#define AD_DMA_RESIBC  0x84    /* RES interrupt base count */
-#define AD_DMA_ADCICC  0x88    /* ADC interrupt current count */
-#define AD_DMA_ADCIBC  0x8c    /* ADC interrupt base count */
-#define AD_DMA_SYNICC  0x90    /* SYN interrupt current count */
-#define AD_DMA_SYNIBC  0x94    /* SYN interrupt base count */
-#define AD_DMA_WAVICC  0x98    /* WAV interrupt current count */
-#define AD_DMA_WAVIBC  0x9c    /* WAV interrupt base count */
-#define AD_DMA_RESCTRL 0xa0    /* RES PCI control/status */
-#define AD_DMA_ADCCTRL 0xa8    /* ADC PCI control/status */
-#define AD_DMA_SYNCTRL 0xb0    /* SYN PCI control/status */
-#define AD_DMA_WAVCTRL 0xb8    /* WAV PCI control/status */
-#define AD_DMA_DISR    0xc0    /* PCI DMA intr status */
-#define AD_DMA_CHSS    0xc4    /* PCI DMA channel stop status */
-
-#define AD_GPIO_IPC    0xc8    /* IO port ctrl */
-#define AD_GPIO_OP     0xca    /* IO output status */
-#define AD_GPIO_IP     0xcc    /* IO input status */
-
-/* AC97 registers, 0x100 - 0x17f; see ac97.h */
-#define AD_AC97_BASE    0x100   /* ac97 base register */
-#define AD_AC97_ACIC   0x180   /* AC Link interface ctrl */
-
-/* OPL3; BAR1 */
-#define AD_OPL_M0AS    0x00    /* Music0 address/status */
-#define AD_OPL_M0DATA  0x01    /* Music0 data */
-#define AD_OPL_M1A     0x02    /* Music1 address */
-#define AD_OPL_M1DATA  0x03    /* Music1 data */
-/* 0x04-0x0f reserved */
-
-/* MIDI; BAR2 */
-#define AD_MIDA                0x00    /* MIDI data */
-#define AD_MISC                0x01    /* MIDI status/cmd */
-/* 0x02-0xff reserved */
-
-#define AD_DS_IOMEMSIZE        512
-#define AD_OPL_MEMSIZE 16
-#define AD_MIDI_MEMSIZE        16
-
-#define AD_WAV_STATE   0
-#define AD_ADC_STATE   1
-#define AD_MAX_STATES  2
-
-#define DMA_SIZE       (128*1024)
-
-#define DMA_FLAG_MAPPED        1
-
-struct ad1889_dev;
-
-typedef struct ad1889_state {
-       struct ad1889_dev *card;
-
-       mode_t open_mode;
-       struct dmabuf {
-               unsigned int rate;
-               unsigned char fmt, enable;
-
-               /* buf management */
-               size_t rawbuf_size;
-               void *rawbuf;
-               dma_addr_t dma_handle;  /* mapped address */
-               unsigned long dma_len;  /* number of bytes mapped */
-
-               /* indexes into rawbuf for setting up DMA engine */
-               volatile unsigned long rd_ptr, wr_ptr;
-
-               wait_queue_head_t wait; /* to wait for buf servicing */
-
-               /* OSS bits */
-               unsigned int mapped:1;
-               unsigned int ready:1;
-               unsigned int ossfragshift;
-               int ossmaxfrags;
-               unsigned int subdivision;
-       } dmabuf;
-
-       struct mutex mutex;
-} ad1889_state_t;
-
-typedef struct ad1889_dev {
-       void __iomem *regbase;
-       struct pci_dev *pci;
-       
-       spinlock_t lock;
-
-       int dev_audio;
-
-       /* states; one per channel; right now only WAV and ADC */
-       struct ad1889_state state[AD_MAX_STATES];
-
-       /* AC97 codec */
-       struct ac97_codec *ac97_codec;
-       u16 ac97_features;
-
-       /* debugging stuff */
-       struct stats {
-               unsigned int wav_intrs, adc_intrs;
-               unsigned int blocks, underrun, error;
-       } stats;
-} ad1889_dev_t;
-
-typedef struct ad1889_reg {
-       const char *name;
-       int offset;
-       int width;
-} ad1889_reg_t;
-
-#endif
diff --git a/sound/oss/adlib_card.c b/sound/oss/adlib_card.c
deleted file mode 100644 (file)
index c9a7c9b..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * sound/oss/adlib_card.c
- *
- * Detection routine for the AdLib card.
- *
- * Copyright (C) by Hannu Savolainen 1993-1997
- *
- * OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
- * Version 2 (June 1991). See the "COPYING" file distributed with this software
- * for more info.
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-
-#include "sound_config.h"
-
-#include "opl3.h"
-
-static void __init attach_adlib_card(struct address_info *hw_config)
-{
-       hw_config->slots[0] = opl3_init(hw_config->io_base, hw_config->osp, THIS_MODULE);
-}
-
-static int __init probe_adlib(struct address_info *hw_config)
-{
-       return opl3_detect(hw_config->io_base, hw_config->osp);
-}
-
-static struct address_info cfg;
-
-static int __initdata io = -1;
-
-module_param(io, int, 0);
-
-static int __init init_adlib(void)
-{
-       cfg.io_base = io;
-
-       if (cfg.io_base == -1) {
-               printk(KERN_ERR "adlib: must specify I/O address.\n");
-               return -EINVAL;
-       }
-       if (probe_adlib(&cfg) == 0)
-               return -ENODEV;
-       attach_adlib_card(&cfg);
-
-       return 0;
-}
-
-static void __exit cleanup_adlib(void)
-{
-       sound_unload_synthdev(cfg.slots[0]);
-       
-}
-
-module_init(init_adlib);
-module_exit(cleanup_adlib);
-
-#ifndef MODULE
-static int __init setup_adlib(char *str)
-{
-        /* io */
-       int ints[2];
-       str = get_options(str, ARRAY_SIZE(ints), ints);
-       
-       io = ints[1];
-
-       return 1;
-}
-__setup("adlib=", setup_adlib);
-#endif
-MODULE_LICENSE("GPL");
diff --git a/sound/oss/cs461x.h b/sound/oss/cs461x.h
deleted file mode 100644 (file)
index 0ce4133..0000000
+++ /dev/null
@@ -1,1691 +0,0 @@
-#ifndef __CS461X_H
-#define __CS461X_H
-
-/*
- *  Copyright (c) by Cirrus Logic Corporation <pcaudio@crystal.cirrus.com>
- *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
- *  Definitions for Cirrus Logic CS461x chips
- *
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License as published by
- *   the Free Software Foundation; either version 2 of the License, or
- *   (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef PCI_VENDOR_ID_CIRRUS
-#define PCI_VENDOR_ID_CIRRUS            0x1013
-#endif
-#ifndef PCI_DEVICE_ID_CIRRUS_4610
-#define PCI_DEVICE_ID_CIRRUS_4610       0x6001
-#endif
-#ifndef PCI_DEVICE_ID_CIRRUS_4612
-#define PCI_DEVICE_ID_CIRRUS_4612       0x6003
-#endif
-#ifndef PCI_DEVICE_ID_CIRRUS_4615
-#define PCI_DEVICE_ID_CIRRUS_4615       0x6004
-#endif
-
-/*
- *  Direct registers
- */
-
-/*
- *  The following define the offsets of the registers accessed via base address
- *  register zero on the CS461x part.
- */
-#define BA0_HISR                               0x00000000
-#define BA0_HSR0                                0x00000004
-#define BA0_HICR                                0x00000008
-#define BA0_DMSR                                0x00000100
-#define BA0_HSAR                                0x00000110
-#define BA0_HDAR                                0x00000114
-#define BA0_HDMR                                0x00000118
-#define BA0_HDCR                                0x0000011C
-#define BA0_PFMC                                0x00000200
-#define BA0_PFCV1                               0x00000204
-#define BA0_PFCV2                               0x00000208
-#define BA0_PCICFG00                            0x00000300
-#define BA0_PCICFG04                            0x00000304
-#define BA0_PCICFG08                            0x00000308
-#define BA0_PCICFG0C                            0x0000030C
-#define BA0_PCICFG10                            0x00000310
-#define BA0_PCICFG14                            0x00000314
-#define BA0_PCICFG18                            0x00000318
-#define BA0_PCICFG1C                            0x0000031C
-#define BA0_PCICFG20                            0x00000320
-#define BA0_PCICFG24                            0x00000324
-#define BA0_PCICFG28                            0x00000328
-#define BA0_PCICFG2C                            0x0000032C
-#define BA0_PCICFG30                            0x00000330
-#define BA0_PCICFG34                            0x00000334
-#define BA0_PCICFG38                            0x00000338
-#define BA0_PCICFG3C                            0x0000033C
-#define BA0_CLKCR1                              0x00000400
-#define BA0_CLKCR2                              0x00000404
-#define BA0_PLLM                                0x00000408
-#define BA0_PLLCC                               0x0000040C
-#define BA0_FRR                                 0x00000410 
-#define BA0_CFL1                                0x00000414
-#define BA0_CFL2                                0x00000418
-#define BA0_SERMC1                              0x00000420
-#define BA0_SERMC2                              0x00000424
-#define BA0_SERC1                               0x00000428
-#define BA0_SERC2                               0x0000042C
-#define BA0_SERC3                               0x00000430
-#define BA0_SERC4                               0x00000434
-#define BA0_SERC5                               0x00000438
-#define BA0_SERBSP                              0x0000043C
-#define BA0_SERBST                              0x00000440
-#define BA0_SERBCM                              0x00000444
-#define BA0_SERBAD                              0x00000448
-#define BA0_SERBCF                              0x0000044C
-#define BA0_SERBWP                              0x00000450
-#define BA0_SERBRP                              0x00000454
-#ifndef NO_CS4612
-#define BA0_ASER_FADDR                          0x00000458
-#endif
-#define BA0_ACCTL                               0x00000460
-#define BA0_ACSTS                               0x00000464
-#define BA0_ACOSV                               0x00000468
-#define BA0_ACCAD                               0x0000046C
-#define BA0_ACCDA                               0x00000470
-#define BA0_ACISV                               0x00000474
-#define BA0_ACSAD                               0x00000478
-#define BA0_ACSDA                               0x0000047C
-#define BA0_JSPT                                0x00000480
-#define BA0_JSCTL                               0x00000484
-#define BA0_JSC1                                0x00000488
-#define BA0_JSC2                                0x0000048C
-#define BA0_MIDCR                               0x00000490
-#define BA0_MIDSR                               0x00000494
-#define BA0_MIDWP                               0x00000498
-#define BA0_MIDRP                               0x0000049C
-#define BA0_JSIO                                0x000004A0
-#ifndef NO_CS4612
-#define BA0_ASER_MASTER                         0x000004A4
-#endif
-#define BA0_CFGI                                0x000004B0
-#define BA0_SSVID                               0x000004B4
-#define BA0_GPIOR                               0x000004B8
-#ifndef NO_CS4612
-#define BA0_EGPIODR                             0x000004BC
-#define BA0_EGPIOPTR                            0x000004C0
-#define BA0_EGPIOTR                             0x000004C4
-#define BA0_EGPIOWR                             0x000004C8
-#define BA0_EGPIOSR                             0x000004CC
-#define BA0_SERC6                               0x000004D0
-#define BA0_SERC7                               0x000004D4
-#define BA0_SERACC                              0x000004D8
-#define BA0_ACCTL2                              0x000004E0
-#define BA0_ACSTS2                              0x000004E4
-#define BA0_ACOSV2                              0x000004E8
-#define BA0_ACCAD2                              0x000004EC
-#define BA0_ACCDA2                              0x000004F0
-#define BA0_ACISV2                              0x000004F4
-#define BA0_ACSAD2                              0x000004F8
-#define BA0_ACSDA2                              0x000004FC
-#define BA0_IOTAC0                              0x00000500
-#define BA0_IOTAC1                              0x00000504
-#define BA0_IOTAC2                              0x00000508
-#define BA0_IOTAC3                              0x0000050C
-#define BA0_IOTAC4                              0x00000510
-#define BA0_IOTAC5                              0x00000514
-#define BA0_IOTAC6                              0x00000518
-#define BA0_IOTAC7                              0x0000051C
-#define BA0_IOTAC8                              0x00000520
-#define BA0_IOTAC9                              0x00000524
-#define BA0_IOTAC10                             0x00000528
-#define BA0_IOTAC11                             0x0000052C
-#define BA0_IOTFR0                              0x00000540
-#define BA0_IOTFR1                              0x00000544
-#define BA0_IOTFR2                              0x00000548
-#define BA0_IOTFR3                              0x0000054C
-#define BA0_IOTFR4                              0x00000550
-#define BA0_IOTFR5                              0x00000554
-#define BA0_IOTFR6                              0x00000558
-#define BA0_IOTFR7                              0x0000055C
-#define BA0_IOTFIFO                             0x00000580
-#define BA0_IOTRRD                              0x00000584
-#define BA0_IOTFP                               0x00000588
-#define BA0_IOTCR                               0x0000058C
-#define BA0_DPCID                               0x00000590
-#define BA0_DPCIA                               0x00000594
-#define BA0_DPCIC                               0x00000598
-#define BA0_PCPCIR                              0x00000600
-#define BA0_PCPCIG                              0x00000604
-#define BA0_PCPCIEN                             0x00000608
-#define BA0_EPCIPMC                             0x00000610
-#endif
-
-/*
- *  The following define the offsets of the registers and memories accessed via
- *  base address register one on the CS461x part.
- */
-#define BA1_SP_DMEM0                            0x00000000
-#define BA1_SP_DMEM1                            0x00010000
-#define BA1_SP_PMEM                             0x00020000
-#define BA1_SP_REG                             0x00030000
-#define BA1_SPCR                                0x00030000
-#define BA1_DREG                                0x00030004
-#define BA1_DSRWP                               0x00030008
-#define BA1_TWPR                                0x0003000C
-#define BA1_SPWR                                0x00030010
-#define BA1_SPIR                                0x00030014
-#define BA1_FGR1                                0x00030020
-#define BA1_SPCS                                0x00030028
-#define BA1_SDSR                                0x0003002C
-#define BA1_FRMT                                0x00030030
-#define BA1_FRCC                                0x00030034
-#define BA1_FRSC                                0x00030038
-#define BA1_OMNI_MEM                            0x000E0000
-
-/*
- *  The following defines are for the flags in the host interrupt status
- *  register.
- */
-#define HISR_VC_MASK                            0x0000FFFF
-#define HISR_VC0                                0x00000001
-#define HISR_VC1                                0x00000002
-#define HISR_VC2                                0x00000004
-#define HISR_VC3                                0x00000008
-#define HISR_VC4                                0x00000010
-#define HISR_VC5                                0x00000020
-#define HISR_VC6                                0x00000040
-#define HISR_VC7                                0x00000080
-#define HISR_VC8                                0x00000100
-#define HISR_VC9                                0x00000200
-#define HISR_VC10                               0x00000400
-#define HISR_VC11                               0x00000800
-#define HISR_VC12                               0x00001000
-#define HISR_VC13                               0x00002000
-#define HISR_VC14                               0x00004000
-#define HISR_VC15                               0x00008000
-#define HISR_INT0                               0x00010000
-#define HISR_INT1                               0x00020000
-#define HISR_DMAI                               0x00040000
-#define HISR_FROVR                              0x00080000
-#define HISR_MIDI                               0x00100000
-#ifdef NO_CS4612
-#define HISR_RESERVED                           0x0FE00000
-#else
-#define HISR_SBINT                              0x00200000
-#define HISR_RESERVED                           0x0FC00000
-#endif
-#define HISR_H0P                                0x40000000
-#define HISR_INTENA                             0x80000000
-
-/*
- *  The following defines are for the flags in the host signal register 0.
- */
-#define HSR0_VC_MASK                            0xFFFFFFFF
-#define HSR0_VC16                               0x00000001
-#define HSR0_VC17                               0x00000002
-#define HSR0_VC18                               0x00000004
-#define HSR0_VC19                               0x00000008
-#define HSR0_VC20                               0x00000010
-#define HSR0_VC21                               0x00000020
-#define HSR0_VC22                               0x00000040
-#define HSR0_VC23                               0x00000080
-#define HSR0_VC24                               0x00000100
-#define HSR0_VC25                               0x00000200
-#define HSR0_VC26                               0x00000400
-#define HSR0_VC27                               0x00000800
-#define HSR0_VC28                               0x00001000
-#define HSR0_VC29                               0x00002000
-#define HSR0_VC30                               0x00004000
-#define HSR0_VC31                               0x00008000
-#define HSR0_VC32                               0x00010000
-#define HSR0_VC33                               0x00020000
-#define HSR0_VC34                               0x00040000
-#define HSR0_VC35                               0x00080000
-#define HSR0_VC36                               0x00100000
-#define HSR0_VC37                               0x00200000
-#define HSR0_VC38                               0x00400000
-#define HSR0_VC39                               0x00800000
-#define HSR0_VC40                               0x01000000
-#define HSR0_VC41                               0x02000000
-#define HSR0_VC42                               0x04000000
-#define HSR0_VC43                               0x08000000
-#define HSR0_VC44                               0x10000000
-#define HSR0_VC45                               0x20000000
-#define HSR0_VC46                               0x40000000
-#define HSR0_VC47                               0x80000000
-
-/*
- *  The following defines are for the flags in the host interrupt control
- *  register.
- */
-#define HICR_IEV                                0x00000001
-#define HICR_CHGM                               0x00000002
-
-/*
- *  The following defines are for the flags in the DMA status register.
- */
-#define DMSR_HP                                 0x00000001
-#define DMSR_HR                                 0x00000002
-#define DMSR_SP                                 0x00000004
-#define DMSR_SR                                 0x00000008
-
-/*
- *  The following defines are for the flags in the host DMA source address
- *  register.
- */
-#define HSAR_HOST_ADDR_MASK                     0xFFFFFFFF
-#define HSAR_DSP_ADDR_MASK                      0x0000FFFF
-#define HSAR_MEMID_MASK                         0x000F0000
-#define HSAR_MEMID_SP_DMEM0                     0x00000000
-#define HSAR_MEMID_SP_DMEM1                     0x00010000
-#define HSAR_MEMID_SP_PMEM                      0x00020000
-#define HSAR_MEMID_SP_DEBUG                     0x00030000
-#define HSAR_MEMID_OMNI_MEM                     0x000E0000
-#define HSAR_END                                0x40000000
-#define HSAR_ERR                                0x80000000
-
-/*
- *  The following defines are for the flags in the host DMA destination address
- *  register.
- */
-#define HDAR_HOST_ADDR_MASK                     0xFFFFFFFF
-#define HDAR_DSP_ADDR_MASK                      0x0000FFFF
-#define HDAR_MEMID_MASK                         0x000F0000
-#define HDAR_MEMID_SP_DMEM0                     0x00000000
-#define HDAR_MEMID_SP_DMEM1                     0x00010000
-#define HDAR_MEMID_SP_PMEM                      0x00020000
-#define HDAR_MEMID_SP_DEBUG                     0x00030000
-#define HDAR_MEMID_OMNI_MEM                     0x000E0000
-#define HDAR_END                                0x40000000
-#define HDAR_ERR                                0x80000000
-
-/*
- *  The following defines are for the flags in the host DMA control register.
- */
-#define HDMR_AC_MASK                            0x0000F000
-#define HDMR_AC_8_16                            0x00001000
-#define HDMR_AC_M_S                             0x00002000
-#define HDMR_AC_B_L                             0x00004000
-#define HDMR_AC_S_U                             0x00008000
-
-/*
- *  The following defines are for the flags in the host DMA control register.
- */
-#define HDCR_COUNT_MASK                         0x000003FF
-#define HDCR_DONE                               0x00004000
-#define HDCR_OPT                                0x00008000
-#define HDCR_WBD                                0x00400000
-#define HDCR_WBS                                0x00800000
-#define HDCR_DMS_MASK                           0x07000000
-#define HDCR_DMS_LINEAR                         0x00000000
-#define HDCR_DMS_16_DWORDS                      0x01000000
-#define HDCR_DMS_32_DWORDS                      0x02000000
-#define HDCR_DMS_64_DWORDS                      0x03000000
-#define HDCR_DMS_128_DWORDS                     0x04000000
-#define HDCR_DMS_256_DWORDS                     0x05000000
-#define HDCR_DMS_512_DWORDS                     0x06000000
-#define HDCR_DMS_1024_DWORDS                    0x07000000
-#define HDCR_DH                                 0x08000000
-#define HDCR_SMS_MASK                           0x70000000
-#define HDCR_SMS_LINEAR                         0x00000000
-#define HDCR_SMS_16_DWORDS                      0x10000000
-#define HDCR_SMS_32_DWORDS                      0x20000000
-#define HDCR_SMS_64_DWORDS                      0x30000000
-#define HDCR_SMS_128_DWORDS                     0x40000000
-#define HDCR_SMS_256_DWORDS                     0x50000000
-#define HDCR_SMS_512_DWORDS                     0x60000000
-#define HDCR_SMS_1024_DWORDS                    0x70000000
-#define HDCR_SH                                 0x80000000
-#define HDCR_COUNT_SHIFT                        0
-
-/*
- *  The following defines are for the flags in the performance monitor control
- *  register.
- */
-#define PFMC_C1SS_MASK                          0x0000001F
-#define PFMC_C1EV                               0x00000020
-#define PFMC_C1RS                               0x00008000
-#define PFMC_C2SS_MASK                          0x001F0000
-#define PFMC_C2EV                               0x00200000
-#define PFMC_C2RS                               0x80000000
-#define PFMC_C1SS_SHIFT                         0
-#define PFMC_C2SS_SHIFT                         16
-#define PFMC_BUS_GRANT                          0
-#define PFMC_GRANT_AFTER_REQ                    1
-#define PFMC_TRANSACTION                        2
-#define PFMC_DWORD_TRANSFER                     3
-#define PFMC_SLAVE_READ                         4
-#define PFMC_SLAVE_WRITE                        5
-#define PFMC_PREEMPTION                         6
-#define PFMC_DISCONNECT_RETRY                   7
-#define PFMC_INTERRUPT                          8
-#define PFMC_BUS_OWNERSHIP                      9
-#define PFMC_TRANSACTION_LAG                    10
-#define PFMC_PCI_CLOCK                          11
-#define PFMC_SERIAL_CLOCK                       12
-#define PFMC_SP_CLOCK                           13
-
-/*
- *  The following defines are for the flags in the performance counter value 1
- *  register.
- */
-#define PFCV1_PC1V_MASK                         0xFFFFFFFF
-#define PFCV1_PC1V_SHIFT                        0
-
-/*
- *  The following defines are for the flags in the performance counter value 2
- *  register.
- */
-#define PFCV2_PC2V_MASK                         0xFFFFFFFF
-#define PFCV2_PC2V_SHIFT                        0
-
-/*
- *  The following defines are for the flags in the clock control register 1.
- */
-#define CLKCR1_OSCS                             0x00000001
-#define CLKCR1_OSCP                             0x00000002
-#define CLKCR1_PLLSS_MASK                       0x0000000C
-#define CLKCR1_PLLSS_SERIAL                     0x00000000
-#define CLKCR1_PLLSS_CRYSTAL                    0x00000004
-#define CLKCR1_PLLSS_PCI                        0x00000008
-#define CLKCR1_PLLSS_RESERVED                   0x0000000C
-#define CLKCR1_PLLP                             0x00000010
-#define CLKCR1_SWCE                             0x00000020
-#define CLKCR1_PLLOS                            0x00000040
-
-/*
- *  The following defines are for the flags in the clock control register 2.
- */
-#define CLKCR2_PDIVS_MASK                       0x0000000F
-#define CLKCR2_PDIVS_1                          0x00000001
-#define CLKCR2_PDIVS_2                          0x00000002
-#define CLKCR2_PDIVS_4                          0x00000004
-#define CLKCR2_PDIVS_7                          0x00000007
-#define CLKCR2_PDIVS_8                          0x00000008
-#define CLKCR2_PDIVS_16                         0x00000000
-
-/*
- *  The following defines are for the flags in the PLL multiplier register.
- */
-#define PLLM_MASK                               0x000000FF
-#define PLLM_SHIFT                              0
-
-/*
- *  The following defines are for the flags in the PLL capacitor coefficient
- *  register.
- */
-#define PLLCC_CDR_MASK                          0x00000007
-#ifndef NO_CS4610
-#define PLLCC_CDR_240_350_MHZ                   0x00000000
-#define PLLCC_CDR_184_265_MHZ                   0x00000001
-#define PLLCC_CDR_144_205_MHZ                   0x00000002
-#define PLLCC_CDR_111_160_MHZ                   0x00000003
-#define PLLCC_CDR_87_123_MHZ                    0x00000004
-#define PLLCC_CDR_67_96_MHZ                     0x00000005
-#define PLLCC_CDR_52_74_MHZ                     0x00000006
-#define PLLCC_CDR_45_58_MHZ                     0x00000007
-#endif
-#ifndef NO_CS4612
-#define PLLCC_CDR_271_398_MHZ                   0x00000000
-#define PLLCC_CDR_227_330_MHZ                   0x00000001
-#define PLLCC_CDR_167_239_MHZ                   0x00000002
-#define PLLCC_CDR_150_215_MHZ                   0x00000003
-#define PLLCC_CDR_107_154_MHZ                   0x00000004
-#define PLLCC_CDR_98_140_MHZ                    0x00000005
-#define PLLCC_CDR_73_104_MHZ                    0x00000006
-#define PLLCC_CDR_63_90_MHZ                     0x00000007
-#endif
-#define PLLCC_LPF_MASK                          0x000000F8
-#ifndef NO_CS4610
-#define PLLCC_LPF_23850_60000_KHZ               0x00000000
-#define PLLCC_LPF_7960_26290_KHZ                0x00000008
-#define PLLCC_LPF_4160_10980_KHZ                0x00000018
-#define PLLCC_LPF_1740_4580_KHZ                 0x00000038
-#define PLLCC_LPF_724_1910_KHZ                  0x00000078
-#define PLLCC_LPF_317_798_KHZ                   0x000000F8
-#endif
-#ifndef NO_CS4612
-#define PLLCC_LPF_25580_64530_KHZ               0x00000000
-#define PLLCC_LPF_14360_37270_KHZ               0x00000008
-#define PLLCC_LPF_6100_16020_KHZ                0x00000018
-#define PLLCC_LPF_2540_6690_KHZ                 0x00000038
-#define PLLCC_LPF_1050_2780_KHZ                 0x00000078
-#define PLLCC_LPF_450_1160_KHZ                  0x000000F8
-#endif
-
-/*
- *  The following defines are for the flags in the feature reporting register.
- */
-#define FRR_FAB_MASK                            0x00000003
-#define FRR_MASK_MASK                           0x0000001C
-#ifdef NO_CS4612
-#define FRR_CFOP_MASK                           0x000000E0
-#else
-#define FRR_CFOP_MASK                           0x00000FE0
-#endif
-#define FRR_CFOP_NOT_DVD                        0x00000020
-#define FRR_CFOP_A3D                            0x00000040
-#define FRR_CFOP_128_PIN                        0x00000080
-#ifndef NO_CS4612
-#define FRR_CFOP_CS4280                         0x00000800
-#endif
-#define FRR_FAB_SHIFT                           0
-#define FRR_MASK_SHIFT                          2
-#define FRR_CFOP_SHIFT                          5
-
-/*
- *  The following defines are for the flags in the configuration load 1
- *  register.
- */
-#define CFL1_CLOCK_SOURCE_MASK                  0x00000003
-#define CFL1_CLOCK_SOURCE_CS423X                0x00000000
-#define CFL1_CLOCK_SOURCE_AC97                  0x00000001
-#define CFL1_CLOCK_SOURCE_CRYSTAL               0x00000002
-#define CFL1_CLOCK_SOURCE_DUAL_AC97             0x00000003
-#define CFL1_VALID_DATA_MASK                    0x000000FF
-
-/*
- *  The following defines are for the flags in the configuration load 2
- *  register.
- */
-#define CFL2_VALID_DATA_MASK                    0x000000FF
-
-/*
- *  The following defines are for the flags in the serial port master control
- *  register 1.
- */
-#define SERMC1_MSPE                             0x00000001
-#define SERMC1_PTC_MASK                         0x0000000E
-#define SERMC1_PTC_CS423X                       0x00000000
-#define SERMC1_PTC_AC97                         0x00000002
-#define SERMC1_PTC_DAC                          0x00000004
-#define SERMC1_PLB                              0x00000010
-#define SERMC1_XLB                              0x00000020
-
-/*
- *  The following defines are for the flags in the serial port master control
- *  register 2.
- */
-#define SERMC2_LROE                             0x00000001
-#define SERMC2_MCOE                             0x00000002
-#define SERMC2_MCDIV                            0x00000004
-
-/*
- *  The following defines are for the flags in the serial port 1 configuration
- *  register.
- */
-#define SERC1_SO1EN                             0x00000001
-#define SERC1_SO1F_MASK                         0x0000000E
-#define SERC1_SO1F_CS423X                       0x00000000
-#define SERC1_SO1F_AC97                         0x00000002
-#define SERC1_SO1F_DAC                          0x00000004
-#define SERC1_SO1F_SPDIF                        0x00000006
-
-/*
- *  The following defines are for the flags in the serial port 2 configuration
- *  register.
- */
-#define SERC2_SI1EN                             0x00000001
-#define SERC2_SI1F_MASK                         0x0000000E
-#define SERC2_SI1F_CS423X                       0x00000000
-#define SERC2_SI1F_AC97                         0x00000002
-#define SERC2_SI1F_ADC                          0x00000004
-#define SERC2_SI1F_SPDIF                        0x00000006
-
-/*
- *  The following defines are for the flags in the serial port 3 configuration
- *  register.
- */
-#define SERC3_SO2EN                             0x00000001
-#define SERC3_SO2F_MASK                         0x00000006
-#define SERC3_SO2F_DAC                          0x00000000
-#define SERC3_SO2F_SPDIF                        0x00000002
-
-/*
- *  The following defines are for the flags in the serial port 4 configuration
- *  register.
- */
-#define SERC4_SO3EN                             0x00000001
-#define SERC4_SO3F_MASK                         0x00000006
-#define SERC4_SO3F_DAC                          0x00000000
-#define SERC4_SO3F_SPDIF                        0x00000002
-
-/*
- *  The following defines are for the flags in the serial port 5 configuration
- *  register.
- */
-#define SERC5_SI2EN                             0x00000001
-#define SERC5_SI2F_MASK                         0x00000006
-#define SERC5_SI2F_ADC                          0x00000000
-#define SERC5_SI2F_SPDIF                        0x00000002
-
-/*
- *  The following defines are for the flags in the serial port backdoor sample
- *  pointer register.
- */
-#define SERBSP_FSP_MASK                         0x0000000F
-#define SERBSP_FSP_SHIFT                        0
-
-/*
- *  The following defines are for the flags in the serial port backdoor status
- *  register.
- */
-#define SERBST_RRDY                             0x00000001
-#define SERBST_WBSY                             0x00000002
-
-/*
- *  The following defines are for the flags in the serial port backdoor command
- *  register.
- */
-#define SERBCM_RDC                              0x00000001
-#define SERBCM_WRC                              0x00000002
-
-/*
- *  The following defines are for the flags in the serial port backdoor address
- *  register.
- */
-#ifdef NO_CS4612
-#define SERBAD_FAD_MASK                         0x000000FF
-#else
-#define SERBAD_FAD_MASK                         0x000001FF
-#endif
-#define SERBAD_FAD_SHIFT                        0
-
-/*
- *  The following defines are for the flags in the serial port backdoor
- *  configuration register.
- */
-#define SERBCF_HBP                              0x00000001
-
-/*
- *  The following defines are for the flags in the serial port backdoor write
- *  port register.
- */
-#define SERBWP_FWD_MASK                         0x000FFFFF
-#define SERBWP_FWD_SHIFT                        0
-
-/*
- *  The following defines are for the flags in the serial port backdoor read
- *  port register.
- */
-#define SERBRP_FRD_MASK                         0x000FFFFF
-#define SERBRP_FRD_SHIFT                        0
-
-/*
- *  The following defines are for the flags in the async FIFO address register.
- */
-#ifndef NO_CS4612
-#define ASER_FADDR_A1_MASK                      0x000001FF
-#define ASER_FADDR_EN1                          0x00008000
-#define ASER_FADDR_A2_MASK                      0x01FF0000
-#define ASER_FADDR_EN2                          0x80000000
-#define ASER_FADDR_A1_SHIFT                     0
-#define ASER_FADDR_A2_SHIFT                     16
-#endif
-
-/*
- *  The following defines are for the flags in the AC97 control register.
- */
-#define ACCTL_RSTN                              0x00000001
-#define ACCTL_ESYN                              0x00000002
-#define ACCTL_VFRM                              0x00000004
-#define ACCTL_DCV                               0x00000008
-#define ACCTL_CRW                               0x00000010
-#define ACCTL_ASYN                              0x00000020
-#ifndef NO_CS4612
-#define ACCTL_TC                                0x00000040
-#endif
-
-/*
- *  The following defines are for the flags in the AC97 status register.
- */
-#define ACSTS_CRDY                              0x00000001
-#define ACSTS_VSTS                              0x00000002
-#ifndef NO_CS4612
-#define ACSTS_WKUP                              0x00000004
-#endif
-
-/*
- *  The following defines are for the flags in the AC97 output slot valid
- *  register.
- */
-#define ACOSV_SLV3                              0x00000001
-#define ACOSV_SLV4                              0x00000002
-#define ACOSV_SLV5                              0x00000004
-#define ACOSV_SLV6                              0x00000008
-#define ACOSV_SLV7                              0x00000010
-#define ACOSV_SLV8                              0x00000020
-#define ACOSV_SLV9                              0x00000040
-#define ACOSV_SLV10                             0x00000080
-#define ACOSV_SLV11                             0x00000100
-#define ACOSV_SLV12                             0x00000200
-
-/*
- *  The following defines are for the flags in the AC97 command address
- *  register.
- */
-#define ACCAD_CI_MASK                           0x0000007F
-#define ACCAD_CI_SHIFT                          0
-
-/*
- *  The following defines are for the flags in the AC97 command data register.
- */
-#define ACCDA_CD_MASK                           0x0000FFFF
-#define ACCDA_CD_SHIFT                          0
-
-/*
- *  The following defines are for the flags in the AC97 input slot valid
- *  register.
- */
-#define ACISV_ISV3                              0x00000001
-#define ACISV_ISV4                              0x00000002
-#define ACISV_ISV5                              0x00000004
-#define ACISV_ISV6                              0x00000008
-#define ACISV_ISV7                              0x00000010
-#define ACISV_ISV8                              0x00000020
-#define ACISV_ISV9                              0x00000040
-#define ACISV_ISV10                             0x00000080
-#define ACISV_ISV11                             0x00000100
-#define ACISV_ISV12                             0x00000200
-
-/*
- *  The following defines are for the flags in the AC97 status address
- *  register.
- */
-#define ACSAD_SI_MASK                           0x0000007F
-#define ACSAD_SI_SHIFT                          0
-
-/*
- *  The following defines are for the flags in the AC97 status data register.
- */
-#define ACSDA_SD_MASK                           0x0000FFFF
-#define ACSDA_SD_SHIFT                          0
-
-/*
- *  The following defines are for the flags in the joystick poll/trigger
- *  register.
- */
-#define JSPT_CAX                                0x00000001
-#define JSPT_CAY                                0x00000002
-#define JSPT_CBX                                0x00000004
-#define JSPT_CBY                                0x00000008
-#define JSPT_BA1                                0x00000010
-#define JSPT_BA2                                0x00000020
-#define JSPT_BB1                                0x00000040
-#define JSPT_BB2                                0x00000080
-
-/*
- *  The following defines are for the flags in the joystick control register.
- */
-#define JSCTL_SP_MASK                           0x00000003
-#define JSCTL_SP_SLOW                           0x00000000
-#define JSCTL_SP_MEDIUM_SLOW                    0x00000001
-#define JSCTL_SP_MEDIUM_FAST                    0x00000002
-#define JSCTL_SP_FAST                           0x00000003
-#define JSCTL_ARE                               0x00000004
-
-/*
- *  The following defines are for the flags in the joystick coordinate pair 1
- *  readback register.
- */
-#define JSC1_Y1V_MASK                           0x0000FFFF
-#define JSC1_X1V_MASK                           0xFFFF0000
-#define JSC1_Y1V_SHIFT                          0
-#define JSC1_X1V_SHIFT                          16
-
-/*
- *  The following defines are for the flags in the joystick coordinate pair 2
- *  readback register.
- */
-#define JSC2_Y2V_MASK                           0x0000FFFF
-#define JSC2_X2V_MASK                           0xFFFF0000
-#define JSC2_Y2V_SHIFT                          0
-#define JSC2_X2V_SHIFT                          16
-
-/*
- *  The following defines are for the flags in the MIDI control register.
- */
-#define MIDCR_TXE                               0x00000001     /* Enable transmitting. */
-#define MIDCR_RXE                               0x00000002     /* Enable receiving. */
-#define MIDCR_RIE                               0x00000004     /* Interrupt upon tx ready. */
-#define MIDCR_TIE                               0x00000008     /* Interrupt upon rx ready. */
-#define MIDCR_MLB                               0x00000010     /* Enable midi loopback. */
-#define MIDCR_MRST                              0x00000020     /* Reset interface. */
-
-/*
- *  The following defines are for the flags in the MIDI status register.
- */
-#define MIDSR_TBF                               0x00000001     /* Tx FIFO is full. */
-#define MIDSR_RBE                               0x00000002     /* Rx FIFO is empty. */
-
-/*
- *  The following defines are for the flags in the MIDI write port register.
- */
-#define MIDWP_MWD_MASK                          0x000000FF
-#define MIDWP_MWD_SHIFT                         0
-
-/*
- *  The following defines are for the flags in the MIDI read port register.
- */
-#define MIDRP_MRD_MASK                          0x000000FF
-#define MIDRP_MRD_SHIFT                         0
-
-/*
- *  The following defines are for the flags in the joystick GPIO register.
- */
-#define JSIO_DAX                                0x00000001
-#define JSIO_DAY                                0x00000002
-#define JSIO_DBX                                0x00000004
-#define JSIO_DBY                                0x00000008
-#define JSIO_AXOE                               0x00000010
-#define JSIO_AYOE                               0x00000020
-#define JSIO_BXOE                               0x00000040
-#define JSIO_BYOE                               0x00000080
-
-/*
- *  The following defines are for the flags in the master async/sync serial
- *  port enable register.
- */
-#ifndef NO_CS4612
-#define ASER_MASTER_ME                          0x00000001
-#endif
-
-/*
- *  The following defines are for the flags in the configuration interface
- *  register.
- */
-#define CFGI_CLK                                0x00000001
-#define CFGI_DOUT                               0x00000002
-#define CFGI_DIN_EEN                            0x00000004
-#define CFGI_EELD                               0x00000008
-
-/*
- *  The following defines are for the flags in the subsystem ID and vendor ID
- *  register.
- */
-#define SSVID_VID_MASK                          0x0000FFFF
-#define SSVID_SID_MASK                          0xFFFF0000
-#define SSVID_VID_SHIFT                         0
-#define SSVID_SID_SHIFT                         16
-
-/*
- *  The following defines are for the flags in the GPIO pin interface register.
- */
-#define GPIOR_VOLDN                             0x00000001
-#define GPIOR_VOLUP                             0x00000002
-#define GPIOR_SI2D                              0x00000004
-#define GPIOR_SI2OE                             0x00000008
-
-/*
- *  The following defines are for the flags in the extended GPIO pin direction
- *  register.
- */
-#ifndef NO_CS4612
-#define EGPIODR_GPOE0                           0x00000001
-#define EGPIODR_GPOE1                           0x00000002
-#define EGPIODR_GPOE2                           0x00000004
-#define EGPIODR_GPOE3                           0x00000008
-#define EGPIODR_GPOE4                           0x00000010
-#define EGPIODR_GPOE5                           0x00000020
-#define EGPIODR_GPOE6                           0x00000040
-#define EGPIODR_GPOE7                           0x00000080
-#define EGPIODR_GPOE8                           0x00000100
-#endif
-
-/*
- *  The following defines are for the flags in the extended GPIO pin polarity/
- *  type register.
- */
-#ifndef NO_CS4612
-#define EGPIOPTR_GPPT0                          0x00000001
-#define EGPIOPTR_GPPT1                          0x00000002
-#define EGPIOPTR_GPPT2                          0x00000004
-#define EGPIOPTR_GPPT3                          0x00000008
-#define EGPIOPTR_GPPT4                          0x00000010
-#define EGPIOPTR_GPPT5                          0x00000020
-#define EGPIOPTR_GPPT6                          0x00000040
-#define EGPIOPTR_GPPT7                          0x00000080
-#define EGPIOPTR_GPPT8                          0x00000100
-#endif
-
-/*
- *  The following defines are for the flags in the extended GPIO pin sticky
- *  register.
- */
-#ifndef NO_CS4612
-#define EGPIOTR_GPS0                            0x00000001
-#define EGPIOTR_GPS1                            0x00000002
-#define EGPIOTR_GPS2                            0x00000004
-#define EGPIOTR_GPS3                            0x00000008
-#define EGPIOTR_GPS4                            0x00000010
-#define EGPIOTR_GPS5                            0x00000020
-#define EGPIOTR_GPS6                            0x00000040
-#define EGPIOTR_GPS7                            0x00000080
-#define EGPIOTR_GPS8                            0x00000100
-#endif
-
-/*
- *  The following defines are for the flags in the extended GPIO ping wakeup
- *  register.
- */
-#ifndef NO_CS4612
-#define EGPIOWR_GPW0                            0x00000001
-#define EGPIOWR_GPW1                            0x00000002
-#define EGPIOWR_GPW2                            0x00000004
-#define EGPIOWR_GPW3                            0x00000008
-#define EGPIOWR_GPW4                            0x00000010
-#define EGPIOWR_GPW5                            0x00000020
-#define EGPIOWR_GPW6                            0x00000040
-#define EGPIOWR_GPW7                            0x00000080
-#define EGPIOWR_GPW8                            0x00000100
-#endif
-
-/*
- *  The following defines are for the flags in the extended GPIO pin status
- *  register.
- */
-#ifndef NO_CS4612
-#define EGPIOSR_GPS0                            0x00000001
-#define EGPIOSR_GPS1                            0x00000002
-#define EGPIOSR_GPS2                            0x00000004
-#define EGPIOSR_GPS3                            0x00000008
-#define EGPIOSR_GPS4                            0x00000010
-#define EGPIOSR_GPS5                            0x00000020
-#define EGPIOSR_GPS6                            0x00000040
-#define EGPIOSR_GPS7                            0x00000080
-#define EGPIOSR_GPS8                            0x00000100
-#endif
-
-/*
- *  The following defines are for the flags in the serial port 6 configuration
- *  register.
- */
-#ifndef NO_CS4612
-#define SERC6_ASDO2EN                           0x00000001
-#endif
-
-/*
- *  The following defines are for the flags in the serial port 7 configuration
- *  register.
- */
-#ifndef NO_CS4612
-#define SERC7_ASDI2EN                           0x00000001
-#define SERC7_POSILB                            0x00000002
-#define SERC7_SIPOLB                            0x00000004
-#define SERC7_SOSILB                            0x00000008
-#define SERC7_SISOLB                            0x00000010
-#endif
-
-/*
- *  The following defines are for the flags in the serial port AC link
- *  configuration register.
- */
-#ifndef NO_CS4612
-#define SERACC_CODEC_TYPE_MASK                  0x00000001
-#define SERACC_CODEC_TYPE_1_03                  0x00000000
-#define SERACC_CODEC_TYPE_2_0                   0x00000001
-#define SERACC_TWO_CODECS                       0x00000002
-#define SERACC_MDM                              0x00000004
-#define SERACC_HSP                              0x00000008
-#endif
-
-/*
- *  The following defines are for the flags in the AC97 control register 2.
- */
-#ifndef NO_CS4612
-#define ACCTL2_RSTN                             0x00000001
-#define ACCTL2_ESYN                             0x00000002
-#define ACCTL2_VFRM                             0x00000004
-#define ACCTL2_DCV                              0x00000008
-#define ACCTL2_CRW                              0x00000010
-#define ACCTL2_ASYN                             0x00000020
-#endif
-
-/*
- *  The following defines are for the flags in the AC97 status register 2.
- */
-#ifndef NO_CS4612
-#define ACSTS2_CRDY                             0x00000001
-#define ACSTS2_VSTS                             0x00000002
-#endif
-
-/*
- *  The following defines are for the flags in the AC97 output slot valid
- *  register 2.
- */
-#ifndef NO_CS4612
-#define ACOSV2_SLV3                             0x00000001
-#define ACOSV2_SLV4                             0x00000002
-#define ACOSV2_SLV5                             0x00000004
-#define ACOSV2_SLV6                             0x00000008
-#define ACOSV2_SLV7                             0x00000010
-#define ACOSV2_SLV8                             0x00000020
-#define ACOSV2_SLV9                             0x00000040
-#define ACOSV2_SLV10                            0x00000080
-#define ACOSV2_SLV11                            0x00000100
-#define ACOSV2_SLV12                            0x00000200
-#endif
-
-/*
- *  The following defines are for the flags in the AC97 command address
- *  register 2.
- */
-#ifndef NO_CS4612
-#define ACCAD2_CI_MASK                          0x0000007F
-#define ACCAD2_CI_SHIFT                         0
-#endif
-
-/*
- *  The following defines are for the flags in the AC97 command data register
- *  2.
- */
-#ifndef NO_CS4612
-#define ACCDA2_CD_MASK                          0x0000FFFF
-#define ACCDA2_CD_SHIFT                         0  
-#endif
-
-/*
- *  The following defines are for the flags in the AC97 input slot valid
- *  register 2.
- */
-#ifndef NO_CS4612
-#define ACISV2_ISV3                             0x00000001
-#define ACISV2_ISV4                             0x00000002
-#define ACISV2_ISV5                             0x00000004
-#define ACISV2_ISV6                             0x00000008
-#define ACISV2_ISV7                             0x00000010
-#define ACISV2_ISV8                             0x00000020
-#define ACISV2_ISV9                             0x00000040
-#define ACISV2_ISV10                            0x00000080
-#define ACISV2_ISV11                            0x00000100
-#define ACISV2_ISV12                            0x00000200
-#endif
-
-/*
- *  The following defines are for the flags in the AC97 status address
- *  register 2.
- */
-#ifndef NO_CS4612
-#define ACSAD2_SI_MASK                          0x0000007F
-#define ACSAD2_SI_SHIFT                         0
-#endif
-
-/*
- *  The following defines are for the flags in the AC97 status data register 2.
- */
-#ifndef NO_CS4612
-#define ACSDA2_SD_MASK                          0x0000FFFF
-#define ACSDA2_SD_SHIFT                         0
-#endif
-
-/*
- *  The following defines are for the flags in the I/O trap address and control
- *  registers (all 12).
- */
-#ifndef NO_CS4612
-#define IOTAC_SA_MASK                           0x0000FFFF
-#define IOTAC_MSK_MASK                          0x000F0000
-#define IOTAC_IODC_MASK                         0x06000000
-#define IOTAC_IODC_16_BIT                       0x00000000
-#define IOTAC_IODC_10_BIT                       0x02000000
-#define IOTAC_IODC_12_BIT                       0x04000000
-#define IOTAC_WSPI                              0x08000000
-#define IOTAC_RSPI                              0x10000000
-#define IOTAC_WSE                               0x20000000
-#define IOTAC_WE                                0x40000000
-#define IOTAC_RE                                0x80000000
-#define IOTAC_SA_SHIFT                          0
-#define IOTAC_MSK_SHIFT                         16
-#endif
-
-/*
- *  The following defines are for the flags in the I/O trap fast read registers
- *  (all 8).
- */
-#ifndef NO_CS4612
-#define IOTFR_D_MASK                            0x0000FFFF
-#define IOTFR_A_MASK                            0x000F0000
-#define IOTFR_R_MASK                            0x0F000000
-#define IOTFR_ALL                               0x40000000
-#define IOTFR_VL                                0x80000000
-#define IOTFR_D_SHIFT                           0
-#define IOTFR_A_SHIFT                           16
-#define IOTFR_R_SHIFT                           24
-#endif
-
-/*
- *  The following defines are for the flags in the I/O trap FIFO register.
- */
-#ifndef NO_CS4612
-#define IOTFIFO_BA_MASK                         0x00003FFF
-#define IOTFIFO_S_MASK                          0x00FF0000
-#define IOTFIFO_OF                              0x40000000
-#define IOTFIFO_SPIOF                           0x80000000
-#define IOTFIFO_BA_SHIFT                        0
-#define IOTFIFO_S_SHIFT                         16
-#endif
-
-/*
- *  The following defines are for the flags in the I/O trap retry read data
- *  register.
- */
-#ifndef NO_CS4612
-#define IOTRRD_D_MASK                           0x0000FFFF
-#define IOTRRD_RDV                              0x80000000
-#define IOTRRD_D_SHIFT                          0
-#endif
-
-/*
- *  The following defines are for the flags in the I/O trap FIFO pointer
- *  register.
- */
-#ifndef NO_CS4612
-#define IOTFP_CA_MASK                           0x00003FFF
-#define IOTFP_PA_MASK                           0x3FFF0000
-#define IOTFP_CA_SHIFT                          0
-#define IOTFP_PA_SHIFT                          16
-#endif
-
-/*
- *  The following defines are for the flags in the I/O trap control register.
- */
-#ifndef NO_CS4612
-#define IOTCR_ITD                               0x00000001
-#define IOTCR_HRV                               0x00000002
-#define IOTCR_SRV                               0x00000004
-#define IOTCR_DTI                               0x00000008
-#define IOTCR_DFI                               0x00000010
-#define IOTCR_DDP                               0x00000020
-#define IOTCR_JTE                               0x00000040
-#define IOTCR_PPE                               0x00000080
-#endif
-
-/*
- *  The following defines are for the flags in the direct PCI data register.
- */
-#ifndef NO_CS4612
-#define DPCID_D_MASK                            0xFFFFFFFF
-#define DPCID_D_SHIFT                           0
-#endif
-
-/*
- *  The following defines are for the flags in the direct PCI address register.
- */
-#ifndef NO_CS4612
-#define DPCIA_A_MASK                            0xFFFFFFFF
-#define DPCIA_A_SHIFT                           0
-#endif
-
-/*
- *  The following defines are for the flags in the direct PCI command register.
- */
-#ifndef NO_CS4612
-#define DPCIC_C_MASK                            0x0000000F
-#define DPCIC_C_IOREAD                          0x00000002
-#define DPCIC_C_IOWRITE                         0x00000003
-#define DPCIC_BE_MASK                           0x000000F0
-#endif
-
-/*
- *  The following defines are for the flags in the PC/PCI request register.
- */
-#ifndef NO_CS4612
-#define PCPCIR_RDC_MASK                         0x00000007
-#define PCPCIR_C_MASK                           0x00007000
-#define PCPCIR_REQ                              0x00008000
-#define PCPCIR_RDC_SHIFT                        0
-#define PCPCIR_C_SHIFT                          12
-#endif
-
-/*
- *  The following defines are for the flags in the PC/PCI grant register.
- */ 
-#ifndef NO_CS4612
-#define PCPCIG_GDC_MASK                         0x00000007
-#define PCPCIG_VL                               0x00008000
-#define PCPCIG_GDC_SHIFT                        0
-#endif
-
-/*
- *  The following defines are for the flags in the PC/PCI master enable
- *  register.
- */
-#ifndef NO_CS4612
-#define PCPCIEN_EN                              0x00000001
-#endif
-
-/*
- *  The following defines are for the flags in the extended PCI power
- *  management control register.
- */
-#ifndef NO_CS4612
-#define EPCIPMC_GWU                             0x00000001
-#define EPCIPMC_FSPC                            0x00000002
-#endif 
-
-/*
- *  The following defines are for the flags in the SP control register.
- */
-#define SPCR_RUN                                0x00000001
-#define SPCR_STPFR                              0x00000002
-#define SPCR_RUNFR                              0x00000004
-#define SPCR_TICK                               0x00000008
-#define SPCR_DRQEN                              0x00000020
-#define SPCR_RSTSP                              0x00000040
-#define SPCR_OREN                               0x00000080
-#ifndef NO_CS4612
-#define SPCR_PCIINT                             0x00000100
-#define SPCR_OINTD                              0x00000200
-#define SPCR_CRE                                0x00008000
-#endif
-
-/*
- *  The following defines are for the flags in the debug index register.
- */
-#define DREG_REGID_MASK                         0x0000007F
-#define DREG_DEBUG                              0x00000080
-#define DREG_RGBK_MASK                          0x00000700
-#define DREG_TRAP                               0x00000800
-#if !defined(NO_CS4612)
-#if !defined(NO_CS4615)
-#define DREG_TRAPX                              0x00001000
-#endif
-#endif
-#define DREG_REGID_SHIFT                        0
-#define DREG_RGBK_SHIFT                         8
-#define DREG_RGBK_REGID_MASK                    0x0000077F
-#define DREG_REGID_R0                           0x00000010
-#define DREG_REGID_R1                           0x00000011
-#define DREG_REGID_R2                           0x00000012
-#define DREG_REGID_R3                           0x00000013
-#define DREG_REGID_R4                           0x00000014
-#define DREG_REGID_R5                           0x00000015
-#define DREG_REGID_R6                           0x00000016
-#define DREG_REGID_R7                           0x00000017
-#define DREG_REGID_R8                           0x00000018
-#define DREG_REGID_R9                           0x00000019
-#define DREG_REGID_RA                           0x0000001A
-#define DREG_REGID_RB                           0x0000001B
-#define DREG_REGID_RC                           0x0000001C
-#define DREG_REGID_RD                           0x0000001D
-#define DREG_REGID_RE                           0x0000001E
-#define DREG_REGID_RF                           0x0000001F
-#define DREG_REGID_RA_BUS_LOW                   0x00000020
-#define DREG_REGID_RA_BUS_HIGH                  0x00000038
-#define DREG_REGID_YBUS_LOW                     0x00000050
-#define DREG_REGID_YBUS_HIGH                    0x00000058
-#define DREG_REGID_TRAP_0                       0x00000100
-#define DREG_REGID_TRAP_1                       0x00000101
-#define DREG_REGID_TRAP_2                       0x00000102
-#define DREG_REGID_TRAP_3                       0x00000103
-#define DREG_REGID_TRAP_4                       0x00000104
-#define DREG_REGID_TRAP_5                       0x00000105
-#define DREG_REGID_TRAP_6                       0x00000106
-#define DREG_REGID_TRAP_7                       0x00000107
-#define DREG_REGID_INDIRECT_ADDRESS             0x0000010E
-#define DREG_REGID_TOP_OF_STACK                 0x0000010F
-#if !defined(NO_CS4612)
-#if !defined(NO_CS4615)
-#define DREG_REGID_TRAP_8                       0x00000110
-#define DREG_REGID_TRAP_9                       0x00000111
-#define DREG_REGID_TRAP_10                      0x00000112
-#define DREG_REGID_TRAP_11                      0x00000113
-#define DREG_REGID_TRAP_12                      0x00000114
-#define DREG_REGID_TRAP_13                      0x00000115
-#define DREG_REGID_TRAP_14                      0x00000116
-#define DREG_REGID_TRAP_15                      0x00000117
-#define DREG_REGID_TRAP_16                      0x00000118
-#define DREG_REGID_TRAP_17                      0x00000119
-#define DREG_REGID_TRAP_18                      0x0000011A
-#define DREG_REGID_TRAP_19                      0x0000011B
-#define DREG_REGID_TRAP_20                      0x0000011C
-#define DREG_REGID_TRAP_21                      0x0000011D
-#define DREG_REGID_TRAP_22                      0x0000011E
-#define DREG_REGID_TRAP_23                      0x0000011F
-#endif
-#endif
-#define DREG_REGID_RSA0_LOW                     0x00000200
-#define DREG_REGID_RSA0_HIGH                    0x00000201
-#define DREG_REGID_RSA1_LOW                     0x00000202
-#define DREG_REGID_RSA1_HIGH                    0x00000203
-#define DREG_REGID_RSA2                         0x00000204
-#define DREG_REGID_RSA3                         0x00000205
-#define DREG_REGID_RSI0_LOW                     0x00000206
-#define DREG_REGID_RSI0_HIGH                    0x00000207
-#define DREG_REGID_RSI1                         0x00000208
-#define DREG_REGID_RSI2                         0x00000209
-#define DREG_REGID_SAGUSTATUS                   0x0000020A
-#define DREG_REGID_RSCONFIG01_LOW               0x0000020B
-#define DREG_REGID_RSCONFIG01_HIGH              0x0000020C
-#define DREG_REGID_RSCONFIG23_LOW               0x0000020D
-#define DREG_REGID_RSCONFIG23_HIGH              0x0000020E
-#define DREG_REGID_RSDMA01E                     0x0000020F
-#define DREG_REGID_RSDMA23E                     0x00000210
-#define DREG_REGID_RSD0_LOW                     0x00000211
-#define DREG_REGID_RSD0_HIGH                    0x00000212
-#define DREG_REGID_RSD1_LOW                     0x00000213
-#define DREG_REGID_RSD1_HIGH                    0x00000214
-#define DREG_REGID_RSD2_LOW                     0x00000215
-#define DREG_REGID_RSD2_HIGH                    0x00000216
-#define DREG_REGID_RSD3_LOW                     0x00000217
-#define DREG_REGID_RSD3_HIGH                    0x00000218
-#define DREG_REGID_SRAR_HIGH                    0x0000021A
-#define DREG_REGID_SRAR_LOW                     0x0000021B
-#define DREG_REGID_DMA_STATE                    0x0000021C
-#define DREG_REGID_CURRENT_DMA_STREAM           0x0000021D
-#define DREG_REGID_NEXT_DMA_STREAM              0x0000021E
-#define DREG_REGID_CPU_STATUS                   0x00000300
-#define DREG_REGID_MAC_MODE                     0x00000301
-#define DREG_REGID_STACK_AND_REPEAT             0x00000302
-#define DREG_REGID_INDEX0                       0x00000304
-#define DREG_REGID_INDEX1                       0x00000305
-#define DREG_REGID_DMA_STATE_0_3                0x00000400
-#define DREG_REGID_DMA_STATE_4_7                0x00000404
-#define DREG_REGID_DMA_STATE_8_11               0x00000408
-#define DREG_REGID_DMA_STATE_12_15              0x0000040C
-#define DREG_REGID_DMA_STATE_16_19              0x00000410
-#define DREG_REGID_DMA_STATE_20_23              0x00000414
-#define DREG_REGID_DMA_STATE_24_27              0x00000418
-#define DREG_REGID_DMA_STATE_28_31              0x0000041C
-#define DREG_REGID_DMA_STATE_32_35              0x00000420
-#define DREG_REGID_DMA_STATE_36_39              0x00000424
-#define DREG_REGID_DMA_STATE_40_43              0x00000428
-#define DREG_REGID_DMA_STATE_44_47              0x0000042C
-#define DREG_REGID_DMA_STATE_48_51              0x00000430
-#define DREG_REGID_DMA_STATE_52_55              0x00000434
-#define DREG_REGID_DMA_STATE_56_59              0x00000438
-#define DREG_REGID_DMA_STATE_60_63              0x0000043C
-#define DREG_REGID_DMA_STATE_64_67              0x00000440
-#define DREG_REGID_DMA_STATE_68_71              0x00000444
-#define DREG_REGID_DMA_STATE_72_75              0x00000448
-#define DREG_REGID_DMA_STATE_76_79              0x0000044C
-#define DREG_REGID_DMA_STATE_80_83              0x00000450
-#define DREG_REGID_DMA_STATE_84_87              0x00000454
-#define DREG_REGID_DMA_STATE_88_91              0x00000458
-#define DREG_REGID_DMA_STATE_92_95              0x0000045C
-#define DREG_REGID_TRAP_SELECT                  0x00000500
-#define DREG_REGID_TRAP_WRITE_0                 0x00000500
-#define DREG_REGID_TRAP_WRITE_1                 0x00000501
-#define DREG_REGID_TRAP_WRITE_2                 0x00000502
-#define DREG_REGID_TRAP_WRITE_3                 0x00000503
-#define DREG_REGID_TRAP_WRITE_4                 0x00000504
-#define DREG_REGID_TRAP_WRITE_5                 0x00000505
-#define DREG_REGID_TRAP_WRITE_6                 0x00000506
-#define DREG_REGID_TRAP_WRITE_7                 0x00000507
-#if !defined(NO_CS4612)
-#if !defined(NO_CS4615)
-#define DREG_REGID_TRAP_WRITE_8                 0x00000510
-#define DREG_REGID_TRAP_WRITE_9                 0x00000511
-#define DREG_REGID_TRAP_WRITE_10                0x00000512
-#define DREG_REGID_TRAP_WRITE_11                0x00000513
-#define DREG_REGID_TRAP_WRITE_12                0x00000514
-#define DREG_REGID_TRAP_WRITE_13                0x00000515
-#define DREG_REGID_TRAP_WRITE_14                0x00000516
-#define DREG_REGID_TRAP_WRITE_15                0x00000517
-#define DREG_REGID_TRAP_WRITE_16                0x00000518
-#define DREG_REGID_TRAP_WRITE_17                0x00000519
-#define DREG_REGID_TRAP_WRITE_18                0x0000051A
-#define DREG_REGID_TRAP_WRITE_19                0x0000051B
-#define DREG_REGID_TRAP_WRITE_20                0x0000051C
-#define DREG_REGID_TRAP_WRITE_21                0x0000051D
-#define DREG_REGID_TRAP_WRITE_22                0x0000051E
-#define DREG_REGID_TRAP_WRITE_23                0x0000051F
-#endif
-#endif
-#define DREG_REGID_MAC0_ACC0_LOW                0x00000600
-#define DREG_REGID_MAC0_ACC1_LOW                0x00000601
-#define DREG_REGID_MAC0_ACC2_LOW                0x00000602
-#define DREG_REGID_MAC0_ACC3_LOW                0x00000603
-#define DREG_REGID_MAC1_ACC0_LOW                0x00000604
-#define DREG_REGID_MAC1_ACC1_LOW                0x00000605
-#define DREG_REGID_MAC1_ACC2_LOW                0x00000606
-#define DREG_REGID_MAC1_ACC3_LOW                0x00000607
-#define DREG_REGID_MAC0_ACC0_MID                0x00000608
-#define DREG_REGID_MAC0_ACC1_MID                0x00000609
-#define DREG_REGID_MAC0_ACC2_MID                0x0000060A
-#define DREG_REGID_MAC0_ACC3_MID                0x0000060B
-#define DREG_REGID_MAC1_ACC0_MID                0x0000060C
-#define DREG_REGID_MAC1_ACC1_MID                0x0000060D
-#define DREG_REGID_MAC1_ACC2_MID                0x0000060E
-#define DREG_REGID_MAC1_ACC3_MID                0x0000060F
-#define DREG_REGID_MAC0_ACC0_HIGH               0x00000610
-#define DREG_REGID_MAC0_ACC1_HIGH               0x00000611
-#define DREG_REGID_MAC0_ACC2_HIGH               0x00000612
-#define DREG_REGID_MAC0_ACC3_HIGH               0x00000613
-#define DREG_REGID_MAC1_ACC0_HIGH               0x00000614
-#define DREG_REGID_MAC1_ACC1_HIGH               0x00000615
-#define DREG_REGID_MAC1_ACC2_HIGH               0x00000616
-#define DREG_REGID_MAC1_ACC3_HIGH               0x00000617
-#define DREG_REGID_RSHOUT_LOW                   0x00000620
-#define DREG_REGID_RSHOUT_MID                   0x00000628
-#define DREG_REGID_RSHOUT_HIGH                  0x00000630
-
-/*
- *  The following defines are for the flags in the DMA stream requestor write
- */
-#define DSRWP_DSR_MASK                          0x0000000F
-#define DSRWP_DSR_BG_RQ                         0x00000001
-#define DSRWP_DSR_PRIORITY_MASK                 0x00000006
-#define DSRWP_DSR_PRIORITY_0                    0x00000000
-#define DSRWP_DSR_PRIORITY_1                    0x00000002
-#define DSRWP_DSR_PRIORITY_2                    0x00000004
-#define DSRWP_DSR_PRIORITY_3                    0x00000006
-#define DSRWP_DSR_RQ_PENDING                    0x00000008
-
-/*
- *  The following defines are for the flags in the trap write port register.
- */
-#define TWPR_TW_MASK                            0x0000FFFF
-#define TWPR_TW_SHIFT                           0
-
-/*
- *  The following defines are for the flags in the stack pointer write
- *  register.
- */
-#define SPWR_STKP_MASK                          0x0000000F
-#define SPWR_STKP_SHIFT                         0
-
-/*
- *  The following defines are for the flags in the SP interrupt register.
- */
-#define SPIR_FRI                                0x00000001
-#define SPIR_DOI                                0x00000002
-#define SPIR_GPI2                               0x00000004
-#define SPIR_GPI3                               0x00000008
-#define SPIR_IP0                                0x00000010
-#define SPIR_IP1                                0x00000020
-#define SPIR_IP2                                0x00000040
-#define SPIR_IP3                                0x00000080
-
-/*
- *  The following defines are for the flags in the functional group 1 register.
- */
-#define FGR1_F1S_MASK                           0x0000FFFF
-#define FGR1_F1S_SHIFT                          0
-
-/*
- *  The following defines are for the flags in the SP clock status register.
- */
-#define SPCS_FRI                                0x00000001
-#define SPCS_DOI                                0x00000002
-#define SPCS_GPI2                               0x00000004
-#define SPCS_GPI3                               0x00000008
-#define SPCS_IP0                                0x00000010
-#define SPCS_IP1                                0x00000020
-#define SPCS_IP2                                0x00000040
-#define SPCS_IP3                                0x00000080
-#define SPCS_SPRUN                              0x00000100
-#define SPCS_SLEEP                              0x00000200
-#define SPCS_FG                                 0x00000400
-#define SPCS_ORUN                               0x00000800
-#define SPCS_IRQ                                0x00001000
-#define SPCS_FGN_MASK                           0x0000E000
-#define SPCS_FGN_SHIFT                          13
-
-/*
- *  The following defines are for the flags in the SP DMA requestor status
- *  register.
- */
-#define SDSR_DCS_MASK                           0x000000FF
-#define SDSR_DCS_SHIFT                          0
-#define SDSR_DCS_NONE                           0x00000007
-
-/*
- *  The following defines are for the flags in the frame timer register.
- */
-#define FRMT_FTV_MASK                           0x0000FFFF
-#define FRMT_FTV_SHIFT                          0
-
-/*
- *  The following defines are for the flags in the frame timer current count
- *  register.
- */
-#define FRCC_FCC_MASK                           0x0000FFFF
-#define FRCC_FCC_SHIFT                          0
-
-/*
- *  The following defines are for the flags in the frame timer save count
- *  register.
- */
-#define FRSC_FCS_MASK                           0x0000FFFF
-#define FRSC_FCS_SHIFT                          0
-
-/*
- *  The following define the various flags stored in the scatter/gather
- *  descriptors.
- */
-#define DMA_SG_NEXT_ENTRY_MASK                  0x00000FF8
-#define DMA_SG_SAMPLE_END_MASK                  0x0FFF0000
-#define DMA_SG_SAMPLE_END_FLAG                  0x10000000
-#define DMA_SG_LOOP_END_FLAG                    0x20000000
-#define DMA_SG_SIGNAL_END_FLAG                  0x40000000
-#define DMA_SG_SIGNAL_PAGE_FLAG                 0x80000000
-#define DMA_SG_NEXT_ENTRY_SHIFT                 3
-#define DMA_SG_SAMPLE_END_SHIFT                 16
-
-/*
- *  The following define the offsets of the fields within the on-chip generic
- *  DMA requestor.
- */
-#define DMA_RQ_CONTROL1                         0x00000000
-#define DMA_RQ_CONTROL2                         0x00000004
-#define DMA_RQ_SOURCE_ADDR                      0x00000008
-#define DMA_RQ_DESTINATION_ADDR                 0x0000000C
-#define DMA_RQ_NEXT_PAGE_ADDR                   0x00000010
-#define DMA_RQ_NEXT_PAGE_SGDESC                 0x00000014
-#define DMA_RQ_LOOP_START_ADDR                  0x00000018
-#define DMA_RQ_POST_LOOP_ADDR                   0x0000001C
-#define DMA_RQ_PAGE_MAP_ADDR                    0x00000020
-
-/*
- *  The following defines are for the flags in the first control word of the
- *  on-chip generic DMA requestor.
- */
-#define DMA_RQ_C1_COUNT_MASK                    0x000003FF
-#define DMA_RQ_C1_DESTINATION_SCATTER           0x00001000
-#define DMA_RQ_C1_SOURCE_GATHER                 0x00002000
-#define DMA_RQ_C1_DONE_FLAG                     0x00004000
-#define DMA_RQ_C1_OPTIMIZE_STATE                0x00008000
-#define DMA_RQ_C1_SAMPLE_END_STATE_MASK         0x00030000
-#define DMA_RQ_C1_FULL_PAGE                     0x00000000
-#define DMA_RQ_C1_BEFORE_SAMPLE_END             0x00010000
-#define DMA_RQ_C1_PAGE_MAP_ERROR                0x00020000
-#define DMA_RQ_C1_AT_SAMPLE_END                 0x00030000
-#define DMA_RQ_C1_LOOP_END_STATE_MASK           0x000C0000
-#define DMA_RQ_C1_NOT_LOOP_END                  0x00000000
-#define DMA_RQ_C1_BEFORE_LOOP_END               0x00040000
-#define DMA_RQ_C1_2PAGE_LOOP_BEGIN              0x00080000
-#define DMA_RQ_C1_LOOP_BEGIN                    0x000C0000
-#define DMA_RQ_C1_PAGE_MAP_MASK                 0x00300000
-#define DMA_RQ_C1_PM_NONE_PENDING               0x00000000
-#define DMA_RQ_C1_PM_NEXT_PENDING               0x00100000
-#define DMA_RQ_C1_PM_RESERVED                   0x00200000
-#define DMA_RQ_C1_PM_LOOP_NEXT_PENDING          0x00300000
-#define DMA_RQ_C1_WRITEBACK_DEST_FLAG           0x00400000
-#define DMA_RQ_C1_WRITEBACK_SRC_FLAG            0x00800000
-#define DMA_RQ_C1_DEST_SIZE_MASK                0x07000000
-#define DMA_RQ_C1_DEST_LINEAR                   0x00000000
-#define DMA_RQ_C1_DEST_MOD16                    0x01000000
-#define DMA_RQ_C1_DEST_MOD32                    0x02000000
-#define DMA_RQ_C1_DEST_MOD64                    0x03000000
-#define DMA_RQ_C1_DEST_MOD128                   0x04000000
-#define DMA_RQ_C1_DEST_MOD256                   0x05000000
-#define DMA_RQ_C1_DEST_MOD512                   0x06000000
-#define DMA_RQ_C1_DEST_MOD1024                  0x07000000
-#define DMA_RQ_C1_DEST_ON_HOST                  0x08000000
-#define DMA_RQ_C1_SOURCE_SIZE_MASK              0x70000000
-#define DMA_RQ_C1_SOURCE_LINEAR                 0x00000000
-#define DMA_RQ_C1_SOURCE_MOD16                  0x10000000
-#define DMA_RQ_C1_SOURCE_MOD32                  0x20000000
-#define DMA_RQ_C1_SOURCE_MOD64                  0x30000000
-#define DMA_RQ_C1_SOURCE_MOD128                 0x40000000
-#define DMA_RQ_C1_SOURCE_MOD256                 0x50000000
-#define DMA_RQ_C1_SOURCE_MOD512                 0x60000000
-#define DMA_RQ_C1_SOURCE_MOD1024                0x70000000
-#define DMA_RQ_C1_SOURCE_ON_HOST                0x80000000
-#define DMA_RQ_C1_COUNT_SHIFT                   0
-
-/*
- *  The following defines are for the flags in the second control word of the
- *  on-chip generic DMA requestor.
- */
-#define DMA_RQ_C2_VIRTUAL_CHANNEL_MASK          0x0000003F
-#define DMA_RQ_C2_VIRTUAL_SIGNAL_MASK           0x00000300
-#define DMA_RQ_C2_NO_VIRTUAL_SIGNAL             0x00000000
-#define DMA_RQ_C2_SIGNAL_EVERY_DMA              0x00000100
-#define DMA_RQ_C2_SIGNAL_SOURCE_PINGPONG        0x00000200
-#define DMA_RQ_C2_SIGNAL_DEST_PINGPONG          0x00000300
-#define DMA_RQ_C2_AUDIO_CONVERT_MASK            0x0000F000
-#define DMA_RQ_C2_AC_NONE                       0x00000000
-#define DMA_RQ_C2_AC_8_TO_16_BIT                0x00001000
-#define DMA_RQ_C2_AC_MONO_TO_STEREO             0x00002000
-#define DMA_RQ_C2_AC_ENDIAN_CONVERT             0x00004000
-#define DMA_RQ_C2_AC_SIGNED_CONVERT             0x00008000
-#define DMA_RQ_C2_LOOP_END_MASK                 0x0FFF0000
-#define DMA_RQ_C2_LOOP_MASK                     0x30000000
-#define DMA_RQ_C2_NO_LOOP                       0x00000000
-#define DMA_RQ_C2_ONE_PAGE_LOOP                 0x10000000
-#define DMA_RQ_C2_TWO_PAGE_LOOP                 0x20000000
-#define DMA_RQ_C2_MULTI_PAGE_LOOP               0x30000000
-#define DMA_RQ_C2_SIGNAL_LOOP_BACK              0x40000000
-#define DMA_RQ_C2_SIGNAL_POST_BEGIN_PAGE        0x80000000
-#define DMA_RQ_C2_VIRTUAL_CHANNEL_SHIFT         0
-#define DMA_RQ_C2_LOOP_END_SHIFT                16
-
-/*
- *  The following defines are for the flags in the source and destination words
- *  of the on-chip generic DMA requestor.
- */
-#define DMA_RQ_SD_ADDRESS_MASK                  0x0000FFFF
-#define DMA_RQ_SD_MEMORY_ID_MASK                0x000F0000
-#define DMA_RQ_SD_SP_PARAM_ADDR                 0x00000000
-#define DMA_RQ_SD_SP_SAMPLE_ADDR                0x00010000
-#define DMA_RQ_SD_SP_PROGRAM_ADDR               0x00020000
-#define DMA_RQ_SD_SP_DEBUG_ADDR                 0x00030000
-#define DMA_RQ_SD_OMNIMEM_ADDR                  0x000E0000
-#define DMA_RQ_SD_END_FLAG                      0x40000000
-#define DMA_RQ_SD_ERROR_FLAG                    0x80000000
-#define DMA_RQ_SD_ADDRESS_SHIFT                 0
-
-/*
- *  The following defines are for the flags in the page map address word of the
- *  on-chip generic DMA requestor.
- */
-#define DMA_RQ_PMA_LOOP_THIRD_PAGE_ENTRY_MASK   0x00000FF8
-#define DMA_RQ_PMA_PAGE_TABLE_MASK              0xFFFFF000
-#define DMA_RQ_PMA_LOOP_THIRD_PAGE_ENTRY_SHIFT  3
-#define DMA_RQ_PMA_PAGE_TABLE_SHIFT             12
-
-#define BA1_VARIDEC_BUF_1       0x000
-
-#define BA1_PDTC                0x0c0    /* BA1_PLAY_DMA_TRANSACTION_COUNT_REG */
-#define BA1_PFIE                0x0c4    /* BA1_PLAY_FORMAT_&_INTERRUPT_ENABLE_REG */
-#define BA1_PBA                 0x0c8    /* BA1_PLAY_BUFFER_ADDRESS */
-#define BA1_PVOL                0x0f8    /* BA1_PLAY_VOLUME_REG */
-#define BA1_PSRC                0x288    /* BA1_PLAY_SAMPLE_RATE_CORRECTION_REG */
-#define BA1_PCTL                0x2a4    /* BA1_PLAY_CONTROL_REG */
-#define BA1_PPI                 0x2b4    /* BA1_PLAY_PHASE_INCREMENT_REG */
-
-#define BA1_CCTL                0x064    /* BA1_CAPTURE_CONTROL_REG */
-#define BA1_CIE                 0x104    /* BA1_CAPTURE_INTERRUPT_ENABLE_REG */
-#define BA1_CBA                 0x10c    /* BA1_CAPTURE_BUFFER_ADDRESS */
-#define BA1_CSRC                0x2c8    /* BA1_CAPTURE_SAMPLE_RATE_CORRECTION_REG */
-#define BA1_CCI                 0x2d8    /* BA1_CAPTURE_COEFFICIENT_INCREMENT_REG */
-#define BA1_CD                  0x2e0    /* BA1_CAPTURE_DELAY_REG */
-#define BA1_CPI                 0x2f4    /* BA1_CAPTURE_PHASE_INCREMENT_REG */
-#define BA1_CVOL                0x2f8    /* BA1_CAPTURE_VOLUME_REG */
-
-#define BA1_CFG1                0x134    /* BA1_CAPTURE_FRAME_GROUP_1_REG */
-#define BA1_CFG2                0x138    /* BA1_CAPTURE_FRAME_GROUP_2_REG */
-#define BA1_CCST                0x13c    /* BA1_CAPTURE_CONSTANT_REG */
-#define BA1_CSPB                0x340    /* BA1_CAPTURE_SPB_ADDRESS */
-
-/*
- *
- */
-
-#define CS461X_MODE_OUTPUT     (1<<0)   /* MIDI UART - output */ 
-#define CS461X_MODE_INPUT      (1<<1)   /* MIDI UART - input */
-
-//****************************************************************************
-//
-// The following define the offsets of the AC97 shadow registers, which appear
-// as a virtual extension to the base address register zero memory range.
-//
-//****************************************************************************
-#define AC97_REG_OFFSET_MASK                    0x0000007EL
-#define AC97_CODEC_NUMBER_MASK                  0x00003000L
-
-#define BA0_AC97_RESET                          0x00001000L
-#define BA0_AC97_MASTER_VOLUME                  0x00001002L
-#define BA0_AC97_HEADPHONE_VOLUME               0x00001004L
-#define BA0_AC97_MASTER_VOLUME_MONO             0x00001006L
-#define BA0_AC97_MASTER_TONE                    0x00001008L
-#define BA0_AC97_PC_BEEP_VOLUME                 0x0000100AL
-#define BA0_AC97_PHONE_VOLUME                   0x0000100CL
-#define BA0_AC97_MIC_VOLUME                     0x0000100EL
-#define BA0_AC97_LINE_IN_VOLUME                 0x00001010L
-#define BA0_AC97_CD_VOLUME                      0x00001012L
-#define BA0_AC97_VIDEO_VOLUME                   0x00001014L
-#define BA0_AC97_AUX_VOLUME                     0x00001016L
-#define BA0_AC97_PCM_OUT_VOLUME                 0x00001018L
-#define BA0_AC97_RECORD_SELECT                  0x0000101AL
-#define BA0_AC97_RECORD_GAIN                    0x0000101CL
-#define BA0_AC97_RECORD_GAIN_MIC                0x0000101EL
-#define BA0_AC97_GENERAL_PURPOSE                0x00001020L
-#define BA0_AC97_3D_CONTROL                     0x00001022L
-#define BA0_AC97_MODEM_RATE                     0x00001024L
-#define BA0_AC97_POWERDOWN                      0x00001026L
-#define BA0_AC97_EXT_AUDIO_ID                   0x00001028L
-#define BA0_AC97_EXT_AUDIO_POWER                0x0000102AL
-#define BA0_AC97_PCM_FRONT_DAC_RATE             0x0000102CL
-#define BA0_AC97_PCM_SURR_DAC_RATE              0x0000102EL
-#define BA0_AC97_PCM_LFE_DAC_RATE               0x00001030L
-#define BA0_AC97_PCM_LR_ADC_RATE                0x00001032L
-#define BA0_AC97_MIC_ADC_RATE                   0x00001034L
-#define BA0_AC97_6CH_VOL_C_LFE                  0x00001036L
-#define BA0_AC97_6CH_VOL_SURROUND               0x00001038L
-#define BA0_AC97_RESERVED_3A                    0x0000103AL
-#define BA0_AC97_EXT_MODEM_ID                   0x0000103CL
-#define BA0_AC97_EXT_MODEM_POWER                0x0000103EL
-#define BA0_AC97_LINE1_CODEC_RATE               0x00001040L
-#define BA0_AC97_LINE2_CODEC_RATE               0x00001042L
-#define BA0_AC97_HANDSET_CODEC_RATE             0x00001044L
-#define BA0_AC97_LINE1_CODEC_LEVEL              0x00001046L
-#define BA0_AC97_LINE2_CODEC_LEVEL              0x00001048L
-#define BA0_AC97_HANDSET_CODEC_LEVEL            0x0000104AL
-#define BA0_AC97_GPIO_PIN_CONFIG                0x0000104CL
-#define BA0_AC97_GPIO_PIN_TYPE                  0x0000104EL
-#define BA0_AC97_GPIO_PIN_STICKY                0x00001050L
-#define BA0_AC97_GPIO_PIN_WAKEUP                0x00001052L
-#define BA0_AC97_GPIO_PIN_STATUS                0x00001054L
-#define BA0_AC97_MISC_MODEM_AFE_STAT            0x00001056L
-#define BA0_AC97_RESERVED_58                    0x00001058L
-#define BA0_AC97_CRYSTAL_REV_N_FAB_ID           0x0000105AL
-#define BA0_AC97_TEST_AND_MISC_CTRL             0x0000105CL
-#define BA0_AC97_AC_MODE                        0x0000105EL
-#define BA0_AC97_MISC_CRYSTAL_CONTROL           0x00001060L
-#define BA0_AC97_LINE1_HYPRID_CTRL              0x00001062L
-#define BA0_AC97_VENDOR_RESERVED_64             0x00001064L
-#define BA0_AC97_VENDOR_RESERVED_66             0x00001066L
-#define BA0_AC97_SPDIF_CONTROL                  0x00001068L
-#define BA0_AC97_VENDOR_RESERVED_6A             0x0000106AL
-#define BA0_AC97_VENDOR_RESERVED_6C             0x0000106CL
-#define BA0_AC97_VENDOR_RESERVED_6E             0x0000106EL
-#define BA0_AC97_VENDOR_RESERVED_70             0x00001070L
-#define BA0_AC97_VENDOR_RESERVED_72             0x00001072L
-#define BA0_AC97_VENDOR_RESERVED_74             0x00001074L
-#define BA0_AC97_CAL_ADDRESS                    0x00001076L
-#define BA0_AC97_CAL_DATA                       0x00001078L
-#define BA0_AC97_VENDOR_RESERVED_7A             0x0000107AL
-#define BA0_AC97_VENDOR_ID1                     0x0000107CL
-#define BA0_AC97_VENDOR_ID2                     0x0000107EL
-#endif                         /* __CS461X_H */
diff --git a/sound/oss/cs461x_image.h b/sound/oss/cs461x_image.h
deleted file mode 100644 (file)
index b5c5a46..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
-/****************************************************************************
- * "CWCIMAGE.H"-- For CS46XX. Ver 1.04
- *      Copyright 1998-2001 (c) Cirrus Logic Corp.
- *      Version 1.04
- ****************************************************************************
- */
-#ifndef __CS_IMAGE_H
-#define __CS_IMAGE_H
-
-#define CLEAR__COUNT     3
-#define FILL__COUNT      4
-#define BA1__DWORD_SIZE  13*1024+512
-
-static struct
-{
-        unsigned BA1__DestByteOffset;
-        unsigned BA1__SourceSize;
-} ClrStat[CLEAR__COUNT] ={ {0x00000000, 0x00003000 },
-                           {0x00010000, 0x00003800 },
-                           {0x00020000, 0x00007000 } };
-
-static u32 FillArray1[]={
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000163,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00200040,0x00008010,0x00000000,
-0x00000000,0x80000001,0x00000001,0x00060000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00900080,0x00000173,0x00000000,
-0x00000000,0x00000010,0x00800000,0x00900000,
-0xf2c0000f,0x00000200,0x00000000,0x00010600,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000163,0x330300c2,
-0x06000000,0x00000000,0x80008000,0x80008000,
-0x3fc0000f,0x00000301,0x00010400,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00b00000,0x00d0806d,0x330480c3,
-0x04800000,0x00000001,0x00800001,0x0000ffff,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x066a0600,0x06350070,0x0000929d,0x929d929d,
-0x00000000,0x0000735a,0x00000600,0x00000000,
-0x929d735a,0x00000000,0x00010000,0x735a735a,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x0000804f,0x000000c3,
-0x05000000,0x00a00010,0x00000000,0x80008000,
-0x00000000,0x00000000,0x00000700,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000080,0x00a00000,0x0000809a,0x000000c2,
-0x07400000,0x00000000,0x80008000,0xffffffff,
-0x00c80028,0x00005555,0x00000000,0x000107a0,
-0x00c80028,0x000000c2,0x06800000,0x00000000,
-0x06e00080,0x00300000,0x000080bb,0x000000c9,
-0x07a00000,0x04000000,0x80008000,0xffffffff,
-0x00c80028,0x00005555,0x00000000,0x00000780,
-0x00c80028,0x000000c5,0xff800000,0x00000000,
-0x00640080,0x00c00000,0x00008197,0x000000c9,
-0x07800000,0x04000000,0x80008000,0xffffffff,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x0000805e,0x000000c1,
-0x00000000,0x00800000,0x80008000,0x80008000,
-0x00020000,0x0000ffff,0x00000000,0x00000000};
-
-static u32 FillArray2[]={
-0x929d0600,0x929d929d,0x929d929d,0x929d0000,
-0x929d929d,0x929d929d,0x929d929d,0x929d929d,
-0x929d929d,0x00100635,0x060b013f,0x00000004,
-0x00000001,0x007a0002,0x00000000,0x066e0610,
-0x0105929d,0x929d929d,0x929d929d,0x929d929d,
-0x929d929d,0xa431ac75,0x0001735a,0xa431ac75,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0xa431ac75,0xa431ac75,0xa431ac75,0x735a0051,
-0x00000000,0x929d929d,0x929d929d,0x929d929d,
-0x929d929d,0x929d929d,0x929d929d,0x929d929d,
-0x929d929d,0x929d929d,0x00000000,0x06400136,
-0x0000270f,0x00010000,0x007a0000,0x00000000,
-0x068e0645,0x0105929d,0x929d929d,0x929d929d,
-0x929d929d,0x929d929d,0xa431ac75,0x0001735a,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0xa431ac75,0xa431ac75,0xa431ac75,0xa431ac75,
-0x735a0100,0x00000000,0x00000000,0x00000000};
-
-static u32 FillArray3[]={
-0x00000000,0x00000000,0x00000000,0x00010004};
-
-static u32 FillArray4[]={
-0x00040730,0x00001002,0x000f619e,0x00001003,
-0x00001705,0x00001400,0x000a411e,0x00001003,
-0x00040730,0x00001002,0x000f619e,0x00001003,
-0x00009705,0x00001400,0x000a411e,0x00001003,
-0x00040730,0x00001002,0x000f619e,0x00001003,
-0x00011705,0x00001400,0x000a411e,0x00001003,
-0x00040730,0x00001002,0x000f619e,0x00001003,
-0x00019705,0x00001400,0x000a411e,0x00001003,
-0x00040730,0x00001002,0x000f619e,0x00001003,
-0x00021705,0x00001400,0x000a411e,0x00001003,
-0x00040730,0x00001002,0x000f619e,0x00001003,
-0x00029705,0x00001400,0x000a411e,0x00001003,
-0x00040730,0x00001002,0x000f619e,0x00001003,
-0x00031705,0x00001400,0x000a411e,0x00001003,
-0x00040730,0x00001002,0x000f619e,0x00001003,
-0x00039705,0x00001400,0x000a411e,0x00001003,
-0x000fe19e,0x00001003,0x0009c730,0x00001003,
-0x0008e19c,0x00001003,0x000083c1,0x00093040,
-0x00098730,0x00001002,0x000ee19e,0x00001003,
-0x00009705,0x00001400,0x000a211e,0x00001003,
-0x00098730,0x00001002,0x000ee19e,0x00001003,
-0x00011705,0x00001400,0x000a211e,0x00001003,
-0x00098730,0x00001002,0x000ee19e,0x00001003,
-0x00019705,0x00001400,0x000a211e,0x00001003,
-0x00098730,0x00001002,0x000ee19e,0x00001003,
-0x00021705,0x00001400,0x000a211e,0x00001003,
-0x00098730,0x00001002,0x000ee19e,0x00001003,
-0x00029705,0x00001400,0x000a211e,0x00001003,
-0x00098730,0x00001002,0x000ee19e,0x00001003,
-0x00031705,0x00001400,0x000a211e,0x00001003,
-0x00098730,0x00001002,0x000ee19e,0x00001003,
-0x00039705,0x00001400,0x000a211e,0x00001003,
-0x0000a730,0x00001008,0x000e2730,0x00001002,
-0x0000a731,0x00001002,0x0000a731,0x00001002,
-0x0000a731,0x00001002,0x0000a731,0x00001002,
-0x0000a731,0x00001002,0x0000a731,0x00001002,
-0x00000000,0x00000000,0x000f619c,0x00001003,
-0x0007f801,0x000c0000,0x00000037,0x00001000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x000c0000,0x00000000,0x00000000,
-0x0000373c,0x00001000,0x00000000,0x00000000,
-0x000ee19c,0x00001003,0x0007f801,0x000c0000,
-0x00000037,0x00001000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x0000273c,0x00001000,
-0x00000033,0x00001000,0x000e679e,0x00001003,
-0x00007705,0x00001400,0x000ac71e,0x00001003,
-0x00087fc1,0x000c3be0,0x0007f801,0x000c0000,
-0x00000037,0x00001000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x0000a730,0x00001003,
-0x00000033,0x00001000,0x0007f801,0x000c0000,
-0x00000037,0x00001000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x000c0000,
-0x00000032,0x00001000,0x0000273d,0x00001000,
-0x0004a730,0x00001003,0x00000f41,0x00097140,
-0x0000a841,0x0009b240,0x0000a0c1,0x0009f040,
-0x0001c641,0x00093540,0x0001cec1,0x0009b5c0,
-0x00000000,0x00000000,0x0001bf05,0x0003fc40,
-0x00002725,0x000aa400,0x00013705,0x00093a00,
-0x0000002e,0x0009d6c0,0x00038630,0x00001004,
-0x0004ef0a,0x000eb785,0x0003fc8a,0x00000000,
-0x00000000,0x000c70e0,0x0007d182,0x0002c640,
-0x00000630,0x00001004,0x000799b8,0x0002c6c0,
-0x00031705,0x00092240,0x00039f05,0x000932c0,
-0x0003520a,0x00000000,0x00040731,0x0000100b,
-0x00010705,0x000b20c0,0x00000000,0x000eba44,
-0x00032108,0x000c60c4,0x00065208,0x000c2917,
-0x000406b0,0x00001007,0x00012f05,0x00036880,
-0x0002818e,0x000c0000,0x0004410a,0x00000000,
-0x00040630,0x00001007,0x00029705,0x000c0000,
-0x00000000,0x00000000,0x00003fc1,0x0003fc40,
-0x000037c1,0x00091b40,0x00003fc1,0x000911c0,
-0x000037c1,0x000957c0,0x00003fc1,0x000951c0,
-0x000037c1,0x00000000,0x00003fc1,0x000991c0,
-0x000037c1,0x00000000,0x00003fc1,0x0009d1c0,
-0x000037c1,0x00000000,0x0001ccc1,0x000915c0,
-0x0001c441,0x0009d800,0x0009cdc1,0x00091240,
-0x0001c541,0x00091d00,0x0009cfc1,0x00095240,
-0x0001c741,0x00095c80,0x000e8ca9,0x00099240,
-0x000e85ad,0x00095640,0x00069ca9,0x00099d80,
-0x000e952d,0x00099640,0x000eaca9,0x0009d6c0,
-0x000ea5ad,0x00091a40,0x0006bca9,0x0009de80,
-0x000eb52d,0x00095a40,0x000ecca9,0x00099ac0,
-0x000ec5ad,0x0009da40,0x000edca9,0x0009d300,
-0x000a6e0a,0x00001000,0x000ed52d,0x00091e40,
-0x000eeca9,0x00095ec0,0x000ee5ad,0x00099e40,
-0x0006fca9,0x00002500,0x000fb208,0x000c59a0,
-0x000ef52d,0x0009de40,0x00068ca9,0x000912c1,
-0x000683ad,0x00095241,0x00020f05,0x000991c1,
-0x00000000,0x00000000,0x00086f88,0x00001000,
-0x0009cf81,0x000b5340,0x0009c701,0x000b92c0,
-0x0009de81,0x000bd300,0x0009d601,0x000b1700,
-0x0001fd81,0x000b9d80,0x0009f501,0x000b57c0,
-0x000a0f81,0x000bd740,0x00020701,0x000b5c80,
-0x000a1681,0x000b97c0,0x00021601,0x00002500,
-0x000a0701,0x000b9b40,0x000a0f81,0x000b1bc0,
-0x00021681,0x00002d00,0x00020f81,0x000bd800,
-0x000a0701,0x000b5bc0,0x00021601,0x00003500,
-0x000a0f81,0x000b5f40,0x000a0701,0x000bdbc0,
-0x00021681,0x00003d00,0x00020f81,0x000b1d00,
-0x000a0701,0x000b1fc0,0x00021601,0x00020500,
-0x00020f81,0x000b1341,0x000a0701,0x000b9fc0,
-0x00021681,0x00020d00,0x00020f81,0x000bde80,
-0x000a0701,0x000bdfc0,0x00021601,0x00021500,
-0x00020f81,0x000b9341,0x00020701,0x000b53c1,
-0x00021681,0x00021d00,0x000a0f81,0x000d0380,
-0x0000b601,0x000b15c0,0x00007b01,0x00000000,
-0x00007b81,0x000bd1c0,0x00007b01,0x00000000,
-0x00007b81,0x000b91c0,0x00007b01,0x000b57c0,
-0x00007b81,0x000b51c0,0x00007b01,0x000b1b40,
-0x00007b81,0x000b11c0,0x00087b01,0x000c3dc0,
-0x0007e488,0x000d7e45,0x00000000,0x000d7a44,
-0x0007e48a,0x00000000,0x00011f05,0x00084080,
-0x00000000,0x00000000,0x00001705,0x000b3540,
-0x00008a01,0x000bf040,0x00007081,0x000bb5c0,
-0x00055488,0x00000000,0x0000d482,0x0003fc40,
-0x0003fc88,0x00000000,0x0001e401,0x000b3a00,
-0x0001ec81,0x000bd6c0,0x0004ef08,0x000eb784,
-0x000c86b0,0x00001007,0x00008281,0x000bb240,
-0x0000b801,0x000b7140,0x00007888,0x00000000,
-0x0000073c,0x00001000,0x0007f188,0x000c0000,
-0x00000000,0x00000000,0x00055288,0x000c555c,
-0x0005528a,0x000c0000,0x0009fa88,0x000c5d00,
-0x0000fa88,0x00000000,0x00000032,0x00001000,
-0x0000073d,0x00001000,0x0007f188,0x000c0000,
-0x00000000,0x00000000,0x0008c01c,0x00001003,
-0x00002705,0x00001008,0x0008b201,0x000c1392,
-0x0000ba01,0x00000000,0x00008731,0x00001400,
-0x0004c108,0x000fe0c4,0x00057488,0x00000000,
-0x000a6388,0x00001001,0x0008b334,0x000bc141,
-0x0003020e,0x00000000,0x000886b0,0x00001008,
-0x00003625,0x000c5dfa,0x000a638a,0x00001001,
-0x0008020e,0x00001002,0x0008a6b0,0x00001008,
-0x0007f301,0x00000000,0x00000000,0x00000000,
-0x00002725,0x000a8c40,0x000000ae,0x00000000,
-0x000d8630,0x00001008,0x00000000,0x000c74e0,
-0x0007d182,0x0002d640,0x000a8630,0x00001008,
-0x000799b8,0x0002d6c0,0x0000748a,0x000c3ec5,
-0x0007420a,0x000c0000,0x00062208,0x000c4117,
-0x00070630,0x00001009,0x00000000,0x000c0000,
-0x0001022e,0x00000000,0x0003a630,0x00001009,
-0x00000000,0x000c0000,0x00000036,0x00001000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x0002a730,0x00001008,0x0007f801,0x000c0000,
-0x00000037,0x00001000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x00000000,0x00000000,
-0x00000000,0x00000000,0x0002a730,0x00001008,
-0x00000033,0x00001000,0x0002a705,0x00001008,
-0x00007a01,0x000c0000,0x000e6288,0x000d550a,
-0x0006428a,0x00000000,0x00060730,0x0000100a,
-0x00000000,0x000c0000,0x00000000,0x00000000,
-0x0007aab0,0x00034880,0x00078fb0,0x0000100b,
-0x00057488,0x00000000,0x00033b94,0x00081140,
-0x000183ae,0x00000000,0x000786b0,0x0000100b,
-0x00022f05,0x000c3545,0x0000eb8a,0x00000000,
-0x00042731,0x00001003,0x0007aab0,0x00034880,
-0x00048fb0,0x0000100a,0x00057488,0x00000000,
-0x00033b94,0x00081140,0x000183ae,0x00000000,
-0x000806b0,0x0000100b,0x00022f05,0x00000000,
-0x00007401,0x00091140,0x00048f05,0x000951c0,
-0x00042731,0x00001003,0x0000473d,0x00001000,
-0x000f19b0,0x000bbc47,0x00080000,0x000bffc7,
-0x000fe19e,0x00001003,0x00000000,0x00000000,
-0x0008e19c,0x00001003,0x000083c1,0x00093040,
-0x00000f41,0x00097140,0x0000a841,0x0009b240,
-0x0000a0c1,0x0009f040,0x0001c641,0x00093540,
-0x0001cec1,0x0009b5c0,0x00000000,0x000fdc44,
-0x00055208,0x00000000,0x00010705,0x000a2880,
-0x0000a23a,0x00093a00,0x0003fc8a,0x000df6c5,
-0x0004ef0a,0x000c0000,0x00012f05,0x00036880,
-0x00065308,0x000c2997,0x000d86b0,0x0000100a,
-0x0004410a,0x000d40c7,0x00000000,0x00000000,
-0x00080730,0x00001004,0x00056f0a,0x000ea105,
-0x00000000,0x00000000,0x0000473d,0x00001000,
-0x000f19b0,0x000bbc47,0x00080000,0x000bffc7,
-0x0000273d,0x00001000,0x00000000,0x000eba44,
-0x00048f05,0x0000f440,0x00007401,0x0000f7c0,
-0x00000734,0x00001000,0x00010705,0x000a6880,
-0x00006a88,0x000c75c4,0x00000000,0x000e5084,
-0x00000000,0x000eba44,0x00087401,0x000e4782,
-0x00000734,0x00001000,0x00010705,0x000a6880,
-0x00006a88,0x000c75c4,0x0007c108,0x000c0000,
-0x0007e721,0x000bed40,0x00005f25,0x000badc0,
-0x0003ba97,0x000beb80,0x00065590,0x000b2e00,
-0x00033217,0x00003ec0,0x00065590,0x000b8e40,
-0x0003ed80,0x000491c0,0x00073fb0,0x00074c80,
-0x000283a0,0x0000100c,0x000ee388,0x00042970,
-0x00008301,0x00021ef2,0x000b8f14,0x0000000f,
-0x000c4d8d,0x0000001b,0x000d6dc2,0x000e06c6,
-0x000032ac,0x000c3916,0x0004edc2,0x00074c80,
-0x00078898,0x00001000,0x00038894,0x00000032,
-0x000c4d8d,0x00092e1b,0x000d6dc2,0x000e06c6,
-0x0004edc2,0x000c1956,0x0000722c,0x00034a00,
-0x00041705,0x0009ed40,0x00058730,0x00001400,
-0x000d7488,0x000c3a00,0x00048f05,0x00000000};
-
-static struct
-{   u32 Offset;
-    u32 Size;
-    u32 *pFill;
-} FillStat[FILL__COUNT] = {
-                            {0x00000000, sizeof(FillArray1), FillArray1},
-                            {0x00001800, sizeof(FillArray2), FillArray2},
-                            {0x000137f0, sizeof(FillArray3), FillArray3},
-                            {0x00020000, sizeof(FillArray4), FillArray4}
-                          };
-
-
-#endif
diff --git a/sound/oss/cs46xx.c b/sound/oss/cs46xx.c
deleted file mode 100644 (file)
index 2a1f0d9..0000000
+++ /dev/null
@@ -1,5444 +0,0 @@
-/*
- *     Crystal SoundFusion CS46xx driver
- *
- *     Copyright 1998-2001 Cirrus Logic Corporation <pcaudio@crystal.cirrus.com>
- *                                             <twoller@crystal.cirrus.com>
- *     Copyright 1999-2000 Jaroslav Kysela <perex@suse.cz>
- *     Copyright 2000 Alan Cox <alan@redhat.com>
- *
- *     The core of this code is taken from the ALSA project driver by 
- *     Jaroslav. Please send Jaroslav the credit for the driver and 
- *     report bugs in this port to <alan@redhat.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 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.
- *     Current maintainers:
- *             Cirrus Logic Corporation, Thomas Woller (tw)
- *                     <twoller@crystal.cirrus.com>
- *             Nils Faerber (nf)
- *                     <nils@kernelconcepts.de>
- *             Thanks to David Pollard for testing.
- *
- *     Changes:
- *     20000909-nf     Changed cs_read, cs_write and drain_dac
- *     20001025-tw     Separate Playback/Capture structs and buffers.
- *                     Added Scatter/Gather support for Playback.
- *                     Added Capture.
- *     20001027-nf     Port to kernel 2.4.0-test9, some clean-ups
- *                     Start of powermanagement support (CS46XX_PM).
- *     20001128-tw     Add module parm for default buffer order.
- *                     added DMA_GFP flag to kmalloc dma buffer allocs.
- *                     backfill silence to eliminate stuttering on
- *                     underruns.
- *     20001201-tw     add resyncing of swptr on underruns.
- *     20001205-tw-nf  fixed GETOSPACE ioctl() after open()
- *     20010113-tw     patch from Hans Grobler general cleanup.
- *     20010117-tw     2.4.0 pci cleanup, wrapper code for 2.2.16-2.4.0
- *     20010118-tw     basic PM support for 2.2.16+ and 2.4.0/2.4.2.
- *     20010228-dh     patch from David Huggins - cs_update_ptr recursion.
- *     20010409-tw     add hercules game theatre XP amp code.
- *     20010420-tw     cleanup powerdown/up code.
- *     20010521-tw     eliminate pops, and fixes for powerdown.
- *     20010525-tw     added fixes for thinkpads with powerdown logic.
- *     20010723-sh     patch from Horms (Simon Horman) -
- *                     SOUND_PCM_READ_BITS returns bits as set in driver
- *                     rather than a logical or of the possible values.
- *                     Various ioctls handle the case where the device
- *                     is open for reading or writing but not both better.
- *
- *     Status:
- *     Playback/Capture supported from 8k-48k.
- *     16Bit Signed LE & 8Bit Unsigned, with Mono or Stereo supported.
- *
- *     APM/PM - 2.2.x APM is enabled and functioning fine. APM can also
- *     be enabled for 2.4.x by modifying the CS46XX_ACPI_SUPPORT macro
- *     definition.
- *
- *      Hercules Game Theatre XP - the EGPIO2 pin controls the external Amp,
- *     so, use the drain/polarity to enable.  
- *     hercules_egpio_disable set to 1, will force a 0 to EGPIODR.
- *
- *     VTB Santa Cruz - the GPIO7/GPIO8 on the Secondary Codec control
- *     the external amplifier for the "back" speakers, since we do not
- *     support the secondary codec then this external amp is also not
- *     turned on.
- */
-#include <linux/interrupt.h>
-#include <linux/list.h>
-#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/pci.h>
-#include <linux/bitops.h>
-#include <linux/init.h>
-#include <linux/poll.h>
-#include <linux/ac97_codec.h>
-#include <linux/mutex.h>
-#include <linux/mm.h>
-
-#include <asm/io.h>
-#include <asm/dma.h>
-#include <asm/uaccess.h>
-
-#include "cs46xxpm.h"
-#include "cs46xx_wrapper-24.h"
-#include "cs461x.h"
-
-/* MIDI buffer sizes */
-#define CS_MIDIINBUF  500
-#define CS_MIDIOUTBUF 500
-
-#define ADC_RUNNING    1
-#define DAC_RUNNING    2
-
-#define CS_FMT_16BIT   1               /* These are fixed in fact */
-#define CS_FMT_STEREO  2
-#define CS_FMT_MASK    3
-
-#define CS_TYPE_ADC    1
-#define CS_TYPE_DAC    2
-
-#define CS_TRUE        1
-#define CS_FALSE       0
-
-#define CS_INC_USE_COUNT(m) (atomic_inc(m))
-#define CS_DEC_USE_COUNT(m) (atomic_dec(m))
-#define CS_DEC_AND_TEST(m) (atomic_dec_and_test(m))
-#define CS_IN_USE(m) (atomic_read(m) != 0)
-
-#define CS_DBGBREAKPOINT {__asm__("INT $3");}
-/*
- *     CS461x definitions
- */
-#define CS461X_BA0_SIZE                0x2000
-#define CS461X_BA1_DATA0_SIZE  0x3000
-#define CS461X_BA1_DATA1_SIZE  0x3800
-#define CS461X_BA1_PRG_SIZE    0x7000
-#define CS461X_BA1_REG_SIZE    0x0100
-
-#define GOF_PER_SEC    200
-
-#define CSDEBUG_INTERFACE 1
-#define CSDEBUG 1
-/*
- * Turn on/off debugging compilation by using 1/0 respectively for CSDEBUG
- *
- *
- * CSDEBUG is usual mode is set to 1, then use the
- * cs_debuglevel and cs_debugmask to turn on or off debugging.
- * Debug level of 1 has been defined to be kernel errors and info
- * that should be printed on any released driver.
- */
-#if CSDEBUG
-#define CS_DBGOUT(mask,level,x) if ((cs_debuglevel >= (level)) && ((mask) & cs_debugmask)) {x;}
-#else
-#define CS_DBGOUT(mask,level,x) 
-#endif
-/*
- * cs_debugmask areas
- */
-#define CS_INIT                0x00000001              /* initialization and probe functions */
-#define CS_ERROR       0x00000002              /* tmp debugging bit placeholder */
-#define CS_INTERRUPT   0x00000004              /* interrupt handler (separate from all other) */
-#define CS_FUNCTION    0x00000008              /* enter/leave functions */
-#define CS_WAVE_WRITE  0x00000010              /* write information for wave */
-#define CS_WAVE_READ   0x00000020              /* read information for wave */
-#define CS_MIDI_WRITE  0x00000040              /* write information for midi */
-#define CS_MIDI_READ   0x00000080              /* read information for midi */
-#define CS_MPU401_WRITE 0x00000100             /* write information for mpu401 */
-#define CS_MPU401_READ         0x00000200              /* read information for mpu401 */
-#define CS_OPEN                0x00000400              /* all open functions in the driver */
-#define CS_RELEASE     0x00000800              /* all release functions in the driver */
-#define CS_PARMS       0x00001000              /* functional and operational parameters */
-#define CS_IOCTL       0x00002000              /* ioctl (non-mixer) */
-#define CS_PM          0x00004000              /* PM */
-#define CS_TMP         0x10000000              /* tmp debug mask bit */
-
-#define CS_IOCTL_CMD_SUSPEND   0x1     // suspend
-#define CS_IOCTL_CMD_RESUME    0x2     // resume
-
-#if CSDEBUG
-static unsigned long cs_debuglevel = 1;                        /* levels range from 1-9 */
-module_param(cs_debuglevel, ulong, 0644);
-static unsigned long cs_debugmask = CS_INIT | CS_ERROR;        /* use CS_DBGOUT with various mask values */
-module_param(cs_debugmask, ulong, 0644);
-#endif
-static unsigned long hercules_egpio_disable;  /* if non-zero set all EGPIO to 0 */
-module_param(hercules_egpio_disable, ulong, 0);
-static unsigned long initdelay = 700;  /* PM delay in millisecs */
-module_param(initdelay, ulong, 0);
-static unsigned long powerdown = -1;  /* turn on/off powerdown processing in driver */
-module_param(powerdown, ulong, 0);
-#define DMABUF_DEFAULTORDER 3
-static unsigned long defaultorder = DMABUF_DEFAULTORDER;
-module_param(defaultorder, ulong, 0);
-
-static int external_amp;
-module_param(external_amp, bool, 0);
-static int thinkpad;
-module_param(thinkpad, bool, 0);
-
-/*
-* set the powerdown module parm to 0 to disable all 
-* powerdown. also set thinkpad to 1 to disable powerdown, 
-* but also to enable the clkrun functionality.
-*/
-static unsigned cs_powerdown = 1;
-static unsigned cs_laptop_wait = 1;
-
-/* An instance of the 4610 channel */
-struct cs_channel 
-{
-       int used;
-       int num;
-       void *state;
-};
-
-#define CS46XX_MAJOR_VERSION "1"
-#define CS46XX_MINOR_VERSION "28"
-
-#ifdef __ia64__
-#define CS46XX_ARCH            "64"    //architecture key
-#else
-#define CS46XX_ARCH            "32"    //architecture key
-#endif
-
-static struct list_head cs46xx_devs = { &cs46xx_devs, &cs46xx_devs };
-
-/* magic numbers to protect our data structures */
-#define CS_CARD_MAGIC          0x43525553 /* "CRUS" */
-#define CS_STATE_MAGIC         0x4c4f4749 /* "LOGI" */
-#define NR_HW_CH               3
-
-/* maxinum number of AC97 codecs connected, AC97 2.0 defined 4 */
-#define NR_AC97                2
-
-static const unsigned sample_size[] = { 1, 2, 2, 4 };
-static const unsigned sample_shift[] = { 0, 1, 1, 2 };
-
-/* "software" or virtual channel, an instance of opened /dev/dsp */
-struct cs_state {
-       unsigned int magic;
-       struct cs_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;
-       
-       struct dmabuf {
-               /* wave sample stuff */
-               unsigned int rate;
-               unsigned char fmt, enable;
-
-               /* hardware channel */
-               struct cs_channel *channel;
-               int pringbuf;           /* Software ring slot */
-               void *pbuf;             /* 4K hardware DMA buffer */
-
-               /* OSS buffer management stuff */
-               void *rawbuf;
-               dma_addr_t dma_handle;
-               unsigned buforder;
-               unsigned numfrag;
-               unsigned fragshift;
-               unsigned divisor;
-               unsigned type;
-               void *tmpbuff;                  /* tmp buffer for sample conversions */
-               dma_addr_t dmaaddr;
-               dma_addr_t dmaaddr_tmpbuff;
-               unsigned buforder_tmpbuff;      /* Log base 2 of size in bytes.. */
-
-               /* 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 comsumed or been generated by dma machine */
-               unsigned total_bytes;   /* total bytes dmaed by hardware */
-               unsigned blocks;        /* total blocks */
-
-               unsigned error;         /* number of over/underruns */
-               unsigned underrun;      /* underrun pending before next write has occurred */
-               wait_queue_head_t wait; /* put process on wait queue when no more space in buffer */
-
-               /* redundant, but makes calculations easier */
-               unsigned fragsize;
-               unsigned dmasize;
-               unsigned fragsamples;
-
-               /* OSS stuff */
-               unsigned mapped:1;
-               unsigned ready:1;
-               unsigned endcleared:1;
-               unsigned SGok:1;
-               unsigned update_flag;
-               unsigned ossfragshift;
-               int ossmaxfrags;
-               unsigned subdivision;
-       } dmabuf;
-       /* Guard against mmap/write/read races */
-       struct mutex sem;
-};
-
-struct cs_card {
-       struct cs_channel channel[2];
-       unsigned int magic;
-
-       /* We keep cs461x cards in a linked list */
-       struct cs_card *next;
-
-       /* The cs461x has a certain amount of cross channel interaction
-          so we use a single per card lock */
-       spinlock_t lock;
-       
-       /* Keep AC97 sane */
-       spinlock_t ac97_lock;
-
-       /* mixer use count */
-       atomic_t mixer_use_cnt;
-
-       /* PCI device stuff */
-       struct pci_dev *pci_dev;
-       struct list_head list;
-
-       unsigned int pctl, cctl;        /* Hardware DMA flag sets */
-
-       /* soundcore stuff */
-       int dev_audio;
-       int dev_midi;
-
-       /* structures for abstraction of hardware facilities, codecs, banks and channels*/
-       struct ac97_codec *ac97_codec[NR_AC97];
-       struct cs_state *states[2];
-
-       u16 ac97_features;
-       
-       int amplifier;                  /* Amplifier control */
-       void (*amplifier_ctrl)(struct cs_card *, int);
-       void (*amp_init)(struct cs_card *);
-       
-       int active;                     /* Active clocking */
-       void (*active_ctrl)(struct cs_card *, int);
-       
-       /* hardware resources */
-       unsigned long ba0_addr;
-       unsigned long ba1_addr;
-       u32 irq;
-       
-       /* mappings */
-       void __iomem *ba0;
-       union
-       {
-               struct
-               {
-                       u8 __iomem *data0;
-                       u8 __iomem *data1;
-                       u8 __iomem *pmem;
-                       u8 __iomem *reg;
-               } name;
-               u8 __iomem *idx[4];
-       } ba1;
-       
-       /* Function support */
-       struct cs_channel *(*alloc_pcm_channel)(struct cs_card *);
-       struct cs_channel *(*alloc_rec_pcm_channel)(struct cs_card *);
-       void (*free_pcm_channel)(struct cs_card *, int chan);
-
-       /* /dev/midi stuff */
-       struct {
-               unsigned ird, iwr, icnt;
-               unsigned ord, owr, ocnt;
-               wait_queue_head_t open_wait;
-               wait_queue_head_t iwait;
-               wait_queue_head_t owait;
-               spinlock_t lock;
-               unsigned char ibuf[CS_MIDIINBUF];
-               unsigned char obuf[CS_MIDIOUTBUF];
-               mode_t open_mode;
-               struct mutex open_mutex;
-       } midi;
-       struct cs46xx_pm pm;
-};
-
-static int cs_open_mixdev(struct inode *inode, struct file *file);
-static int cs_release_mixdev(struct inode *inode, struct file *file);
-static int cs_ioctl_mixdev(struct inode *inode, struct file *file, unsigned int cmd,
-                       unsigned long arg);
-static int cs_hardware_init(struct cs_card *card);
-static int cs46xx_powerup(struct cs_card *card, unsigned int type);
-static int cs461x_powerdown(struct cs_card *card, unsigned int type, int suspendflag);
-static void cs461x_clear_serial_FIFOs(struct cs_card *card, int type);
-#ifdef CONFIG_PM
-static int cs46xx_suspend_tbl(struct pci_dev *pcidev, pm_message_t state);
-static int cs46xx_resume_tbl(struct pci_dev *pcidev);
-#endif
-
-#if CSDEBUG
-
-/* DEBUG ROUTINES */
-
-#define SOUND_MIXER_CS_GETDBGLEVEL     _SIOWR('M',120, int)
-#define SOUND_MIXER_CS_SETDBGLEVEL     _SIOWR('M',121, int)
-#define SOUND_MIXER_CS_GETDBGMASK      _SIOWR('M',122, int)
-#define SOUND_MIXER_CS_SETDBGMASK      _SIOWR('M',123, int)
-#define SOUND_MIXER_CS_APM             _SIOWR('M',124, int)
-
-static void printioctl(unsigned int x)
-{
-    unsigned int i;
-    unsigned char vidx;
-       /* these values are incorrect for the ac97 driver, fix.
-         * Index of mixtable1[] member is Device ID 
-         * and must be <= SOUND_MIXER_NRDEVICES.
-         * Value of array member is index into s->mix.vol[]
-         */
-        static const unsigned char mixtable1[SOUND_MIXER_NRDEVICES] = {
-                [SOUND_MIXER_PCM]     = 1,   /* voice */
-                [SOUND_MIXER_LINE1]   = 2,   /* AUX */
-                [SOUND_MIXER_CD]      = 3,   /* CD */
-                [SOUND_MIXER_LINE]    = 4,   /* Line */
-                [SOUND_MIXER_SYNTH]   = 5,   /* FM */
-                [SOUND_MIXER_MIC]     = 6,   /* Mic */
-                [SOUND_MIXER_SPEAKER] = 7,   /* Speaker */
-                [SOUND_MIXER_RECLEV]  = 8,   /* Recording level */
-                [SOUND_MIXER_VOLUME]  = 9    /* Master Volume */
-        };
-        
-    switch (x) {
-       case SOUND_MIXER_CS_GETDBGMASK:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_CS_GETDBGMASK: ") );
-               break;
-       case SOUND_MIXER_CS_GETDBGLEVEL:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_CS_GETDBGLEVEL: ") );
-               break;
-       case SOUND_MIXER_CS_SETDBGMASK:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_CS_SETDBGMASK: ") );
-               break;
-       case SOUND_MIXER_CS_SETDBGLEVEL:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_CS_SETDBGLEVEL: ") );
-               break;
-        case OSS_GETVERSION:
-               CS_DBGOUT(CS_IOCTL, 4, printk("OSS_GETVERSION: ") );
-               break;
-        case SNDCTL_DSP_SYNC:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_SYNC: ") );
-               break;
-        case SNDCTL_DSP_SETDUPLEX:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_SETDUPLEX: ") );
-               break;
-        case SNDCTL_DSP_GETCAPS:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_GETCAPS: ") );
-               break;
-        case SNDCTL_DSP_RESET:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_RESET: ") );
-               break;
-        case SNDCTL_DSP_SPEED:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_SPEED: ") );
-               break;
-        case SNDCTL_DSP_STEREO:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_STEREO: ") );
-               break;
-        case SNDCTL_DSP_CHANNELS:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_CHANNELS: ") );
-               break;
-        case SNDCTL_DSP_GETFMTS: 
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_GETFMTS: ") );
-               break;
-        case SNDCTL_DSP_SETFMT: 
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_SETFMT: ") );
-               break;
-        case SNDCTL_DSP_POST:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_POST: ") );
-               break;
-        case SNDCTL_DSP_GETTRIGGER:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_GETTRIGGER: ") );
-               break;
-        case SNDCTL_DSP_SETTRIGGER:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_SETTRIGGER: ") );
-               break;
-        case SNDCTL_DSP_GETOSPACE:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_GETOSPACE: ") );
-               break;
-        case SNDCTL_DSP_GETISPACE:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_GETISPACE: ") );
-               break;
-        case SNDCTL_DSP_NONBLOCK:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_NONBLOCK: ") );
-               break;
-        case SNDCTL_DSP_GETODELAY:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_GETODELAY: ") );
-               break;
-        case SNDCTL_DSP_GETIPTR:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_GETIPTR: ") );
-               break;
-        case SNDCTL_DSP_GETOPTR:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_GETOPTR: ") );
-               break;
-        case SNDCTL_DSP_GETBLKSIZE:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_GETBLKSIZE: ") );
-               break;
-        case SNDCTL_DSP_SETFRAGMENT:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_SETFRAGMENT: ") );
-               break;
-        case SNDCTL_DSP_SUBDIVIDE:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_SUBDIVIDE: ") );
-               break;
-        case SOUND_PCM_READ_RATE:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_PCM_READ_RATE: ") );
-               break;
-        case SOUND_PCM_READ_CHANNELS:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_PCM_READ_CHANNELS: ") );
-               break;
-        case SOUND_PCM_READ_BITS:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_PCM_READ_BITS: ") );
-               break;
-        case SOUND_PCM_WRITE_FILTER:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_PCM_WRITE_FILTER: ") );
-               break;
-        case SNDCTL_DSP_SETSYNCRO:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SNDCTL_DSP_SETSYNCRO: ") );
-               break;
-        case SOUND_PCM_READ_FILTER:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_PCM_READ_FILTER: ") );
-               break;
-        case SOUND_MIXER_PRIVATE1:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_PRIVATE1: ") );
-               break;
-        case SOUND_MIXER_PRIVATE2:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_PRIVATE2: ") );
-               break;
-        case SOUND_MIXER_PRIVATE3:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_PRIVATE3: ") );
-               break;
-        case SOUND_MIXER_PRIVATE4:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_PRIVATE4: ") );
-               break;
-        case SOUND_MIXER_PRIVATE5:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_PRIVATE5: ") );
-               break;
-        case SOUND_MIXER_INFO:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_INFO: ") );
-               break;
-        case SOUND_OLD_MIXER_INFO:
-               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_OLD_MIXER_INFO: ") );
-               break;
-       default:
-               switch (_IOC_NR(x)) {
-                       case SOUND_MIXER_VOLUME:
-                               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_VOLUME: ") );
-                               break;
-                       case SOUND_MIXER_SPEAKER:
-                               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_SPEAKER: ") );
-                               break;
-                       case SOUND_MIXER_RECLEV:
-                               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_RECLEV: ") );
-                               break;
-                       case SOUND_MIXER_MIC:
-                               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_MIC: ") );
-                               break;
-                       case SOUND_MIXER_SYNTH:
-                               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_SYNTH: ") );
-                               break;
-                       case SOUND_MIXER_RECSRC: 
-                               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_RECSRC: ") );
-                               break;
-                       case SOUND_MIXER_DEVMASK:
-                               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_DEVMASK: ") );
-                               break;
-                       case SOUND_MIXER_RECMASK:
-                               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_RECMASK: ") );
-                               break;
-                       case SOUND_MIXER_STEREODEVS: 
-                               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_STEREODEVS: ") );
-                               break;
-                       case SOUND_MIXER_CAPS:
-                               CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_CAPS:") );
-                               break;
-                       default:
-                               i = _IOC_NR(x);
-                               if (i >= SOUND_MIXER_NRDEVICES || !(vidx = mixtable1[i])) {
-                                       CS_DBGOUT(CS_IOCTL, 4, printk("UNKNOWN IOCTL: 0x%.8x NR=%d ",x,i) );
-                               } else {
-                                       CS_DBGOUT(CS_IOCTL, 4, printk("SOUND_MIXER_IOCTL AC9x: 0x%.8x NR=%d ",
-                                                       x,i));
-                               }
-                               break;
-               }
-    }
-    CS_DBGOUT(CS_IOCTL, 4, printk("command = 0x%x IOC_NR=%d\n",x, _IOC_NR(x)) );
-}
-#endif
-
-/*
- *  common I/O routines
- */
-
-static void cs461x_poke(struct cs_card *codec, unsigned long reg, unsigned int val)
-{
-       writel(val, codec->ba1.idx[(reg >> 16) & 3] + (reg & 0xffff));
-}
-
-static unsigned int cs461x_peek(struct cs_card *codec, unsigned long reg)
-{
-       return readl(codec->ba1.idx[(reg >> 16) & 3] + (reg & 0xffff));
-}
-
-static void cs461x_pokeBA0(struct cs_card *codec, unsigned long reg, unsigned int val)
-{
-       writel(val, codec->ba0 + reg);
-}
-
-static unsigned int cs461x_peekBA0(struct cs_card *codec, unsigned long reg)
-{
-       return readl(codec->ba0 + reg);
-}
-
-
-static u16 cs_ac97_get(struct ac97_codec *dev, u8 reg);
-static void cs_ac97_set(struct ac97_codec *dev, u8 reg, u16 data);
-
-static struct cs_channel *cs_alloc_pcm_channel(struct cs_card *card)
-{
-       if (card->channel[1].used == 1)
-               return NULL;
-       card->channel[1].used = 1;
-       card->channel[1].num = 1;
-       return &card->channel[1];
-}
-
-static struct cs_channel *cs_alloc_rec_pcm_channel(struct cs_card *card)
-{
-       if (card->channel[0].used == 1)
-               return NULL;
-       card->channel[0].used = 1;
-       card->channel[0].num = 0;
-       return &card->channel[0];
-}
-
-static void cs_free_pcm_channel(struct cs_card *card, int channel)
-{
-       card->channel[channel].state = NULL;
-       card->channel[channel].used = 0;
-}
-
-/*
- * setup a divisor value to help with conversion from
- * 16bit Stereo, down to 8bit stereo/mono or 16bit mono.
- * assign a divisor of 1 if using 16bit Stereo as that is
- * the only format that the static image will capture.
- */
-static void cs_set_divisor(struct dmabuf *dmabuf)
-{
-       if (dmabuf->type == CS_TYPE_DAC)
-               dmabuf->divisor = 1;
-       else if (!(dmabuf->fmt & CS_FMT_STEREO) &&
-           (dmabuf->fmt & CS_FMT_16BIT))
-               dmabuf->divisor = 2;
-       else if ((dmabuf->fmt & CS_FMT_STEREO) &&
-           !(dmabuf->fmt & CS_FMT_16BIT))
-               dmabuf->divisor = 2;
-       else if (!(dmabuf->fmt & CS_FMT_STEREO) &&
-           !(dmabuf->fmt & CS_FMT_16BIT))
-               dmabuf->divisor = 4;
-       else
-               dmabuf->divisor = 1;
-
-       CS_DBGOUT(CS_PARMS | CS_FUNCTION, 8, printk(
-               "cs46xx: cs_set_divisor()- %s %d\n",
-                       (dmabuf->type == CS_TYPE_ADC) ? "ADC" : "DAC", 
-                       dmabuf->divisor) );
-}
-
-/*
-* mute some of the more prevalent registers to avoid popping.
-*/
-static void cs_mute(struct cs_card *card, int state) 
-{
-       struct ac97_codec *dev = card->ac97_codec[0];
-
-       CS_DBGOUT(CS_FUNCTION, 2, printk(KERN_INFO "cs46xx: cs_mute()+ %s\n",
-               (state == CS_TRUE) ? "Muting" : "UnMuting"));
-
-       if (state == CS_TRUE) {
-       /*
-       * fix pops when powering up on thinkpads
-       */
-               card->pm.u32AC97_master_volume = (u32)cs_ac97_get( dev, 
-                               (u8)BA0_AC97_MASTER_VOLUME); 
-               card->pm.u32AC97_headphone_volume = (u32)cs_ac97_get(dev, 
-                               (u8)BA0_AC97_HEADPHONE_VOLUME); 
-               card->pm.u32AC97_master_volume_mono = (u32)cs_ac97_get(dev, 
-                               (u8)BA0_AC97_MASTER_VOLUME_MONO); 
-               card->pm.u32AC97_pcm_out_volume = (u32)cs_ac97_get(dev, 
-                               (u8)BA0_AC97_PCM_OUT_VOLUME);
-                       
-               cs_ac97_set(dev, (u8)BA0_AC97_MASTER_VOLUME, 0x8000);
-               cs_ac97_set(dev, (u8)BA0_AC97_HEADPHONE_VOLUME, 0x8000);
-               cs_ac97_set(dev, (u8)BA0_AC97_MASTER_VOLUME_MONO, 0x8000);
-               cs_ac97_set(dev, (u8)BA0_AC97_PCM_OUT_VOLUME, 0x8000);
-       } else {
-               cs_ac97_set(dev, (u8)BA0_AC97_MASTER_VOLUME, card->pm.u32AC97_master_volume);
-               cs_ac97_set(dev, (u8)BA0_AC97_HEADPHONE_VOLUME, card->pm.u32AC97_headphone_volume);
-               cs_ac97_set(dev, (u8)BA0_AC97_MASTER_VOLUME_MONO, card->pm.u32AC97_master_volume_mono);
-               cs_ac97_set(dev, (u8)BA0_AC97_PCM_OUT_VOLUME, card->pm.u32AC97_pcm_out_volume);
-       }
-       CS_DBGOUT(CS_FUNCTION, 2, printk(KERN_INFO "cs46xx: cs_mute()-\n"));
-}
-
-/* set playback sample rate */
-static unsigned int cs_set_dac_rate(struct cs_state * state, unsigned int rate)
-{      
-       struct dmabuf *dmabuf = &state->dmabuf;
-       unsigned int tmp1, tmp2;
-       unsigned int phiIncr;
-       unsigned int correctionPerGOF, correctionPerSec;
-       unsigned long flags;
-
-       CS_DBGOUT(CS_FUNCTION, 2, printk("cs46xx: cs_set_dac_rate()+ %d\n",rate) );
-
-       /*
-        *  Compute the values used to drive the actual sample rate conversion.
-        *  The following formulas are being computed, using inline assembly
-        *  since we need to use 64 bit arithmetic to compute the values:
-        *
-        *  phiIncr = floor((Fs,in * 2^26) / Fs,out)
-        *  correctionPerGOF = floor((Fs,in * 2^26 - Fs,out * phiIncr) /
-         *                                   GOF_PER_SEC)
-         *  ulCorrectionPerSec = Fs,in * 2^26 - Fs,out * phiIncr -M
-         *                       GOF_PER_SEC * correctionPerGOF
-        *
-        *  i.e.
-        *
-        *  phiIncr:other = dividend:remainder((Fs,in * 2^26) / Fs,out)
-        *  correctionPerGOF:correctionPerSec =
-        *      dividend:remainder(ulOther / GOF_PER_SEC)
-        */
-       tmp1 = rate << 16;
-       phiIncr = tmp1 / 48000;
-       tmp1 -= phiIncr * 48000;
-       tmp1 <<= 10;
-       phiIncr <<= 10;
-       tmp2 = tmp1 / 48000;
-       phiIncr += tmp2;
-       tmp1 -= tmp2 * 48000;
-       correctionPerGOF = tmp1 / GOF_PER_SEC;
-       tmp1 -= correctionPerGOF * GOF_PER_SEC;
-       correctionPerSec = tmp1;
-
-       /*
-        *  Fill in the SampleRateConverter control block.
-        */
-       spin_lock_irqsave(&state->card->lock, flags);
-       cs461x_poke(state->card, BA1_PSRC,
-         ((correctionPerSec << 16) & 0xFFFF0000) | (correctionPerGOF & 0xFFFF));
-       cs461x_poke(state->card, BA1_PPI, phiIncr);
-       spin_unlock_irqrestore(&state->card->lock, flags);
-       dmabuf->rate = rate;
-       
-       CS_DBGOUT(CS_FUNCTION, 2, printk("cs46xx: cs_set_dac_rate()- %d\n",rate) );
-       return rate;
-}
-
-/* set recording sample rate */
-static unsigned int cs_set_adc_rate(struct cs_state *state, unsigned int rate)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       struct cs_card *card = state->card;
-       unsigned int phiIncr, coeffIncr, tmp1, tmp2;
-       unsigned int correctionPerGOF, correctionPerSec, initialDelay;
-       unsigned int frameGroupLength, cnt;
-       unsigned long flags;
-       CS_DBGOUT(CS_FUNCTION, 2, printk("cs46xx: cs_set_adc_rate()+ %d\n",rate) );
-
-       /*
-        *  We can only decimate by up to a factor of 1/9th the hardware rate.
-        *  Correct the value if an attempt is made to stray outside that limit.
-        */
-       if ((rate * 9) < 48000)
-               rate = 48000 / 9;
-
-       /*
-        *  We cannot capture at at rate greater than the Input Rate (48000).
-        *  Return an error if an attempt is made to stray outside that limit.
-        */
-       if (rate > 48000)
-               rate = 48000;
-
-       /*
-        *  Compute the values used to drive the actual sample rate conversion.
-        *  The following formulas are being computed, using inline assembly
-        *  since we need to use 64 bit arithmetic to compute the values:
-        *
-        *     coeffIncr = -floor((Fs,out * 2^23) / Fs,in)
-        *     phiIncr = floor((Fs,in * 2^26) / Fs,out)
-        *     correctionPerGOF = floor((Fs,in * 2^26 - Fs,out * phiIncr) /
-        *                                GOF_PER_SEC)
-        *     correctionPerSec = Fs,in * 2^26 - Fs,out * phiIncr -
-        *                          GOF_PER_SEC * correctionPerGOF
-        *     initialDelay = ceil((24 * Fs,in) / Fs,out)
-        *
-        * i.e.
-        *
-        *     coeffIncr = neg(dividend((Fs,out * 2^23) / Fs,in))
-        *     phiIncr:ulOther = dividend:remainder((Fs,in * 2^26) / Fs,out)
-        *     correctionPerGOF:correctionPerSec =
-        *          dividend:remainder(ulOther / GOF_PER_SEC)
-        *     initialDelay = dividend(((24 * Fs,in) + Fs,out - 1) / Fs,out)
-        */
-       tmp1 = rate << 16;
-       coeffIncr = tmp1 / 48000;
-       tmp1 -= coeffIncr * 48000;
-       tmp1 <<= 7;
-       coeffIncr <<= 7;
-       coeffIncr += tmp1 / 48000;
-       coeffIncr ^= 0xFFFFFFFF;
-       coeffIncr++;
-       tmp1 = 48000 << 16;
-       phiIncr = tmp1 / rate;
-       tmp1 -= phiIncr * rate;
-       tmp1 <<= 10;
-       phiIncr <<= 10;
-       tmp2 = tmp1 / rate;
-       phiIncr += tmp2;
-       tmp1 -= tmp2 * rate;
-       correctionPerGOF = tmp1 / GOF_PER_SEC;
-       tmp1 -= correctionPerGOF * GOF_PER_SEC;
-       correctionPerSec = tmp1;
-       initialDelay = ((48000 * 24) + rate - 1) / rate;
-
-       /*
-        *  Fill in the VariDecimate control block.
-        */
-       spin_lock_irqsave(&card->lock, flags);
-       cs461x_poke(card, BA1_CSRC,
-               ((correctionPerSec << 16) & 0xFFFF0000) | (correctionPerGOF & 0xFFFF));
-       cs461x_poke(card, BA1_CCI, coeffIncr);
-       cs461x_poke(card, BA1_CD,
-               (((BA1_VARIDEC_BUF_1 + (initialDelay << 2)) << 16) & 0xFFFF0000) | 0x80);
-       cs461x_poke(card, BA1_CPI, phiIncr);
-       spin_unlock_irqrestore(&card->lock, flags);
-
-       /*
-        *  Figure out the frame group length for the write back task.  Basically,
-        *  this is just the factors of 24000 (2^6*3*5^3) that are not present in
-        *  the output sample rate.
-        */
-       frameGroupLength = 1;
-       for (cnt = 2; cnt <= 64; cnt *= 2) {
-               if (((rate / cnt) * cnt) != rate)
-                       frameGroupLength *= 2;
-       }
-       if (((rate / 3) * 3) != rate) {
-               frameGroupLength *= 3;
-       }
-       for (cnt = 5; cnt <= 125; cnt *= 5) {
-               if (((rate / cnt) * cnt) != rate) 
-                       frameGroupLength *= 5;
-        }
-
-       /*
-        * Fill in the WriteBack control block.
-        */
-       spin_lock_irqsave(&card->lock, flags);
-       cs461x_poke(card, BA1_CFG1, frameGroupLength);
-       cs461x_poke(card, BA1_CFG2, (0x00800000 | frameGroupLength));
-       cs461x_poke(card, BA1_CCST, 0x0000FFFF);
-       cs461x_poke(card, BA1_CSPB, ((65536 * rate) / 24000));
-       cs461x_poke(card, (BA1_CSPB + 4), 0x0000FFFF);
-       spin_unlock_irqrestore(&card->lock, flags);
-       dmabuf->rate = rate;
-       CS_DBGOUT(CS_FUNCTION, 2, printk("cs46xx: cs_set_adc_rate()- %d\n",rate) );
-       return rate;
-}
-
-/* prepare channel attributes for playback */ 
-static void cs_play_setup(struct cs_state *state)
-{
-       struct dmabuf *dmabuf = &state->dmabuf;
-       struct cs_card *card = state->card;
-        unsigned int tmp, Count, playFormat;
-
-       CS_DBGOUT(CS_FUNCTION, 2, printk("cs46xx: cs_play_setup()+\n") );
-        cs461x_poke(card, BA1_PVOL, 0x80008000);
-        if (!dmabuf->SGok)
-               cs461x_poke(card, BA1_PBA, virt_to_bus(dmabuf->pbuf));
-    
-        Count = 4;                                                          
-        playFormat=cs461x_peek(card, BA1_PFIE);                             
-        if ((dmabuf->fmt & CS_FMT_STEREO)) {                                
-                playFormat &= ~DMA_RQ_C2_AC_MONO_TO_STEREO;                 
-                Count *= 2;                                                 
-        } else
-                playFormat |= DMA_RQ_C2_AC_MONO_TO_STEREO;                  
-                                                                            
-        if ((dmabuf->fmt & CS_FMT_16BIT)) {                                 
-                playFormat &= ~(DMA_RQ_C2_AC_8_TO_16_BIT                    
-                           | DMA_RQ_C2_AC_SIGNED_CONVERT);                  
-                Count *= 2;                                                 
-        } else
-                playFormat |= (DMA_RQ_C2_AC_8_TO_16_BIT                     
-                           | DMA_RQ_C2_AC_SIGNED_CONVERT);                  
-                                                                            
-        cs461x_poke(card, BA1_PFIE, playFormat);                            
-                                                                            
-        tmp = cs461x_peek(card, BA1_PDTC);                                  
-        tmp &= 0xfffffe00;                                                  
-        cs461x_poke(card, BA1_PDTC, tmp | --Count);                         
-
-       CS_DBGOUT(CS_FUNCTION, 2, printk("cs46xx: cs_play_setup()-\n") );
-}
-
-static struct InitStruct
-{
-    u32 off;
-    u32 val;
-} InitArray[] = { {0x00000040, 0x3fc0000f},
-                  {0x0000004c, 0x04800000},
-
-                  {0x000000b3, 0x00000780},
-                  {0x000000b7, 0x00000000},
-                  {0x000000bc, 0x07800000},
-
-                  {0x000000cd, 0x00800000},
-                };
-
-/*
- * "SetCaptureSPValues()" -- Initialize record task values before each
- *     capture startup.  
- */
-static void SetCaptureSPValues(struct cs_card *card)
-{
-       unsigned i, offset;
-       CS_DBGOUT(CS_FUNCTION, 8, printk("cs46xx: SetCaptureSPValues()+\n") );
-       for (i = 0; i < sizeof(InitArray) / sizeof(struct InitStruct); i++) {
-               offset = InitArray[i].off*4; /* 8bit to 32bit offset value */
-               cs461x_poke(card, offset, InitArray[i].val );
-       }
-       CS_DBGOUT(CS_FUNCTION, 8, printk("cs46xx: SetCaptureSPValues()-\n") );
-}
-
-/* prepare channel attributes for recording */
-static void cs_rec_setup(struct cs_state *state)
-{
-       struct cs_card *card = state->card;
-       struct dmabuf *dmabuf = &state->dmabuf;
-
-       CS_DBGOUT(CS_FUNCTION, 2, printk("cs46xx: cs_rec_setup()+\n"));
-       SetCaptureSPValues(card);
-
-       /*
-