ALSA SoC Layer Overview

The overall project goal of the ALSA System on Chip (ASoC) layer is toprovide better ALSA support for embedded system-on-chip processors (e.g.pxa2xx, au1x00, iMX, etc) and portable audio codecs. Prior to the ASoCsubsystem there was some support in the kernel for SoC audio, however ithad some limitations:-

  • Codec drivers were often tightly coupled to the underlying SoCCPU. This is not ideal and leads to code duplication - for example,Linux had different wm8731 drivers for 4 different SoC platforms.

  • There was no standard method to signal user initiated audio events (e.g.Headphone/Mic insertion, Headphone/Mic detection after an insertionevent). These are quite common events on portable devices and often requiremachine specific code to re-route audio, enable amps, etc., after such anevent.

  • Drivers tended to power up the entire codec when playing (orrecording) audio. This is fine for a PC, but tends to waste a lot ofpower on portable devices. There was also no support for savingpower via changing codec oversampling rates, bias currents, etc.

ASoC Design

The ASoC layer is designed to address these issues and provide the followingfeatures :-

  • Codec independence. Allows reuse of codec drivers on other platformsand machines.

  • Easy I2S/PCM audio interface setup between codec and SoC. Each SoCinterface and codec registers its audio interface capabilities with thecore and are subsequently matched and configured when the applicationhardware parameters are known.

  • Dynamic Audio Power Management (DAPM). DAPM automatically sets the codec toits minimum power state at all times. This includes powering up/downinternal power blocks depending on the internal codec audio routing and anyactive streams.

  • Pop and click reduction. Pops and clicks can be reduced by powering thecodec up/down in the correct sequence (including using digital mute). ASoCsignals the codec when to change power states.

  • Machine specific controls: Allow machines to add controls to the sound card(e.g. volume control for speaker amplifier).

To achieve all this, ASoC basically splits an embedded audio system intomultiple re-usable component drivers :-

  • Codec class drivers: The codec class driver is platform independent andcontains audio controls, audio interface capabilities, codec DAPMdefinition and codec IO functions. This class extends to BT, FM and MODEMICs if required. Codec class drivers should be generic code that can runon any architecture and machine.

  • Platform class drivers: The platform class driver includes the audio DMAengine driver, digital audio interface (DAI) drivers (e.g. I2S, AC97, PCM)and any audio DSP drivers for that platform.

  • Machine class driver: The machine driver class acts as the glue thatdescribes and binds the other component drivers together to form an ALSA“sound card device”. It handles any machine specific controls andmachine level audio events (e.g. turning on an amp at start of playback).