alsa声卡驱动分析总结
分析只列出部分重要代码,具体请参考linux3.0内核代码。
Alsa架构整体来说十分复杂,但对于驱动移植来说我们仅仅只需要关心ASOC就足够了。
在学习asoc之前我们先了解一些专业术语:
ASoC currently supportsthe three main Digital Audio Interfaces (DAI) found on
SoC controllers and portable audio CODECs today, namelyAC97, I2S and PCM.
ASoC现在支持如今的SoC控制器和便携音频解码器上的三个主要数字音频接口,即AC97,I2S,PCM(与pcm音频格式注意区分,前者是一种音频接口,后者是一种输入声卡的音频格式)。
AC97
AC97
====
AC97 is a five wire interface commonly found on many PC soundcards. It is
now also popular in many portable devices. This DAI has a reset line and time
multiplexes its data on its SDATA_OUT (playback) and SDATA_IN (capture) lines.
The bit clock (BCLK) is always driven by the CODEC (usually 12.288MHz) and the
frame (FRAME) (usually 48kHz) is always driven by the controller. Each AC97
frame is 21uS long and is divided into 13 time slots.
AC97是一种个人电脑声卡上常见的五线接口。现在在很多便携设备中也很流行。这个数字音频接口有一个复位线,分时在SDATA_OUT(回放)和SDATA_IN(捕获)线上传送数据。位时钟常由解码器驱动(通常是12.288MHz).帧时钟(通常48kHz)总是由控制器驱动。每个AC97帧21uS,并分为13个时间槽。
I2S
I2S
===
I2S is a common 4 wire DAI used in HiFi, STBand portable devices. The Tx and
Rx lines are used for audio transmission,whilst the bit clock (BCLK) and
left/right clock (LRC) synchronise the link.I2S is flexible in that either the
controller or CODEC can drive (master) theBCLK and LRC clock lines. Bit clock
usually varies depending on the sample rateand the master system clock
(SYSCLK). LRCLK is the same as the samplerate. A few devices support separate
ADC and DAC LRCLKs, this allows forsimultaneous capture and playback at
different sample rates.
I2S是一个4线数字音频接口,常用于HiFi,STB便携设备。Tx 和Rx信号线用于音频传输。而位时钟和左右时钟(LRC)用于同步链接。I2S具有灵活性,因为控制器和解码器都可以控制位时钟和左右时钟。位时钟因采样率和主系统时钟而有不同。LRCLK与采样率相同。少数设备支持独立的ADC和DAC的LRCLK。这使在不同采样率情况下同步捕获和回放成为可能。
I2S has several different operating modes:-
I2S有几个不同的操作模式:
o I2S - MSB is transmitted on the falling edgeof the first BCLK after LRC
transition.
I2S模式-MSB在LRC后的第一个位时钟的下降沿传送。
o Left Justified - MSB is transmitted ontransition of LRC.
左对齐模式:MSB在LRC传送时传送。
o Right Justified - MSB is transmitted samplesize BCLKs before LRC
transition.
右对齐模式:MSB在(此句不懂)
PCM
PCM
===
PCM is another 4 wire interface, very similarto I2S, which can support a more
flexible protocol. It has bit clock (BCLK) andsync (SYNC) lines that are used
to synchronise the link whilst the Tx and Rxlines are used to transmit and
receive the audio data. Bit clock usuallyvaries depending on sample rate
whilst sync runs at the sample rate. PCM alsosupports Time Division
Multiplexing (TDM) in that several devices canuse the bus simultaneously (this
is sometimes referred to as network mode).
PCM也是一种4线制接口。与I2S非常相像,但支持一个更灵活的协议。它有位时钟(BCLK)和同步时钟(SYNC)用来在Tx和Rx在传送和接收音频数据是同步连接。位时钟通常因采样率的不同而不同,然而同步时钟(SYNC)与采样频率相同。PCM同样支持时分复用,可以几个设备同时使用总线(这有时被称为network模式)。
Common PCM operating modes:-
常用的PCM操作模式:
o Mode A - MSB is transmitted on falling edgeof first BCLK after FRAME/SYNC.
模式A-MSB在FRAME/SYNC后第一个BCLK的下降沿传送。
o Mode B - MSB is transmitted on rising edgeof FRAME/SYNC.
模式B-MSB在FRAME/SYNC的上升沿传送。
Codec(解码器)
各解码器驱动必须提供如下特性:
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)数模转换数字消音控制。
SoC DAI Drivers
板级DAI驱动
===============
Each SoC DAI driver must provide the followingfeatures:-
每个SoC DAI驱动都必须提供如下性能:
1) Digital audio interface (DAI) description
1)数字音频接口描述
2) Digital audio interface configuration
2)数字音频接口配置
3) PCM's description
3)PCM描述
4) SYSCLK configuration
4)系统时钟配置
5) Suspend and resume (optional)
5)挂起和恢复(可选的)
以上由君子翻译,本人实在没办法比他描述的更好了,所以把重要的部分提取出来直接copy。在这里对君子表示由衷感谢,赋上君子注。
君子注:
您现在所阅读的,是君子阅读Linux音频SoC驱动时,写下的文档译文。
君子写些译文,一方面是作为自己的笔记,帮助记忆,另一方面也希望能对他人有所帮助。
如果您能于君子的译文中有所收获,则吾心甚慰
I2S接口规范参考资料
- I2S bus specification from NXP
- TMS320C6000 McBSP: I2S Interface,spra595 from TI
- TMS320DM646x DMSoC Multichannel Audio Serial Port (McASP),spruer1b from TI
来源:CSDN
作者:jsn_ze
链接:https://blog.csdn.net/jsn_ze/article/details/50750984