4AI.1.5 OMAP4 ICS Blaze AIC AIC3262 SW Release3c

= Introduction = This document explains the steps involved in enabling the AIC3262 Audio playback/recording on Blaze Tablet2 platform

Blaze_AIC_Tablet2 = Blaze_Tablet2 + OMAP4 processor card with AIC3262 audio codec

This software release has been developed and verified in the following software and hardware environment.

OS Kernel: Linux® 3.0 Android:  Android IcecreamSandwich 4.0.4(MR1.1) Toolchain: CodeSourcery compiler version Sourcery G++ Lite 2010q1-202 for ARM GNU/Linux Reference hardware platforms: TI OMAP4 4460 ES1.1 HS blaze_tablet and also TI OMAP4 4460 ES1.1 HS blaze Build Host OS: Ubuntu Daily Build Blaze_Tablet Version: 4AI.x_44XX_T2_DEV_DB70 Daily Build Blaze Version: 4AI.x_44XX_Blaze_DEV_DB8 Reference software release http://omappedia.org/wiki/4AI.1.5_OMAP4_Icecream_Sandwich_Release_Notes

This document assumes that
 * The user is familiar with Blaze Tablet2 platform. Please refer the info given here http://omappedia.org/wiki/4AI.1.5_OMAP4_Icecream_Sandwich_Release_Notes
 * User has access to Blaze Tablet2 platform
 * User has access to "OMAP4 Processor card with AIC3262 audio codec"

Release summary
 * Android GUI : Playback on Headphone and Speakers on Blaze and Blaze Tablet2
 * Android GUI : Record from Headset microphone on Blaze and Blaze Tablet2
 * Android GUI : Record from Main microphone and sub microphone on Blaze
 * Command-line: Playback on Headphone and Speakers on Blaze and Blaze Tablet2
 * Command-line: Record from Headset microphone on Blaze and Blaze Tablet2
 * Command-line: Record from Main microphone and sub microphone on Blaze

=Installation=
 * Hardware
 * Install the Processor card (OMAP4+AIC3262) onto Blaze Tablet2 platform. This platform is referred as Blaze_AIC_Tablet2
 * Install the Processor card (OMAP4+AIC3262) onto Blaze platform. This platform is referred as Blaze_AIC

=Release Content= This release Blaze_AIC_AIC3262_SW_Release3c.zip contains three files
 * Patch to be applied on top of the Kernel. Kernel can be pulled from http://omappedia.org/wiki/4AI.1.5_OMAP4_Icecream_Sandwich_Release_Notes#Downloading_Release_Software
 * Patch to be applied on top of Android ICS . ICS can be pulled from http://omappedia.org/wiki/4AI.1.5_OMAP4_Icecream_Sandwich_Release_Notes#Downloading_Release_Software
 * Release document (this document) to explain the steps involved to enable AIC3262 Audio playback/recording

Features supported in this release
 * 1) Fully compliant with ALSA
 * 2) Integrated the driver with OMAP4 ABE
 * 3) Tested Multimedia Headphone playback and headset microphone recording
 * 4) Tested Recording from Main Mic and Sub Mic on Blaze_AIC
 * 5) Tested External Speaker on Blaze_AIC_Tablet2 and Blaze_AIC
 * 6) Tested for single I2S
 * 7) Tested Voip call and SIP call on Blaze_AIC
 * 8) Tested Firmware loading
 * 9) Headset / Headphone distinction
 * 10) Headset / Headphone pop reduction
 * 11) Headset half insertion detection
 * 12) Verbose debug levels support
 * 13) Runtime coefficients updates
 * 14) Switching firmware modes based on use-case

=Build Instructions=

Android File System
Follow instructions to download the Android File system by http://omappedia.org/wiki/4AI.1.5_OMAP4_Icecream_Sandwich_Release_Notes#Downloading_Release_Software

This section explains how to download the Android ICS HAL release and ICS Tinyalsa release for Blaze AIC3262 SW Release3c

