@Fetures Overview
The features supported by ALSA SoC Audio driver are:
-Supports audio codec in ALSA SoC framework.
-Multiple sample rates support (8 KHz, 16 KHz, 22.05 KHz, 32 KHz, 44.1 KHz, 48 KHz etc) for both capture and playback.
-Supports audio in stereo mode.
-Supports simultaneous playback and record (full-duplex mode).
-Start, stop, pause and resume feature.
-Supports mixer interface for audio codecs.
@Tool:
tinyalsa are used for audio playback, capture and configuration.
@ALSA HAL:
mydroid/device/xx/common-open/audio/audio_hw.c
The compiled HAL is named audio.primary.xxxx.so at /system/lib/hw
@ALSA Soc Architecture
- ASOC (ALSA System On Chip)
ASoC) layer is to provide better ALSA support for embedded system on chip processors and portable audio codecs
- Desgin:
1.Codec independence:
Allows reuse of codec drivers on other platforms and machines.
2.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 hw params are known.
3.Dynamic Audio Power Management (DAPM):
DAPM automatically sets the codec to it's 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.
4.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.
-SoC basically splits an embedded audio system into three components:
1.Codec driver:
The codec driver is platform independent and contains audio controls,
audio interface capabilities, codec dapm definition and codec IO functions.
2.Platform driver:
The platform driver contains the audio dma engine and audio interface drivers (e.g. I2S, AC97, PCM)
for that platform.
3.Machine driver:
The machine driver handles any machine specific controls and audio events
i.e. turning on an amp at start of playback
@ Device Interface : /dev/snd/
- PCM devices for recording and play
- CTL devices that allow manipulating the internal mixer and routing of the card
1./dev/snd/controlC0: Control devices (i.e. mixer, etc)
2./dev/snd/pcmC0D0c : PCM Card 0 Device 0 Capture device
3./dev/snd/pcmC0D0p : PCM Card 0 Device 0 Playback device
@ Proc FS Interface: /proc/asound
The /proc/asound kernel interface is used as a status and configuration interface.
A lot of useful information about the sound system can be found in the
/proc/asound subdirectory.
1.cards : List of registered cards
2.version : Version and date the driver was built on
3.devices : List of registered ALSA devices
4.pcm : The list of allocated PCM streams
5.cardX : (X = 0-7) The card specific directory
6.cardX/pcm0p : The directory of the given PCM playback stream
7.cardX/pcm0c : The directory of the given PCM capture stream
@ Sys FS Interface:
- /sys/devices/platform/soc-audio/ : Information on the codec device
- /sys/devices/platform/xxx-pcm-audio : Interface for platfrom pcm (ALSA) device
- /sys/devices/platfrom/xxx-mcbsp-dai.x : Interface for McBSP device
@ Commonly Used API for ALSA:
snd_pcm_open:
Opens a PCM stream
snd_pcm_close:
Closes a previously opened PCM stream
snd_pcm_hw_params_any:
Fill params with a full configuration space for a PCM
snd_pcm_hw_params_test_ <
Test the availability of important parameters like number of channels,
sample rate etc.
For e.g. snd_pcm_hw_params_test_format, snd_pcm_hw_params_test_rate etc.
snd_pcm_hw_params_set_ <
For e.g. snd_pcm_hw_params_set_format, snd_pcm_hw_params_set_rate etc.
snd_pcm_hw_params:
Install one PCM hardware configuration chosen from a configuration space
snd_pcm_writei:
Write interleaved frames to a PCM
snd_pcm_readi:
Read interleaved frames from a PCM
snd_pcm_prepare:
Prepare PCM for use
snd_pcm_drop:
Stop a PCM dropping pending frames
snd_pcm_drain:
Stop a PCM preserving pending frames
reference:
http://processors.wiki.ti.com/index.php/UserGuideAudioDriver_PSP_04.02.00.07
沒有留言:
張貼留言