=======================================================
Documentation for the NeoMagic 256AV/256ZX sound driver
=======================================================

You're looking at version 1.0 of the driver.  (Woohoo!) It has been
successfully tested against the following laptop models:

	Sony Z505S/Z505SX/Z505DX
	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 come whining to me, NeoMagic, Sony, Dell, or anyone else
when it blows up your computer.

============
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. Thus it
almost certainly will not work on laptops that have the
SB16-compatible codec/mixer; you will want to use the standard SB16
OSS driver with these chipsets.  I cannot provide any assistance with
machines using the SB-16 compatible version.

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.

Recording is mono 8-bit only.

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 if your mixer program supports it;
    whether or not it does anything is anyone's guess.  (Reports on this
    would be appreciated.)
  
  * 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 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.o buffertop=0x25a800

This forces the audio buffers to the correct offset in screen RAM.

=================
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.

==============================
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.
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,
and the only known workaround is to disable the ethernet interface
before inserting or removing a PCMCIA card.

======
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

=================
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.