Unzip Blaze_AIC3262_Release3c_Audio_HAL.zip into a temporary directory. $cd mydroid/device/ti/common-open/ patch -p1 < {temporary directory}/Blaze_AIC3262_Release3c_Audio_HAL/Blaze_AIC3262_sw_release3c_Audio_HAL.patch Compiling the audio module $cd mydroid $cd device/ti/common-open/ mydroid$source ./build/envsetup.sh mydroid$lunch full_blaze-userdebug mydroid$make clean-audio.primary.omap4 mydroid$make audio.primary.omap4

For Blaze tablet build $cd mydroid $cd device/ti/common-open/ mydroid$source ./build/envsetup.sh mydroid$lunch blaze-tablet_userdebug mydroid$make clean-audio.primary.omap4 mydroid$make audio.primary.omap4

The above steps will create audio.primary.omap4.so for both blaze_aic and blaze_aic_tablet2 in their respective out-product directories. Push the .so file in to target as follows $./adb push audio.primary.omap4.so /system/lib/hw/

Tinymix control string enabling

This section explains how to patch and build the tinymix Unzip Blaze_AIC3262_Release3c_Audio_HAL.zip into a temporary directory. $cd mydroid/external/tinyalsa/ $patch -p1 < {temporary directory}/Blaze_AIC3262_Release3c_Audio_HAL/BLAZE_AIC3262_tinymix_control_sw_release3c.patch $cd mydroid $source build/envsetup.sh $lunch full_blaze-userdebug or $lunch blaze-tablet_userdebug $make tinymix $push through adb in to the target as follows $./adb push tinymix /system/bin/

Note: tinymix, tinyplay and tinycap pre-built binaries are provided along with the release package

Follow the build instructions given here: http://omappedia.org/wiki/4AI.1.5_OMAP4_Icecream_Sandwich_Release_Notes#Building_Android_Filesystem_.28AFS.29_with_TI_Codecs_enabled under http://omappedia.org/wiki/4AI.1.5_OMAP4_Icecream_Sandwich_Release_Notes#Build_Instructions

Kernel
This section explains how to patch and build the kernel

Unzip Blaze_AIC3262_sw_release3c_kernel.zip into a temporary directory. $cd kernel patch -p1 < {temporary directory}/Blaze_AIC3262_sw_release3c_kernel.patch

Follow the build instructions given here:http://omappedia.org/wiki/4AI.1.5_OMAP4_Icecream_Sandwich_Release_Notes#Building_Kernel under http://omappedia.org/wiki/4AI.1.5_OMAP4_Icecream_Sandwich_Release_Notes#Build_Instructions

Flashing
Follow the steps given in http://omappedia.org/wiki/4AI.1.5_OMAP4_Icecream_Sandwich_Release_Notes#Flashing_the_OMAP4_Hardware

DSP firmware loading
The DSP firmware file (tlv320aic3262_fw_v1.bin file) need to be loaded to the target as follows ./adb push tlv320aic3262_fw_v1.bin /vendor/firmware/ ./adb reboot

The firmware consists of modes and configurations. The tinymix control "Codec Firmware Setmode" sets the required mode automatically according to use-case for instance Music speaker. Music Headphone, Record OnboardMic, Record HeadsetMic. The firmware binary tlv320aic3262_fw_v1.bin is part of release. Example firmware binary

Build and Usage of Firmware tools and Utils
http://omappedia.org/wiki/AIC3262/Firmware_Release_Notes

Enabling and Disabling Verbose debug levels for AIC3262
This section is provided for the purpose of debugging. Using this, user can control different levels of debug messages or prints. Different levels of debugging are available, every debug level enum corresponds to respective verbosity level. ~ ! #    Debug level enum         Verbosity level                     ! ! -- ! ! 0	AIC3XXX_NO_PRINT        No debug prints                      ! ! 1	AIC3XXX_ALERT		for Init functions                   ! ! 2	AIC3XXX_CRIT		for warning messages                 ! ! 3	AIC3XXX_ERR		at if/else/switch case decisions     ! ! 4 	AIC3XXX_WARNING	        for function entry/exit              ! ! 5	AIC3XXX_NOTICE		upper level for codec read/write     ! ! 6	AIC3XXX_INFO		low level for i2c read/write         ! ! 7	AIC3XXX_DEBUG		verbose level for bottom halves      ! ~ path for debug_level on target file system to change at run time


 * 1) cd /sys/devices/platform/soc-audio/subsystem/devices/tlv320aic3262-codec/
 * 2) cat debug_level        - Checking the default debug level
 * 3) echo 3 > debug_level   - Setting the required debug level

Tinyalsa utils
Build the tinyalsa utils. These utilities are needed for playback and recording wav files without GUI. cd  mydroid make tinycap make tinyplay make tinymix

= AIC3262 Audio = This sections explains the top level audio architecture of Blaze_AIC_Tablet2/Blaze_AIC

ABE
ABE audio routing is shown in this diagram

AIC3262
AIC3262 audio routing is shown in this diagram

Important mixer commands are shown in red color

ASI To DAC
ASI to DAC audio routing is shown in this diagram

ADC To ASI
ADC to ASI audio routing is shown in this diagram

Audio Architecture


= AIC3262 Audio Playback and Recording = Plugin a headset with L,R,M,G connections as shown here

Legacy Mode
tinymix "HPL Output Mixer LDAC Switch" 1 tinymix "HPR Output Mixer RDAC Switch" 1 tinymix "LOR Output Mixer RDAC Switch" 0 tinymix "LOL Output Mixer LDAC Switch" 0 tinymix "HeadPhone Driver Amplifier Volume" 6
 * Playback on heaphones

tinyplay data/ -d 6

tinymix "Speaker Amplifier Volume" 1 tinymix "SPKR Output Mixer LOR Volume" 127 tinymix "SPKL Output Mixer LOL Volume" 127 tinymix "LOR Output Mixer RDAC Switch" 1 tinymix "LOL Output Mixer LDAC Switch" 1 tinymix "HPL Output Mixer LDAC Switch" 0 tinymix "HPR Output Mixer RDAC Switch" 0
 * Playback on External Speaker

to playback on multimedia Front end tinyplay data/ to playback on low power front end tinyplay data/ -d 6

tinymix "MicPGA Volume Control" 60 tinymix "Left Input Mixer CM1L Switch" 1 tinymix "Left Input Mixer IN1L Switch" 1
 * Recording from headset microphone

tinycap data/ -d 6 -c 2 -r 48000 -b 16

tinymix "MicPGA Volume Control" 70 tinymix "Left Input Mixer IN1L Switch" 0 tinymix "Left Input Mixer CM1L Switch" 1 tinymix "Left Input Mixer IN2L Switch" 1 tinymix "Left Input Mixer IN2R Switch" 1
 * Recording from Main microphone on Blaze_AIC

tinycap data/ -d 6 -c 2 -r 48000 -b 16

tinymix "MicPGA Volume Control" 70 tinymix "Left Input Mixer IN1L Switch" 0 tinymix "Left Input Mixer CM1L Switch" 1 tinymix "Left Input Mixer IN2L Switch" 0 tinymix "Left Input Mixer IN2R Switch" 0 tinymix "Right Input Mixer IN3L Switch" 1 tinymix "Right Input Mixer IN3R Switch" 1
 * Recording from Sub microphone on Blaze_AIC

tinycap data/ -d 6 -c 2 -r 48000 -b 16

ABE Mode
tinymix "DL1 Media Playback Volume" 120 tinymix "SDT DL Volume" 120 tinymix "DL1 MM_EXT Switch" 1 tinymix "Sidetone Mixer Playback" 1 tinymix "DL1 Mixer Multimedia" 1 tinymix "HeadPhone Driver Amplifier Volume" 6 tinymix "HPR Output Mixer RDAC Switch" 1 tinymix "HPL Output Mixer LDAC Switch" 1 tinymix "LOR Output Mixer RDAC Switch" 0 tinymix "LOL Output Mixer LDAC Switch" 0
 * Playback on heaphones

to playback on multimedia Front end tinyplay data/ to playback on low power front end tinyplay data/ -d 5

tinymix "Speaker Amplifier Volume" 1 tinymix "SPKR Output Mixer LOR Volume" 127 tinymix "SPKL Output Mixer LOL Volume" 127 tinymix "HPR Output Mixer RDAC Switch" 0 tinymix "HPL Output Mixer LDAC Switch" 0 tinymix "LOR Output Mixer RDAC Switch" 1 tinymix "LOL Output Mixer LDAC Switch" 1
 * Playback on External Speaker

to playback on multimedia Front end tinyplay data/ to playback on low power front end tinyplay data/ -d 5

tinymix "MUX_UL11" 10 tinymix "MUX_UL10" 9 tinymix "MicPGA Volume Control" 60 tinymix "Left Input Mixer CM1L Switch" 1 tinymix "Left Input Mixer IN1L Switch" 1
 * Recording from headset microphone

tinycap data/ -d 1 -c 2 -r 48000 -b 16

tinymix "MUX_UL11" 10 tinymix "MUX_UL10" 9 tinymix "MicPGA Volume Control" 90 tinymix "Left Input Mixer CM1L Switch" 1 tinymix "Left Input Mixer IN1L Switch" 0 tinymix "Left Input Mixer IN2L Switch" 1 tinymix "Right Input Mixer IN2L Switch" 1
 * Recording from Main microphone on Blaze_AIC

tinycap data/ -d 1 -c 2 -r 48000 -b 16

tinymix "MicPGA Volume Control" 90 tinymix "MUX_UL11" 10 tinymix "MUX_UL10" 9 tinymix "Left Input Mixer CM1L Switch" 1 tinymix "Left Input Mixer IN1L Switch" 0 tinymix "Right Input Mixer IN1L Switch" 0 tinymix "Left Input Mixer IN2L Switch" 0 tinymix "Right Input Mixer IN2L Switch" 0 tinymix "Left Input Mixer IN3L Switch" 1 tinymix "Right Input Mixer IN3L Switch" 1
 * Recording from Sub microphone on Blaze_AIC

tinycap data/ -d 1 -c 2 -r 48000 -b 16

=Playback and Recording from ICS GUI on Blaze and Blaze Tablet2=

Push the into the /sdcard directory of ICS filesystem.

Playback on headphone/headset
Plug in the headphone/headset. In ICS GUI select music player application and select the from sdcard to playback the file.

Playback on speakers
Unplug the headphone/headset. In ICS GUI select music player application and select the from sdcard to playback the file.

Recording from headset microphone on Blaze and Blaze Tablet2
Plug in headset. In ICS GUI select Sound Recorder application and select start recording from the Headset Microphone.

Recording from main microphone on Blaze
Unplug the headset. In ICS GUI select Sound Recorder application and select start recording from main microphone.

Recording from sub microphone on Blaze
Unplug the headset. In ICS GUI select Sound Recorder application and select start recording from sub microphone

=Wifi and Bluetooth Enabling from ICS on Blaze_AIC and Blaze_AIC_Tablet2=

Wi-fi Enabling
In ICS GUI menu select settings,select wireless & Networks,select wi-fi,to enable the wi-fi select turn on.It will search for available networks,choose an appropriate network hotspot and then connect to that network.Before enabling wi-fi from GUI,build and calibrate wi-fi drivers for target.Follow the link for build and calibration here http://omappedia.org/wiki/Android_Mac80211#WLAN_Driver_build_instruction http://omappedia.org/wiki/Android_Mac80211#WLAN_Calibration_Instruction

Bluetooth Enabling
The Bluetooth firmware files need to be copied into /system/etc/firmware/ of target,run the firmware file with superuser permissions in target.Follow the link here http://omappedia.org/wiki/Android_Mac80211#WLAN_Calibration_Instruction  for calibration. In ICS GUI menu select settings,select Bluetooth,to enable Bluetooth select turn on.It will search for other Bluetooth devices in the range,selecting a particular bluetooth device will pair both the devices.

Known Issues

 * Release is tested on Blaze_AIC and Blaze_tablet
 * Modem call is not tested
 * VOIP/SIP call not tested on Blaze_tablet.
 * Runtime firmware modes switching related to modem call are not tested.