NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

TI-Android-ICS-PortingGuide

From Texas Instruments Wiki
Jump to: navigation, search
Construction Icon small.png This page is currently under construction. The content of this page is due to change quite frequently and thus the quality and accuracy are not guaranteed until this message has been removed. Please feel free to contribute to this page while construction is in progress.

TIBanner.png


Contents

About this manual[edit]

The goal of Porting Guide is to provide valuable information and instructions to people who want to run Android OS on their (new) HW. Information covered here will mainly be useful to port Android ICS DevKit Sitara-based devices.

The information here is currently relevant to TI Android ICS 4.0.3 DevKit 3.0.0 for AM37x and TI Android ICS 4.0.3 DevKit 3.0.1 for AM335x.

NoteNote: Detailed porting information in the different technical areas is dependent on the respective h/w architecture.

WLAN[edit]

Introduction[edit]

This section of guide provides a step by step explanation of what's involved in adding a new WiFi driver and making WiFi work in a custom Android build like Rowboat.

Features Overview[edit]

  • WLAN (802.11 b/g/n)
  • Core IP pre-tested against WiFi specifications.
  • Station mode is fully supported.
  • Initial support for SoftAP/WiFi hotspot and WiFi Direct is available


Android WLAN Sub-System Overview[edit]

WLAN Stack.jpg

Diagram explains WLAN event flow from application to h/w with respect to rowboat android source tree.

Application[edit]

  • Settings/Connection Manager:<android-src>/packages/apps/Settings/src/com/android/settings/WirelessSettings.java

Application Framework[edit]

  • WiFi manager:<android-src>/frameworks/base/wifi/java/android/net/wifi
  • JNI Implementation:<android-src>/frameworks/base/core/jni/android_net_wifi_Wifi.cpp

Libraries[edit]

  • libhardware_legacy:<android-src>/hardware/libhardware_legacy/wifi/wifi.c
  • wpa_supplicant (Daemon):<android-src>/external/hostap/wpa_supplicant
  • Higher level network management is done in <android-src>/frameworks/base/core/java/android/net.

Driver Configuration[edit]

In this Devkit release we are using WL12XX Compat wireless SDK. The drivers and firmwares of WL12XX Compat release are at hardware/ti/wlan

To enable WLAN support in kernel the following settings need to be enabled:

  • First enable Wireless LAN device driver as shown below:
   Device Drivers  --->
       [*] Network device support  --->
           [*]   Wireless LAN --->
  • Enable WLAN Networking support as shown below:
   [*] Networking support  --->
       -*-   Wireless  --->
           [*]   Wireless extensions sysfs files

This enables the following CONFIG options in kernel and allows WL12xx compat wlan drivers to be built:

   CONFIG_WLAN=y
   CONFIG_WIRELESS_EXT=y
   CONFIG_WEXT_CORE=y
   CONFIG_WEXT_PROC=y
   CONFIG_WEXT_PRIV=y
  • The following additional options need to be enabled in kernel for WLAN to operate
  CONFIG_KEYS=y
  CONFIG_SECURITY=y
  CONFIG_CRYPTO=y
  CONFIG_CRYPTO_ARC4=y
  CONFIG_CRYPTO_ECB=y
  CONFIG_CRYPTO_AES=y
  CONFIG_CRYPTO_MICHAEL_MIC=y
  CONFIG_CRC7=y
  • The relevant initialization and pin-muxing for MMC bus is done in the relevant board file e.g for AM335xevm arch/arm/mach-omap2/board-am335xevm.c. Do take care of this initialization and pin-muxing if using any other MMC bus e.g. MMC3.

The following code snippet shows the board-specific WLAN configuration done on AM335xevm. The code below is provided for information only and is not complete. Please refer to the source for more details.

File: arch/arm/mach-omap2/board-am335xevm.c arch/arm/mach-omap2/board-am335xevm.c
struct wl12xx_platform_data am335xevm_wlan_data = {
        .irq = OMAP_GPIO_IRQ(AM335XEVM_WLAN_IRQ_GPIO),
        .board_ref_clock = WL12XX_REFCLOCK_38_XTAL, /* 38.4Mhz */
        .bt_enable_gpio = GPIO_TO_PIN(3, 21),
        .wlan_enable_gpio = GPIO_TO_PIN(1, 16),
};

