1=======================================================
2Documentation for the NeoMagic 256AV/256ZX sound driver
3=======================================================
4
5You're looking at version 1.1 of the driver.  (Woohoo!) It has been
6successfully tested against the following laptop models:
7
8	Sony Z505S/Z505SX/Z505DX/Z505RX
9	Sony F150, F160, F180, F250, F270, F280, PCG-F26
10	Dell Latitude CPi, CPt (various submodels)
11
12There are a few caveats, which is why you should read the entirety of
13this document first.
14
15This driver was developed without any support or assistance from
16NeoMagic.  There is no warranty, expressed, implied, or otherwise.  It
17is free software in the public domain; feel free to use it, sell it,
18give it to your best friends, even claim that you wrote it (but why?!)
19but don't go whining to me, NeoMagic, Sony, Dell, or anyone else
20when it blows up your computer.
21
22Version 1.1 contains a change to try and detect non-AC97 versions of
23the hardware, and not install itself appropriately.  It should also
24reinitialize the hardware on an APM resume event, assuming that APM
25was configured into your kernel.
26
27============
28Installation
29============
30
31Enable the sound drivers, the OSS sound drivers, and then the NM256
32driver.  The NM256 driver *must* be configured as a module (it won't
33give you any other choice).
34
35Next, do the usual "make modules" and "make modules_install".
36Finally, insmod the soundcore, sound and nm256 modules.
37
38When the nm256 driver module is loaded, you should see a couple of
39confirmation messages in the kernel logfile indicating that it found
40the device (the device does *not* use any I/O ports or DMA channels).
41Now try playing a wav file, futz with the CD-ROM if you have one, etc.
42
43The NM256 is entirely a PCI-based device, and all the necessary
44information is automatically obtained from the card.  It can only be
45configured as a module in a vain attempt to prevent people from
46hurting themselves.  It works correctly if it shares an IRQ with
47another device (it normally shares IRQ 9 with the builtin eepro100
48ethernet on the Sony Z505 laptops). 
49
50It does not run the card in any sort of compatibility mode. It will
51not work on laptops that have the SB16-compatible, AD1848-compatible
52or CS4232-compatible codec/mixer; you will want to use the appropriate
53compatible OSS driver with these chipsets.  I cannot provide any
54assistance with machines using the SB16, AD1848 or CS4232 compatible
55versions.  (The driver now attempts to detect the mixer version, and
56will refuse to load if it believes the hardware is not
57AC97-compatible.)
58
59The sound support is very basic, but it does include simultaneous
60playback and record capability.  The mixer support is also quite
61simple, although this is in keeping with the rather limited
62functionality of the chipset.
63
64There is no hardware synthesizer available, as the Losedows OPL-3 and
65MIDI support is done via hardware emulation.
66
67Only three recording devices are available on the Sony: the
68microphone, the CD-ROM input, and the volume device (which corresponds
69to the stereo output).  (Other devices may be available on other
70models of laptops.)  The Z505 series does not have a builtin CD-ROM,
71so of course the CD-ROM input doesn't work.  It does work on laptops
72with a builtin CD-ROM drive.
73
74The mixer device does not appear to have any tone controls, at least
75on the Z505 series.  The mixer module checks for tone controls in the
76AC97 mixer, and will enable them if they are available.
77
78==============
79Known problems
80==============
81
82  * There are known problems with PCMCIA cards and the eepro100 ethernet 
83    driver on the Z505S/Z505SX/Z505DX.  Keep reading.
84
85  * There are also potential problems with using a virtual X display, and
86    also problems loading the module after the X server has been started. 
87    Keep reading.
88
89  * The volume control isn't anywhere near linear.  Sorry.  This will be
90    fixed eventually, when I get sufficiently annoyed with it.  (I doubt
91    it will ever be fixed now, since I've never gotten sufficiently
92    annoyed with it and nobody else seems to care.)
93
94  * There are reports that the CD-ROM volume is very low.  Since I do not
95    have a CD-ROM equipped laptop, I cannot test this (it's kinda hard to
96    do remotely).
97
98  * Only 8 fixed-rate speeds are supported.  This is mainly a chipset
99    limitation.  It may be possible to support other speeds in the future.
100
101  * There is no support for the telephone mixer/codec.  There is support
102    for a phonein/phoneout device in the mixer driver;  whether or not 
103    it does anything is anyone's guess.  (Reports on this would be
104    appreciated.  You'll have to figure out how to get the phone to
105    go off-hook before it'll work, tho.)
106
107  * This driver was not written with any cooperation or support from
108    NeoMagic.  If you have any questions about this, see their website
109    for their official stance on supporting open source drivers.
110
111============
112Video memory
113============
114
115The NeoMagic sound engine uses a portion of the display memory to hold
116the sound buffer.  (Crazy, eh?)  The NeoMagic video BIOS sets up a
117special pointer at the top of video RAM to indicate where the top of
118the audio buffer should be placed.
119
120At the present time XFree86 is apparently not aware of this.  It will
121thus write over either the pointer or the sound buffer with abandon.
122(Accelerated-X seems to do a better job here.)
123
124This implies a few things:
125
126  * Sometimes the NM256 driver has to guess at where the buffer 
127    should be placed, especially if the module is loaded after the
128    X server is started.  It's usually correct, but it will consistently
129    fail on the Sony F250.
130
131  * Virtual screens greater than 1024x768x16 under XFree86 are
132    problematic on laptops with only 2.5MB of screen RAM. This
133    includes all of the 256AV-equipped laptops.  (Virtual displays
134    may or may not work on the 256ZX, which has at least 4MB of
135    video RAM.)
136
137If you start having problems with random noise being output either
138constantly (this is the usual symptom on the F250), or when windows
139are moved around (this is the usual symptom when using a virtual
140screen), the best fix is to
141
142  * Don't use a virtual frame buffer.
143  * Make sure you load the NM256 module before the X server is
144    started.
145
146On the F250, it is possible to force the driver to load properly even
147after the XFree86 server is started by doing:
148
149	insmod nm256 buffertop=0x25a800
150
151This forces the audio buffers to the correct offset in screen RAM.
152
153One user has reported a similar problem on the Sony F270, although
154others apparently aren't seeing any problems.  His suggested command
155is
156
157	insmod nm256 buffertop=0x272800
158
159=================
160Official WWW site
161=================
162
163The official site for the NM256 driver is:
164
165	http://www.uglx.org/sony.html
166
167You should always be able to get the latest version of the driver there,
168and the driver will be supported for the foreseeable future.
169
170==============
171Z505RX and IDE
172==============
173
174There appears to be a problem with the IDE chipset on the Z505RX; one
175of the symptoms is that sound playback periodically hangs (when the
176disk is accessed).  The user reporting the problem also reported that
177enabling all of the IDE chipset workarounds in the kernel solved the
178problem, tho obviously only one of them should be needed--if someone
179can give me more details I would appreciate it.
180
181==============================
182Z505S/Z505SX on-board Ethernet
183==============================
184
185If you're using the on-board Ethernet Pro/100 ethernet support on the Z505
186series, I strongly encourage you to download the latest eepro100 driver from
187Donald Becker's site:
188
189	ftp://cesdis.gsfc.nasa.gov/pub/linux/drivers/test/eepro100.c
190
191There was a reported problem on the Z505SX that if the ethernet
192interface is disabled and reenabled while the sound driver is loaded,
193the machine would lock up.  I have included a workaround that is
194working satisfactorily.  However, you may occasionally see a message
195about "Releasing interrupts, over 1000 bad interrupts" which indicates
196that the workaround is doing its job.
197
198==================================
199PCMCIA and the Z505S/Z505SX/Z505DX
200==================================
201
202There is also a known problem with the Sony Z505S and Z505SX hanging
203if a PCMCIA card is inserted while the ethernet driver is loaded, or
204in some cases if the laptop is suspended.  This is caused by tons of
205spurious IRQ 9s, probably generated from the PCMCIA or ACPI bridges.
206
207There is currently no fix for the problem that works in every case.
208The only known workarounds are to disable the ethernet interface
209before inserting or removing a PCMCIA card, or with some cards
210disabling the PCMCIA card before ejecting it will also help the
211problem with the laptop hanging when the card is ejected.
212
213One user has reported that setting the tcic's cs_irq to some value
214other than 9 (like 11) fixed the problem.  This doesn't work on my
215Z505S, however--changing the value causes the cardmgr to stop seeing
216card insertions and removals, cards don't seem to work correctly, and
217I still get hangs if a card is inserted when the kernel is booted.
218
219Using the latest ethernet driver and pcmcia package allows me to
220insert an Adaptec 1480A SlimScsi card without the laptop hanging,
221although I still have to shut down the card before ejecting or
222powering down the laptop.  However, similar experiments with a DE-660
223ethernet card still result in hangs when the card is inserted.  I am
224beginning to think that the interrupts are CardBus-related, since the
225Adaptec card is a CardBus card, and the DE-660 is not; however, I
226don't have any other CardBus cards to test with.
227
228======
229Thanks
230======
231
232First, I want to thank everyone (except NeoMagic of course) for their
233generous support and encouragement.  I'd like to list everyone's name
234here that replied during the development phase, but the list is
235amazingly long.
236
237I will be rather unfair and single out a few people, however:
238
239	Justin Maurer, for being the first random net.person to try it,
240	and for letting me login to his Z505SX to get it working there
241
242	Edi Weitz for trying out several different versions, and giving
243	me a lot of useful feedback
244
245	Greg Rumple for letting me login remotely to get the driver 
246	functional on the 256ZX, for his assistance on tracking
247	down all sorts of random stuff, and for trying out Accel-X
248
249	Zach Brown, for the initial AC97 mixer interface design
250
251	Jeff Garzik, for various helpful suggestions on the AC97
252	interface
253
254	"Mr. Bumpy" for feedback on the Z505RX
255
256	Bill Nottingham, for generous assistance in getting the mixer ID
257	code working
258
259=================
260Previous versions
261=================
262
263Versions prior to 0.3 (aka `noname') had problems with weird artifacts
264in the output and failed to set the recording rate properly.  These
265problems have long since been fixed.
266
267Versions prior to 0.5 had problems with clicks in the output when
268anything other than 16-bit stereo sound was being played, and also had
269periodic clicks when recording.
270
271Version 0.7 first incorporated support for the NM256ZX chipset, which
272is found on some Dell Latitude laptops (the CPt, and apparently
273some CPi models as well).  It also included the generic AC97
274mixer module.
275
276Version 0.75 renamed all the functions and files with slightly more
277generic names.
278
279Note that previous versions of this document claimed that recording was
2808-bit only; it actually has been working for 16-bits all along.
281