162306a36Sopenharmony_ci=======================
262306a36Sopenharmony_ciALSA SoC Layer Overview
362306a36Sopenharmony_ci=======================
462306a36Sopenharmony_ci
562306a36Sopenharmony_ciThe overall project goal of the ALSA System on Chip (ASoC) layer is to
662306a36Sopenharmony_ciprovide better ALSA support for embedded system-on-chip processors (e.g.
762306a36Sopenharmony_cipxa2xx, au1x00, iMX, etc) and portable audio codecs.  Prior to the ASoC
862306a36Sopenharmony_cisubsystem there was some support in the kernel for SoC audio, however it
962306a36Sopenharmony_cihad some limitations:-
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci  * Codec drivers were often tightly coupled to the underlying SoC
1262306a36Sopenharmony_ci    CPU. This is not ideal and leads to code duplication - for example,
1362306a36Sopenharmony_ci    Linux had different wm8731 drivers for 4 different SoC platforms.
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci  * There was no standard method to signal user initiated audio events (e.g.
1662306a36Sopenharmony_ci    Headphone/Mic insertion, Headphone/Mic detection after an insertion
1762306a36Sopenharmony_ci    event). These are quite common events on portable devices and often require
1862306a36Sopenharmony_ci    machine specific code to re-route audio, enable amps, etc., after such an
1962306a36Sopenharmony_ci    event.
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci  * Drivers tended to power up the entire codec when playing (or
2262306a36Sopenharmony_ci    recording) audio. This is fine for a PC, but tends to waste a lot of
2362306a36Sopenharmony_ci    power on portable devices. There was also no support for saving
2462306a36Sopenharmony_ci    power via changing codec oversampling rates, bias currents, etc.
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ciASoC Design
2862306a36Sopenharmony_ci===========
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ciThe ASoC layer is designed to address these issues and provide the following
3162306a36Sopenharmony_cifeatures :-
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci  * Codec independence. Allows reuse of codec drivers on other platforms
3462306a36Sopenharmony_ci    and machines.
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci  * Easy I2S/PCM audio interface setup between codec and SoC. Each SoC
3762306a36Sopenharmony_ci    interface and codec registers its audio interface capabilities with the
3862306a36Sopenharmony_ci    core and are subsequently matched and configured when the application
3962306a36Sopenharmony_ci    hardware parameters are known.
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci  * Dynamic Audio Power Management (DAPM). DAPM automatically sets the codec to
4262306a36Sopenharmony_ci    its minimum power state at all times. This includes powering up/down
4362306a36Sopenharmony_ci    internal power blocks depending on the internal codec audio routing and any
4462306a36Sopenharmony_ci    active streams.
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci  * Pop and click reduction. Pops and clicks can be reduced by powering the
4762306a36Sopenharmony_ci    codec up/down in the correct sequence (including using digital mute). ASoC
4862306a36Sopenharmony_ci    signals the codec when to change power states.
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci  * Machine specific controls: Allow machines to add controls to the sound card
5162306a36Sopenharmony_ci    (e.g. volume control for speaker amplifier).
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ciTo achieve all this, ASoC basically splits an embedded audio system into
5462306a36Sopenharmony_cimultiple re-usable component drivers :-
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_ci  * Codec class drivers: The codec class driver is platform independent and
5762306a36Sopenharmony_ci    contains audio controls, audio interface capabilities, codec DAPM
5862306a36Sopenharmony_ci    definition and codec IO functions. This class extends to BT, FM and MODEM
5962306a36Sopenharmony_ci    ICs if required. Codec class drivers should be generic code that can run
6062306a36Sopenharmony_ci    on any architecture and machine.
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci  * Platform class drivers: The platform class driver includes the audio DMA
6362306a36Sopenharmony_ci    engine driver, digital audio interface (DAI) drivers (e.g. I2S, AC97, PCM)
6462306a36Sopenharmony_ci    and any audio DSP drivers for that platform.
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci  * Machine class driver: The machine driver class acts as the glue that
6762306a36Sopenharmony_ci    describes and binds the other component drivers together to form an ALSA
6862306a36Sopenharmony_ci    "sound card device". It handles any machine specific controls and
6962306a36Sopenharmony_ci    machine level audio events (e.g. turning on an amp at start of playback).
70