Subject: Advice to people writing audio drivers
To: None <tech-kern@netbsd.org>
From: Charles M. Hannum <mycroft@mit.edu>
List: tech-kern
Date: 08/10/1998 12:33:22
A few things...

1) Use the new `trigger' interface, rather than the old init/start
   interface.  This is important because I have some future plans for
   cleaning up the audio layer which depend on it.  (I've already
   converted the eap, ess, and sbdsp code, and will probably do ad1848
   and am7930 as well.  Other people should deal with the other 7
   audio drivers in our tree.)

2) I noticed that some drivers (e.g. lmc) only support one output
   mode.  It's moderately important that all drivers support 8KHz
   u-law output.  There is code to handle emulating this, and many of
   the drivers (e.g. eap, ess, sbdsp) use it -- as well as emulating
   many other modes.

3) Beware AUDIO_PROP_INDEPENDENT (or lack thereof).  Especially if the
   driver supports emulated modes, you should make sure this flag is
   set (and that whatever coupling is actually necessary is enforced
   in set_params), or the channels will be forced to have the same
   encoding.  See the eap or ess drivers for an example of coupling
   the sample rate only.

4) If the hardware supports a looping DMA mode, use it.

5) Support mmap(2) if possible.  (This requires *very* little code in
   the driver.  Mainly you just have to write the mmap entry point and
   set AUDIO_PROP_MMAP.)

I'd actually like to get rid of AUDIO_PROP_MMAP and
AUDIO_PROP_INDEPENDENT at some point, and simply make these required.

Anyway, that's all for now.