1. 程式人生 > >linux音頻alsa-uda134x驅動文檔閱讀之一轉自http://blog.csdn.net/wantianpei/article/details/7817293

linux音頻alsa-uda134x驅動文檔閱讀之一轉自http://blog.csdn.net/wantianpei/article/details/7817293

發出 hand 增加 int chang == 音頻 set device

前言

目前,linux系統常用的音頻驅動有兩種形式:alsa oss
alsa:現在是linux下音頻驅動的主要形式,與簡單的oss兼容。
oss:過去的形式
而我們板子上的uda1341用的就是alsa驅動。
alsa概述:
因為我們用的是板上系統,用的也是alsa 的一個soc子系統。所以我們直接講解alsa soc子系統。

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.
平臺驅動:平臺驅動包含相應平臺的音頻DAM引擎和音頻接口驅動(如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時鐘

linux音頻alsa-uda134x驅動文檔閱讀之一轉自http://blog.csdn.net/wantianpei/article/details/7817293