1. 程式人生 > >linux音訊alsa驅動分析之一(over-view)

linux音訊alsa驅動分析之一(over-view)

原文來源不記得了,忘作者見諒,儲存下來以備自己溫習,也方便大家查閱!

ALSA SoC Layer

ALSA板上系統層
==============


The overall project goal of the ALSA System on Chip (ASoC) layer is to
provide better ALSA support for embedded system-on-chip processors (e.g.
pxa2xx, au1x00, iMX, etc) and portable audio codecs.  Prior to the ASoC
subsystem there was some support in the kernel for SoC audio, however it
had some limitations:-
ALSA片上系統(ASoC)層的總體專案目標,是為對SOC嵌入式處理器和便攜音訊解碼器提供更好的ALSA支援。在ASoC子系統之前,己有對核心的SoC音訊支援,但是那些支援存在一些侷限:
Codec drivers were often tightly coupled to the underlying SoC
    CPU. This is not ideal and leads to code duplication - for example,
    Linux had different wm8731 drivers for 4 different SoC platforms.
解碼器常常與底層嵌入式處理器一對一緊密結合。這是非理想化的,因為這將導致程式碼的重複-例如,對四個不同的嵌入式平臺,Linux要有不同的wm8731驅動。(理想的狀態是我們可以只有一個wm8731的驅動程式碼,就可以對應於四個不同的處理器,但由上面說的,解碼器-這裡的wm8731與底層嵌入式處理器結合過於緊密,無法實現wm8731驅動程式碼的複用)


  * There was no standard method to signal user initiated audio events (e.g.
    Headphone/Mic insertion, Headphone/Mic detection after an insertion
    event). These are quite common events on portable devices and often require
    machine specific code to re-route audio, enable amps, etc., after such an
    event.
沒有一個標準的方法可以產生使用者初始化音訊事件的訊號(即,耳機/麥克插入,響應插入事件的耳機/麥克探測)。這些在便攜裝置上都是十分常見的事件並且在這些事件之後經常需要機器相關的程式碼來對音訊重設路徑,開啟放大器等。


  * Drivers tended to power up the entire codec when playing (or
    recording) audio. This is fine for a PC, but tends to waste a lot of
    power on portable devices. There was also no support for saving
    power via changing codec oversampling rates, bias currents, etc.
放音(錄音)時,驅動常常會開啟整個解碼器。對個人電腦來說這沒什麼問題,但是在便攜裝置上往往會導致電能的浪費。另外,也沒有通過改變解碼器取樣率、偏置電流等方式來省電的支援。




ASoC Design
ASoC 設計
===========


The ASoC layer is designed to address these issues and provide the following
features :-
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 it's audio interface capabilities with the
    core and are subsequently matched and configured when the application
    hardware parameters are known.
解碼器與SoC的I2S/PCM音訊介面設定很容易。每個SoC介面與解碼器都向ALSA核心註冊它的音訊介面能力,而且應用硬體引數己知時順序匹配並配置。


  * 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.
動態音訊電源管理(DAPM)。DAPM自動無論何時,總是把解碼器自動設定為它的最小電源狀態。這包括依據內部解碼音訊線路和活躍的流來開啟和關閉內部電源模組


  * 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.
咔嗒聲減少。咔嗒聲可以通過使用正確的解碼器電源開啟和關閉順序而減少(包括使用數字消音)。ASoC在改變電源狀態時向解碼器發出訊號。


  * 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 into 3
components :-
要實現這些,ASoC基本上將嵌入式音訊系統分為3個部分:


  * Codec driver: The codec driver is platform independent and contains audio
    controls, audio interface capabilities, codec DAPM definition and codec IO
    functions.
解碼器驅動:解碼器驅動是平臺無關的,包含音訊控制、音訊介面能力、解碼器動態音訊電源管理和解碼器IO函式。




  * Platform driver: The platform driver contains the audio DMA engine and audio
    interface drivers (e.g. I2S, AC97, PCM) for that platform.
平臺驅動:平臺驅動包含相應平臺的音訊DMA引擎和音訊介面驅動(如I2S,AC97,PCM)


  * Machine driver: The machine driver handles any machine specific controls and
    audio events (e.g. turning on an amp at start of playback).
機器驅動:機器驅動處理所有機器相關的控制和音訊事件(如回放開始時開啟放大器)。






Documentation
文件
=============


The documentation is spilt into the following sections:-
本文件分成如下部分:


overview.txt: This file.
overview.txt:概述,本檔案。
codec.txt: Codec driver internals.
codec.txt:解碼器驅動內部實現


DAI.txt: Description of Digital Audio Interface standards and how to configure
a DAI within your codec and CPU DAI drivers.
DAI.txt:對數字音訊介面(DAI)標準和如何配置你的解碼器和CPU的數字音訊接品驅動中的數字音訊介面的描述。


dapm.txt: Dynamic Audio Power Management
dapm.txt:動態音訊電源管理


platform.txt: Platform audio DMA and DAI.
platform.txt:平臺音訊DMA和DAI。


machine.txt: Machine driver internals.
machine.txt:機器驅動內容介紹。


pop_clicks.txt: How to minimise audio artifacts.
pop_clicks.txt:如何最小化音步噪聲。


clocking.txt: ASoC clocking for best power performance.
clocking.txt:最佳電源表現下的ASoC時鐘