没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
file:///E|/Linux/Linux_kernel/sound/core/linux音频alsa-uda134x驱动文档阅读.txt
前言
目前,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.
file:///E|/Linux/Linux_kernel/sound/core/linux音频alsa-uda134x驱动文档阅读.txt(第 1/13 页)2010-9-2 17:57:05
file:///E|/Linux/Linux_kernel/sound/core/linux音频alsa-uda134x驱动文档阅读.txt
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驱动文档阅读之二(时钟)
已有 922 次阅读 2009-11-23 10:31 |个人分类:音频驱动|关键词:文档 时钟 音频 linux 驱动
Audio Clocking
音频时钟
==============
This text describes the audio clocking terms in ASoC and digital audio in
general. Note: Audio clocking can be complex!
本文本总体描述ASoC和数字音频中的音频时钟条款。
Master Clock
主时钟
------------
Every audio subsystem is driven by a master clock (sometimes referred to as MCLK
or SYSCLK). This audio master clock can be derived from a number of sources
(e.g. crystal, PLL, CPU clock) and is responsible for producing the correct
audio playback and capture sample rates.
每个数字音频子系统都是由主时钟来驱动的(有时称为MCLK或SYSCLK)。音频主时钟可以派生于多种源(如晶振,锁相环,处理器时钟)。负责产生正确的音频播放和捕获采样率。
Some master clocks (e.g. PLLs and CPU based clocks) are configurable in that
their speed can be altered by software (depending on the system use and to save
power). Other master clocks are fixed at a set frequency (i.e. crystals).
有些主时钟是可配置的(如基于锁相环或处理器的时钟),它们可以通过软件改变速度(依赖于系统应用和省电的考虑)。另一些主时钟则是固定于一个特定的频率值(如晶振)。
DAI Clocks
数字音频时钟
----------
The Digital Audio Interface is usually driven by a Bit Clock (often referred to
as BCLK). This clock is used to drive the digital audio data across the link
between the codec and CPU.
数字音频接口往往是由一个位时钟来驱动的(通常记为BCLK)。这个时钟用于驱动数字音频数据在解码器与处理器间的传输。
The DAI also has a frame clock to signal the start of each audio frame. This
clock is sometimes referred to as LRC (left right clock) or FRAME. This clock
runs at exactly the sample rate (LRC = Rate).
数字音频接口还有一个帧时钟,用来指示一帧音频的开始。该时钟有时记为LRC(left right clock)或FRAME。该时钟严格工作于采样率上。
Bit Clock can be generated as follows:-
位时钟可以有如下产生方式:
BCLK = MCLK / x
or
BCLK = LRC * x
or
BCLK = LRC * Channels * Word Size
This relationship depends on the codec or SoC CPU in particular. In general
it is best to configure BCLK to the lowest possible speed (depending on your
rate, number of channels and word size) to save on power.
这个关系依赖于解码器,特别是板上处理器。大体上讲,最好将位时钟尽可能低速(取决于你的采样率,通道数和字长)以省电。
It is also desirable to use the codec (if possible) to drive (or master) the
audio clocks as it usually gives more accurate sample rates than the CPU.
可能的话,最好使用解码器来驱动(或控制)音频时钟,因为通常它给出的采样率比处理器更精确。
linux音频alsa-uda134x驱动文档阅读之三(解码器)
已有 1143 次阅读 2009-11-23 10:32 |个人分类:音频驱动|关键词:解码器 文档 音频 linux 驱动
ASoC Codec Driver
ASoC解码器驱动
=================
file:///E|/Linux/Linux_kernel/sound/core/linux音频alsa-uda134x驱动文档阅读.txt(第 2/13 页)2010-9-2 17:57:05
file:///E|/Linux/Linux_kernel/sound/core/linux音频alsa-uda134x驱动文档阅读.txt
The codec driver is generic and hardware independent code that configures the
codec to provide audio capture and playback. It should contain no code that is
specific to the target platform or machine. All platform and machine specific
code should be added to the platform and machine drivers respectively.
解码器驱动是通用、硬件无关的代码,它配置解码器以支持音频捕获与回放。它不应包含任何与目标平台或机器相关的代码。平台或机器相关代码应该分别加 入到平台和机器驱动中去。
Each codec driver *must* provide the following features:-
各解码器驱动必须提供如下特性:
1) Codec DAI and PCM configuration
2) Codec control IO - using I2C, 3 Wire(SPI) or both APIs
3) Mixers and audio controls
4) Codec audio operations
1)解码器数字音频接口和PCM配置。
2)解码器控制IO-使用I2C,3总线(SPI)或两个都有。
3)混音器和音频控制。
4)解码器音频操作。
Optionally, codec drivers can also provide:-
解码器驱动可以选择性提供:
5) DAPM description.
6) DAPM event handler.
7) DAC Digital mute control.
5)动态音频电源管理描述。
6)动态音频电源管理事件控制。
7)数模转换数字消音控制。
Its probably best to use this guide in conjunction with the existing codec
driver code in sound/soc/codecs/
大家也许最好联同己存在于sound/soc/codecs/中的驱动代码一起来使用这个指导书。
ASoC Codec driver breakdown
ASoC 解码器崩溃
===========================
1 - Codec DAI and PCM configuration
1-解码器数字音频接口和PCM配置
-----------------------------------
Each codec driver must have a struct snd_soc_codec_dai to define its DAI and
PCM capabilities and operations. This struct is exported so that it can be
registered with the core by your machine driver.
各解码器驱动必须有一个snd_soc_codec_dai数据结构,它用来定义DAI和PCM提供的功能和操作。这个数据结构要导出,好让你的机器驱动程序将它注册到ALSA核心中去。
e.g.
例如:
struct snd_soc_codec_dai wm8731_dai = {
.name = "WM8731",
/* playback capabilities */
.playback = {
.stream_name = "Playback",
.channels_min = 1,
.channels_max = 2,
.rates = WM8731_RATES,
.formats = WM8731_FORMATS,},
/* capture capabilities */
.capture = {
.stream_name = "Capture",
.channels_min = 1,
.channels_max = 2,
.rates = WM8731_RATES,
.formats = WM8731_FORMATS,},
/* pcm operations - see section 4 below */
.ops = {
.prepare = wm8731_pcm_prepare,
.hw_params = wm8731_hw_params,
.shutdown = wm8731_shutdown,
},
/* DAI operations - see DAI.txt */
.dai_ops = {
.digital_mute = wm8731_mute,
.set_sysclk = wm8731_set_dai_sysclk,
.set_fmt = wm8731_set_dai_fmt,
}
};
EXPORT_SYMBOL_GPL(wm8731_dai);
2 - Codec control IO
2-解码器控制IO
--------------------
The codec can usually be controlled via an I2C or SPI style interface
(AC97 combines control with data in the DAI). The codec drivers provide
functions to read and write the codec registers along with supplying a
register cache:-
解码器通常可以通过I2C或SPI类型的接器进行控制(AC97 的数字音频接口中把数据和控制结合在了一起)。解码器驱动提供读写解码器寄存器和供应寄存器缓存的功能。
/* IO control data and register cache */
void *control_data; /* codec control (i2c/3wire) data */
void *reg_cache;
Codec read/write should do any data formatting and call the hardware
read write below to perform the IO. These functions are called by the
core and ALSA when performing DAPM or changing the mixer:-
解码器读写要可以作用于任何格式,调用底层硬件的读写功能操作IO。ALSA核或ALSA在动态音频电源管理或改变混音器时会调用这些函数。
file:///E|/Linux/Linux_kernel/sound/core/linux音频alsa-uda134x驱动文档阅读.txt(第 3/13 页)2010-9-2 17:57:05
剩余12页未读,继续阅读
资源评论
- wdove2013-04-04不是太好,太深奥
- ktpeng2013-06-26linux 音频的东西,确实比较复杂....
- Iris_Zhou2012-08-20排版是……不行,字小,要放大才能看。 不过内容挺全,是经过翻译的,谢谢了
- benu2011-11-07排版有点差。 不过还是谢谢。
- abc000000012015-06-18文档还可以 但是linux的这个音频架构有些烂,大家还是看最新的架构吧。
liyonghua4040
- 粉丝: 0
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功