1. 程式人生 > >linux音訊子系統 - ASoc框架

linux音訊子系統 - ASoc框架

為什麼要設計ASoC

引用linux Document中的解釋:
The overall project goal of the ALSA System on Chip (ASoC) layer is to
provide better ALSA support for embedded system-on-chip processors and
portable audio codecs.

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 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).

ASoc框架

這裡寫圖片描述

ASoC-pcm結構

pcm這塊主要分codec/platform/machine,codec主要對應的是音訊的ADC/DAC硬體(包括外圍器件和soc器件),platform一般主要是平臺上的裝置,比如DMA裝置,machine相當於board,主要是負責音效卡的註冊,每個machine對應的codec/platform都是不一樣的,這樣可以自由組合使用。

  • Codec driver: The codec driver is platform independent and contains audio
    controls, audio interface capabilities, codec DAPM definition and codec IO
    functions.
  • Platform driver: The platform driver contains the audio DMA engine and audio
    interface drivers (e.g. I2S, AC97, PCM) for that platform.
  • Machine driver: The machine driver handles any machine specific controls and
    audio events (e.g. turning on an amp at start of playback).

ASoC-control結構

ASoC這邊在control裡主要加入了DAPM,具體細節後文介紹,DAPM主要就是在你每次set/get操作的時候,都會按照既定的原則,來對連結串列上的裝置按順序turn/off