/* Module pin mux for wlan and bluetooth */
static struct pinmux_config mmc2_wl12xx_pin_mux[] = {
        {"gpmc_a1.mmc2_dat0", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
        {"gpmc_a2.mmc2_dat1", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
        {"gpmc_a3.mmc2_dat2", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
        {"gpmc_ben1.mmc2_dat3", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
        {"gpmc_csn3.mmc2_cmd", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
        {"gpmc_clk.mmc2_clk", OMAP_MUX_MODE3 | AM33XX_PIN_INPUT_PULLUP},
        {NULL, 0},
};
...
static int wl12xx_set_power(struct device *dev, int slot, int on, int vdd)
{
        if (on) {
                gpio_direction_output(am335xevm_wlan_data.wlan_enable_gpio, 1);
                mdelay(70);
        } else {
                gpio_direction_output(am335xevm_wlan_data.wlan_enable_gpio, 0);
        }

        return 0;
}

static void wl12xx_init(int evm_id, int profile)
{
...
        if (wl12xx_set_platform_data(&am335xevm_wlan_data))
                pr_err("error setting wl12xx data\n");

        dev = am335x_mmc[1].dev;
        if (!dev) {
                pr_err("wl12xx mmc device initialization failed\n");
                goto out;
        }
...
        ret = gpio_request_one(am335xevm_wlan_data.wlan_enable_gpio,
                GPIOF_OUT_INIT_LOW, "wlan_en");
...
        setup_pin_mux(wl12xx_pin_mux);

        pdata->slots[0].set_power = wl12xx_set_power;
out:
        return;
}


See also: Wl127x WiLink6 Portal

Android WiFi HAL Configuration[edit]

  • Enable building of wpa_supplicant 0.8.x in your BoardConfig.mk (e.g. device/ti/am335xevm/BoardConfig.mk for AM335xevm and device/ti/omap3evm/BoardConfig.mk for AM37xevm)

This is by simply adding following options in BoardConfig.mk:

   BOARD_WPA_SUPPLICANT_DRIVER      := NL80211
   WPA_SUPPLICANT_VERSION           := VER_0_8_X
   BOARD_WLAN_DEVICE                := wl12xx_mac80211
   BOARD_SOFTAP_DEVICE              := wl12xx_mac80211
   BOARD_WPA_SUPPLICANT_PRIVATE_LIB := lib_driver_cmd_wl12xx
   WIFI_DRIVER_MODULE_PATH          := "/system/lib/modules/wl12xx_sdio.ko"
   WIFI_DRIVER_MODULE_NAME          := "wl12xx_sdio"

This will set WPA_BUILD_SUPPLICANT to true in external/wpa_supplicant_8/Android.mk enabling building of wpa_supplicant 0.8.x with NL80211. At run time wl12xx_sdio will get loaded from WIFI_DRIVER_MODULE_PATH.

BOARD_SOFTAP_DEVICE := wl12xx_mac80211 needs to be set only if SoftAP/hotspot feature is required.

  • Next we need to provide a proper wpa_supplicant.conf for our device. That we will keep in /data/misc/wifi.
  • Set the correct permissions and paths created from init.rc
   # give system access to wpa_supplicant.conf for backup and restore
   mkdir /system/etc/wifi 0770 system wifi
   chmod 0770 /system/etc/wifi
   chmod 0660 /system/etc/wifi/wpa_supplicant.conf
   chown system wifi /system/etc/wifi/wpa_supplicant.conf
   mkdir /data/misc/wifi 0770 system wifi
   mkdir /data/misc/wifi/sockets 0770 system wifi
   chmod 0770 /data/misc/wifi
   chmod 0660 /data/misc/wifi/wpa_supplicant.conf
   chown wifi wifi /data/misc/wifi
   chown wifi wifi /data/misc/wifi/wpa_supplicant.conf

Important We use System user(uid: 1000) to initiate wpa_supplicant service that way are able to enable WiFi over Android NFS rootfs. Here is the detailed discussion on that WiFi does not work when booting from an NFS file system

  • Set the wifi interface name in device.mk
  PRODUCT_PROPERTY_OVERRIDES := \
       wifi.interface=wlan0
  • Start wpa_supplicant and dhcpcd from init.rc.
   # wpa_supplicant and dhcp daemon
   service wpa_supplicant /system/bin/wpa_supplicant -Dnl80211 -iwlan0
       class main
       socket wpa_wlan0 dgram 660 wifi wifi
       disabled
       oneshot
   service dhcpcd_wlan0 /system/bin/dhcpcd -ABKL
       class main
       disabled
       oneshot
   service iprenew_wlan0 /system/bin/dhcpcd -n
       class main
       disabled
       oneshot

The following entries are required to configure SoftAP/hotspot and WiFi Direct functions:

  • Register hostap service for SoftAP/hotspot:
   service hostapd_bin /system/bin/hostapd -d /data/misc/wifi/hostapd.conf
       socket wpa_wlan1 dgram 660 wifi wifi
       disabled
       oneshot
  • Register dhcp hooks for WiFi Direct:
   service dhcpcd_p2p /system/bin/dhcpcd -aABKL
       disabled
       oneshot
   service iprenew_p2p /system/bin/dhcpcd -n
       disabled
       oneshot

Overlay changes[edit]

The following entries enable Wi-Fi for use by android network manager.

Add the following entries in device/ti/<boardname>/overlay/frameworks/base/core/res/res/values/config.xml

<string-array translatable="false" name="networkAttributes">
...
        <item>"wifi,1,1,1,-1,true"</item>
        <item>"wifi_p2p,13,1,0,-1,true"</item>
...
    </string-array>

<string-array translatable="false" name="radioAttributes">
        <item>"1,1"</item>
...
    </string-array>

Add the required permissions file into the android filesystem by updating device.mk. This also enables the Wi-Fi and Wi-Fi Direct options in the Settings App.

PRODUCT_COPY_FILES := \
...
    frameworks/base/data/etc/android.hardware.wifi.xml:system/etc/permissions/android.hardware.wifi.xml \
    frameworks/base/data/etc/android.hardware.wifi.direct.xml:system/etc/permissions/android.hardware.wifi.direct.xml


The following commits in device/ti/omap3evm enable WiFi, SoftAP and WiFi Direct support on AM37xevm. Ensure that similar additions are done to support WiFi on your platform.

Verify WLAN from console[edit]

The following steps perform basic checks to see if WiFi driver is operational:

# lsmod
wl12xx 142062 0 - Live 0xbf08d000 (O)
mac80211 248275 1 wl12xx, Live 0xbf03c000 (O)
cfg80211 161123 2 wl12xx,mac80211, Live 0xbf004000 (O)
compat 1706 0 - Live 0xbf000000 (O)


# insmod /system/lib/modules/wl12xx_sdio.ko
[  154.549804] wl1271: loaded

If you do not see the message wl1271: loaded after inserting wl12xx_sdio.ko kernel module, the wifi driver initialization may not be correct. Please ensure that all the relevant pinmuxing and gpio configuration is correct and not over-written.

Next, check that the driver is not unloaded after initialization:

# netcfg
lo       UP                                   127.0.0.1/8   0x00000049 00:00:00:00:00:00
sit0     DOWN                                   0.0.0.0/0   0x00000080 00:00:00:00:00:00
eth0     UP                               172.24.190.76/22  0x00001043 40:5f:c2:76:4c:99
wlan0    DOWN                                   0.0.0.0/0   0x00001002 00:12:34:56:78:90

If wlan0 is not available in netcfg output, the driver might have been unloaded due to some error.

Now, we try to up the wlan0 interface:

# netcfg wlan0 up
[ 8255.485626] wl1271: firmware booted (Rev 6.3.6.0.79_2)
[ 8255.491027] wl1271: Driver version: R4_SP2_03_00
[ 8255.515350] ADDRCONF(NETDEV_UP): wlan0: link is not ready

The above messages show that the interface is up and the firmware is downloaded to wlan module and booted.

Ensure that wlan drivers are unloaded before trying the Android UI for wireless settings

# netcfg wlan0 down
# rmmod wl12xx_sdio

If wlan0 is not available in netcfg output, the driver might have been unloaded due to some error.

TBD

WLAN calibration[edit]

  • Copy the ini files used for calibration to the sdcard
  sudo cp -rv rowboat/hardware/ti/wlan/mac80211/ti-utils/ini_files /media/rootfs/system/etc/wifi
  • Boot the board. Make sure WLAN is disabled. wl12xx_sdio.ko should NOT be loaded
root@android:/ # lsmod
omaplfb 10662 0 - Live 0xbf0ed000 (O)
pvrsrvkm 159205 49 omaplfb, Live 0xbf0bc000 (O)
wl12xx 142062 0 - Live 0xbf08e000 (O)
mac80211 251034 1 wl12xx, Live 0xbf03c000 (O)
cfg80211 161115 2 wl12xx,mac80211, Live 0xbf004000 (O)
compat 1706 0 - Live 0xbf000000 (O)
  • Remove existing calibration file
  rm /system/etc/firmware/ti-connectivity/wl1271-nvs.bin
  • Run the calibrator tool
  calibrator plt autocalibrate wlan0 /system/lib/modules/wl12xx_sdio.ko /system/etc/wifi/ini_files/127x/TQS_S_2.6.ini /system/etc/firmware/ti-connectivity/wl1271-nvs.bin

NOTE: Running the calibration results in a random MAC address being set. To set the desired MAC address, run the following step:

  calibrator set nvs_mac /system/etc/firmware/ti-connectivity/wl1271-nvs.bin <MAC Address>

You can verify the MAC address using the following command:

  calibrator get nvs_mac /system/etc/firmware/ti-connectivity/wl1271-nvs.bin

Bluetooth[edit]

Introduction[edit]

This section describes how to enable Bluetooth support on Android for wl1271 chipset.

Features Overview[edit]

  • Bluetooth 2.1
  • OPP, A2DP, AVRCP, HID profiles are supported.
  • HSP, HFP profiles are NOT supported


Android BT Sub-System Overview[edit]

BT Stack.jpg


Enable Bluetooth with the following setting in BoardConfig.mk (e.g. device/ti/am335xevm/BoardConfig.mk)

   # Bluetooth
   BOARD_HAVE_BLUETOOTH := true

This enables bluez external/bluez HAL layer, which is used to connect with Android Frameworks (frameworks/base/core/jni/android_bluetooth_*.cpp, frameworks/base/core/java/android/bluetooth/*.java and SystemServer via DBUS .

Driver Configuration[edit]

TI Android DevKit uses the TI Wilink7 Bluetooth driver along with the TI Shared-Transport driver (TI-ST) for managing the BT-UART.

  • WL12xx BT is interfaced to UART1 on AM37xevm and AM335xevm. UART1 initialization and BT module registration with TI-ST is implemented at arch/arm/mach-omap2/board-am335xevm.c for AM37xevm and arch/arm/mach-omap2/board-am335xevm.c for AM335xevm.
  • Bluetooth support is enabled in the kernel as shown below:
   [*] Networking support  ---> 
       <*>   Bluetooth subsystem support  --->
           [*]   L2CAP protocol support
           <*>   RFCOMM protocol support
           <*>   RFCOMM protocol support
           <*>   BNEP protocol support
           [*]     Multicast filter support
           [*]     Protocol filter support 
           <*>   HIDP protocol support 
                 Bluetooth device drivers  --->
                   <*> HCI UART driver
                   [*]   UART (H4) protocol support 
                   [*]   HCILL protocol support
       <*>   RF switch subsystem support

This enables the following CONFIG options:

CONFIG_BT=y
CONFIG_BT_L2CAP=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=y
CONFIG_BT_HCIUART=y
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_LL=y
CONFIG_RFKILL=y
  • The following CONFIG options enable TI-ST and WiLink Bluetooth driver support:
CONFIG_BT_WILINK=y
CONFIG_TI_ST=y
  • The following kernel configs are required for Bluetooth AVRCP support:
CONFIG_INPUT_MISC=y
CONFIG_INPUT_UINPUT=y

You can check this as follows:

   Device Drivers  --->
       Input device support  --->
           [*]   Miscellaneous devices  --->
                   <*>   User level driver support


The following code-snippet shows board-level configuration for TI-ST on AM335xevm:

File: arch/arm/mach-omap2/board-am335xevm.c
struct ti_st_plat_data wilink_pdata = {
	.nshutdown_gpio = GPIO_TO_PIN(3, 21),
	.dev_name = "/dev/ttyO1",
	.flow_cntrl = 1,
	.baud_rate = 3000000,
	.suspend = plat_kim_suspend,
	.resume = plat_kim_resume,
	.chip_enable = plat_kim_chip_enable,
	.chip_disable = plat_kim_chip_disable,
};

static struct platform_device wl12xx_device = {
	.name		= "kim",
	.id		= -1,
	.dev.platform_data = &wilink_pdata,
};

static struct platform_device btwilink_device = {
	.name = "btwilink",
	.id = -1,
};

static inline void __init am335xevm_init_btwilink(void)
{
	pr_info("am335xevm: bt init\n");

	platform_device_register(&wl12xx_device);
	platform_device_register(&btwilink_device);
}


Android BT HAL Configuration[edit]

  • Set the correct permissions and paths created from init.rc
   #Owners, Modes for Bluetooth
   chmod 0660 /dev/ttyO1
   chown bluetooth bluetooth /dev/ttyO1
   chmod 0660 /sys/class/rfkill/rfkill0/state
   chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
  • The following services are registered in init.rc for Bluetooth operation:
  • dbus-daemon: (deal connections between hcid and system server)
   service dbus /system/bin/dbus-daemon --system --nofork
   class main
   socket dbus stream 660 bluetooth bluetooth
   user bluetooth
   group bluetooth net_bt_admin
  • bluetoothd: create hcid (Bluetooth Host Controller Interface Daemon) service, but disabled at first
   service bluetoothd /system/bin/bluetoothd -n
   class main
   socket bluetooth stream 660 bluetooth bluetooth
   socket dbus_bluetooth stream 660 bluetooth bluetooth
   # init.rc does not yet support applying capabilities, so run as root and
   # let bluetoothd drop uid to bluetooth with the right linux capabilities
   group bluetooth net_bt_admin misc
   disabled
  • uim-sysfs: userspace module for TI-ST kernel driver. This service attaches the BT UART HCI interface to the bluetooth stack at 3000000 baud rate. It is also responsible for loading the BT firmware on WL1271. The sources for uim-sysfs is found in hadware/ti/wpan
   #shared transport user space mgr service for Bluetooth, FM and GPS
   service uim /system/bin/uim-sysfs
   class core
   user bluetooth
   group bluetooth net_bt_admin

Overlay changes[edit]

Add bluetooth entry in the overlay to indicate bluetooth availability to network manager

<string-array translatable="false" name="networkAttributes">
...
    <item>"bluetooth,7,7,0,-1,true"</item>
...
</string-array>

<string-array translatable="false" name="radioAttributes">
...
    <item>"7,1"</item>
...

Copy the Bluetooth permissions file and the relevant bluez conf file. The permissions file also enables Bluetooth menu in Settings

PRODUCT_COPY_FILES += \
    device/ti/omap3evm/android.hardware.bluetooth.xml:system/etc/permissions/android.hardware.bluetooth.xml \
    system/bluetooth/data/main.nonsmartphone.conf:system/etc/bluetooth/main.conf

Audio[edit]

Introduction[edit]

AM37xevm uses the audio module of TPS65950 while AM335xevm uses AIC31 audio codec module for analog audio input and output.

The audio module is interfaced to the main processor through the TDM / I2S interface and used to transmit and receive audio data. The audio codec is connected via Multi-Channel Buffered Serial Port (McBSP) interface on AM37xevm and Multi-Channel Audio Serial Port (McASP) interface on AM335x, to the main processor.

The Audio module is controlled by internal registers that can be accessed by the high speed I2C control interface.

This user manual section defines and describes the user level and platform level interfaces of the ALSA SoC Audio driver.

Features Overview[edit]

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.


Important

Please note that enabling any line-in inputs necessitates connecting an audio playback source's output; connecting a (non-preamplified) microphone input (like the one from a head-set jack) might not work.

Android Audio Sub-System Overview[edit]

TBD

Driver Configuration[edit]

Android Audio HAL Configuration[edit]

Android uses the kernel ALSA framework for audio input/output.

The tinyalsa utilities present at external/tinyalsa are used for audio playback, capture and configuration. These can be used to test the audio functionality and configuration at kernel-level.

The ALSA HAL is present at hardware/ti/omap3/audio/audio_hw.c. The compiled HAL is named audio.primary.<boardname>.so

NoteNote: Android handles volume control in software. We recommend to keep the default volume levels close to maximum in the ALSA HAL.

The following commits enable audio support for AM37xevm and AM335xevm:

  • AM37xevm: Enable audio support commit
  • AM335xevm: Enable audio support commit


Important
Please note that enabling any line-in inputs necessitates connecting an audio playback source's output ; connecting a (non-preamplified) microphone input (like the one from a head-set jack) might not work.


Display[edit]

Introduction[edit]

This section of the porting guide describes the display system with respect to TI Android ICS DevKit. AM37xevm, flashboard and AM335xevm use LCD interface for display while BeagleBoard uses DVI output.

Depending on the display size, android uses either the phone layout (e.g. AM37xevm, AM335xevm) or tablet layout (Beagleboard).

Features Overview[edit]

  • Supports LCD display interface on AM37xevm, Flashboard, AM335xevm and BeagleBone with LCD cape
  • Supports DVI output on Beagleboard, AM37xevm, Flashboard and BeagleBone with DVI-D cape

Android Display Subsystem Overview[edit]

TBD

Driver Configuration[edit]

Display backlight[edit]

Introduction[edit]

This section explains how the LCD backlight control is implemented in the DevKit. For variable backlight intensity, PWM-controlled backlight is generally used.

Driver Configuration[edit]

TBD

Android Configuration[edit]

For integration with the Android Backlight settings configuration, the liblights HAL needs to be implemented for the board. The output HAL library should have the name lights.<TARGET_PRODUCT>.so. E.g. for AM335x EVM, the liblights HAL is called lights.am335xevm.so.

The liblights backlight HAL for AM335x EVM is implemented at device/ti/am335xevm/liblights.

MMC[edit]

Introduction[edit]

The MMC/SD card is used as the primary boot device and storage device on TI Android DevKit. This section gives details on configuring the MMC interface and supporting MMC/SD storage card.


Features Overview[edit]

The MMC/SD/SDIO driver supports following features

  • The driver is built in-kernel (part of vmlinux).
  • MMC cards including High Speed cards.
  • SD cards including SD High Speed and SDHC cards
  • Uses block bounce buffer to aggregate scattered blocks


Driver Configuration[edit]

Android MMC HAL or Vold Configuration[edit]

Android system uses vold as the mount daemon, which detects, mounts and monitors the status of sdcard. The mount daemon needs a configuration file to tell it what the sdcard device is. Since Android 2.2 (froyo), it ships with a new implementation of vold (aka vold2). The configuration is changed to /etc/vold.fstab and its format is also changed. See system/core/rootdir/etc/vold.fstab in the Android source tree for the detailed explanations of the format.

However, a fixed vold.fstab can only support block device with fixed name.

# cat /etc/vold.fstab
dev_mount sdcard /mnt/sdcard 3 /devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0
dev_mount usb /mnt/usb2 auto /devices/platform/omap/ti81xx-usbss/musb-hdrc.1/usb2

Depending on the interface used these values can change. Best way is to probe sysfs directories to find the fixed name. For MMC the entry will be of the form:

 /sys/devices/platform/omap/omap_hsmmc.X/mmc_host/mmcY


Update the android storage list overlay at overlay/frameworks/base/core/res/res/xml/storage_list.xml

<StorageList xmlns:android="http://schemas.android.com/apk/res/android">
    <storage android:mountPoint="/mnt/sdcard"
             android:storageDescription="@string/storage_internal"
             android:primary="true"
             android:emulated="true"
             android:mtpReserve="100"
             android:allowMassStorage="true" />
</StorageList>

Touchscreen[edit]

Introduction[edit]

The touchscreen is the primary input device for TI Android DevKit on AM37xevm, Flashboard and AM335xevm.

Features Overview[edit]

The features supported by Touchscreen in Android are:

  • Single touch input
  • Single click
  • Single long click
  • Uni-direction motion touch

Driver Configuration[edit]

Add touchscreen driver support[edit]

Test touch driver using getevent[edit]

  • Once ADC Touchscreen driver is up through board file (e.g. board-am335xevm.c) configuration.
  • Test with AndroidFS as events are coming while touching the LCD display. Run on command prompt:
    # getevent
    add device 1: /dev/input/event1
      name:     "ti-tsc-adcc"

    /dev/input/event1: 0003 0000 00000659
    /dev/input/event1: 0003 0001 00000a31
    /dev/input/event1: 0001 014a 00000001
    /dev/input/event1: 0000 0000 00000000
    /dev/input/event1: 0003 0000 00000654
    /dev/input/event1: 0000 0000 00000000
    
  • It confirms that touch inputs and irq based event generation is working fine.

Touch Calibration[edit]

  • Touch inputs (x, y, pressure) need to calibrate based on touch controller used.
  • To define the touch input boundaries, the following macros are used in driver (e.g. drivers/input/touchscreen/ti_tscadc.c)
    • AM335X_XMIN -- Minimum raw x input possible
    • AM335X_XMAX -- Maximum raw x input possible
    • AM335X_YMIN -- Minimux raw y input possible
    • AM335X_YMAX -- Maximum raw y input possible
  • add the log to get print of x, y and pressure values as raw and absolute both in function tscadc_interrupt():
    /* Calibrate absolute value of x and y co-ordinate */
    val_x = ts_dev->x_max -
                ((ts_dev->x_max * (val_x - AM335X_TS_XMIN)) /
                    (AM335X_TS_XMAX - AM335X_TS_XMIN));
    val_y = ts_dev->y_max -
                ((ts_dev->y_max * (val_y - AM335X_TS_YMIN)) /
                    (AM335X_TS_YMAX - AM335X_TS_YMIN));
  • Get the debug log for x, y and pressure at following points on the touchscreen
    • Left Top Most Point
    • Right Top Most Point
    • Left Bottom Down Point
    • Right Bottom Down Point
  • Update the macros based on observation of above input points
    • set AM335X_XMIN value as "minimum x input possible value from the reading of left top most touch"
    • set AM335X_XMAX value as "maximum x input possible value from the reading of right top most touch"
    • set AM335X_YMIN value as "minimux y input possible value from the reading of left top most touch"
    • set AM335X_YMAX value as "maximum y input possible value from the reading of left bottom down touch"

Note: Above four macros need to be fine tune to get the correct absolute value of x and y.

  • For example in ads7846.c:
#ifdef CONFIG_MACH_AM335XEVM
#define AM335X_XMIN           0x0A5
#define AM335X_XMAX           0xFB0
#define AM335X_YMIN           0x0DC
#define AM335X_YMAX           0xF43
#endif

Note: sometimes calculation method return negative values. Then method needs some modification to get positive calculated touch inputs.

Test Touch Calibration in Android[edit]

  • Run android on the board.
  • select "Menu" -> "Dev Tools" -> "Pointer Location" utility
  • Touch and draw on the screen and observe that the expected points are getting marked on the LCD screen.
  • if drawing on LCD is not proper then driver needs to be fine tune the above mentioned macros.

Android Touchscreen configuration[edit]

TBD

See also :http://source.android.com/tech/input/touch-devices.html

Keypad[edit]

Introduction[edit]

The matrix gpio keypad and Volume gpio keys are in AM335x EVM. Here porting explanation for matrix gpio keypad controller.

Features Overview[edit]

  • 3x2 matrix key layout supported
  • single click input

Driver Configuration[edit]

Add keypad driver support

  • start the Linux Kernel Configuration tool:
    $ make ARCH=arm menuconfig
  • Select Device Drivers from the main menu.
    ...
    Power management options --->
    [*] Networking support --->
    '''Device Drivers --->'''
    File systems --->
    Kernel hacking --->
    ...
  • Select Input device support form the next menu:
    ...
    [ ] ISDN support  --->
    < > Telephony support  --->
    '''Input device support  --->'''
    Character devices  --->
    -*- I2C support  --->
    ...
  • Select Keyboards from the next menu:
    ...
    < >   Reset key
          *** Input Device Drivers ***
    '''[*]   Keyboards  --->'''
    [ ]   Mice  --->
    [ ]   Joysticks/Gamepads  --->
....
  • Select GPIO driven matrix keypad support and GPIO Buttons from the next menu:
    ....
 < >   DECstation/VAXstation LK201/LK401 keyboard
 <*>   GPIO Buttons
 < >   Polled GPIO buttons
 < >   TCA6416/TCA6408A Keypad Support
 <*>   GPIO driven matrix keypad support
 < >   Maxim MAX7359 Key Switch Controller
....

Board-specific Configuration The board-specific configuration includes, specifying the GPIOs, no. of rows and columns, debounce, scan settings etc. The following code snippet shows the configuration for AM335x EVM (arch/arm/mach-omap2/board-am335xevm.c).

static const uint32_t am335x_evm_matrix_keys[] = {
        KEY(0, 0, KEY_MENU),
        KEY(1, 0, KEY_BACK),
        KEY(2, 0, KEY_LEFT),

        KEY(0, 1, KEY_RIGHT),
        KEY(1, 1, KEY_ENTER),
        KEY(2, 1, KEY_DOWN),
};

const struct matrix_keymap_data am335x_evm_keymap_data = {
        .keymap      = am335x_evm_matrix_keys,
        .keymap_size = ARRAY_SIZE(am335x_evm_matrix_keys),
};

static const unsigned int am335x_evm_keypad_row_gpios[] = {
        GPIO_TO_PIN(1, 25), GPIO_TO_PIN(1, 26), GPIO_TO_PIN(1, 27)
};

static const unsigned int am335x_evm_keypad_col_gpios[] = {
        GPIO_TO_PIN(1, 21), GPIO_TO_PIN(1, 22)
};

static struct matrix_keypad_platform_data am335x_evm_keypad_platform_data = {
        .keymap_data       = &am335x_evm_keymap_data,
        .row_gpios         = am335x_evm_keypad_row_gpios,
        .num_row_gpios     = ARRAY_SIZE(am335x_evm_keypad_row_gpios),
        .col_gpios         = am335x_evm_keypad_col_gpios,
        .num_col_gpios     = ARRAY_SIZE(am335x_evm_keypad_col_gpios),
        .active_low        = false,
        .debounce_ms       = 5,
        .col_scan_delay_us = 2,
};

...

static struct gpio_keys_button am335x_evm_volume_gpio_buttons[] = {
        {
                .code                   = KEY_VOLUMEUP,
                .gpio                   = GPIO_TO_PIN(0, 2),
                .active_low             = true,
                .desc                   = "volume-up",
                .type                   = EV_KEY,
                .wakeup                 = 1,
        },
        {
                .code                   = KEY_VOLUMEDOWN,
                .gpio                   = GPIO_TO_PIN(0, 3),
                .active_low             = true,
                .desc                   = "volume-down",
                .type                   = EV_KEY,
                .wakeup                 = 1,
        },
};

static struct gpio_keys_platform_data am335x_evm_volume_gpio_key_info = {
        .buttons        = am335x_evm_volume_gpio_buttons,
        .nbuttons       = ARRAY_SIZE(am335x_evm_volume_gpio_buttons),
};

Test keypad driver using getevent

  • Once matrix gpio keypad and volume gpio keys driver is up through board file (e.g. board-am335xevm.c) configuration.
  • Test with AndroidFS as events are coming while pressing the keys. Run on command prompt:
    # getevent
    add device 1: /dev/input/event2
            name: "gpio-keys"
    add device 2: /dev/input/event0
            name: "matrix-keypad"

    /dev/input/event0: 0004 0004 00000002
    /dev/input/event0: 0001 009e 00000001
    /dev/input/event0: 0000 0000 00000000
    /dev/input/event0: 0004 0004 00000002
    /dev/input/event0: 0001 009e 00000000
    /dev/input/event0: 0000 0000 00000000
    
  • It confirms that keypad inputs and irq based event generation is working fine.

Android Keypad Configuration[edit]

  • Android requires Key layout files (.kl files) for mapping Linux key codes and axis codes to Android key codes and axis codes and specifying associated policy flags.
  • The <matrix keypad driver name>.kl (e.g. QWERTY_Keypad.kl) or <gpio keypad driver name>.kl (e.g. gpio-keys.kl) should be present in root directory of AndroidFS.
  • Syntax of a Key layout File (Refer to the link: http://source.android.com/tech/input/key-layout-files.html):
  • Key declarations each consist of the keyword "key" followed by a Linux key code number(In Decimal), an Android key code name, and optional set of whitespace delimited policy flags.
  • For example:
  The gpio-keys.kl for Beaglebone looks like:
  # Beaglebone LCD Cape  GPIO KEYPAD keylayout
  key 105   BACK               WAKE
  key 106   HOME               WAKE
  key 103   MENU               WAKE
  key 108   SEARCH             WAKE
  key 28    POWER              WAKE


NAND[edit]

Introduction[edit]

This section of porting guide will describe the NAND layout present on AM335x EVM and how to integrate Fastboot functionality in u-boot. Micron MT29F2G08ABA Nand part (AM335x EVM) is supported.

NAND Layout

The NAND on the EVM has been configured in the following manner.

 +------------+-->0x00000000-> SPL start
 |            |
 |            |-->0x0001FFFF-> SPL end  
 |            |-->0x00020000-> SPL.backup1 start
 |            |
 |            |-->0x0003FFFF-> SPL.backup1 end  
 |            |-->0x00040000-> SPL.backup2 start
 |            |
 |            |-->0x0005FFFF-> SPL.backup2 end  
 |            |-->0x00060000-> SPL.backup3 start
 |            |
 |            |-->0x0007FFFF-> SPL.backup3 end  
 |            |-->0x00080000-> U-Boot start
 |            |
 |            |-->0x0025FFFF-> U-Boot end  
 |            |-->0x00260000-> U-Boot ENV start
 |            |
 |            |
 |            |-->0x0027FFFF-> ENV end
 |            |-->0x00280000-> Linux Kernel start
 |            |
 |            |
 |            |
 |            |
 |            |-->0x0077FFFF-> Linux Kernel end
 |            |-->0x00780000-> Filesystem start
 |            |
 |            |
 |            |
 |            |
 |            |
 |            |
 |            |
 |            |
 +------------+-->0x10000000-> Filesystem end


Features Overview[edit]


Driver Configuration[edit]

  • Start the Kernel configuration tool to enable/disable NAND and UBIFS support:
$ make ARCH=arm menuconfig
  • Enable NAND support from the main menu. Select Device Drivers -> MTD support -> NAND support.
-> Device Drivers
   -> Memory Technology Device (MTD) support (MTD [=y])
      -> NAND Device Support (MTD_NAND [=y])     
  • Enable UBI support. Select Device Drivers -> MTD support -> Enable UBI.
-> Device Drivers
   -> Memory Technology Device (MTD) support (MTD [=y])
      -> Enable UBI - Unsorted block images (MTD_UBI [=y])
  • Enable UBIFS support. Select Filesystems -> Misc filesystems -> UBIFS support.
-> File systems
   -> Miscellaneous filesystems (MISC_FILESYSTEMS [=y])
      -> UBIFS file system support (UBIFS_FS [=y])


Fastboot[edit]

Fastboot flashing utility is for updating the different software components of Android. Here is a guide to re-flash the spl, u-boot, kernel and root-filesystem (UBIFS image). This guide assume that Rowboat has been compiled before trying out these instructions.

Establishing Fastboot connectivity[edit]

  • Connect serial port to host PC via null modem cable.
  • Serial port settings: 115200 8N1, No flow control.
  • Apply power to the board.
  • Press any key in serial port utility during boot and get U-boot command prompt.
  • Run "fastboot" on u-boot command prompt (u-boot will echo "fastboot initialized").
  • Connect USB cable between USB OTG port of the board and host PC.

Setup on Linux host

  • On command prompt, run
   $ export ANDROID_ROOT=<rowboat top level directory>
   $ cd $ANDROID_ROOT/out/host/linux-x86/bin
   $ sudo ./fastboot devices

if a device number is echoed, fastboot is working.

Setup on Windows host

   %SingleBootLoaderInterface% = USB_Install, USB\VID_0451
  • Proceed installing, with the difference that device to be selected is "Android Bootloader Interface" instead of "Android ADB Interface".

Supported Fastboot commands[edit]

   $ export ANDROID_ROOT=<rowboat_top_level_build_directory>
   $ cd $ANDROID_ROOT/out/host/linux-x86/bin
  • List connected devices
   $ sudo ./fastboot devices
  • Boot with new kernel image
   $ sudo ./fastboot boot <image_path>
  • Update images
   $ sudo ./fastboot flash <image_name> <image_path>

Note: Where "image_name" can be spl, uboot, kernel or filesystem.

  • Erasing images or partition.
   $ sudo ./fastboot erase <partition_name> (eg. spl)
NoteNote:
  • "partition_name" can be spl, uboot, environment, kernel or filesystem in case of AM335x.
  • "partition_name" can be xloader, uboot, environment, kernel or filesystem in case of AM37x.
  • Display fastboot variable
   $ sudo ./fastboot getvar <variable>
  • Exit fastboot mode in uboot
   $ sudo ./fastboot continue

Fastboot Porting guide[edit]

Fastboot implementation have a generic board independent function driver (cmd_fastboot.c), which will communicate with USB gadget driver, in the present case USB gadget stack is handled by MUSB driver. In the board dependent files, configurations like the available partition name, offset, size, method of nand write etc are defined.

In the Config file:

  • Enable CONFIG_FASTBOOT
  • Enable CONFIG_MUSB_UDC, disable CONFIG_MUSB_HCD (assumption: gadget driver used is MUSB)
  • Enable CONFIG_CMD_FASTBOOT
  • Define CONFIG_FASTBOOT_TRANSFER_BUFFER (location to which fastboot data has to be downloaded)
  • Define CONFIG_FASTBOOT_TRANSFER_BUFFER_SIZE (maximum fastboot data that can be downloaded, make sure it does not overlap bootloader memory)
  • Define FASTBOOT_NAND_BLOCK_SIZE
  • Define FASTBOOT_NAND_OOB_SIZE
  • Define FASTBOOT_PRODUCT_NAME, make sure that string is same as value of TARGET_PRODUCT used for compiling Android
  • Define USB_BCD_VERSION to 0x0200, if HS USB support is required

In the Board file:

  • Add header file - fastboot.h
  • Define "struct fastboot_ptentry" array with entries equal to the number of partitions required
  • Each entry to have name - this is the variable used for flashing, erasing.
  • Each entry to provide NAND start address & length
  • Each entry to specify flags, options as follows,
  • FASTBOOT_PTENTRY_FLAGS_WRITE_HW_ECC - flash the partition using HW ECC
  • FASTBOOT_PTENTRY_FLAGS_HW_ECC_LAYOUT_1 - Sets the NANDECC to use Kernel/FS layout for writing
  • FASTBOOT_PTENTRY_FLAGS_HW_ECC_LAYOUT_2 - Sets the NANDECC to use X-loader/U-boot layout for writing
  • FASTBOOT_PTENTRY_FLAGS_WRITE_SW_ECC - flash the partition using SW ECC
  • FASTBOOT_PTENTRY_FLAGS_WRITE_I - Use write.i for NAND write
  • FASTBOOT_PTENTRY_FLAGS_WRITE_JFFS2 - Use write.jffs2 for NAND write
  • FASTBOOT_PTENTRY_FLAGS_WRITE_ENV - Add this flag to indicate to fastboot driver the partition for storing environmental variable
  • FASTBOOT_PTENTRY_FLAGS_REPEAT_4 - Use this to indicate that partition will be written 4 times
  • Additional flags can be defined to write till 15 times, last 4 bits are reserved for repeat value, Define required value & OR the value in flag
  • Invoke fastboot API, ' fastboot_flash_add_ptn' for each partition so as to inform about the partition details to fastboot driver.

Notes

  • Existing USB gadget supported only FS, this was modified so that HS USB can be handled. Changes were done in USB header files, MUSB files.
  • AM335X was having problems due to the wrapper over MUSB IP. Fix in MUSB UDC; read TI EP interrupt register instead of MUSB register.
  • A fix with respect to the index for EP array has also been done.
  • MUSB EP setup has been modified to be more in line with the USB TRM.
  • Portions of the code that has been ported from OmapZoom is included within the macro FASTBOOT_PORT_OMAPZOOM_NAND_FLASHING.


USB Host and Gadget[edit]

Introduction[edit]

Android ICS supports both USB host and USB device ports. USB host can be used to connect Keyboard/Mouse, Mass storage device, modem dongles etc, while the USB device port is mainly used for adb.

Driver Configuration[edit]

TBD
-> Device Drivers
   -> USB support
      -> USB Gadget Support
         -> USB Gadget Drivers
            (X) Android Gadget

Android USB Configuration[edit]

Android USB Gadget Configuration[edit]

USB Gadget configuration for AM37x[edit]

The AM37x TI Android DevKit uses 2.6.37 kernel. Here the USB android gadget mode is configured as part of board initialization.

File: kernel/arch/arm/mach-omap2/board-omap3evm.c
#ifdef CONFIG_USB_ANDROID

#define GOOGLE_VENDOR_ID		0x18d1
#define GOOGLE_PRODUCT_ID		0x9018
#define GOOGLE_ADB_PRODUCT_ID		0x9015

static char *usb_functions_adb[] = {
	"adb",
};

static char *usb_functions_mass_storage[] = {
	"usb_mass_storage",
};
static char *usb_functions_ums_adb[] = {
	"usb_mass_storage",
	"adb",
};

static char *usb_functions_all[] = {
	"adb", "usb_mass_storage",
};

static struct android_usb_product usb_products[] = {
	{
		.product_id	= GOOGLE_PRODUCT_ID,
		.num_functions	= ARRAY_SIZE(usb_functions_adb),
		.functions	= usb_functions_adb,
	},
	{
		.product_id	= GOOGLE_PRODUCT_ID,
		.num_functions	= ARRAY_SIZE(usb_functions_mass_storage),
		.functions	= usb_functions_mass_storage,
	},
	{
		.product_id	= GOOGLE_PRODUCT_ID,
		.num_functions	= ARRAY_SIZE(usb_functions_ums_adb),
		.functions	= usb_functions_ums_adb,
	},
};

static struct usb_mass_storage_platform_data mass_storage_pdata = {
	.nluns		= 1,
	.vendor		= "rowboat",
	.product	= "rowboat gadget",
	.release	= 0x100,
};

static struct platform_device usb_mass_storage_device = {
	.name	= "usb_mass_storage",
	.id	= -1,
	.dev	= {
		.platform_data = &mass_storage_pdata,
	},
};

static struct android_usb_platform_data android_usb_pdata = {
	.vendor_id	= GOOGLE_VENDOR_ID,
	.product_id	= GOOGLE_PRODUCT_ID,
	.functions	= usb_functions_all,
	.num_products	= ARRAY_SIZE(usb_products),
	.products	= usb_products,
	.version	= 0x0100,
	.product_name	= "rowboat gadget",
	.manufacturer_name	= "rowboat",
	.serial_number	= "20100720",
	.num_functions	= ARRAY_SIZE(usb_functions_all),
};

static struct platform_device androidusb_device = {
	.name	= "android_usb",
	.id	= -1,
	.dev	= {
		.platform_data = &android_usb_pdata,
	},
};

static void omap3evm_android_gadget_init(void)
{
	platform_device_register(&androidusb_device);
}

#endif


USB Gadget configuration for AM335x[edit]

The Android gadget driver is configured via the sysfs entries. These are done from init.rc

# Used to disable USB when switching states
on property:sys.usb.config=none
    stop adbd
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/bDeviceClass 0
    setprop sys.usb.state $sys.usb.config

# adb only USB configuration
# This should only be used during device bringup
# and as a fallback if the USB manager fails to set a standard configuration
on property:sys.usb.config=adb
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/idVendor 18d1
    write /sys/class/android_usb/android0/idProduct D002
    write /sys/class/android_usb/android0/functions $sys.usb.config
    write /sys/class/android_usb/android0/enable 1
    start adbd
    setprop sys.usb.state $sys.usb.config

# USB accessory configuration
on property:sys.usb.config=accessory
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/idVendor 18d1
    write /sys/class/android_usb/android0/idProduct 2d00
    write /sys/class/android_usb/android0/functions $sys.usb.config
    write /sys/class/android_usb/android0/enable 1
    setprop sys.usb.state $sys.usb.config

# USB accessory configuration, with adb
on property:sys.usb.config=accessory,adb
    write /sys/class/android_usb/android0/enable 0
    write /sys/class/android_usb/android0/idVendor 18d1
    write /sys/class/android_usb/android0/idProduct 2d01
    write /sys/class/android_usb/android0/functions $sys.usb.config
    write /sys/class/android_usb/android0/enable 1
    start adbd
    setprop sys.usb.state $sys.usb.config

# Used to set USB configuration at boot and to switch the configuration
# when changing the default configuration
on property:persist.sys.usb.config=*
    setprop sys.usb.config $persist.sys.usb.config

The sysfs settings need to be done depending on the features required to be enabled. By default only the adb mode is configured.

USB Mass storage[edit]

The USB mass storage device class, otherwise known as USB MSC or UMS, is a protocol that allows file transfers between device and host to which it is connected. Mass storage is very good source of carrying media as well as other data files.

Introduction[edit]

The Android system uses vold as the mount daemon which detects, mounts and monitors the status of external storage.This mount daemon needs a configuration file(vold.fstab) to determine the mount device and location where it should be mounted.
Vold reads /etc/vold.fstab configuration file and mounts the device specified in the file. The basic format of the vold.fstab is

  dev_mount <label> <mount_point> <part> <sysfs_path1...> 
  
  where
  label - Label for the volume
  mount_point - Where the volume will be mounted
  part - Partition # (1 based), or 'auto' for first usable partition.
  <sysfs_path> - List of sysfs paths to source devices

sysfs_path is the full or partial path where kernel exports the udev information about the device currently pluged into system.
See system/core/rootdir/etc/vold.fstab in the Android source tree for the detailed explanations of the format.

Android Configuration for USB mass storage[edit]

In case of AM335xevm, Kernel populates udev entries for the following path for USB.

  /sys/devices/platform/omap/ti81xx-usbss/musb-hdrc.1/usb2

The following changes are done to detect connected usb mass storage device and mount/unmount it automatically when plugged/unplugged.

  • An entry is added in vold.fstab for USB storage
  dev_mount sdcard /mnt/sdcard 3 /devices/platform/omap/omap_hsmmc.0/mmc_host/mmc0
  dev_mount usb /mnt/usb2 auto /devices/platform/omap/ti81xx-usbss/musb-hdrc.1/usb2
  • init.rc is updated as follows
# create mountpoints
    mkdir /mnt 0775 root system
    mkdir /mnt/sdcard 0000 system system
    mkdir /mnt/usb2 0000 system system

... 
# Backwards Compat - XXX: Going away in G*
    symlink /mnt/sdcard /sdcard
    symlink /mnt/usb2 /usb2

    mkdir /system
    mkdir /data 0771 system system
  • Entry is added to the storage list: overlay/frameworks/base/core/res/res/xml/storage_list.xml
    <storage android:mountPoint="/mnt/usb2"
             android:storageDescription="@string/storage_usb"
             android:removable="true" />

Test mass storage in Android[edit]

Connect USB mass storage device to board and check whether it is mounted properly.

  • Use mount command to see the list of mount points. Here is the sample output of mount command.
  # mount
  rootfs / rootfs rw 0 0
  /dev/root / ext3 rw,relatime,errors=continue,barrier=1,data=writeback 0 0
  tmpfs /dev tmpfs rw,relatime,mode=755 0 0
  devpts /dev/pts devpts rw,relatime,mode=600 0 0
  proc /proc proc rw,relatime 0 0
  sysfs /sys sysfs rw,relatime 0 0
  tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
  /dev/block/mmcblk0p3 /part-3 vfat rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
  /dev/block/vold/179:3 /mnt/sdcard vfat rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
  /dev/block/vold/179:3 /mnt/secure/asec vfat rw,nosuid,nodev,noexec,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
  tmpfs /mnt/sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
  /dev/block/vold/8:1 /mnt/usb2 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
  /dev/block/vold/8:1 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
  tmpfs /mnt/usb2/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
  • Run OI File Manager application and see whether usb2 directory is populated with the contents of the USB mass storage device.

Browsing to usb2 directory using OI File Manager

USB Camera[edit]

This section discusses interfacing USB camera with android

Kernel configuration[edit]

Enable the following CONFIGs to add support for USB camera in kernel:

  CONFIG_USB_VIDEO_CLASS=y
  CONFIG_USB_VIDEO_CLASS_INPUT_EVDEV=y

This commit enables USB camera support in BeagleBoard

Android Configuration[edit]

Enable USB Camera support in BoardConfig.mk. Also disable stub camera

   BOARD_USB_CAMERA := true
   #USE_CAMERA_STUB := true

Add the following entries in device.mk

#Camera
PRODUCT_PACKAGES += \
        camera.omap3 \
        Camera

The Camera HAL is at hardware/ti/omap3/camera.

NOTE: By default it is assumed that the USB camera is registered as /dev/video0 ( source ). You may need to change this for your device.

E.g on BeagleBoard, the USB video device node is /dev/video9

USB 3G Modem[edit]

The USB 3G Modem section describes how to connect USB Modem to the android.

Introduction[edit]

PPP is the protocol used for establishing internet links over dial-up modems, DSL connections, and many other types of point-to-point links. The pppd daemon works together with the kernel PPP driver to establish and maintain a PPP link with another system (called the peer) and to negotiate Internet Protocol (IP) addresses for each end of the link.

Kernel Configuration for USB Modem[edit]

Device Drivers  --->
 [*] Network device support  --->
   <*>   PPP (point-to-point protocol) support
     <*>     PPP BSD-Compress compression
     <*>     PPP Deflate compression
     <*>     PPP support for async serial ports
     <*>     PPP support for sync tty ports
 [*] USB support  --->
   <*>   USB Modem (CDC ACM) support
   <*>   USB Serial Converter support  --->
     [*]   USB Generic Serial Driver
     <*>   USB driver for GSM and CDMA modems

File System Changes[edit]

To get the Modem Working, we need usb_modeswitch, usb_modeswicth.conf(configuration file) for the specific modem or Hardware vendor and the airtel.chat(dialer script) for the specific network.

  • Copy the usb_modeswitch (ARM Compiled binary) and usb_modeswitch.conf to the /system/xbin folder. The ARM compiled binary and the sources can be obtained from HERE
  • Copy the airtel.chat(dialer script) to the /system/etc/ppp folder

Below is the description of an example usb_modeswitch.conf file for the Huawei E1731 Modem (Airtel in India)

  Huawei E1731

  EnableLogging=1

  DefaultVendor= 0x12d1
  DefaultProduct=0x1446

  TargetVendor=  0x12d1
  TargetProductList="1001,1406,140b,140c,1412,141b,1436,14ac,1506"

  CheckSuccess=20

  MessageEndpoint= 0x01
  MessageContent="55534243123456780000000000000011062000000100000000000000000000"


The DefaultVendor and DefaultProduct is the ID displayed for CDROM or mass storage, the TargetVendor and TargetProduct is for Modem. Plug the device into linux system and do "dmesg" or "lsusb" to know the IDs.

Example: HUAWEI E1731 Modem Below is the log when plugged to PC

   [6663132.917033] usb 1-4: new high speed USB device number 10 using ehci_hcd
   [6663133.033394] usb 1-4: New USB device found, idVendor=12d1, idProduct=1446
[6663133.033400] usb 1-4: New USB device strings: Mfr=3, Product=2, SerialNumber=0
[6663133.033404] usb 1-4: Product: HUAWEI Mobile
[6663133.033407] usb 1-4: Manufacturer: HUAWEI Technology
[6663133.036040] scsi16 : usb-storage 1-4:1.0
[6663133.036652] scsi17 : usb-storage 1-4:1.1
[6663133.685546] usb 1-4: USB disconnect, device number 10
[6663137.665047] usb 1-4: new high speed USB device number 11 using ehci_hcd
[6663137.781645] usb 1-4: New USB device found, idVendor=12d1, idProduct=1436
[6663137.781651] usb 1-4: New USB device strings: Mfr=4, Product=3, SerialNumber=0
[6663137.781654] usb 1-4: Product: HUAWEI Mobile
[6663137.781657] usb 1-4: Manufacturer: HUAWEI Technology
[6663137.784476] option 1-4:1.0: GSM modem (1-port) converter detected
[6663137.784663] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB0
[6663137.786425] cdc_ether 1-4:1.1: wwan0: register 'cdc_ether' at usb-0000:00:1d.7-4, Mobile Broadband Network Device, 02:50:f3:00:00:00
[6663137.788066] option 1-4:1.3: GSM modem (1-port) converter detected
[6663137.788268] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB1
[6663137.788509] option 1-4:1.4: GSM modem (1-port) converter detected
[6663137.788646] usb 1-4: GSM modem (1-port) converter now attached to ttyUSB2
[6663137.789203] scsi22 : usb-storage 1-4:1.5
[6663137.789812] scsi23 : usb-storage 1-4:1.6
[6663138.790809] scsi 22:0:0:0: CD-ROM            HUAWEI   Mass Storage     2.31 PQ: 0 ANSI: 2
[6663138.791303] scsi 23:0:0:0: Direct-Access     HUAWEI   SD Storage       2.31 PQ: 0 ANSI: 2
[6663138.807169] sr1: scsi-1 drive
[6663138.808426] sr 22:0:0:0: Attached scsi CD-ROM sr1
[6663138.808593] sr 22:0:0:0: Attached scsi generic sg5 type 5
[6663138.809394] sd 23:0:0:0: Attached scsi generic sg6 type 0
[6663138.812181] sd 23:0:0:0: [sde] Attached SCSI removable disk

Below is the description of an example airtel.chat(dialer script) file for AirTel (INDIA)

TIMEOUT 10
ABORT 'BUSY'
ABORT 'NO ANSWER'
ABORT 'ERROR'
SAY 'Starting GPRS connect script\n'
""'ATZ'
SAY 'Setting APN\n'
OK 'AT+CGDCONT=1,"IP","airtelgprs.com"'
ABORT 'NO CARRIER'
SAY 'Dialing...\n'
OK 'ATD*99***1#'
CONNECT

NOTE: the single quotes in the above chat file must be together. ie no space allowed.

This file is network service provider dependent, so modify the airtelgprs.com according to your service provider.

Usage[edit]

Below are the steps to perform once android boots up with the above necessary modifications

  • Disable wireless and ethernet settings
  • Plug the USB Modem
  • Run the following commands
   mount -t usbfs usbfs /proc/bus/usb
   /system/xbin/usb_modeswitch -I -W -c /system/xbin/usb_modeswitch.conf

Mount the usbfs file system to /proc/bus/usb. This is necessary to avoid the “Couldn’t opendir()” error you get otherwise on running usb_modeswitch.
Once Mode Switch Succeeds, modem will be enumerated as /dev/ttyUSB* (* can be 0,1,2).
If you place the usb_modeswitch and usb_modeswitch.conf at other place, change the above command accordingly.

  • Once Modem succeeds in enumeration, run the follwoing command
   /system/bin/pppd /dev/ttyUSB0 115200 persist defaultroute usepeerdns updetach crtscts noauth debug connect "/system/xbin/chat -v -s -f /system/etc/ppp/airtel.chat"
  • From the logcat check what primary and secondary dns server IPs you got, you can kill the logcat after getting the IPs. Set those primary and secondary DNS server IPs for your device with the following commands replacing IP1 and IP2 with whatever IPs you got.
   setprop net.dns1 <IP1>
   setprop net.dns2 <IP2>

You are ready to browse that net after this if everything went well in the previous steps.
Enjoy the 3G fast speed surfing on your device.

Sensors[edit]

Accelerometer[edit]

The STMicro LIS33 Accelerometer is supported on Am37x Flashboard and AM335x evm.

Kernel driver for accelerometer on AM335x : http://gitorious.org/rowboat/kernel/trees/rowboat-am335x-kernel-3.2/drivers/misc/lis3lv02d

Android HAL on AM335xevm: http://gitorious.org/rowboat/vendor-ti-am335xevm/trees/rowboat-ics/libsensors

To indicate accelerometer support to android add the following line in device.mk

PRODUCT_COPY_FILES += \
    frameworks/base/data/etc/android.hardware.sensor.accelerometer.xml:system/etc/permissions/android.hardware.sensor.accelerometer.xml

Light sensor[edit]

AM335x evm supports light sensor TSL2550.

Light sensor kernel driver : http://gitorious.org/rowboat/kernel/blobs/rowboat-am335x-kernel-3.2/drivers/misc/tsl2550.c

Please note that the standard linux driver is modified to report light sensor values to the input sub-system. See commit.

Android HAL on AM335xevm: http://gitorious.org/rowboat/vendor-ti-am335xevm/trees/rowboat-ics/libsensors

To indicate light sensor support to android add the following line in device.mk

PRODUCT_COPY_FILES += \
    frameworks/base/data/etc/android.hardware.sensor.light.xml:system/etc/permissions/android.hardware.sensor.light.xml

You can use the light sensor input to modify the LCD backlight intensity. You need to add the following entry in the overlay:

  <bool name="config_automatic_brightness_available">true</bool>

Also you need to implement a lookup table to map the light intensity to the LCD backlight values. Please refer to the overlay file for more details.

Temperature sensor[edit]

AM335xevm supports temperature sensor LM75.

Kernel driver path : TBD

Android HAL is at TBD

Disclaimer[edit]

  • All components explained in this porting guide are validated against TI Android DevKit release 3.0.0 and 3.0.1 only.
  • However guide can be taken as reference to port mentioned components on similar architecture.

Technical Support and Product Updates[edit]

For further information or to report any problems, contact http://e2e.ti.com/android or http://support.ti.com.
For community support join http://groups.google.com/group/rowboat
For IRC #rowboat on irc.freenode.net

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article TI-Android-ICS-PortingGuide here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article TI-Android-ICS-PortingGuide here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article TI-Android-ICS-PortingGuide here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article TI-Android-ICS-PortingGuide here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article TI-Android-ICS-PortingGuide here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article TI-Android-ICS-PortingGuide here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article TI-Android-ICS-PortingGuide here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article TI-Android-ICS-PortingGuide here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article TI-Android-ICS-PortingGuide here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity