1*4882a593Smuzhiyun======================= 2*4882a593SmuzhiyunALSA SoC Layer Overview 3*4882a593Smuzhiyun======================= 4*4882a593Smuzhiyun 5*4882a593SmuzhiyunThe overall project goal of the ALSA System on Chip (ASoC) layer is to 6*4882a593Smuzhiyunprovide better ALSA support for embedded system-on-chip processors (e.g. 7*4882a593Smuzhiyunpxa2xx, au1x00, iMX, etc) and portable audio codecs. Prior to the ASoC 8*4882a593Smuzhiyunsubsystem there was some support in the kernel for SoC audio, however it 9*4882a593Smuzhiyunhad some limitations:- 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun * Codec drivers were often tightly coupled to the underlying SoC 12*4882a593Smuzhiyun CPU. This is not ideal and leads to code duplication - for example, 13*4882a593Smuzhiyun Linux had different wm8731 drivers for 4 different SoC platforms. 14*4882a593Smuzhiyun 15*4882a593Smuzhiyun * There was no standard method to signal user initiated audio events (e.g. 16*4882a593Smuzhiyun Headphone/Mic insertion, Headphone/Mic detection after an insertion 17*4882a593Smuzhiyun event). These are quite common events on portable devices and often require 18*4882a593Smuzhiyun machine specific code to re-route audio, enable amps, etc., after such an 19*4882a593Smuzhiyun event. 20*4882a593Smuzhiyun 21*4882a593Smuzhiyun * Drivers tended to power up the entire codec when playing (or 22*4882a593Smuzhiyun recording) audio. This is fine for a PC, but tends to waste a lot of 23*4882a593Smuzhiyun power on portable devices. There was also no support for saving 24*4882a593Smuzhiyun power via changing codec oversampling rates, bias currents, etc. 25*4882a593Smuzhiyun 26*4882a593Smuzhiyun 27*4882a593SmuzhiyunASoC Design 28*4882a593Smuzhiyun=========== 29*4882a593Smuzhiyun 30*4882a593SmuzhiyunThe ASoC layer is designed to address these issues and provide the following 31*4882a593Smuzhiyunfeatures :- 32*4882a593Smuzhiyun 33*4882a593Smuzhiyun * Codec independence. Allows reuse of codec drivers on other platforms 34*4882a593Smuzhiyun and machines. 35*4882a593Smuzhiyun 36*4882a593Smuzhiyun * Easy I2S/PCM audio interface setup between codec and SoC. Each SoC 37*4882a593Smuzhiyun interface and codec registers its audio interface capabilities with the 38*4882a593Smuzhiyun core and are subsequently matched and configured when the application 39*4882a593Smuzhiyun hardware parameters are known. 40*4882a593Smuzhiyun 41*4882a593Smuzhiyun * Dynamic Audio Power Management (DAPM). DAPM automatically sets the codec to 42*4882a593Smuzhiyun its minimum power state at all times. This includes powering up/down 43*4882a593Smuzhiyun internal power blocks depending on the internal codec audio routing and any 44*4882a593Smuzhiyun active streams. 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun * Pop and click reduction. Pops and clicks can be reduced by powering the 47*4882a593Smuzhiyun codec up/down in the correct sequence (including using digital mute). ASoC 48*4882a593Smuzhiyun signals the codec when to change power states. 49*4882a593Smuzhiyun 50*4882a593Smuzhiyun * Machine specific controls: Allow machines to add controls to the sound card 51*4882a593Smuzhiyun (e.g. volume control for speaker amplifier). 52*4882a593Smuzhiyun 53*4882a593SmuzhiyunTo achieve all this, ASoC basically splits an embedded audio system into 54*4882a593Smuzhiyunmultiple re-usable component drivers :- 55*4882a593Smuzhiyun 56*4882a593Smuzhiyun * Codec class drivers: The codec class driver is platform independent and 57*4882a593Smuzhiyun contains audio controls, audio interface capabilities, codec DAPM 58*4882a593Smuzhiyun definition and codec IO functions. This class extends to BT, FM and MODEM 59*4882a593Smuzhiyun ICs if required. Codec class drivers should be generic code that can run 60*4882a593Smuzhiyun on any architecture and machine. 61*4882a593Smuzhiyun 62*4882a593Smuzhiyun * Platform class drivers: The platform class driver includes the audio DMA 63*4882a593Smuzhiyun engine driver, digital audio interface (DAI) drivers (e.g. I2S, AC97, PCM) 64*4882a593Smuzhiyun and any audio DSP drivers for that platform. 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun * Machine class driver: The machine driver class acts as the glue that 67*4882a593Smuzhiyun describes and binds the other component drivers together to form an ALSA 68*4882a593Smuzhiyun "sound card device". It handles any machine specific controls and 69*4882a593Smuzhiyun machine level audio events (e.g. turning on an amp at start of playback). 70