为什么要设计ASoC
引用linux Document中的解释:
The overall project goal of the ALSA System on Chip (ASoC) layer is to
provide better ALSA support for embedded system-on-chip processors and
portable audio codecs.
ASoC的特性:
-
Codec independence. Allows reuse of codec drivers on other platforms
and machines. -
Easy I2S/PCM audio interface setup between codec and SoC. Each SoC
interface and codec registers its audio interface capabilities with the
core and are subsequently matched and configured when the application
hardware parameters are known. -
Dynamic Audio Power Management (DAPM). DAPM automatically sets the codec to
its minimum power state at all times. This includes powering up/down
internal power blocks depending on the internal codec audio routing and any
active streams. -
Pop and click reduction. Pops and clicks can be reduced by powering the
codec up/down in the correct sequence (including using digital mute). ASoC
signals 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).
ASoc框架
ASoC-pcm结构
pcm这块主要分codec/platform/machine,codec主要对应的是音频的ADC/DAC硬件(包括外围器件和soc器件),platform一般主要是平台上的设备,比如DMA设备,machine相当于board,主要是负责声卡的注册,每个machine对应的codec/platform都是不一样的,这样可以自由组合使用。
- Codec driver: The codec driver is platform independent and contains audio
controls, audio interface capabilities, codec DAPM definition and codec IO
functions.
- Platform driver: The platform driver contains the audio DMA engine and audio
interface drivers (e.g. I2S, AC97, PCM) for that platform. - Machine driver: The machine driver handles any machine specific controls and
audio events (e.g. turning on an amp at start of playback).
ASoC-control结构
ASoC这边在control里主要加入了DAPM,具体细节后文介绍,DAPM主要就是在你每次set/get操作的时候,都会按照既定的原则,来对链表上的设备按顺序turn/off