This version is outdated by a newer approved version.DiffThis version (29 Aug 2011 14:58) was approved by mhennerich.The Previously approved version (29 Aug 2011 14:46) is available.Diff

This is an old revision of the document!

ADAU1373 Sound CODEC Linux Driver

Supported Devices

This driver supports the

Source Code


Source Mainlined?
git In progress


Example device initialization

For compile time configuration, it’s common Linux practice to keep board- and application-specific configuration out of the main driver file, instead putting it into the board support file.

For devices on custom boards, as typical of embedded and SoC-(system-on-chip) based hardware, Linux uses platform_data to point to board-specific structures describing devices and how they are connected to the SoC. This can include available ports, chip variants, preferred modes, default initialization, additional pin roles, and so on. This shrinks the board-support packages (BSPs) and minimizes board and application specific #ifdefs in drivers.

21 Oct 2010 16:10


Declaring I2C devices

Unlike PCI or USB devices, I2C devices are not enumerated at the hardware level. Instead, the software must know which devices are connected on each I2C bus segment, and what address these devices are using. For this reason, the kernel code must instantiate I2C devices explicitly. There are different ways to achieve this, depending on the context and requirements. However the most common method is to declare the I2C devices by bus number.

This method is appropriate when the I2C bus is a system bus, as in many embedded systems, wherein each I2C bus has a number which is known in advance. It is thus possible to pre-declare the I2C devices that inhabit this bus. This is done with an array of struct i2c_board_info, which is registered by calling i2c_register_board_info().

So, to enable such a driver one need only edit the board support file by adding an appropriate entry to i2c_board_info.

For more information see: Documentation/i2c/instantiating-devices

21 Oct 2010 16:10
static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
		I2C_BOARD_INFO("adau1373", 0x1a),
