ASoC 概述(中文翻译) / ASoC Overview

68 篇文章 11 订阅
56 篇文章 6 订阅

【版权声明】

    本文为 ASoC 框架的概述性文档,翻译自 Linux 内核源码文档中的 Documentation/sound/alsa/soc/overview.txt,遵循 GPL 协议。

    文中如有翻译不当的地方,请不吝指正。


【译文正文】

ASoC层

======

ASoC层的目标是为嵌入式片上系统处理器(比如 pxa2xx,au1x00,iMX 等)和移动平台上的 音频编解码芯片提供更好的 ALSA 支持。相较于之前的音频架构,ASoC 子系统的优势在于 其能在内核为 SoC 音频提供一些支持。当然,她也存在一些不足之处:
    * 编解码芯片驱动与其所依附的 CPU 耦合过于紧密。这导致代码很难重用,并不是我们 希望看到的。举个例子,Linux 中的 wm8731 驱动代码在 4 个使用不同 CPU 的平台上 有 4 份不同的源文件。
    * 当音频初始化事件发生时,没有规定一个标准的方法来通知用户(比如 耳机/麦克风的 插入事件、插入后的检测事件)。这些都是在移动设备上常见的事件类型,通常在这些 事件发生后还需要一些平台相关的代码来进行处理,比如重新选通音频通路、使能功放 等。
    * 在进行音频播放或录音时,驱动代码总是试图为整个编解码芯片上电。在电脑上这么做 当然无可厚非,但在移动设备上也采用这样的策略会导致严重的电量浪费。类似的, 现有驱动也无法通过更改编解码芯片的过采样率、偏置电流等方式来减少设备耗电。


ASoC 的设计架构 

===============

ASoC 层被设计用于解决上述问题,并具备以下这些特点:

    * Codec 模块独立性。允许在不同 Platform 模块和 Machine 模块上重用 Codec模块 驱动代码。

    * 更易于在 Codec 模块 和 SoC 之间完善 I2S/PCM 音频接口。每个 SoC 和 编解码芯片寄存器的音频接口都与内核接口兼容,并且当具体应用场景的硬件参数 给定之后,这些接口都能被恰当地匹配和配置。

    * 动态音频电源管理机制(DAPM)。DAPM 总是自动根据编解码芯片情况设置其工作在 最低功耗状态。包括根据实际的音频选路情况来为芯片内的各个模块上电/断电。

    * 减少 pop/click 噪声。通过为编解码芯片内各模块设置正确的上电/断电顺序(包括 使用数字静音功能),从而减少 pop/click 噪声。ASoC 总是先通知编解码芯片, 再更改她的通电状态。

    * Machine 相关控制功能: 允许在 Machine 模块中添加声卡控制代码(比如 扬声器 功放音量控制)。


为了实现这些设计思想,ASoC 将嵌入式音频系统划分为 3 个可重用的驱动模块:

    * Codec 驱动模块: Codec 驱动模块独立于 Platform 模块,包含了音频控制、音频接口实现、 DAPM 定义、I/O控制函数。这个模块也可被扩展移植到蓝牙、调频和调制解调芯片上。 Codec 驱动模块中的代码应该是通用的,可以运行于任意的 CPU 架构和设备上。

    * Platform 驱动模块: Platform 驱动模块包含音频 DMA 驱动、数字音频接口(DAI)驱动 (比如 I2S、AC97、PCM)以及该平台所搭配的 DSP 模块所对应的驱动。

    * Machine 驱动模块: Machine 驱动模块的作用就像胶水,她描述并绑定前 2 个模块 所提供的功能,从而生成 1 个符合 ALSA 框架的 “声卡设备”。所有硬件相关的控制 与硬件相关的音频事件都在这里进行处理(比如在播放音频的起始阶段启用功放)。


相关文档

========

ASoC 的相关文档被分成以下几部分:

    overview.txt:    本文档。

    codec.txt:    Codec 驱动模块描述。

    DAI.txt:    描述数字音频接口(DAI)标准以及如何配置你自己的 Codec 模块和 Platform 模块 中的 DAI 驱动代码。

    dapm.txt:    动态音频电源管理(DAPM)相关描述。

    platform.txt:    Platform 模块中的 DMA 和 DAI 相关描述。

    machine.txt:    Machine 驱动模块描述。

    pop_clicks.txt:    描述如何最小化音频中的 pop/click 噪声。

    clocking.txt:    描述如何管理/配置时钟以达到功耗最优化。

    jack.txt:    ASoC 中的插头检测功能描述。

    DPCM.txt: 动态PCM - 以 DSP 为例描述 DPCM 功能。


【名词释义】

    pop/click 噪声:  pop/click 噪声是指音频放大器在上电、断电瞬间以及在待机切换时,电源对输入电容、偏置电容或输出隔直电容充电所产生的爆破声。参见《pop-click噪声》 或《电子工程术语定义:喀嗒声》


【英文原文】

ALSA SoC Layer 

==============
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:-
    * 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.
    * 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 

===========
The ASoC layer is designed to address these issues and provide the following features :-
    * 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).


To achieve all this, ASoC basically splits an embedded audio system into multiple re-usable component drivers :-
    * Codec class drivers: The codec class driver is platform independent and contains audio controls, audio interface capabilities, codec DAPM definition and codec IO functions. This class extends to BT, FM and MODEM ICs if required. Codec class drivers should be generic code that can run on any architecture and machine.
    * Platform class drivers: The platform class driver includes the audio DMA engine driver, digital audio interface (DAI) drivers (e.g. I2S, AC97, PCM) and any audio DSP drivers for that platform.
    * Machine class driver: The machine driver class acts as the glue that decribes and binds the other component drivers together to form an ALSA "sound card device". It handles any machine specific controls and machine level 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.
    codec.txt: Codec driver internals.
    DAI.txt: Description of Digital Audio Interface standards and how to configure a DAI within your codec and CPU DAI drivers.
    dapm.txt: Dynamic Audio Power Management
    platform.txt: Platform audio DMA and DAI.
    machine.txt: Machine driver internals.
    pop_clicks.txt: How to minimise audio artifacts.
    clocking.txt: ASoC clocking for best power performance.
    jack.txt: ASoC jack detection.
    DPCM.txt: Dynamic PCM - Describes DPCM with DSP examples. 


  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值