Audio Drive Arch
From OMAPpedia
Contents |
[edit] OMAP4 Audio Design
This page describes the overall OMAP4 Audio architecture. It complies with the ALSA/ASoC model to provide user applications with an industry standard interface to the audio components. The OMAP4 hardware includes the integrated Audio Back End (ABE) processor and the Phoenix (TWL6040) codec to provide complete audio support.
[edit] ALSA System on Chip (ASoc)
The ASoC layer was designed to better support audio subsystems in embedded system on chip (SoC) platforms. Embedded systems have unique audio needs such as:
- Detection of insertion/removal of headset/microphones
- Dynamic routing of audio
- Power management features (DAPM).
In order to provide these features, ASoC drivers are generally split up in to 3 parts:
- Codec Driver -
- Platform Driver
- Machine Driver
For more information on ASoC design, see: ASoC - ALSA Project
[edit] Audio Back End (ABE)
The Audio Back-End module is a sub-system in OMAP4 with dedicated Power domains to support low power Audio use cases. The purpose of the ABE is to handle the audio processing of the application. It means that it will be in charge to receive voice or audio sample either from CPU/DSP or external component (phoenix or other) and send them to the analog part or memories after processing.
The functional responsibilities of the Audio Back-End drivers are:
- Managing various Audio/voice UL/DL streams between Host like DSP/MPU/DMA (Front End ports) and the physical interfaces like McBSP, McASP, McPDM, DMIC and SLIMBUS (Back End ports).
- Performing real-time audio processing like equalization, mixing, SRC etc.
Audio BackEnd subsystem integrates:
- Peripheral connectivity modules
- 3 McBSPs (to support Modem voice, BT, and Audio)
- 1 McASP1 module
- 1 Slimbus (to support new generation of codec MIPI complaint
- 1 DMIC (to support 3 stereo digital microphones, hence 6 channel data)
- 1 McPDM (to support interconnect with Audio IC Phoenix)
- HDMI
- Audio Engine Sub-system (AESS)
- ATC (audio traffic controller)
- Local Interconnect
- Asynchronous interconnect
- L3 Master (T2Async)
- DSP Master (T2Async)
- MCU Master (T2Async)
- On chip memory
- 64KB of RAM 32-bit data length DMEM
- 4KB for coefficient CMEM
- 32KB for Sample SMEM (address space with 24KB of physical mem)
- 8KB for Program PMEM
- 4 GP Timers and 1 Watchdog timer
- Independent Power Domain and PRCM controls
- The ABE power domain can remain always on even when the rest of OMAP is in OFF mode
[edit] Codec Driver - Phoenix (TWL6040)
The Phoenix codec in OMAP4 is the analog part of the audio architecture. It consists of the following components:
Audio output:
- Headset
- Handsfree
- Vibrator
- Auxiliary
- Earphone
Audio input:
- Mic left input (Can be Main mic, HS mic or AUX/FM left input)
- Mic Right input (Can be Sub mic, HS mic or AUX/FM right input)
- Line In
The Phoenix codec renders samples at 88.4 KHz and 96 KHz. Handsfree speakers and other paths can only work at 96 KHz, but heaphones has two modes of operation:
- Low power mode (88.4 KHz and 96 KHz). Consumes less power but the audio quality may be affected.
- High performance mode (96 KHz only). Good for applications in which quality of audio is desired.
There are eight digital input channels on the Phoenix that can be used for rendering audio out to nine different analog outputs. There are 5 McPDM channels (DL0 -> DL4), an I2C channel, and two auxiliary inputs that can be used for the FM radio (AFM0, AFM1). Audio from these inputs can be routed to the various analog outputs on the Phoenix as per the following table:
DL0 | DL1 | DL2 | DL3 | DL4 | I2C or Frame(3) | AFM0 | AFM1 | |
Earphone | X(1) | |||||||
Left Headset | X | X | ||||||
Right Headset | X | X | X | |||||
Left HF | X | X | ||||||
Right HF | X | X | X | |||||
Left Auxiliary | X(2) | X | ||||||
Right Auxiliary | X(2) | X(2) | X | |||||
Left Vibrator | X | X | ||||||
Right Vibrator | X | X |
- (1) This path can not be concurrent of L/R headset paths
- (2) These paths can be concurrent but not independent of L/R hands free paths
- (3) The Frame line can be used for register write (e.g. vibrator data registers) in command mode.
Likewise, the Phoenix has the following 5 analog inputs that can be used for encoding audio. Uplink audio from the Phoenix to the ABE can be transferred over 2 McPDM channels (UL0 and UL1) or via two auxiliary ports, AFM0 and AFM1, which are often used for FM radio audio. The possible mappings of these inputs to uplink channels in to the ABE are as follows:
UL0 | UL1 | AFM0 | AFM1 | |
Main Microphone, MMIC | X | |||
Sub Microphone, SMIC | X | |||
Headset Microphone, HSMIC | X | X | ||
Left Auxillary/FM radio | X | X | ||
Right Auxillary/FM radio | X | X |
[edit] Platform Driver
The Platform Driver the audio interface drivers (McBSP, I2C, McPDM, etc) for the system
Currently supported platform drivers are:
[edit] Machine Driver
In the ASoC model, there is a machine driver that is specific to the system hardware. This is the "glue" that ties the platform and the codec drivers together.
The OMAP4430SDP/Blaze machine driver supports several audio interfaces (Front End):
- Multimedia – Hi fidelity audio.
- Tones – Tone generation support.
- Voice - voice grade audio.
- Digital uplink – audio uplink port
- Vibrator – eventual support for haptic vibrator support.
This assumes the following:
- Support for the OMAP4430SDP or Blaze board with ES2.x silicon.
- Audio will be rendered to TWL6040 via DAI channels over a McPDM interface.
- Support for I2C (via McBSP) will be supported later.
This defines the audio devices as seen by the ALSA layer:
ubuntu@ubuntu:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: SDP4430 [SDP4430], device 0: Multimedia null-codec-dai-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SDP4430 [SDP4430], device 2: Voice null-codec-dai-2 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SDP4430 [SDP4430], device 3: Tone Playback null-codec-dai-3 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SDP4430 [SDP4430], device 4: VIB-DL null-codec-dai-4 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SDP4430 [SDP4430], device 5: MODEM null-codec-dai-5 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SDP4430 [SDP4430], device 6: Multimedia null-codec-dai-6 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SDP4430 [SDP4430], device 7: HDMI HDMI-7 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SDP4430 [SDP4430], device 8: Multimedia FM Digital-8 []
Subdevices: 1/1
Subdevice #0: subdevice #0
ubuntu@ubuntu:~$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: SDP4430 [SDP4430], device 0: Multimedia null-codec-dai-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SDP4430 [SDP4430], device 1: Multimedia Capture null-codec-dai-1 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SDP4430 [SDP4430], device 2: Voice null-codec-dai-2 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SDP4430 [SDP4430], device 5: MODEM null-codec-dai-5 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SDP4430 [SDP4430], device 8: Multimedia FM Digital-8 []
Subdevices: 1/1
Subdevice #0: subdevice #0
[edit] Multimedia DAI
The Multimedia DAI is used to encode/decode high fidelity audio.
[edit] Voice DAI
The Voice DAI is used to render low fidelity (8 or 16 Khz) audio.
[edit] Tones DAI
The Tones DAI is a used to render generated tones to one of the outputs. Can be single or dual tone generated.
[edit] Vibra DAI
This DAI is used to support haptic feedback through the vibra driver. The Phoenix chipset provides support for using PCM audio data to modulate the vibrators through this DAI. [Feature not implemented yet]
[edit] HDMI DAI
The machine driver provides a DAI for access to the HDMI audio port on the OMAP4. Audio written to this DAI are handed off to the HDMI lib which, in turn, is responsible for writing the audio data out the HDMI port. The HDMI lib is responsible for configuration of the stream to work with the rendering device.
[edit] OMAP4/5 ASoc Kernel audio driver controls mapping
This section map the kernel control on the OMAP4 HW. The mixer controls can be divided into two parts:
- Controls for path setting
- Controls for Volume setting
[edit] Path setting
Mixer controls associated to path are checked by the ASoC Dynamic PCM part in order to cross check valid Audio path. The next Graph show the mixer control since 3.1 Audio feature tree kernel. In case the mixer controls for data PATH are not set correctly ASoC driver will return an "error no valid path set"
For example for Multimedia playback a minimum set of mixer control need to be set:
amixer cset name='DL1 Media Playback' 1 # 'DL1 Mixer Multimedia' on newer systems? amixer cset name='Sidetone Mixer Playback' 1 amixer cset name='Headset Left Playback' 1 amixer cset name='Headset Right Playback' 1 amixer cset name='DL1 PDM Switch' 1
After you can set the volume (described inside the next section)
amixer cset name='DL1 Media Playback Volume' 120 amixer cset name='SDT DL Volume' 120 amixer cset name='Headset Playback Volume' 12
Then you can make playback on Headset
aplay -D plughw:0,0 file.wav
[edit] Volume setting
All the volume setting can be done at any time. They are here to controls the volume of the platform. All the ABE digital gain have a range from +30 dB to -120 dB (mute) with step of 1 dB. For ABE gain value 120 is corresponding to 0 dB. Please note that when some paths are stopped the digital gain are muted by the driver automatically so you do not need to do it form user space (except if you wnat to make SW mute).
[edit] Earlier graph
the next picture show the mixer control before 3.0 kernel.
[edit] Testing Audio Driver
You can use some ALSA tools in order to test the driver in the most basic way without intervention of other applicacion to find if your driver, hardware or codec is working properly. Most of the times the tools are included in the filesystem. Here are some examples for TI platforms and public releases.
[edit] 4AI.1.4 and previous
DMic Multimedia Capture (MM_UL)
tinymix 5 0 # DMIC Equalizer to High-pass 0dB tinymix 24 120 # DMIC1 UL Volume to 120 tinymix 62 1 # MUX_UL01 to DMIC0 L tinymix 63 2 # MUX_UL00 to DMIC0 R tinycap /data/filecapdmic.wav -d 0 -b 32 -c 2 -r 48000
AMic Multimedia Capture (MM_UL2)
tinymix 4 0 # AMIC Equalizer to High-pass 0dB tinymix 23 120 # AMIC UL Volume to 120 tinymix 46 11 # MUX_UL11 to AMIC0 tinymix 47 12 # MUX_UL10 to AMIC1 tinymix 70 1 # Analog Right Capture Route to Sub Mic tinymix 71 1 # Analog Left Capture Route to Main mic tinycap /data/filecapamic.wav -d 1 -c 2 -r 48000
DMic Voice Capture (VX_UL)
tinymix 5 0 # DMIC Equalizer to High-pass 0dB tinymix 24 120 # DMIC1 UL Volume to 120 tinymix 43 1 # Voice Capture Mixer Capture to On tinymix 52 1 # MUX_VX1 to DMIC0 L tinymix 53 2 # MUX_VX0 to DMIC0 R tinycap /data/filecapvxdmic.wav -d 2 -c 2 -r 16000
Headset Multimedia Playback (MM_DL)
tinymix 0 0 # DL1 Equalizer to Flat response tinymix 3 0 # Sidetone Equalizer to Flat response tinymix 6 120 # DL1 Media Playback Volume to 120 tinymix 23 110 # SDT DL Volume to 110 tinymix 34 1 # DL1 PDM Switch to On tinymix 36 1 # Sidetone Mixer Playback to On tinymix 51 1 # DL1 Mixer Multimedia to On tinymix 67 15 # Headset Playback Volume to 15 tinymix 72 1 # Headset Right Playback to On tinymix 73 1 # Headset Left Playback to On tinyplay /data/filecapdmic.wav -d 0
Handsfree Voice Playback (VX_DL)
tinymix 1 0 # DL2 Left Equalizer to Flat response tinymix 2 0 # DL2 Right Equalizer to Flat response tinymix 12 120 # DL2 Voice Playback Volume to 120 tinymix 45 1 # DL2 Mixer Voice to On tinymix 68 26 # Handsfree Playback Volume to 26 tinymix 74 1 # Handsfree Right Playback to HF DAC tinymix 75 1 # Handsfree Left Playback to HF DAC tinyplay /data/filecapvxdmic.wav -d 2
[edit] 4AI.1.5 and later
DMic Multimedia Capture (MM_UL)
tinymix 5 0 # DMIC Equalizer to High-pass 0dB tinymix 20 120 # DMIC1 UL Volume to 120 tinymix 54 1 # MUX_UL01 to DMIC0 L tinymix 55 2 # MUX_UL00 to DMIC0 R tinycap /data/filecapdmic.wav -d 0 -b 32 -c 2 -r 48000
AMic Multimedia Capture (MM_UL2)
tinymix 4 0 # AMIC Equalizer to High-pass 0dB tinymix 23 120 # AMIC UL Volume to 120 tinymix 46 11 # MUX_UL11 to AMIC0 tinymix 47 12 # MUX_UL10 to AMIC1 tinymix 70 1 # Analog Right Capture Route to Sub Mic tinymix 71 1 # Analog Left Capture Route to Main mic tinycap /data/filecapamic.wav -d 1 -c 2 -r 48000
DMic Voice Capture (VX_UL)
tinymix 5 0 # DMIC Equalizer to High-pass 0dB tinymix 20 120 # DMIC1 UL Volume to 120 tinymix 39 1 # Voice Capture Mixer Capture to On tinymix 44 1 # MUX_VX1 to DMIC0 L tinymix 45 2 # MUX_VX0 to DMIC0 R tinycap /data/filecapvxdmic.wav -d 2 -c 2 -r 16000
Headset Multimedia Playback (MM_DL)
tinymix 0 0 # DL1 Equalizer to Flat response tinymix 3 0 # Sidetone Equalizer to Flat response tinymix 6 120 # DL1 Media Playback Volume to 120 tinymix 19 110 # SDT DL Volume to 110 tinymix 30 1 # DL1 PDM Switch to On tinymix 32 1 # Sidetone Mixer Playback to On tinymix 43 1 # DL1 Mixer Multimedia tinymix 59 15 # Headset Playback Volume to 15 tinymix 63 1 # Earphone Playback Switch to On tinymix 66 1 # Headset Right Playback to On tinymix 67 1 # Headset Left Playback to On tinyplay /data/filecapdmic.wav -d 0
Handsfree Voice Playback (VX_DL)
tinymix 0 0 # DL1 Equalizer to Flat response tinymix 3 0 # Sidetone Equalizer to Flat response tinymix 8 120 # DL1 Voice Playback Volume to 120 tinymix 29 1 # DL1 PDM2 Switch to On tinymix 32 1 # Sidetone Mixer Playback to On tinymix 41 1 # DL1 Mixer Voice tinymix 60 26 # Handsfree Playback Volume to 26 tinymix 68 1 # Handsfree Right Playback to HF DAC tinymix 69 1 # Handsfree Left Playback to HF DAC tinyplay /data/filecapvxdmic.wav -d 2
[edit] 4AJ
DMic Multimedia Capture (MM_UL)
tinymix 3 0 # DMIC Equalizer to High-pass 0dB tinymix 18 120 # DMIC1 UL Volume to 120 tinymix 52 1 # MUX_UL01 to DMIC0 L tinymix 53 2 # MUX_UL00 to DMIC0 R tinycap /data/filecapdmic.wav -d 0 -b 32 -c 2 -r 48000
AMic Multimedia Capture (MM_UL2)
tinymix 2 0 # AMIC Equalizer to High-pass 0dB tinymix 21 120 # AMIC UL Volume to 120 tinymix 44 11 # MUX_UL11 to AMIC0 tinymix 45 12 # MUX_UL10 to AMIC1 tinymix 68 1 # Analog Right Capture Route to Sub Mic tinymix 69 1 # Analog Left Capture Route to Main mic tinycap /data/filecapamic.wav -d 1 -c 2 -r 48000
DMic Voice Capture (VX_UL)
tinymix 3 0 # DMIC Equalizer to High-pass 0dB tinymix 18 120 # DMIC1 UL Volume to 120 tinymix 37 1 # Voice Capture Mixer Capture to On tinymix 42 1 # MUX_VX1 to DMIC0 L tinymix 43 2 # MUX_VX0 to DMIC0 R tinycap /data/filecapvxdmic.wav -d 2 -c 2 -r 16000
Headset Multimedia Playback (MM_DL)
tinymix 0 0 # DL1 Equalizer to Flat response tinymix 1 0 # Sidetone Equalizer to Flat response tinymix 4 120 # DL1 Media Playback Volume to 120 tinymix 17 110 # SDT DL Volume to 110 tinymix 28 1 # DL1 PDM Switch to On tinymix 30 1 # Sidetone Mixer Playback to On tinymix 41 1 # DL1 Mixer Multimedia tinymix 57 15 # Headset Playback Volume to 15 tinymix 61 1 # Earphone Playback Switch to On tinymix 64 1 # Headset Right Playback to On tinymix 65 1 # Headset Left Playback to On tinyplay /data/filecapdmic.wav -d 0
Handsfree Voice Playback (VX_DL)
tinymix 0 0 # DL1 Equalizer to Flat response tinymix 1 0 # Sidetone Equalizer to Flat response tinymix 6 120 # DL1 Voice Playback Volume to 120 tinymix 27 1 # DL1 PDM2 Switch to On tinymix 30 1 # Sidetone Mixer Playback to On tinymix 39 1 # DL1 Mixer Voice tinymix 58 26 # Handsfree Playback Volume to 26 tinymix 66 1 # Handsfree Right Playback to HF DAC tinymix 67 1 # Handsfree Left Playback to HF DAC tinyplay /data/filecapvxdmic.wav -d 2