static int __init stamp_init(void)
	i2c_register_board_info(0, bfin_i2c_board_info,
	return 0;

ASoC DAPM Widgets

Name Description
AIN1L Left Channel Input 1
AIN1R Right Channel Input 1
AIN2L Left Channel Input 2
AIN2R Right Channel Input 2
AIN3L Left Channel Input 3
AIN3R Right Channel Input 3
AIN4L Left Channel Input 4
AIN4R Right Channel Input 4
DMIC1DAT Serial Data Input Digital Microphone 1 and 2
DMIC2DAT Serial Data Input Digital Microphone 3 and 4
LOUT1L Left Channel Line Output 1
LOUT1R Right Channel Line Output 1
LOUT2L Left Channel Line Output 2
LOUT2R Right Channel Line Output 2
HPL Left Headphone Output
HPR Right Headphone Output
SPKL Left Speaker Output
SPKR Right Speaker Output
EP Eearpiece Output
MICBIAS1 Micbias 1 supply
MICBIAS2 Micbias 2 supply

ALSA Controls

Name Description Configuration
AIF1 Capture Volume
AIF2 Capture Volume
AIF3 Capture Volume
ADC Capture Volume
DMIC Capture Volume
AIF1 Playback Volume
AIF2 Playback Volume
AIF3 Playback Volume
DAC1 Playback Volume
DAC2 Playback Volume
Lineout1 Playback Volume
Speaker Playback Volume
Headphone Playback Volume
Input 1 Capture Volume
Input 2 Capture Volume
Input 3 Capture Volume
Input 4 Capture Volume
Earpiece Playback Volume
AIF3 Boost Playback Volume
AIF2 Boost Playback Volume
AIF1 Boost Playback Volume
AIF3 Boost Capture Volume
AIF2 Boost Capture Volume
AIF1 Boost Capture Volume
DMIC Boost Capture Volume
ADC Boost Capture Volume
DAC2 Boost Playback Volume
DAC1 Boost Playback Volume
Input 1 Boost Capture Volume
Input 2 Boost Capture Volume
Input 3 Boost Capture Volume
Input 4 Boost Capture Volume
Speaker Boost Playback Volume
Lineout1 LR Mux
Speaker LR Mux
HPF Cutoff
HPF Switch
HPF Channel
Bass HPF Cutoff
Bass Clip Level Threshold
Bass LPF Cutoff
Bass Playback Switch
Bass Playback Volume
Bass Channel
3D Freq
3D Level
3D Playback Switch
3D Playback Volume
3D Channel
Zero Cross Switch
Lineout2 Playback Volume Single-ended lineout
Lineout2 LR Mux Single-ended lineout
DRC1 Channel
DRC2 Channel
DRC3 Channel

Supported DAI formats

Name Supported by driver Description
SND_SOC_DAIFMT_I2S yes I2S Justified mode
SND_SOC_DAIFMT_RIGHT_J yes Right Justified mode
SND_SOC_DAIFMT_LEFT_J yes Left Justified mode
SND_SOC_DAIFMT_AC97 no AC97 mode
SND_SOC_DAIFMT_PDM no Pulse density modulation
SND_SOC_DAIFMT_NB_NF yes Normal bit- and frameclock
SND_SOC_DAIFMT_NB_IF yes Normal bitclock, inverted frameclock
SND_SOC_DAIFMT_IB_NF yes Inverted frameclock, normal bitclock
SND_SOC_DAIFMT_IB_IF yes Inverted bit- and frameclock
SND_SOC_DAIFMT_CBM_CFM yes Codec bit- and frameclock master
SND_SOC_DAIFMT_CBS_CFM no Codec bitclock slave, frameclock master
SND_SOC_DAIFMT_CBM_CFS no Codec bitclock master, frameclock slave
SND_SOC_DAIFMT_CBS_CFS yes Codec bit- and frameclock slave

ADAU1373 evaluation board driver



Source Mainlined?
In progress


Adding Kernel Support - As a module

Skip this section if you want to build the driver into the kernel directly. To add support for codec ADAU1373 to the kernel build system, a few things must be enabled properly for things to work.The configuration is as following:

Linux Kernel Configuration
  Device Drivers  ---> 
    Sound  ---> 
      <M> Sound card support
        Advanced Linux Sound Architecture  --->
          <M> Advanced Linux Sound Architecture
          < > Sequencer support
          <M> OSS Mixer API 
          <M> OSS PCM (digital audio) API
        System on Chip audio support  --->
            <M> ALSA for SoC audio support
            <M> SoC I2S Audio for the ADI BF5xx chip 
            <M> SoC ADAU1373 Audio support 
            < > SoC AC97 Audio support for BF5xx 
            (0) Set a SPORT for Sound chip
I2C bus is used to configure the codec. So, if the audio driver is built into kernel, the I2c driver is also built into kernel automatically. But if the audio driver is built as module, then make sure that the I2C driver is loaded before the audio module.
Linux Kernel Configuration
  Device Drivers  --->
    <*> I2C support  --->
      --- I2C support
          I2C Hardware Bus Support --->
            <*> Blackfin TWI I2C support  

Doing this will create modules (outside the kernel). The modules will be inserted automatically when it is needed. You can also build sound driver into kernel.

Testing the built in kernel driver

If audio is configured as modules, skip this section. If audio is built into kernel and you have booted the kernel, there are a few things to check to ensure audio is working:

  1. Check the boot messages to see if you have booted the correct kernel. During kernel boot, it should print out:
    Advanced Linux Sound Architecture Driver Version 1.0.12rc1 (Thu Jun 22 13:55:50 2006 UTC).
    ASoC version 0.13.1
    dma rx:3 tx:4, err irq:15, regs:ffc00800
    adau1371 Audio Codec 0.1<6>dma_alloc_init: dma_page @ 0x03011000 - 512 pages at 0x03e00000
    asoc: ADAU1373 <-> bf5xx-i2s-0 mapping ok
    ALSA device list:
      #0: bf5xx_adau1373 (ADAU1373)

Testing the audio module

root:~> modprobe snd-adau1373
root:~> modprobe snd-pcm-oss
root:~> lsmod
Module                  Size  Used by
snd_pcm_oss            31968  0 
snd_mixer_oss          11360  1 snd_pcm_oss
snd_adau1373             1412  0 
snd_soc_adau1373         8528  1 snd_adau1373
snd_soc_bf5xx           2784  1 snd_adau1373
snd_soc_bf5xx_i2s      10916  2 snd_adau1373,snd_soc_bf5xx
snd_soc_core           17120  3 snd_adau1373,snd_soc_adau1373,snd_soc_bf5xx
snd_pcm                48356  3 snd_pcm_oss,snd_soc_bf5xx,snd_soc_core
snd_page_alloc          4232  1 snd_pcm
snd_timer              13796  1 snd_pcm
snd                    31092  6 snd_pcm_oss,snd_mixer_oss,snd_soc_adau1373,snd_soc_core,snd_pcm,snd_timer
soundcore               3940  1 snd

root:~> tone
TONE: generating sine wave at 1000 Hz...

Testing Audio

  1. Check the output
    root:~> tone
    TONE: generating sine wave at 1000 Hz...
    You should hear something out of the headphone Jack on the top of J8.
  2. Select audio input to INPB (the default is INPA, assuming you have built ALSA utils):
    root:/> amixer sset 'Input Mux' 'INPB'
    Simple mixer control 'Input Mux',0
      Capabilities: enum
      Items: 'INPA' 'INPB' 'INPD' 'INPD'
      Item0: 'INPB'
    Also you can run “alsamixer” to get graphic configuration interface.
  3. Check to make sure mp3s work (assuming you have built mp3play),
    1. The first step is to download a mp3 file onto the platform. The wget command assumes that networking is properly configured (you have an IP number, the default gateway is set, and DNS servers can be accessed), and working. See the network setup page for more info.
      root:/> cd /var
      root:/var> wget
    2. Next, play it with mp3play:
      root:/var> mp3play ABCOWhosOnFirstclip.mp3
  4. You can play it in one step with:
    root:~> mp3play MPEG2-III (0 ms)
  5. Optionally check to make sure the audio out is right:
    root:/> amixer sset 'Output Mixer' 'Line'
    Simple mixer control 'Output Mixer',0
      Capabilities: enum
      Items: 'Line' 'Class D' 'HeadPhone'
      Item0: 'Line'
    root:~> arecord -d 10 test.wav
    Recording WAVE "test.wav" : Unsigned 8 bit, Rate 8000 Hz, Mono
    root:~> aplay test.wav
    Adjust playback volume can be done through command:amixer sset Master 80%
    here 80 is the ratio.
    This should record 10 seconds of whatever is on the Line, and then play it back over the output.
  6. You should also be able to do a “talkthrough”, and hear on the speakers anything you put on the line.
    root:~> arecord | aplay
resources/tools-software/linux-drivers/sound/adau1373.1314622713.txt.gz · Last modified: 29 Aug 2011 14:58 by mhennerich