snd_amd5536.ko is a FreeBSD 7.0 and 6.x audio (sound) driver for the AMD 5536 companion chip sound system. This driver was developed on an ALIX 1C low power computer board from PC Engines, with a 500 Mhz AMD Geode LX CPU and an AMD cs5536 companion chip. The Alix 1D is now the current board: http://www.mini-box.com/Alix-1C-Board-1-LAN-1-MINI-PCI_2?sc=8&category=754 This driver was developed for FreeBSD 7.0 and FreeBSD 6.2. The driver has 2 play channels and 1 record channel. However, since the Alix 1C has only a single codec, the two play channels must use the same dma busmaster, and hence they must have the same rate (speed) and the same block size. Currently, channel 0 takes precedence. I. To load this driver: 1) Make a /usr/src/modules/sound/driver/amd5536 directory. (you MUST be root to load this driver). 2) Download snd_amd5536.tar.gz into this directory. At this time it is at: www.modelofreality.org/snd_amd5536 3) "Unzip" and "Untar" the file: gzip -d snd_amd5536.tar.gz tar xvf snd_amd5536.tar 4) Move snd_amd5536.ko to the /boot/kernel directory: mv ./snd_amd5536.ko /boot/kernel 5) load the driver with the kernel dynamic loader: kldload snd_amd5536.ko 6) To allow the mic to work, run: mixer rec 75 Run mixer again to check. The "rec" level should be 75. (If you want to use the "line" interface instead of the mic: mixer +rec line ) 7) Turn OFF the vchan interface for FreeBSD 7.0. (This is mandatory since the vchan interface wants to run the two play channels at different rates): sysctl dev.pcm.0.play.vchans=0 sysctl dev.pcm.0.rec.vchans=0 run cat /dev/sndstat to verify. It should say 2p:0v/1r:0v channels duplex default II. The driver should now be loaded and ready. To test the device: 1) cat count.raw > /dev/dsp You should hear me counting out of the speakers. 2) While this is playing, switch to another terminal by pressing ALT-F2. cat count.raw > /dev/dsp You should hear both left and right channels simultaneously counting. You can also cat 1khz.raw > /dev/dsp to hear a 1 khz sine wave. 3) Switch back to the primary terminal by pressing ALT-F1. Put a mic into the mic jack. cat /dev/dsp > test.raw Speak into the microphone and when finished, press CTRL-c. 4) To hear what you recorded: cat test.raw > /dev/dsp 5) You can also run ./loopback to hear the mono mic input from the speakers. Press CTRL-c to exit. III. Settings for automatic boot. 1) Put snd_amd5536_load="YES" into /boot/loader.conf to automatically load on bootup. (snd_amd5536.ko must be in the /boot/kernel directory). 2) Rather than running mixer rec 75 everytime to enable record, one can put hint.pcm.0.rec="75" into the /boot/device.hints file. 3) Put dev.pcm.0.play.vchans=0 (use no spaces) dev.pcm.0.rec.vchans=0 into the /etc/sysctl.conf file, to automatically turn off the vchan interface (mandatory). IV. Compiling this driver on FreeBSD 7.0: 1) You must have "source files" installed for this to work. If you do not have source files installed, find out how to install them from the freebsd.org site. 2) Move the amd5536.c and amd5536.h files to the /usr/src/sys/dev/sound/pci directory While in the /usr/src/sys/modules/sound/driver/amd5536 directory: mv ./amd5536.c /usr/src/sys/dev/sound/pci mv ./amd5536.h /usr/src/sys/dev/sound/pci 3) You should be root to compile this driver. Type make The sound driver should compile. 4) Don't forget that the snd_amd5536.ko must be placed into the /boot/kernel directory for automatic boot. If you want to run the new driver temporarily, then first unload the current one: kldunload -n snd_amd5536 5) Then load the new one: kldload ./snd_amd5536.ko 6) Check by running: kldstat or cat /dev/sndstat V. Other notes. 1) This drivers supports 2 mono channels simultaneously: Channel 0 and Channel 1. However, if Channel 0 is programmed as stereo, it takes precedence and uses both left and right channels. Channel 1 will not be heard out of the right channel in if Channel 0 is running in stereo. 2) The 1 record channel is independent and runs in either stereo or mono. However, if record is run mono, then only the left channel is recorded! The right channel is ignored in this case. 3) The vchan interface should not be used. 4) Channel 0 takes precedence over Channel 1. Change the blocksize for channel 0 to change the blocksize for both. Change the rate for channel 0 to change the rate for both. For programmers: open /dev/dsp to get play channel 0, then open /dev/dsp0.1 to get play channel 1. Set the rate and blocksize for channel 0. Andrew Gray ancelgray?yahoo.com