ADAU1372

ADAU1372 Sound CODEC Linux Driver.

Supported Devices

Evaluation Boards

Source Code

Status

Source

Mainlined?

git

WiP

Files

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.

I2C

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: How to instantiate I2C devices

The I2C device id depends on the ADDR0 and ADDR1 pin settings and needs to be set according to your board setup.

ADDR1

ADDR0

I2C device id

0

0

0x3c

0

1

0x3d

1

0

0x3e

1

1

0x3f

In this example we assume ADDR0=0 and ADDR1=0.

static struct i2c_board_info __initdata bfin_i2c_board_info[] = {

    [--snip--]
    {
        I2C_BOARD_INFO("adau1372", 0x3c),
    },
    [--snip--]
}
static int __init stamp_init(void)
{
    [--snip--]
    i2c_register_board_info(0, bfin_i2c_board_info,
                ARRAY_SIZE(bfin_i2c_board_info));
    [--snip--]

    return 0;
}
arch_initcall(board_init);

SPI

Unlike PCI or USB devices, SPI devices are not enumerated at the hardware level. Instead, the software must know which devices are connected on each SPI bus segment, and what slave selects these devices are using. For this reason, the kernel code must instantiate SPI devices explicitly. The most common method is to declare the SPI devices by bus number.

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

For more information see: Overview of Linux kernel SPI support

ASoC DAPM Widgets

The driver registers a set of input, output and supply DAPM widgets which represent the physical input and output signals of the device. For maximum power-saving these are widgets should be used in the machine driver DAPM routing to accurately model the external connections of the device.

Name

Description

AIN0

ADC0 Single-ended Analog Input

AIN1

ADC1 Single-ended Analog Input

AIN2

ADC2 Single-ended Analog Input

AIN3

ADC3 Single-ended Analog Input

DMIC0_1

Digital Microphone Input Channel 0 and 1

DMIC2_3

Digital Microphone Input Channel 2 and 3

MICBIAS0

Bias Voltage for Electret Microphone

MICBIAS1

Bias Voltage for Electret Microphone

HPOUTL

Left Headphone Output

HPOUTR

Right Headphone Output

ALSA Controls

Name

Description

Configuration

ADC 0 Capture Switch

Digital mute control for the first ADC path.

ADC 0 Capture Volume

Digital attenuation volume control for the first ADC path.

ADC 0+1 Bias

ADC0 and ADC1 bias current setting. Available settings: Normal operation Enhanced performance Power saving

ADC 0+1 High-Pass-Filter

High-Pass-Filter configuration for the first and second ADC path. Available settings: Off 1 Hz 4 Hz 8 Hz

ADC 1 Capture Switch

Digital mute control for the second ADC path.

ADC 1 Capture Volume

Digital attenuation volume control for the second ADC path.

ADC 2 Capture Switch

Digital mute control for the third ADC path.

ADC 2 Capture Volume

Digital attenuation volume control for the third ADC path.

ADC 2+3 Bias

ADC2 and ADC3 bias current setting. Available settings: Normal operation Enhanced performance Power saving

ADC 2+3 High-Pass-Filter

High-Pass-Filter configuration for the third and fourth ADC path. Available settings: Off 1 Hz 4 Hz 8 Hz

ADC 3 Capture Switch

Digital mute control for the fourth ADC path.

ADC 3 Capture Volume

Digital attenuation volume control for the fourth ADC path.

AFE 0+1 Bias

Analog Front-End 0 and Analog Front-End 1 bias current setting. Available settings: Normal operation Extreme power saving Enhanced performance Power saving

AFE 2+3 Bias

Analog Front-End 2 and Analog Front-End 3 bias current setting. Available settings: Normal operation Extreme power saving Enhanced performance Power saving

DAC 0 Mux

Source select for the first DAC. Available settings: Input ASRC0 Input ASRC1

DAC 0 Playback Switch

Digital mute control for the first DAC path.

DAC 0 Playback Volume

Digital attenuation volume control for the first DAC path.

DAC 0+1 Bias

DAC bias current setting. Available settings: Normal operation Power saving Superior performance Enhanced performance

DAC 1 Mux

Source select for the second DAC. Available settings: Input ASRC0 Input ASRC1

DAC 1 Playback Switch

Digital mute control for the second DAC path.

DAC 1 Playback Volume

