Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 1 | ALSA SoC Layer |
| 2 | ============== |
| 3 | |
Mark Brown | 7c4dbbd | 2008-01-23 08:41:46 +0100 | [diff] [blame] | 4 | The overall project goal of the ALSA System on Chip (ASoC) layer is to |
| 5 | provide better ALSA support for embedded system-on-chip processors (e.g. |
| 6 | pxa2xx, au1x00, iMX, etc) and portable audio codecs. Prior to the ASoC |
| 7 | subsystem there was some support in the kernel for SoC audio, however it |
| 8 | had some limitations:- |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 9 | |
Mark Brown | 7c4dbbd | 2008-01-23 08:41:46 +0100 | [diff] [blame] | 10 | * Codec drivers were often tightly coupled to the underlying SoC |
| 11 | CPU. This is not ideal and leads to code duplication - for example, |
| 12 | Linux had different wm8731 drivers for 4 different SoC platforms. |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 13 | |
Mark Brown | 7c4dbbd | 2008-01-23 08:41:46 +0100 | [diff] [blame] | 14 | * There was no standard method to signal user initiated audio events (e.g. |
Matt LaPlante | 01dd2fb | 2007-10-20 01:34:40 +0200 | [diff] [blame] | 15 | Headphone/Mic insertion, Headphone/Mic detection after an insertion |
| 16 | event). These are quite common events on portable devices and often require |
| 17 | machine specific code to re-route audio, enable amps, etc., after such an |
| 18 | event. |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 19 | |
Mark Brown | 7c4dbbd | 2008-01-23 08:41:46 +0100 | [diff] [blame] | 20 | * Drivers tended to power up the entire codec when playing (or |
| 21 | recording) audio. This is fine for a PC, but tends to waste a lot of |
| 22 | power on portable devices. There was also no support for saving |
| 23 | power via changing codec oversampling rates, bias currents, etc. |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 24 | |
| 25 | |
| 26 | ASoC Design |
| 27 | =========== |
| 28 | |
| 29 | The ASoC layer is designed to address these issues and provide the following |
| 30 | features :- |
| 31 | |
| 32 | * Codec independence. Allows reuse of codec drivers on other platforms |
| 33 | and machines. |
| 34 | |
Mark Brown | 7c4dbbd | 2008-01-23 08:41:46 +0100 | [diff] [blame] | 35 | * Easy I2S/PCM audio interface setup between codec and SoC. Each SoC |
Francis Galiegue | a33f322 | 2010-04-23 00:08:02 +0200 | [diff] [blame] | 36 | interface and codec registers its audio interface capabilities with the |
Mark Brown | 7c4dbbd | 2008-01-23 08:41:46 +0100 | [diff] [blame] | 37 | core and are subsequently matched and configured when the application |
| 38 | hardware parameters are known. |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 39 | |
| 40 | * Dynamic Audio Power Management (DAPM). DAPM automatically sets the codec to |
Mark Brown | 7c4dbbd | 2008-01-23 08:41:46 +0100 | [diff] [blame] | 41 | its minimum power state at all times. This includes powering up/down |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 42 | internal power blocks depending on the internal codec audio routing and any |
| 43 | active streams. |
| 44 | |
| 45 | * Pop and click reduction. Pops and clicks can be reduced by powering the |
| 46 | codec up/down in the correct sequence (including using digital mute). ASoC |
| 47 | signals the codec when to change power states. |
| 48 | |
| 49 | * Machine specific controls: Allow machines to add controls to the sound card |
Mark Brown | 7c4dbbd | 2008-01-23 08:41:46 +0100 | [diff] [blame] | 50 | (e.g. volume control for speaker amplifier). |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 51 | |
Liam Girdwood | d9e9ff5 | 2014-01-07 17:51:41 +0000 | [diff] [blame] | 52 | To achieve all this, ASoC basically splits an embedded audio system into |
| 53 | multiple re-usable component drivers :- |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 54 | |
Liam Girdwood | d9e9ff5 | 2014-01-07 17:51:41 +0000 | [diff] [blame] | 55 | * Codec class drivers: The codec class driver is platform independent and |
| 56 | contains audio controls, audio interface capabilities, codec DAPM |
| 57 | definition and codec IO functions. This class extends to BT, FM and MODEM |
| 58 | ICs if required. Codec class drivers should be generic code that can run |
| 59 | on any architecture and machine. |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 60 | |
Liam Girdwood | d9e9ff5 | 2014-01-07 17:51:41 +0000 | [diff] [blame] | 61 | * Platform class drivers: The platform class driver includes the audio DMA |
| 62 | engine driver, digital audio interface (DAI) drivers (e.g. I2S, AC97, PCM) |
| 63 | and any audio DSP drivers for that platform. |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 64 | |
Liam Girdwood | d9e9ff5 | 2014-01-07 17:51:41 +0000 | [diff] [blame] | 65 | * Machine class driver: The machine driver class acts as the glue that |
| 66 | decribes and binds the other component drivers together to form an ALSA |
| 67 | "sound card device". It handles any machine specific controls and |
| 68 | machine level audio events (e.g. turning on an amp at start of playback). |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 69 | |
| 70 | |
| 71 | Documentation |
| 72 | ============= |
| 73 | |
| 74 | The documentation is spilt into the following sections:- |
| 75 | |
| 76 | overview.txt: This file. |
| 77 | |
| 78 | codec.txt: Codec driver internals. |
| 79 | |
| 80 | DAI.txt: Description of Digital Audio Interface standards and how to configure |
| 81 | a DAI within your codec and CPU DAI drivers. |
| 82 | |
| 83 | dapm.txt: Dynamic Audio Power Management |
| 84 | |
| 85 | platform.txt: Platform audio DMA and DAI. |
| 86 | |
| 87 | machine.txt: Machine driver internals. |
| 88 | |
| 89 | pop_clicks.txt: How to minimise audio artifacts. |
| 90 | |
Mark Brown | 7c4dbbd | 2008-01-23 08:41:46 +0100 | [diff] [blame] | 91 | clocking.txt: ASoC clocking for best power performance. |
Liam Girdwood | d9e9ff5 | 2014-01-07 17:51:41 +0000 | [diff] [blame] | 92 | |
| 93 | jack.txt: ASoC jack detection. |
| 94 | |
| 95 | DPCM.txt: Dynamic PCM - Describes DPCM with DSP examples. |