Audio Drive Arch

From OMAPpedia

Revision as of 20:35, 7 November 2012 by Icepeda83 (Talk | contribs)
Jump to: navigation, search

Contents

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.

ALSA System on Chip (ASoc)

Asoc Top Level.jpg


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:

In order to provide these features, ASoC drivers are generally split up in to 3 parts:

For more information on ASoC design, see: ASoC - ALSA Project


Audio Back End (ABE)

Audio arch.jpg

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:

Audio BackEnd subsystem integrates:


Codec Driver - Phoenix (TWL6040)

OMAP4 Audio Phoenix.jpg

The Phoenix codec in OMAP4 is the analog part of the audio architecture. It consists of the following components:

Audio output:

Audio input:

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:


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:

Output port mapping
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    


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:

Input port mapping
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


Platform Driver

The Platform Driver the audio interface drivers (McBSP, I2C, McPDM, etc) for the system

Currently supported platform drivers are:


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


This assumes the following:


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

Multimedia DAI

The Multimedia DAI is used to encode/decode high fidelity audio.

Voice DAI

The Voice DAI is used to render low fidelity (8 or 16 Khz) audio.

Tones DAI

The Tones DAI is a used to render generated tones to one of the outputs. Can be single or dual tone generated.

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]

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.

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:

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

ASoC ABE controls.jpg

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

ASoC ABE volumes.jpg

Earlier graph

the next picture show the mixer control before 3.0 kernel. ASoC OMAP4.jpg

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.

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_UL11 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

4AI.1.5 and later, and 4AJ

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_UL11 to DMIC0 L
tinymix 55 2 # MUX_UL10 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_UL11 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
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox