You are on page 1of 9

TLV320AIC326x Android Integration

July 2011

Android 2.3 Integration with TLV320AIC326x Linux Audio Driver


ABSTRACT
The Android is an application framework from Google for embedded Devices. This datasheet discusses the Android Demo Image and the steps required for getting the Android built for the Custom OMAP4 Evaluation Module running the Linux 2.6.35 Kernel along with AIC326x Linux ASoC Audio Driver. TLV320AIC326x Android Datasheet
July 2011

Table of contents 1 Introduction.............................................................................................. ........................3 2 Getting Started..................................................................................................... .............3 2.1 Hardware................................................................................................. ...................4 2.2 Software................................................................................................... ..................4 2.2.1 Downloading the sources...................................................................................5 3 PANDA-AIC OMAP4 EVM Android Build....................................................................7 3.1 Android Kernel and File system Build......................................................................7 4 Manual Configuration of SD/MMC Card.........................................................................8 4.1 Format and Partition the MMC/SD Card...................................................................9 4.2 Installing Android Rootfs .......................................................................................12 5 Android on PANDA-AIC OMAP4 EVM.......................................................................14 5.1 Using the Demo Contents........................................................................................14 5.2 Music Player....................................................................................................... .....17 5.3 Sound Recorder.................................................................................................. ......19

July 2011 TLV320AIC326x Android Integration for OMAP4430 2

TLV320AIC326x Android Datasheet


July 2011

1 Introduction
Texas Instruments TLV320AIC3262 is a flexible, low-power, low-voltage stereo audio codec with digital microphone inputs and programmable outputs, Power-tune capabilities, fully-programmable mini-DSP, fixed predefined and parameter customizable signal processing blocks, integrated PLL, and flexible digital interfaces. This device is ideal for portable audio and telephony applications, in which an embedded operating system (OS), such as Linux often resides and operates. This application report discusses the driver for the AIC3262, codec that was developed to enable users to quickly set up, run, and use the codec device with the Linux OS and Android applications . The AIC3262 driver was coded to support the latest ASoC architecture to make port into different host processors. The CODEC driver described in this document was run and tested on TLV320AIC3262 EVM REV. B and OMAP4 Panda-AIC Revision A. This version of the Linux Audio Driver can also be used on other variant of the codec such as the AIC3202 with minor reconfiguration. This data-sheet discusses the Android 2.3 Integration with the AIC326x codec that was developed to enable users to quickly set up, run, and use the codec device with the Linux 2.6.35. The CODEC driver described in this document was developed and tested using the custom PANDA-AIC OMAP4 EVM.

2 Getting Started

This release provides the pre-built Android SD/eMMC Card based Images and also the steps required to manually build, configure and download the Android Images into an SD/eMMC Card for final testing. Before exercising the manual configuration and download, it is advised to test the demo Android SD/eMMC Card based Images for the initial Android usage. This section explains the Hardware/Software setup required for testing the Android Demo Image.
July 2011 TLV320AIC326x Android Integration for OMAP4430 3

TLV320AIC326x Android Datasheet


July 2011

2.1 Hardware
Custom OMAP4EVM PANDA-AIC

MMC/SD Card USB Card reader to format/program the MMC/SD Card

Optional Self powered USB Hub USB Keyboard and mouse Note : This code base supports 12 MHz , 24 MHz and 38 Mz and has been tested with 12 Mhz and 38.4 Mhz clock frequencies .To support other frequencies for new platforms the source files have to be modified.

2.2 Software
Required Components Binary image with all components for Android support, ready for programming miniDsp Firmware X-loader (mlo) U-boot (u-boot.bin) Linux kernel (uImage)

Required Packages a. Operating System : i. Linux Ubuntu version 10.04 is recommended b. Cross Compilation Tool Chain : i. CodeSourcery compiler version Sourcery G++ Lite 2010q1-202 for ARM GNU/Linux. c. Java Development Platform : i. sun-java6-jdk d. Other Dependent Packages : i. flex ii. bison iii. gperf iv. libsdl-dev v. libesd0-dev vi. libwxgtk2.6-dev vii. build-essential viii.zip ix. curl x. libncurses5-dev xi. zlib1g-dev
July 2011 TLV320AIC326x Android Integration for OMAP4430 4

TLV320AIC326x Android Datasheet


July 2011

xii. tofrodos e. Serial terminal emulation program (minicom or kermit on Linux / HyperTerminal on Windows) f. Android Gingerbread Source: i. The full source of Android Gingerbread configured for custom PANDAAIC OMAP4 EVM. g. Linux Kernel: i. A full Linux kernel source of version 2.6.35 Applications Root File System for Android Media files (*.wav) required on the SD Card for testing Audio. 2.2.1 Downloading the sources Before downloading the source, we need git and repo tools. The procedure for setting up the git and the tools are listed in the link below http://omappedia.org/wiki/PandaBoardL27.12.1-P2_Release_Notes Create a new folder L27.12.1-P2/mydroid cd mydroid curl http://Android.git.kernel.org/repo > ./repo chmod a+x repo repo init -u git://git.omapzoom.org/platform/omapmanifest.git -b 27.x -m RLS27.12.1-P2_Gingerbread.xml repo sync Apply all the patches mentioned in the release notes relevant Android source The following changes have to be made in the file alsa_omap4.h #define MM_DEFAULT_DEVICE "plughw:0,0" #define MM_LP_DEVICE "plughw:0,0" Note: The Android rootfs released along with this document includes this change.
July 2011 TLV320AIC326x Android Integration for OMAP4430 5

TLV320AIC326x Android Datasheet


July 2011

The following command will get the u-boot and sync the Android repo with the git repository. Create a new folder u-boot in mydroid git clone git://git.omapzoom.org/repo/u-boot.git u-boot cd u-boot git checkout 601ff71c8d46b5e90e13613974a16d10f2006b make distclean make ARCH=arm omap4430panda_config make The following command will get the x-loader and sync the Android repo with the git repository. create a new folder x-loader in mydroid git clone git://git.omapzoom.org/repo/x-loader.git x-loader cd x-loader git checkout c8855fa6b85bd44073bd1b25dbffa99f02cbeeed make distclean make ARCH=arm omap4430panda_config make The following command will download Android 2.6.35 kernel Create a folder kernel in L27.12.1-P2 folder git clone git://git.omapzoom.org/kernel/omap.git kernel/Android-2.6.35 cd kernel/Android-2.6.35 git checkout ec895072ad0b686d2c130e5d80a3076a03042033 Apply the kernel patches listed in the links below cd {YOUR PATH}/L27.12.1-P2/kernel/Android-2.6.35 1. For updating the PANDA_DEFCONFIG to support Android
July 2011 TLV320AIC326x Android Integration for OMAP4430 6

TLV320AIC326x Android Datasheet


July 2011

o git fetch http://review.omapzoom.org/p/kernel/omap/ refs/changes/29/13029/3 && git cherry-pick FETCH_HEAD o git fetch http://review.omapzoom.org/p/kernel/omap refs/changes/61/13861/1 && git cherry-pick FETCH_HEAD 2. For Mouse and Keyboard Support only if required o git fetch http://review.omapzoom.org/p/kernel/omap refs/changes/17/13617/1 && git cherry-pick FETCH_HEAD

3 PANDA-AIC OMAP4 EVM Android Build


This section explains the build procedure of the custom omp4evm kernel and Android file system.

3.1 Android Kernel and File system Build


This section explains the steps to be followed for buildng the kernel where we have to add the sources released from Mistral to get the Linux Kernel which is compatible for the Android development. Please ensure that the codesourcery cross compiler or any other compatible toolchain is present and environment variables are set. 1. Extract the AIC326x_asoc_driver_sources.tar.gz file provided by the Mistral 2. Copy the contents of the Codec_driver Folder into the sound/soc/codecs folder of the Linux Kernel Tree. 3. Copy the contents of the Machine_driver folder into the sound/soc/omap folder of the Linux Kernel Tree. 4. Modify the makefile and kconfig files situated under the sound/soc/codecs folder of the Linux Kernel Tree.

5. Modify the makefile and the kconfig files situated under the sound/soc/omap folder of the Linux Kernel Tree. For building Android root files system execute the following commands below 6. cd $MYDROID 7. cp -Rfp device/ti/pandaboard/buildspec.mk.default buildspec.mk 8. make clean #(required for rebuild only) 9. make TARGET_PRODUCT=pandaboard -j4
July 2011 TLV320AIC326x Android Integration for OMAP4430 7

TLV320AIC326x Android Datasheet


July 2011

This will build the Android file system For Building Linux image execute the following command given below 10. cd kernel 11. set appropriate path of the tool chain 12.make panda_defconfig 13.make menuconfig . Enable the aic3262 codec related drivers. 14. make uImage

4 Manual Configuration of SD/MMC Card


This section provides a step-by-step approach to formatting and programming an MMC/SD card with Android for the custom OMAP4EVM. It requires the individual components that make up the software system on the custom OMAP4EVM (Boot loaders, Linux kernel, Media Files and Android Root FS) The steps mentioned here need to be followed only if the user chooses to program Android to the MMC/SD card using individual software components. You can use any of your available partition managers with or without GUI to create the necessary partitions. The end result should be one SD/eMMC card with following partitions. 1. Boot partition: Type: FAT32 Label: boot or BOOT Flags: boot,lba 2. File system Partition: Type: EXT3 Label: rootfs Flags: none To simply program Android on the MMC/SD card for use on the OMAP4EVM, use the pre-built binaries provided.
July 2011 TLV320AIC326x Android Integration for OMAP4430 8

TLV320AIC326x Android Datasheet


July 2011

4.1 Format and Partition the MMC/SD Card


You would need a Host PC running Linux (Ubuntu 10.04) in order to successfully format the MMC/SD card for programming Android. Connect the card reader to the Host system running Linux (Ubuntu 10.04). Check if the device has automatically been mounted by the system. Unmount the partition if it is already mounted. It can be seen that the device has been detected as /dev/sdc1 and /dev/sdc2 Create the partitions by using the fdisk command. In the following steps, [ ] indicates that a user input is required. Check the existing partition layout. The output seen by the user need not be exactly as shown below since it depends on the current partition layout of the MMC/SD card.
July 2011 TLV320AIC326x Android Integration for OMAP4430 9

[root@host]# dmesg /dev/sda1 on /media/ACER type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096) ... /dev/sdc1 on /media/disk-3 type ext3 (rw,nosuid,nodev,uhelper=hal) /dev/sdc2 on /media/disk-4 type vfat (rw,nosuid,nodev,uhelper=hal,shortname=lower,uid=500) [root@host]# [root@host]# umount /media/disk-3 [root@host]# umount /media/disk-4 TLV320AIC326x Android Datasheet
July 2011

Remove all existing partitions. The user would have to run a delete command for each partition Create two new partitions Set the first partition size set to 128MB, filesytem as FAT32 and enable it as an active partition
July 2011 TLV320AIC326x Android Integration for OMAP4430 10

[root@host]# fdisk /dev/sdc Command (m for help):[p] Disk /dev/sdc: 2021 MB, 2021654528 bytes 255 heads, 63 sectors/track, 245 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdc1 130 1016 1732311 c W95 FAT32 (LBA)

Command (m for help):


Command (m for help): [d] Selected partition 1 Command (m for help): TLV320AIC326x Android Datasheet
July 2011

Verify the two partitions created on the MMC/SD card. The output must resemble the following
July 2011 TLV320AIC326x Android Integration for OMAP4430 11

Command (m for help): [n] Command action e extended p primary partition (1-4) [p] Partition number (1-4): [1] First cylinder (1-247, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-247, default 247): [+128M] Command (m for help): [t] Selected partition 1 Hex code (type L to list codes): [c] Changed system type of partition 1 to c (W95 FAT32 (LBA)) Command (m for help): [a] Partition number (1-4): [1] Command (m for help): [n] Command action e extended

p primary partition (1-4) [p] Partition number (1-4): [2] First cylinder (18-247, default 18): Using default value 18 Last cylinder or +size or +sizeM or +sizeK (18-247, default 247): [] Using default value 247

Command (m for help):


TLV320AIC326x Android Datasheet
July 2011

Write the changes with new partition layout information to the MMC/SD card Create FAT32 and EXT3 file systems on the respective partitions
July 2011 TLV320AIC326x Android Integration for OMAP4430 12

Command (m for help): [p] Disk /dev/sdb: 2032 MB, 2032664576 bytes 255 heads, 63 sectors/track, 247 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x009cd1b0 Device Boot Start End Blocks Id System /dev/sdc1 * 1 17 136521 c W95 FAT32 (LBA) /dev/sdc2 18 247 1847475 83 Linux Command (m for help): Command (m for help): [w] The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. Syncing disks. [root@host] # [root@host] # mkfs.vfat F 32 n boot /dev/sdc1 [root@host] # mkfs.ext3 filesystem /dev/sdc2 TLV320AIC326x Android Datasheet
July 2011

4.2 Installing Android Rootfs


Connect the USB Card reader to the Host System running Linux. Insert the MMC/SD card partitioned and formatted for Android into the card reader. The Linux system should detect the two partitions and mount them. This can be verified with the mount command. If the partitioning is proper, the two partitions should auto mount and open in two separate windows under your GUI. You are advised not to use the GUI as the ext3 partition will need root access while programming. Stick to the command line. Program the Android File System to the EXT3 partition of the MMC/SD card. Do cd to your git root directory, from there execute the following commands. The following command will copy the x-loader image into your eMMC-card. $ sudo cp /mydroid/x-loader/MLO /media/boot The following command will copy the u-boot.bin into the boot partition of your eMMC card. $sudo cp /mydroid/u-boot/u-boot.bin /media/boot The following command will copy the kernel image into the boot partition of the eMMC card. $sudo cp kernel-2.6.35/arch/arm/boot/uImage /media/boot

The following command will copy the Android file system into the file system partition of the eMMC card. In /L27.12.1-P2 create a folder named myfs $sudo mkdir myfs cp -ax $MYDROID/device/ti/proprietary-open/graphics/omap4/* $MYDROID/out/target/product/pandaboard/ $sudo cp R /out/target/product/pandaboard/root/* $sudo cp R /out/target/product/pandaboard/system .
July 2011 TLV320AIC326x Android Integration for OMAP4430 13

[user@host ~]$ mount /dev/root on / type ext3 (rw) proc on /proc type proc (rw) ... /dev/sdc2 on /media/disk-3 type vfat (rw,nosuid,nodev,uhelper=hal,shortname=lower,uid=500) /dev/sdc1 on /media/disk-4 type ext3 (rw,nosuid,nodev,uhelper=hal) [user@host ~]$ TLV320AIC326x Android Datasheet
July 2011

$sudo cp R /out/target/product/pandaboard/data. $sudo cp -R myfs/* /media/rootfs Similarly copy the required media files into the eMMC card. Note: For SD card replace the string adb push with cp in all commands and execute the same
July 2011 TLV320AIC326x Android Integration for OMAP4430 14

TLV320AIC326x Android Datasheet


July 2011

5 Android on PANDA-AIC OMAP4 EVM


On successful programming of the MMC/SD card, the card now has Android installed on it and the capability to boot custom OMAP4EVM. Insert the MMC/SD card to the custom OMAP4EVM and power on the board and issue the following commands on boot loader command prompt 1. Set the bootargs setenv bootargs 'console=ttyO2,115200n8 mem=456M@0x80000000 mem=512M@0xA0000000 root=/dev/mmcblk0p2 rw rootdelay=2 init=/init vram="32M" omapfb.vram=0:16M,1:16M consoleblank=0' 2. To boot the image from the MMC/SDCARD, issue following command setenv bootcmd 'mmcinit 0;fatload mmc 0 0x80000000 uImage; bootm 0x80000000' 3. run boot Android should come up and the user should see the startup screen of Android.

5.1 Using the Demo Contents

When Android comes up on the PANDA-AIC OMAP4 EVM, it presents the user with the default opening screen as shown below. Figure 1: Main Android Gingerbread Screen
July 2011 TLV320AIC326x Android Integration for PANDA-AIC OMAP4430 15

TLV320AIC326x Android Datasheet


July 2011

Drag up the lock icon to unlock the screen. On successful unlocking, the Android desktop should be visible. Figure 2: Android Screen after the user unlocks the device
July 2011 TLV320AIC326x Android Integration for PANDA-AIC OMAP4430 16

TLV320AIC326x Android Datasheet


July 2011

Bring up the Applications Screen by clicking on the square shaped icon seen at the

middle of the tab. Figure 3: Android Application Screen


July 2011 TLV320AIC326x Android Integration for PANDA-AIC OMAP4430 17

TLV320AIC326x Android Datasheet


July 2011

5.2 Music Player


Initiate the Music Player by clicking on the Music icon on the Application icons. On successful launch, the user will be presented with the default screen of the Music Player. Figure 4: MUSIC Application in Android
July 2011 TLV320AIC326x Android Integration for PANDA-AIC OMAP4430 18

TLV320AIC326x Android Datasheet


July 2011

Click on Songs to bring up a list of Songs on the custom PANDA-AIC OMAP4 EVM Figure 5: Songs being enumerated by MUSIC Application Selecting any of the tracks displayed will initiate a playback of the selected Audio file. During Playback, the user may adjust the volume using the Volume Up or Volume Down keys. Figure 6: Music being played from Android
July 2011 TLV320AIC326x Android Integration for PANDA-AIC OMAP4430 19

TLV320AIC326x Android Datasheet


July 2011

5.3 Sound Recorder


Initiate the Sound recorder by clicking on the Sound Recorder icon on the Application icons. On successful launch, the user will be presented with the default screen of the Sound recorder. Figure 7: Sound Recorder Application in Android Before executing the Start/Record button on the Sound Recorder Application, Ensure that the MIC-Input has been enabled from the Audio Driver (This is enabled by default). It is required to provide an Audio Input source and then start the Record button. Once the Recording starts, the Time-stamp keeps increasing to denote that recording is in progress and when the user is done with the Audio Recording, the Stop button can be pressed. After the stop button is pressed, it is possible to play-out the recorded file.
July 2011 TLV320AIC326x Android Integration for PANDA-AIC OMAP4430 20

You might also like