AtmelAc97cDriver

Status

I can confirm that the AC97 driver in the 2.6.18-at0 (BSP 2.0) kernel works. It was tested on the NGW100 using a Cirrus Logic CS4202 AC97 CODEC attached to the expansion headers. This chip can be acquired from Digikey for around $6 USD. It also requires a 24.576MHz crystal and a few passive components. See the reference design in the for details.

How to use it

Your kernel .config should have the following:

#
# Sound
#
CONFIG_SOUND=m

#
# Advanced Linux Sound Architecture
#
CONFIG_SND=m
CONFIG_SND_TIMER=m
CONFIG_SND_PCM=m
# CONFIG_SND_SEQUENCER is not set
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=m
CONFIG_SND_PCM_OSS=m
CONFIG_SND_PCM_OSS_PLUGINS=y
# CONFIG_SND_DYNAMIC_MINORS is not set
# CONFIG_SND_SUPPORT_OLD_API is not set
CONFIG_SND_VERBOSE_PROCFS=y
CONFIG_SND_VERBOSE_PRINTK=y
CONFIG_SND_DEBUG=y
CONFIG_SND_DEBUG_DETECT=y
# CONFIG_SND_PCM_XRUN_DEBUG is not set

#
# Generic devices
#
CONFIG_SND_AC97_CODEC=m
CONFIG_SND_AC97_BUS=m
CONFIG_SND_DUMMY=m
# CONFIG_SND_MTPAV is not set
# CONFIG_SND_SERIAL_U16550 is not set
# CONFIG_SND_MPU401 is not set

#
# ALSA AVR32 devices
#
CONFIG_SND_ATMEL_AC97=m
CONFIG_SND_ATMEL_AC97_USE_ALSA_MALLOC_CALLS=y
CONFIG_SND_ATMEL_AC97C_USE_PDC=y
CONFIG_SND_AT73C213=m
CONFIG_SND_AT73C213_USE_ALSA_MALLOC_CALLS=y

#
# Open Sound System
#
CONFIG_SOUND_PRIME=m
# CONFIG_OSS_OBSOLETE_DRIVER is not set
# CONFIG_SOUND_MSNDCLAS is not set
# CONFIG_SOUND_MSNDPIN is not set
CONFIG_SOUND_AT32_DAC=m

Edit your board setup file to add the AC97 peripheral initialization:

linux-2.6.xx/arch/avr32/boards/atngw/setup.c for the NGW100 linux-2.6.xx/arch/avr32/boards/atstk1000/atstk1002.c for the STK1000

add the following line to your board setup file (this call is located in linux-2.6.xx/arch/avr32/mach-at32ap/at32ap7000.c):

for the NGW100, inside static int __init atngw_init(void) add

at32_add_device_ac97c(0);

for the STK1000, inside static int __init atstk1002_init(void) add

at32_add_device_ac97c(0);

Then recompile your kernel.

Add the following lines to /etc/modules on your target to load the modules automatically at boot, or you can manually load them with modprobe.

snd-atmel-ac97 index=0 id="CS4202" enable=1
snd-pcm-oss
snd-mixer-oss

Check to see if everything worked by typing:

cat /proc/asound/cards

You should see the following:

 0 [CS4202         ]: ac97c - Atmel-AC97
                      Atmel AVR32 AC97 Controller at 0xfff02800, irq 29

Inside your /dev directory you should now have:

pcmC0D0c
pcmC0D0p
mixer
controlC0
dsp
audio