[alsa-devel] Writing an AT91SAM9260-EK Dumb Codec Driver

Paul Kavan pkavan at gmail.com
Fri Jun 15 20:46:59 CEST 2007

Hello all:

I am working on a driver for a dumb codec to work with the SSC as a PCM on
the AT91SAM9260. I have, with the gracious help of Frank Mandarino, have the
glue code written without too many problems. However, I need some guidance
on getting a few things configured correctly for my codec and then getting
it to compile and load correctly.

For configuration, I am using the Winbond W6811. For this, I am going to use
a 256kHz BCLK and an 8kHz frame. Each sample consists of 8-bit u-law PCM,
MSB first. When I execute a read from the codec to the processor, I need to
make the reads on the falling edge of the BCLK at each sync pulse. When
executing a write from the processor to the codec I need to write on the
rising edge at each sync pulse. I think I the timing correct in my driver

    cmr_div = 187;    /* PCM_CLK = ~96MHz/(2*187) = 256kHz */
   period = 15;    /* PCM_SYNC = PCM_CLK/(2*(15+1)) = 8000Hz */

However, I am not sure how to get the following correct for my needs:


Now to making the driver once the code is done. I am relatively new to
writing linux drivers. In the 6 or so that I have written, I usually
cross-compile them as modules and then insmod them. I have tried that here
and am getting a strange warning that I am unsure of.  I have a pretty
simple Makefile and when I execute it, I get:

make ARCH=arm CROSS_COMPILE=arm-linux-
make -C ~/Linux_Builds/linux-
make[1]: Entering directory `/home/grhuser/Linux_Builds/linux-'
  CC [M]
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: "at91_ssc_dai"
  LD [M]
make[1]: Leaving directory `/home/grhuser/Linux_Builds/linux-'

As you can see, I am using linux- I have ALSA checked and AT91-SoC
checked in my .config file. For this attempt to build the driver, I have a
separate folder than contains: at91-ssc.h and at91-pcm.h. If there is a more
correct way to do this and be able to debug it, please let me know.

I have attached copies of my driver. I would appreciate any and all feedback
and assistance on getting this running.

More information about the Alsa-devel mailing list