Digital attenuation volume control for the second DAC path.

Decimator 0+1 Capture Mux

Decimator 0 and 1 input select. Available settings: ADC DMIC

Decimator 2+3 Capture Mux

Decimator 2 and 3 input select. Available settings: ADC DMIC

Headphone Bias

Headphone output bias current setting. Available settings: Normal operation Extreme power saving Enhanced performance Power saving

Input ASRC Playback Mux

Input sample-rate-converter input select: Available settings: Serial Input 0+1 Serial Input 2+3 Serial Input 4+5 Serial Input 6+7

Microphone Bias

Microphone input bias current setting. Available settings: Normal operation Extreme power saving Enhanced performance Power saving

Output ASRC0 Mux

Output sample-rate-converter 0 input select. Available settings: Decimator0 Decimator1 Decimator2 Decimator3

Output ASRC1 Mux

Output sample-rate-converter 1 input select. Available settings: See Output ASRC0 Mux

Output ASRC2 Mux

Output sample-rate-converter 2 input select. Available settings: See Output ASRC0 Mux

Output ASRC3 Mux

Output sample-rate-converter 3 input select. Available settings: See Output ASRC0 Mux

PGA 0 Boost Capture Volume

Input PGA 0 additional 10dB gain volume.

PGA 0 Capture Switch

Input PGA 0 mute control.

PGA 0 Capture Volume

Input PGA 0 gain volume control.

PGA 1 Boost Capture Volume

Input PGA 1 additional 10dB gain volume.

PGA 1 Capture Switch

Input PGA 1 mute control.

PGA 1 Capture Volume

Input PGA 1 gain volume control.

PGA 2 Boost Capture Volume

Input PGA 2 additional 10dB gain volume.

PGA 2 Capture Switch

Input PGA 2 mute control.

PGA 2 Capture Volume

Input PGA 2 gain volume control.

PGA 3 Boost Capture Volume

Input PGA 3 additional 10dB gain volume.

PGA 3 Capture Switch

Input PGA 3 mute control.

PGA 3 Capture Volume

Input PGA 3 gain volume control.

Serial Output 0 Capture Mux

Serial output channel 0 input select. Available settings: Output ASRC0 Output ASRC1 Output ASRC2 Output ASRC3 Serial Input 0 Serial Input 1 Serial Input 2 Serial Input 3 Serial Input 4 Serial Input 5 Serial Input 6 Serial Input 7

Serial Output 1 Capture Mux

Serial output channel 1 input select. Available settings: See Serial Output 0 Capture Mux

Serial Output 2 Capture Mux

Serial output channel 2 input select. Available settings: See Serial Output 0 Capture Mux

Serial Output 3 Capture Mux

Serial output channel 3 input select. Available settings: See Serial Output 0 Capture Mux

Serial Output 4 Capture Mux

Serial output channel 4 input select. Available settings: See Serial Output 0 Capture Mux

Serial Output 5 Capture Mux

Serial output channel 5 input select. Available settings: See Serial Output 0 Capture Mux

Serial Output 6 Capture Mux

Serial output channel 6 input select. Available settings: See Serial Output 0 Capture Mux

Serial Output 7 Capture Mux

Serial output channel 7 input select. Available settings: See Serial Output 0 Capture Mux

DAI configuration

The codec driver registers one DAI: adau1372

This DAI has a capture and a playback interface which share the clocking and are synchronous to each other. Which means they have to run in the same configuration.

Supported DAI formats

Name

Supported by driver

Description

SND_SOC_DAIFMT_I2S

yes

I2S mode

SND_SOC_DAIFMT_RIGHT_J

no

Right Justified mode

SND_SOC_DAIFMT_LEFT_J

yes

Left Justified mode

SND_SOC_DAIFMT_DSP_A

yes

data MSB after FRM LRC

SND_SOC_DAIFMT_DSP_B

yes

data MSB during FRM LRC

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

DAI sysclk

Example DAI configuration

TDM configuration

The ADAU1372 has TDM support.

  • The number of slots can be either 2, 4 or 8.

  • The slot width can be 16 or 32.

  • The slot mask can select any combination of channels on both TX and RX

Example TDM configuration:

ret = snd_soc_dai_set_tdm_slot(codec_dai, 0x3, 0x3, 8, 24);

More information

Need Help?