1. SAMSUNG ELECTRONICS CO LTD.
Tizen Porting Guide
Tizen the True Open Platform
9/10/2012
This document acts as a guide for porting and bringing up the Tizen OS on a new hardware
platform.
2. Tizen Porting Guide
Revision History
Version Date Comments
1.0 03/13/2012 Tizen Porting Guide Initial version
2.0-α 09/10/2012 Overall document update
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 1 of 143
3. Tizen Porting Guide
Contents
CONTENTS ................................................................................................................................................ 2
INTRODUCTION...................................................................................................................................... 6
About Tizen ...............................................................................................................................................................6
Purpose of this document .........................................................................................................................................6
TIZEN ARCHITECTURE......................................................................................................................... 7
The Application Layer ................................................................................................................................................8
The Core Layer ...........................................................................................................................................................8
The Kernel Layer ........................................................................................................................................................9
DEVELOPMENT ENVIRONMENT SETUP ....................................................................................... 10
Tizen OS Development Setup ..................................................................................................................................10
Introduction to OBS .................................................................................................................................................11
OBS Light .................................................................................................................................................................11
OBS Light server Appliance............................................................................................................................12
OBS Light Client Appliance ............................................................................................................................12
Installation of SDK ...................................................................................................................................................12
GETTING SOURCE CODE & BUILD .................................................................................................. 13
Platform Build ..........................................................................................................................................................13
Kernel Build .............................................................................................................................................................13
TIZEN BOOTUP OVERVIEW .............................................................................................................. 15
Kernel Bootup ..........................................................................................................................................................15
Platform Bootup ......................................................................................................................................................15
BSP CUSTOMIZATION ......................................................................................................................... 18
Bootloader Fundamentals .......................................................................................................................................18
Bootloader Setup and Build ....................................................................................................................................18
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 2 of 143
4. Tizen Porting Guide
Bootloader Commands Support ..............................................................................................................................18
Bootloader Kernel Parameters ................................................................................................................................19
KERNEL FUNDAMENTALS ................................................................................................................. 20
Kernel Configurations ..............................................................................................................................................20
Tizen File System .....................................................................................................................................................21
Virtual Filesystem (VFS ) ................................................................................................................................21
Tizen Partition Layout ....................................................................................................................................22
File-system Hierarchy Standard in Tizen ........................................................................................................23
Configuration .................................................................................................................................................23
Reference.......................................................................................................................................................23
MMC ........................................................................................................................................................................24
Description ....................................................................................................................................................24
Reference.......................................................................................................................................................25
SYSTEM ................................................................................................................................................... 26
System Framework ..................................................................................................................................................26
Description ....................................................................................................................................................26
Porting OAL Interface ....................................................................................................................................28
Configuration .................................................................................................................................................36
Reference.......................................................................................................................................................36
Sensor Framework ...................................................................................................................................................40
Description ....................................................................................................................................................40
Porting OAL Interface ....................................................................................................................................42
Configuration .................................................................................................................................................46
Reference.......................................................................................................................................................46
GRAPHICS AND UI ................................................................................................................................ 48
OpenGL ....................................................................................................................................................................48
3D Graphics Library .......................................................................................................................................48
EGL (Embedded-System Graphics Library) ....................................................................................................49
Porting ...........................................................................................................................................................50
OpenGL ES .....................................................................................................................................................50
X server ....................................................................................................................................................................54
Input Driver .............................................................................................................................................................54
Description: ...................................................................................................................................................54
Porting OAL Interface: ...................................................................................................................................55
Configuration .................................................................................................................................................56
Video Driver .............................................................................................................................................................57
Description: ...................................................................................................................................................57
Porting OAL Interface: ...................................................................................................................................58
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 3 of 143
7. Tizen Porting Guide
Introduction
About Tizen
Tizen is an open source standards-based software platform, targeted towards multiple device
segments, including smart phones, tablets, netbooks, in-vehicle infotainment devices, smart TVs,
and more.
Purpose of this document
The intent of this document is to provide information and instruction to boot Tizen on new
hardware and create products based on the Tizen OS. The Tizen porting guide takes you through
the porting process by elaborating the Tizen architecture, the tools needed, the development
environment setup, as well as creating a Tizen Image and demonstrating the modifications
needed across various functional areas.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 6 of 143
8. Tizen Porting Guide
Tizen Architecture
The figure below illustrates the Tizen architecture for smartphone and tablet devices.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 7 of 143
9. Tizen Porting Guide
The Application Layer
Tizen supports web applications. Tizen web applications leverage the full power of the platform, just like
native applications.
The Core Layer
The Core layer consists of the Tizen API and Tizen Core Service.
Tizen API
Tizen web applications can be developed using the Tizen Web API. The Tizen Web API is a collection of
W3C (HTML5 and more), Khronos WebGL, and newly defined device APIs.
Tizen Core Services
Application Framework
The Application Framework provides application management, including launching other applications
using the package name, URI, or MIME type. It also launches pre-defined services, such as the system
dialer application. The Application Framework also notifies applications of common events, such as low
memory events, low battery, changes in screen orientation, and push notification.
Base
Base contains Linux* base essential system libraries that provide key features, such as database support,
internationalization, and XML parsing.
Connectivity
Connectivity consists of all network- and connectivity-related functionalities, such as 3G, Wi-Fi,
Bluetooth, HTTP, and NFC (Near Field Communication). Data network is based on ConnMan (Connection
manager), which provides 3G and Wi-Fi based network connection management.
Graphics and UI
Graphics and UI consist of the system graphic and UI stacks, which includes the EFL (Enlightenment
Foundation Libraries), an X11-based window management system, input methods, and OpenGL® ES*.
The heart of the Graphics component, the EFL, is a suite of libraries. It is for creating rich graphics with
ease, for all UI resolutions. The libraries build UIs in layers, allowing for 3D transformations and more.
The EFL includes the Evas canvas API library and the elementary widget library.
Location
Location provides location based services (LBS), including position information, geocoding, satellite
information, and GPS status. It is based on GeoClue, which delivers location information from various
positioning sources, such as GPS, WPS (Wi-Fi Positioning System), Cell ID, and sensors.
Messaging
Messaging consists of SMS, MMS, Email, and IM.
Multimedia
Multimedia is based on GStreamer. It provides support for media, including video, audio, imaging, and
VoIP. It also provides media content management for managing media file metadata information.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 8 of 143
10. Tizen Porting Guide
PIM (Personal Information Management)
PIM enables managing user data on the device, including managing calendar, contacts, tasks, and
retrieving data about the device context (such as device position and cable status).
Security
Security is responsible for security deployment across the system. It consists of platform security
enablers, such as access control, certificate management, and secure application distribution.
System
System consists of system and device management features, including:
Interfaces for accessing devices, such as sensors, display, or vibrator.
Power management, such as LCD display backlight dimming/off and application processor sleep.
Monitoring devices and handling events, such as USB, MMC, charger, and ear jack events.
System upgrade.
Mobile device management.
Telephony
Telephony consists of cellular functionalities communicating with the modem:
Managing call-related and non-call-related information and services for UMTS and CDMA.
Managing packet service and network status information for UMTS and CDMA.
Managing SMS-related services for UMTS and CDMA.
Managing SIM files, phone book, and security.
Managing SIM Application Toolkit services for UMTS.
Web
Web provides a complete implementation of the Tizen Web API optimized for low power devices. It
includes WebKit, which is a layout engine designed to allow web browsers to render web pages. It also
provides web runtimes for web applications.
The Kernel Layer
The Kernel layer includes Linux kernel and device drivers.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 9 of 143
11. Tizen Porting Guide
Development Environment Setup
This section provides a brief overview about setting up your development environment on your
host system, such as your Ubuntu* system. The below figure briefly describes the Tizen
development environment setup.
Follow the steps below to set up the development environment on your Ubuntu system.
Tizen OS Development Setup
Please refer to the following links to set up the Tizen OS Development environment and to
obtain infomation regarding devlopment.
https://source.tizen.org/os-development
1. Work Flow
This section explains GIT/Gerrit based source code management and review process,
package creation using Open Build Service(OBS), and code submission methods,
including development and upstream branches.
2. Developer Guide
This section describes registration and information on a development environment
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 10 of 143
12. Tizen Porting Guide
setup for GIT/Gerrit, SSH, GIT Build system, Image creator, and install tools. It includes
the code and package submission using GIT and OBS buildsystem and the complete
development flow.
3. Git Build System
The GBS(Git-Build-System) is a custom command line tool that supports Tizen package
development. This section explains about auto-generating tarballs based on git
repositories, performing local and report builds, and OBS code submission. This section
also has procedure to monitor remote build log and status.
4. MIC Image Creator
This tools is used to create images for Tizen. This section provides detailed explainations
of image creation, conversion and chrooting into image procedure.
As is explained in the above URLs, Tizen development requires Open(SuSE) Build system and
the required components. In the following sections, we will briefly introduce various such
build requirements.
Introduction to OBS
The Open Build Service (OBS) is an open and complete distribution development platform that
provides a transparent infrastructure for development of Linux distributions, used by openSUSE,
MeeGo, and other distributions. (Supporting also Fedora, Debian, Ubuntu, RedHat, and other
Linux distributions). OBS provides the developers an easy way of using web-based and
command based interface to achieve development activities. OBS maintains a consistent build
environment, which each developer can rely on for various Linux distributions. For more
information on OBS, you can refer to this link:
https://build.tizen.org/
OBS can be set up locally or we can refer any available OBS services. http://doc.opensuse.org/p
roducts/draft/OBS/obs-best-practices_draft/cha.obs.best-practices.localsetup.html is one of th
e links that talks about setting up OBS server locally. To make use of any available OBS servers,
user credentials are required. Each OBS implemetiation can have more customized tools to achi
eve the build servies. You can find information on Tizen OBS and its customized build tool, nam
ed git-build-System(GBS), in this link
https://source.tizen.org/os-development/git-build-system/
OBS Light
OBS Light is an OBS base development process, but which is lighter to use. It creates an
encapsulation of OBS and presents a lighter face of OBS.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 11 of 143
13. Tizen Porting Guide
OBS Light server Appliance
This is a ready-to-use OBS for MeeGo and Tizen. openSUSE Build Service(OBS) 2.3.0-1.6. The
openSUSE Build Service appliance contains the complete OBS stack, including a Worker, the
Backend, API, Webclient, and osc, the command line client. FakeOBS is an added utility, through
which we can achieve priovate OBS Builds.
OBS Light Client Appliance
OBS Client Appliance consists of a command line (obslight) and a graphical user interface GUI
(obslightgui). OBS Client includes MIC to create a bootable image.
http://en.opensuse.org/openSUSE:OBS_Light_Manual
http://en.opensuse.org/openSUSE:OBS_Light_Fakeobs
http://susestudio.com/a/e0uuBG/obs-obs-server-obs-light
http://en.opensuse.org/openSUSE:OBS_Light_Installation
Installation of SDK
The Tizen SDK is a comprehensive set of tools for developing Tizen web applications. It consists
of Web IDE, Emulator, tool chain, sample code, and documentation. The beta release of the
Tizen SDK runs on Windows*, as well as Ubuntu. Tizen Web applications may be developed
without relying on an official Tizen IDE, as long as the application complies with Tizen packaging
rules. Use the link below to download the Tizen SDK.
https://developer.tizen.org/sdk
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 12 of 143
14. Tizen Porting Guide
Getting Source Code & Build
Follow this link to download the full source code for your Tizen platform and kernel
https://review.tizen.org/git/
Refer to below link for more information
Sorurce code Management on Tizen releases:
GIT/Gerrit: https://review.tizen.org/gerrit
Tizen Build setup
OBS: https://build.tizen.org/
Tizen Bug Tracking system
Jira: https://bugs.tizen.org/jira
Download URL: http://download.tizen.org/
Platform Build
Follow the link below to get learn how to add something like below:
https://source.tizen.org/os-development/developer-guide
Follow the link below to build the source code by using git build system.
https://source.tizen.org/os-development/git-build-system
Kernel Build
Follow the steps below steps to build the Tizen kernel.
Install and set up the osc, OBS client tools on your system.
Get the kernel source package and spec file from OBS . You can see kernel-3.0.15.tar.gz and
kernel.spec file.
$ osc co TIZEN:2.0:System kernel
Createdefconfig kernel configuration file as per the target requirement. The configuration
files available under arch/arm/configs/ can be modified by adding and removking kernel
configuration options to create a customized default config, file like xyz_defconfig.
Copy the new config file (such as xyz_defconfig) into the arch/arm/configs/ folder inside the
kernel source directory. This step can be skipped to use the existing defconfig file.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 13 of 143
15. Tizen Porting Guide
The following command is used to apply the custom config file such as xyz_defconfig for the
target, this command can be updated within the spec file to specify the custom defconfig
file.
make xyz_defconfig
The following command is used to build the kernel RPM package inside the kernel directory.
$ osc build armv7el –no-verify --clean
Once the build is successful, the RPM kernel package is created under/var/tmp/build-
root/abuild/rpmbuild/RPMS/armv7l/kernel-3.0.15-1.armv7l.rpm. The kernel RPM package is
downloaded on to the target and installed, as below
# rpm –Uvh kernel-3.0.15-1.armv7l.rpm
Instead of using the RPM kernel package, the kernel uImage can also be downloaded to the
target. The uImage is created under /var/tmp/build-root/home/abuild/rmpbuild/BUILD
/kernel-3.0.15/arch/arm/boot/uImage after the successful build. Create a tarball to
download the kernel to your target .
$ cd /var/tmp/build-root/home/abuild/rpmbuild/BUILD/kernel-
3.0.15/arch/arm/boot/
$ tar cvf tizen-kernel.tar uImage
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 14 of 143
16. Tizen Porting Guide
Tizen Bootup Overview
This section provides a brief overview of the typical booting sequence, starting from boot loader
to the kernel and the platform.
Kernel Bootup
The Tizen bootup process is the same as any other Linux kernel. We just need to make sure that
the correct machine ID and the boot arguments are passed from the boot loader.
Platform Bootup
The system-plugin-slp is an OAL plugin for booting the Tizen platform. Thisplugin shall be
modified as per the platform bootup sequence requirements from the vendor.
The platform bootup, using the OAL plugin (system-plugin-slp), is mentioned below and is
applicable for Tizen SDK Bootup.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 15 of 143
17. Tizen Porting Guide
Special file-systems like /proc, /tmp, /var, /sys and /dev are mounted during ‘mount *1+'.
Make device node about NULL device.
Run hotplug daemon of Linux.
Script checks for special booting mode. For example, in charging mode or during FOTA
(Firmware upgrade On The Air), it runs scripts from /etc/rc.d/rc2.d. This directory should
have the scripts for the special booting mode. After exiting special booting mode, the target
will be restarted.
For the first time booting after downloading, resize all ext4 partitions before mounting them
and configure the device information.
General file-systems for Tizen like /opt, /opt/media are mounted during ‘mount *2+'.
Set device node permissions for security.
Start modem booting.
Run scripts in /etc/rc.d/rc3.d. Detailed sequence of rc3.d scripts are described in the next
chapter.
The following section provides an overview on the init script sequence for the Tizen platform.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 16 of 143
18. Tizen Porting Guide
In the Tizen SDK, rc.sysinit runs every scripts on rc3.d in the order indicated above.
For example:
S05dlog is run for dlog.
S10sqlfs-mount and S12vconf-init is run for vconf which is configuration system for Tizen.
S20xserver is for xserver - Xorg, and window manager - enlightenment.
Others are run for each module. The scripts, which are not important for bringing up the
menu screen, are launched after the S46menudaemon script.
In S46menudaemon script, register /opt/share/applications/*.desktop files, change the
VCONFKEY_START value to 1, and then run the menu-screen.
The Tizen Git repository for the system-plugin-slp is
https://review.tizen.org/git/adaptation/system-plugin-slp.git;a=summary
The rpm package installation of this plugin is:
#zypper install system-plugin-slp
Note: Verify that the installation command is correct.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 17 of 143
19. Tizen Porting Guide
BSP Customization
This section covers the basic configuration, set up, and build procedure required for building the
boot loader and the kernel image.
Bootloader Fundamentals
Boot loader is a small piece of software that is required to perform the basic hardware and
peripheral initialization and load the kernel to RAM. For the Tizen platform, the boot loader
comes in two parts. The first part is the primary boot loader and the second part is the
secondary boot loader. The primary boot loader is the Samsung proprietary boot loader and is
also called s-boot. The secondary boot loader is the open source boot loader u-boot, which is
customized further for the Tizen platform.
If your platform is already loaded with the compatible boot loader software, then you can skip
this section and move directly to the kernel section.
Bootloader Setup and Build
Follow the steps to build the Tizen boot loader
SSet up OBS (Open Build Service) on the host system.
Get bootloader source from OBS, as shown below:
$ osc co TIZEN:2.0:System u-boot
Execute command to build the boot loader image:
$ osc build armv7el --no-verify --clean
Once the build is successful, the bootloader RPM package is created under
/var/tmp/build-root/home/abuild/rpmbuild/
Create a bootloader tarball to download the boot loader onto the target
$ cd /var/tmp/build-root/home/abuild/rpmbuild/BUILD/u-boot-
0.1.1
$ tar cvf bootloader.tar u-boot.bin
Bootloader Commands Support
The Tizen boot loader supports various commands, which are used with u-boot prompt before
loading the kernel. Below are some examples of the commands used in boot loader.
Example:
usb
reset
printenv
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 18 of 143
20. Tizen Porting Guide
setenv
saveenv
ramdump
pit
help
You can find the details about each command using the help command followed by the
command name.
Example:
<u-boot prompt> help ramdump
ramdump - Kernel lockup/panic logger
Usage:
ramdump show klog/dlog - log print on console
ramdump show blog <index[-1(default), 0]> - log print on console
ramdump save <ram/klog/dlog/blog/fb> - log save as file on UMS
ramdump logo - draw logo
ramdump check - check header info
Bootloader Kernel Parameters
The command line parameters can be passed from boot loader to the kernel. Here are some
example command line parameters.
Example:
console=ttySAC2,115200n8
fbmem=24M@0x66800000
csa=/dev/mmcblk0p1
bootloader_log=1167@0x62d08010
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 19 of 143
21. Tizen Porting Guide
Kernel Fundamentals
The kernel is the operating system that drives the platform. Here the kernel refers to the open
source Linux kernel that is customized for the Tizen platform. The following section will give a
brief overview about the Tizen kernel setup, configuration, and the build procedure for building
a Linux kernel for your Tizen platform. The output of the kernel binary will be a uImage that is
suitable only for u-boot boot loader. If you have chosen for a secure booting configuration in
your boot loader, then this uImage should be compatible with your boot loader.
Kernel Configurations
To download the Tizen kernel source package, refer to “Getting Source code and Build” section
in this document. Set up or modify your kernel configuration, use the appropriate defconfig file
from arch/arm/configs/.
For more detailed information about Tizen kernel configuration and kernel building, refer to the
section “Kernel Build” under “Getting Source code and Build” in this document.
Note: Tizen uses INOTIFY and does not use DNOTIFY. So, you should disable DNOTIFY from your
kernel configuration.
If you want to use initramfs, you can use these configurations:
CONFIG_INITRAMFS_SOURCE
CONFIG_INITRAMFS_ROOT_UID
CONFIG_INITRAMFS_ROOT_GID
CONFIG_INITRAMFS_COMPRESSION_NONE/GZIP/BZIP2/LZNA/LZO
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 20 of 143
22. Tizen Porting Guide
Tizen File System
Virtual Filesystem (VFS )
The virtual file system (VFS) is an interesting aspect of the Linux kernel because it provides a
common interface abstraction for file systems (ext2, jfs, ext4, etc...). The VFS provides a
switching layer between the SCI (System call interface) and the file systems supported by the
kernel, as shown in 7.1
Figure 7.1
At the top of the VFS is a common API abstraction of functions, such as open, close, read, and
writes. At the bottom of the VFS are the file system abstractions that define how the upper-
layer functions are implemented with respect to specific file system.
Below the file system layer is the buffer cache, which provides a common set of functions to the
file system layer (independent of any particular file system). This caching layer optimizes access
to the physical devices by keeping data around for a short time (or speculatively read ahead, so
that the data is available when needed). Below the buffer cache are the device drivers, which
implement the interface for the particular physical device.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 21 of 143
23. Tizen Porting Guide
Tizen Partition Layout
The following description is an example of the Tizen partition layout. The product vendor can
modify the sequence or partition layout for their devices, as needed.
Figure 7.2
The ‘boot’ partition is mounted in ‘/boot’ of rootfs. Here s-boot, u-boot, and kernel image are
saved as a file format, provided as system.tar.
1. CSA (Configuration Saved Area) is for non-volatile data that is calibration value of modem, etc.
2. The boot partition includes kernel image, boot-loader image, and modem image. Additionally,
it can have device driver modules.
3. Third partition is reserved for the future.
4. The ‘platform’ partition is mounted on the root directory ( / ). It contains fundamental
frameworks for Tizen and some general utility for Linux. It may be provided as platform.img file.
5. The ‘data’ partition is mounted on ‘/opt’ and it includes applications, libraries of applications,
and the platform database. It may be provided as a data.img file.
6. CSC (Customer Software Configuration) ‘csc’ partition is mounted on '/mnt/csc'. It can store
the customer’s software configuration, such as default language, time zone, etc.
7. UMS (USB Mass Storage) partition is mounted on ‘/opt/media’ and it includes default (media)
contents. It may be provided as ums.img.
8. Each image file, ‘platform.img’, ‘data.img’, and ‘ums.img’ can be zipped for downloading, like
IMAGE_NAME.tar.gz.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 22 of 143
24. Tizen Porting Guide
File-system Hierarchy Standard in Tizen
Each partition has this hierarchy:
Figure 7.3
Supported filesystems in Tizen
Filesystems that Tizen supports are Extended 4 (Ext 4) file-system, and MSDOS VFAT file-system.
The Tizen kernel has to be compiled to enable support for the other file systems like JFS, XFS,
BTRFS, and Reiserfs.
Default File-system in Tizen
The Extended (Ext 4) file-system is configured as a default file-system for Tizen.
Configuration
The ext4 kernel configuration is done like this standard kernel configuration.
Reference
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_XATTR=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
These are the configuration option to enable in kernel configuration file.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 23 of 143
25. Tizen Porting Guide
MMC
Description
Tizen supports MultiMediaCard, Secure Digital, and Secure Digital I/O Support. The MMC driver
is implemented on top of host controller (such as SDHCI controller driver) and supports MMC,
SD, SD High Speed, and SDHC cards.
If MMC is your booting device, read-write APIs, partition management, and flashing should be
provided at the boot loader.
Features Overview:
The MMC/SD/SDIO driver supports these features:
The driver is built in-kernel
MMC cards, including high speed cards
SD cards, including SD high speed and SDHC cards
MMC subsystem code structure in kernel is at /driver/mmc
MMC subsystem structure is divided into three parts:
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 24 of 143
26. Tizen Porting Guide
MMC block device driver /driver/mmc/card/
Protocol stack for MMC, SD, SDIO /driver/mmc/core/
Host controller driver /driver/mmc/host/
Hotplug MMC event handling in Tizen:
Based on the hotplug event handling, the notification is passed to the System server for device
status changes. It detects, mounts, and monitors the status of the sd card.
Reference
Kernel Configuration
CONFIG_MMC_BLOCK
CONFIG_MMC
CONFIG_MMC_SDHCI (For SDHCI host Interface enable)
sys interface: /dev/mmcblk0pX
Here ‘X’ denotes the MMC partition number. Details of partition mount point for Tizen are
covered under Tizen partition Layout.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 25 of 143
27. Tizen Porting Guide
System
System Framework
Description
The System framework module abstracts low level system functions and manages the Tizen platf
orm, in terms of platform policy, with the following major functionality.
The System framework contains these sub-components:
System server
The system server handles system events like out of memory, battery level, plug & play device st
atus as well as handles process watchdog.
Power manager
The power manager is a session daemon that runs to manage the power for a system. It
provides conditional state transition. The power manager transitions with any wakeup event,
shifting to a higher power state. Similarly, based on timeouts, it transits to the next lower
power state. The Tizen Power manager functionalities control display backlight dimming/off and
device sleep.
Power manager conditional state transition
When an application such as a media player is running, there may be no input from the user for
a long time, but the LCD should not be dimmed or turned off. Applications can request that the
Power manager not change to a specific state.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 26 of 143
28. Tizen Porting Guide
Conditional state transition
Lock : keep system from entering lower state than specific state
For example, lock(LCD_OFF) forces system to be in LCD_NORMAL, LCD_DIM or LCD_OFF.
Unlock : allow system to enter lower state than specific state
Controlling the device’s power status and sleep mode.
sys interface: /sys/power/state
/sys/power/wakeup_count
/dev/event0
/dev/event1
Device manager
Providing the interface to controlling all devices
LCD backlight dimming/off, application processor sleep
System monitoring and events handling from devices and system
Process/battery level/low memory monitoring
USB/MMC/charger/earjack event handling
Interfaces for accessing devices
LCD, touch, LED, vibrator, etc.
System OAL
The System OAL interface provides function pointers for OEMs to plug in their device/platform
specific code to the System framework.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 27 of 143
29. Tizen Porting Guide
Porting OAL Interface
The OAL interface provides function pointers for OEMs to plugin their device/platform specific
code to System framework.
OEM developers should implement API defined in devman_plugin_intf.h and compile their
library as libslp_devman_plugin.so. OEM APIs can be grouped as power, battery, haptics, LED,
light, and memory. Device Manager (devman) upon initialization calls const
OEM_sys_devman_plugin_interface* OEM_sys_get_devman_plugin_interface() ,
which in turn returns the address of implemented OEM APIs.If and when applications request
device manager APIs then appropriate OEM APIs referred by
OEM_sys_devman_plugin_interface would be called.
Devman library uses sysfs for interfaces with device drivers and kernel. sysfs is a virtual file
system provided by Linux 2.6 or above.
Configuration:
Install the OEM library as libslp_devman_plugin.so to /usr/lib
OAL API definitions are in the devman_plugin_intf.h header file:
typedef struct {
int (*OEM_sys_get_display_count) (int *value);
int (*OEM_sys_get_backlight_min_brightness) (int index, int *value);
int (*OEM_sys_get_backlight_max_brightness) (int index, int *value);
int (*OEM_sys_get_backlight_brightness) (int index, int *value, int power_saving);
int (*OEM_sys_set_backlight_brightness) (int index, int value, int power_saving);
int (*OEM_sys_set_backlight_dimming) (int index, int value);
int (*OEM_sys_get_backlight_acl_control) (int index, int *value);
int (*OEM_sys_set_backlight_acl_control) (int index, int value);
int (*OEM_sys_get_lcd_power) (int index, int *value);
int (*OEM_sys_set_lcd_power) (int index, int value);
int (*OEM_sys_get_image_enhance_mode) (int *value);
int (*OEM_sys_set_image_enhance_mode) (int value);
int (*OEM_sys_get_image_enhance_scenario) (int *value);
int (*OEM_sys_set_image_enhance_scenario) (int value);
int (*OEM_sys_get_image_enhance_tone) (int *value);
int (*OEM_sys_set_image_enhance_tone) (int value);
int (*OEM_sys_get_image_enhance_outdoor) (int *value);
int (*OEM_sys_set_image_enhance_outdoor) (int value);
int (*OEM_sys_get_image_enhance_tune) (int *value);
int (*OEM_sys_set_image_enhance_tune) (int value);
int (*OEM_sys_image_enhance_info) (int *value);
int (*OEM_sys_set_display_frame_rate) (int value);
int (*OEM_sys_get_uart_path) (int *value);
int (*OEM_sys_set_uart_path) (int value);
int (*OEM_sys_get_usb_path) (int *value);
int (*OEM_sys_set_usb_path) (int value);
int (*OEM_sys_get_haptic_vibetones_level_max) (int *value);
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 28 of 143
30. Tizen Porting Guide
int (*OEM_sys_get_haptic_vibetones_level) (int *value);
int (*OEM_sys_set_haptic_vibetones_level) (int value);
int (*OEM_sys_set_haptic_vibetones_enable) (int value);
int (*OEM_sys_set_haptic_vibetones_oneshot) (int value);
int (*OEM_sys_get_battery_capacity) (int *value);
int (*OEM_sys_get_battery_capacity_raw) (int *value);
int (*OEM_sys_get_battery_charge_full) (int *value);
int (*OEM_sys_get_battery_charge_now) (int *value);
int (*OEM_sys_get_battery_present) (int *value);
int (*OEM_sys_get_battery_health) (int *value);
int (*OEM_sys_get_battery_polling_required) (int *value);
int (*OEM_sys_get_jack_charger_online) (int *value);
int (*OEM_sys_get_jack_earjack_online) (int *value);
int (*OEM_sys_get_jack_earkey_online) (int *value);
int (*OEM_sys_get_jack_hdmi_online) (int *value);
int (*OEM_sys_get_jack_usb_online) (int *value);
int (*OEM_sys_get_jack_cradle_online) (int *value);
int (*OEM_sys_get_jack_tvout_online) (int *value);
int (*OEM_sys_get_jack_keyboard_online) (int *value);
int (*OEM_sys_get_leds_torch_max_brightness) (int *value);
int (*OEM_sys_get_leds_torch_brightness) (int *value);
int (*OEM_sys_set_leds_torch_brightness) (int value);
/* TODO: Change args type */
int (*OEM_sys_set_power_state) (int value);
/* TODO: Should determine enum values of wakeup_count nodes */
int (*OEM_sys_get_power_wakeup_count) (int *value);
int (*OEM_sys_set_power_wakeup_count) (int value);
int (*OEM_sys_get_memnotify_node) (char *node);
int (*OEM_sys_get_memnotify_victim_task) (int *value);
int (*OEM_sys_set_memnotify_threshold_lv1) (int value);
int (*OEM_sys_set_memnotify_threshold_lv2) (int value);
int (*OEM_sys_get_process_monitor_node) (char *node);
int (*OEM_sys_set_process_monitor_mp_pnp) (int value);
int (*OEM_sys_set_process_monitor_mp_vip) (int value);
int (*OEM_sys_get_cpufreq_cpuinfo_max_freq) (int *value);
int (*OEM_sys_get_cpufreq_cpuinfo_min_freq) (int *value);
int (*OEM_sys_get_cpufreq_scaling_max_freq) (int *value);
int (*OEM_sys_set_cpufreq_scaling_max_freq) (int value);
int (*OEM_sys_get_cpufreq_scaling_min_freq) (int *value);
int (*OEM_sys_set_cpufreq_scaling_min_freq) (int value);}
OEM_sys_devman_plugin_interface;
const OEM_sys_devman_plugin_interface *OEM_sys_get_devman_plugin_interface();
Device manager (devman) gets the pointer to the structure
OEM_sys_get_devman_plugin_interface in variable plugin_intf, as shown below in the code.
const OEM_sys_devman_plugin_interface *(*OEM_sys_get_devman_plugin_interface)
();
OEM_sys_get_devman_plugin_interface = dlsym(dlopen_handle,
"OEM_sys_get_devman_plugin_interface");
if ((error = dlerror()) != NULL) {
ERR("dlsym() failed: %s", error);
dlclose(dlopen_handle);
return;
}
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 29 of 143
31. Tizen Porting Guide
plugin_intf = OEM_sys_get_devman_plugin_interface();
if (!plugin_intf) {
ERR("get_devman_plugin_interface() failed");
dlclose(dlopen_handle);
return;
}
OAL API reference implementation:
Sample implementation code for OEM_sys_get_backlight_brightness()
This function gets the current brightness of the backlight unit and the output is stored in the
variable “value”. The “value” can range from :0 <= value <= MAX_BACKLIGHT_BRIGHTNESS
The path for input and output parameters of OEM APIs can be found in file
devman_define_node_path.h
#define BATTERY_CAPACITY_PATH "/sys/class/power_supply/battery/capacity"
#define BATTERY_CHARGE_FULL_PATH "/sys/class/power_supply/battery/charge_full"
#define BACKLIGHT_PATH "/sys/class/backlight/"
#define BACKLIGHT_MAX_BRIGHTNESS_PATH BACKLIGHT_PATH"%s/max_brightness"
#define BACKLIGHT_BRIGHTNESS_PATH BACKLIGHT_PATH"%s/brightness"
int OEM_sys_get_backlight_brightness(int index, int *value, int power_saving)
{
int ret = -1;
char path[MAX_NAME+1];
int max_brightness;
int pwr_saving_offset;
if (index >= DISP_MAX) {
devmgr_log("supports %d display node", DISP_MAX);
return ret;
}
snprintf(path, MAX_NAME, BACKLIGHT_BRIGHTNESS_PATH,
disp_info[index].bl_name);
ret = sys_get_int(path, value);
devmgr_log("path[%s]value[%d]power_saving[%d]", path, *value,
power_saving);
if (power_saving){
snprintf(path, MAX_NAME, BACKLIGHT_MAX_BRIGHTNESS_PATH,
disp_info[index].bl_name);
ret = sys_get_int(path, &max_brightness);
if (ret)
{
devmgr_log("Can't read max_brightness node[%s]", path);
return ret;
}
pwr_saving_offset = (PWR_SAVING_CANDELA_CRITERION *
max_brightness / MAX_CANDELA_CRITERION) + 0.5;
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 30 of 143
32. Tizen Porting Guide
if (*value > max_brightness - pwr_saving_offset)
*value = max_brightness;
else
*value = *value + pwr_saving_offset;
devmgr_log("power_saving result[%d]", *value);
}
return ret;
}
The function, sys_get_int(path,value) provides access to kernel device driver node parameters.
The parameter “path” is defined in the file devman_define_node_path.h , as described above.
The value to be get/set is stored in parameter “value”. In similar ways , functions like sys_get_str,
sys_set_int, sys_set_str, and sys_get_node are implemented to set/get the parameter values at
the respective path. Here is the sample implementation for sys_get_int.
int sys_get_int(char *fname, int *val)
{
char buf[BUFF_MAX];
if (sys_read_buf(fname, buf) == 0) {
*val = atoi(buf);
return 0;
} else {
*val = -1;
return -1;
}}
static int sys_read_buf(char *file, char *buf)
{
int fd;
int r;
fd = open(file, O_RDONLY);
if (fd == -1) {
return -ENOENT;
}
r = read(fd, buf, BUFF_MAX);
if ((r >= 0) && (r < BUFF_MAX))
buf[r] = '0';
else {
return -EIO;
}
close(fd);
return 0;
}
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 31 of 143
33. Tizen Porting Guide
Power manager
The various power states include Normal, LCD_DIM, LCD_OFF, and SLEEP and the device can
switch from one state to another, as shown in the above diagram. The values for different states
The power states are defined in the below enum.
typedef enum
{
POWER_STATE_NORMAL, /**< Normal state */
POWER_STATE_SCREEN_DIM, /**< Screen dim state */
POWER_STATE-SCREEN_OFF, /**< Screen off state */
} power_state_e;
Function Prototype Description (0-success, others -failure)
The function sets the device to suspend mode (0: Mandatory
int (*OEM_sys_set_power_state) (int value);
Suspend Mode).
int (*OEM_sys_get_power_wakeup_count) Mandatory
The function gets the current “wakeup_count”.
(int *value);
int (*OEM_sys_set_power_wakeup_count) The function sets the “wakeup_count” with input Mandatory
(int value); value.
int The function gets the limitation of max cpu Optional
(*OEM_sys_get_cpufreq_cpuinfo_max_freq) frequency
(int *value); value : cpu frequency (KHz).
int The function gets the limitation of min cpu Optional
(*OEM_sys_get_cpufreq_cpuinfo_min_freq) frequency
(int *value); value : cpu frequency (KHz).
int The function gets the current max cpu frequency Optional
(*OEM_sys_get_cpufreq_scaling_max_freq) (CPUINFO_MIN_FREQ <= value <=
(int *value); CPUINFO_MAX_FREQ in KHz).
int The function sets the current max cpu frequency Optional
(*OEM_sys_set_cpufreq_scaling_max_freq) (CPUINFO_MIN_FREQ <= value <=
(int value); CPUINFO_MAX_FREQ in KHz).
int The function gets the current min cpu frequency Optional
(*OEM_sys_get_cpufreq_scaling_min_freq) (CPUINFO_MIN_FREQ <= value <=
(int *value); CPUINFO_MAX_FREQ in KHz).
int The function sets the current min cpu frequency Optional
(*OEM_sys_set_cpufreq_scaling_min_freq) (CPUINFO_MIN_FREQ <= value <=
(int value); CPUINFO_MAX_FREQ in KHz).
The function gets the current path of uart node (0: Optional
int (*OEM_sys_get_uart_path) (int *value);
CP, 1: AP).
The function sets the current path of uart node (0: Optional
int (*OEM_sys_set_uart_path) (int value);
CP, 1: AP).
The function gets the current path of usb node (0: Optional
int (*OEM_sys_get_usb_path) (int *value);
CP, 1: AP).
The function sets the current path of usb node (0: Optional
int (*OEM_sys_set_usb_path) (int value);
CP, 1: AP).
int (*OEM_sys_get_jack_charger_online) (int The function gets the charger online status (0: Mandatory
*value); Offline, 1: Online).
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 32 of 143
34. Tizen Porting Guide
int (*OEM_sys_get_jack_earjack_online) (int The function gets the earjack online status (0: Mandatory
*value); Offline, 1: Online).
int (*OEM_sys_get_jack_earkey_online) (int The function gets the earkey online status (0: Mandatory
*value); Offline, 1: Online).
int (*OEM_sys_get_jack_hdmi_online) (int The function gets the hdmi online status (0: Offline, Optional
*value); 1: Online).
int (*OEM_sys_get_jack_usb_online) (int The function gets the usb online status (0: Offline, Optional
*value); 1: Online).
int (*OEM_sys_get_jack_cradle_online) (int The function gets the cradle online status (0: Optional
*value); Offline, 1: Online).
int (*OEM_sys_get_jack_tvout_online) (int The function gets the TV out online status (0: Optional
*value); Offline, 1: Online).
int(*OEM_sys_get_jack_keyboard_online) Optional
The fuction gets the keyboard interface status.
(int *value);
Vibrator
Vibrator interfaces are used to for accessing vibrator device. They provides functions to control
and retrieve vibrator parameters.
Function Prototype Description (0: Success, Others:
Failed)
int The function gets the max vibrationOptional
(*OEM_sys_get_haptic_vibetones_level_max) feedback intensity level.
(int *value)
int (*OEM_sys_get_haptic_vibetones_level) (int The function gets the current vibration Optional
*value) feedback intensity level
(0 <= value <= VIBETONES_LEVEL_MAX).
int (*OEM_sys_set_haptic_vibetones_level) (int The function sets the current vibration Optional
value) feedback intensity level
(0 <= value <= VIBETONES_LEVEL_MAX).
int (*OEM_sys_set_haptic_vibetones_enable) The function enables the vibration with Mandatory
(int value) current intensity level (0: Off, 1: On).
int (*OEM_sys_set_haptic_vibetones_oneshot) The function enables the oneshot Optional
(int value) vibration with current intensity level
(mili-second).
Image Enhancement
Image Enhancement interfaces provides functions to control the Image Quality Enhancement
Algorithm.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 33 of 143
35. Tizen Porting Guide
Function Prototype Description (0: Success, Others: Failed)
int (*OEM_sys_get_image_enh The function gets the mode of image enhance algorithm Optional
ance_mode) (int *value); (0 : DYNAMIC, 1 : STANDARD, 2 : NATURAL, 3 : MOVIE)
int (*OEM_sys_set_image_enh The function sets the mode of image enhance algorithm Optional
ance_mode) (int value); (0 : DYNAMIC, 1 : STANDARD, 2 : NATURAL, 3 : MOVIE)
int (*OEM_sys_get_image_enh The function gets the scenario of image enhance algorithm Optional
ance_scenario) (int *value); (0 : UI, 1 : GALLERY, 2: VIDEO, 3 : VTCALL, 4 : CAMERA, 5 : B
ROWSER, 6 : NEGATIVE, 7 : BYPASS)
int (*OEM_sys_set_image_enh The function sets the scenario of image enhance algorithm Optional
ance_scenario) (int value); (0 : UI, 1 : GALLERY, 2: VIDEO, 3 : VTCALL, 4 : CAMERA, 5 : B
ROWSER, 6 : NEGATIVE, 7 : BYPASS)
int (*OEM_sys_get_image_enh The function gets the tone of image enhance algorithm Optional
ance_tone) (int *value); (browser scenario - 0 : TONE_1, 1 : TONE_2, 2 : TONE_3)
(other scenario - 0 : NORMAL, 1: WARM, 2: COLD)
int (*OEM_sys_set_image_enh The function sets the tone of image enhance algorithm Optional
ance_tone) (int value); (browser scenario - 0 : TONE_1, 1 : TONE_2, 2 : TONE_3)
(other scenario - 0 : NORMAL, 1: WARM, 2: COLD)
int (*OEM_sys_get_image_enh The function gets the outdoor of image enhance algorithm Optional
ance_outdoor) (int *value); (0 : OUTDOOR_OFF, 1: OUTDOOR_ON)
int (*OEM_sys_set_image_enh The function sets the outdoor of image enhance algorithm Optional
ance_outdoor) (int value); (0 : OUTDOOR_OFF, 1: OUTDOOR_ON)
int (*OEM_sys_image_enhanc This function reports whether Image Quality Enhancement Optional
e_info) (int *value); Algorithm is supported
int (*OEM_sys_set_display_fra The function sets the frame rate of LCD Optional
me_rate) (int value); (0 : OFF - 60HZ, 1 : ON - 40HZ)
Light
Light interfaces provides functions to control light, brightness, and get and set brightness of LED
and to control power status of LCD power.
Function Prototype Description (0: Success, Others: Failed)
int The function gets the max brightness of Mandatory
(*OEM_sys_get_backlight_max_brightn backlight unit.
ess) (int index, int *value)
Int The function gets the min brightness of Mandatory
(*OEM_sys_get_backlight_min_brightn backlight unit.
ess) (int index, int *value)
int The function gets the current brightness of Mandatory
(*OEM_sys_get_backlight_brightness) backlight unit
(int index, int *value, int power_saving) (0 <= value <= MAX_BACKLIGHT_BRIGHTNESS).
int The function sets the current brightness of Mandatory
(*OEM_sys_set_backlight_brightness) backlight unit
(int index, int value, int power_saving) (0 <= value <= MAX_BACKLIGHT_BRIGHTNESS).
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 34 of 143
36. Tizen Porting Guide
int The function sets the dimming status of Mandatory
(*OEM_sys_set_backlight_dim backlight unit (0: Off, 1: On).
ming) (int index, int value)
int The function gets the current ACL control status Optional
(*OEM_sys_get_backlight_acl_control) of backlight unit (0: Off, 1: On).
(int index, int *value)
int The function sets the current ACL control status Optional
(*OEM_sys_set_backlight_acl_control) of backlight unit (0: Off, 1: On).
(int index, int value)
int (*OEM_sys_get_lcd_power) (int The function gets the current LCD power status Optional
index, int *value) (0: Off, 1: On).
int (*OEM_sys_set_lcd_power) (int The function sets the current LCD power status Optional
index, int value) (0: Off, 1: On).
int The function gets the max brightness of the led Optional
(*OEM_sys_get_leds_torch_max_bright torch.
ness) (int *value)
int The function gets the current brightness of the Optional
(*OEM_sys_get_leds_torch_brightness) led torch
(int *value) (0 <= value <= TORCH_MAX_BRIGHTNESS).
int The function sets the current brightness of the Optional
(*OEM_sys_set_leds_torch_brightness) led torch
(int value) (0 <= value <= TORCH_MAX_BRIGHTNESS).
Keytouch OAL interfaces
Key and touch event OAL interfaces uses standard input driver methods. These interfaces are
used to get the key and touch events. The standard input structure in include/linux/input.h is:
struct input_event {
struct timeval time;
__u16 type;
__u16 code;
__s32 value;
};
Battery
Battery Interfaces provide access to battery status functions to retrieve current battery status
information.
Function Name Description (0: Success, Others: Failed)
int (*OEM_sys_get_battery_capacity) (int The function gets the current battery Mandatory
*value) capacity (0 %< value < 100%).
int The function gets the current battery Mandatory
(*OEM_sys_get_battery_capacity_ capacity (0% < value < 10000%).
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 35 of 143
37. Tizen Porting Guide
raw) (int *value)
int (*OEM_sys_get_battery_charge_full) The function gets the current battery full Mandatory
(int *value) charge status (0: Not full charge, 1: Full
charge).
int (*OEM_sys_get_battery_charge_now) The function gets the battery charging status Mandatory
(int *value) (0: Not charging, 1: Charging).
int (*OEM_sys_get_battery_present) (int The function gets the battery installation Mandatory
*value) status (0: Not charging, 1: Charging).
int (*OEM_sys_get_battery_health) The function gets the temperature status Optional
(int *value) (0: UNKNOWN, 1: good, 2: overheat, 3: dead
4: overvoltage, 5: unspecified, 6: cold,
7: health max
Utility
These utility OAL interfaces monitor process, notify low memory warning, and kill the process.
Function Name Description (0: Success, Others: Failed)
int (*OEM_sys_get_memnotify_node) (char The function gets the node of out of memory Mandatory
*node); notification.
Int (*OEM_sys_get_memnotify_victim_task) The function gets the pid of victim process to be Mandatory
(int *value); killed in OOM.
Int Mandatory
The function sets the memory size of thershold
(*OEM_sys_set_memnotify_threshold_lv1)
OOM level 1.
(int value);
Int The function sets the memory size of thershold Mandatory
(*OEM_sys_set_memnotify_threshold_lv2) OOM level 2.
(int value);
Int (*OEM_sys_get_process_monitor_node) The function gets the node that send pid of Mandatory
(char *node); unexpected killed proccess.
Int The function sets the pid of the process regarded Mandatory
(*OEM_sys_set_process_monitor_mp_pnp) as a permanent process.
(int value);00
Int Mandatory
The function sets the pid of the process regarded
(*OEM_sys_set_process_monitor_mp_vip)
as vip process type.
(int value);
Configuration
None
Reference
Packagename: device-manager-plugin-exynos
Include file : devman_define_node_path.h
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 36 of 143
38. Tizen Porting Guide
Source file: device_manager_plugin_exynos.c
PM Kernel Configuration
Power management options
[*] Power Management support
Linux Suspend Resume Code is located at kernel/power
Generic Device/Bus suspend resume code located at drivers/base/power/
Device/Bus level suspend resume code in .suspend and .resume callbacks for each device driver
or bus driver
sys interface: /sys/kernel/power/
CPU Idle
It is a generic framework for supporting software-controlled idle processor power management.
It includes modular cross-platform governors that can be swapped during runtime.
[*] CPU idle PM support
The default CPU Idle governor is the menu governor and the code is located at drivers/cpuidle.
sys interface: /sys/devices/system/cpu/cpuidle/
CPU DVFS
It allows you to change the clock speed of CPUs on the fly. This is a nice method to save power,
because the lower the CPU clock speed, the less power the CPU consumes.
There are different generic CPU frequency governors, like performance, powersave, userspace,
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 37 of 143
39. Tizen Porting Guide
ondemand, etc., to control transitions among various Operating Points. The code is located at
drivers/cpufreq.
sys interface: /sys/devices/system/cpu/cpufreq/
CPU Hotplug
In addition to the above, Tizen Power management provides extra features to support dynamic
cpu hotplug to reduce power consumption.
To enable this feature, select this configuration:
-*- Support for hot-pluggable CPUs (EXPERIMENTAL)
sys interface: /sys/devices/system/cpu/
To support dynamic CPU hotplug to reduce power consumption, select this configuration
System Type Support dynamic cpu hotplug
sys interface: /sys/module/pm_hotplug/
System OAL Kernel configuration
CONFIG_SLP_PROCESS_MON
CONFIG_INPUT
CONFIG_INPUT_MISC
CONFIG_INPUT_MOUSEDEV(Optional)
CONFIG_INPUT_KEYBOARD(Optional)
CONFIG_INPUT_TOUCHSCREEN(Optional)
CONFIG_FB
CONFIG_FB_S3C
CONFIG_BACKLIGHT_CLASS_DEVICE
CONFIG_LCD_CLASS_DEVICE
CONFIG_LCD_S6E8AA0
CONFIG_MMC
CONFIG_MMC_BLOCK
CONFIG_MMC_SDHCI_S3C
CONFIG_MMC_S3C_DEV_HSMMC*
CONFIG_USB_EXYNOS_SWITCH
CONFIG_UART_SELECT
CONFIG_VIBETONZ
CONFIG_CHARGER_MANAGER
CONFIG_PM
CONFIG_PM_SLEEP
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 38 of 143
41. Tizen Porting Guide
Sensor Framework
Description
Sensor devices are used widely in mobile devices to enhance user experience. Most modern
mobile OSs have a framework which manages sensor hardware on the platform and provides
convenient API to the application.
Types of Sensors
Tizen supports individual plugin frameworks for these sensors:
Accelerometer sensor
Gyroscope sensor
Proximity sensor
Motion sensor
Geomagnetic sensor
Light sensor
Note: Details are not available for Ambient light, Magnetic sensors
Accelerometer sensor
The accelerometer sensor is used to measure the acceleration of the device. The three
dimensional coordinate system is used to illustrate the direction of the acceleration. When a
phone is moving along an axis, the acceleration is positive if it moves in a positive direction.
Gyroscope sensor
A gyroscope is a device used primarily for navigation and measurement of angular velocity.
Gyroscopes measure how quickly an object rotates. This rate of rotation can be measured along
any of the three axes X, Y, and Z.
Proximity sensor
A proximity sensor can detect the presence of nearby objects without any physical contact.
That is, it indicates if the device is close or not close to the user.
Motion sensor
A motion sensor is a virtual sensor that uses the accelerometer and gyroscope sensors. Motion
sensor detects snap, panning, tilt, shake, overturn, and double tap event.
Geomagnetic sensor
A geomagnetic sensor indicates the strength of the geomagnetic flux density in the X, Y, and Z
axes. This sensor is used to find the orientation of a body, which is a description of how it is
aligned to the space it is in.
Light sensor
A light sensor measures the amount of light that it receives or the surrounding light conditions.
The ambient light state is measured as a step value, where 0 is very dark and 10 is bright
sunlight.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 40 of 143
42. Tizen Porting Guide
Figure: Sensor Framework Architecture
Components of Sensor Framework
The Sensor framework provides a sensor server for creating plugins and a medium through
which the client applications are connected to the sensor hardware to exchange data. The
sensor plugins retrieve data from sensor hardware and enable the client applications to use the
data for specific requirements.
Here's the description of the sensor framework components:
Sensor Library
The application that wants to access the sensor service should communicate with the daemon
through the sensor API library. An API library allows the application to access the sensor service.
As shown in the below diagram, applications/middleware frameworks can have the sensor-
framework client library in the process context.
Sensor Server
The sensor server is a daemon which communicates uniquely to sensor drivers in the system
and dispatches sensor data to the application. The sensor server takes care of interacting with
the sensor driver in hardware initialization, driver configuration, and data fetching, to manage
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 41 of 143
43. Tizen Porting Guide
all sensors on the platform.
Type of plugins in sensor framework
Sensor Plugin
Sensor plugins takes care of interacting with the sensor driver.
Plug-ins process data from sensor drivers and communicate it to the sensor server.
Processor:Active component (it has a thread) that processes data or makes events from a filter
or from sensor data.
Filter: Passive component that converts sensor raw data to other types of data
Sensor: Passive component that gets raw data from the kernel node
Figure: Sensor Framework Components
Porting OAL Interface
The sensor OAL includes the processor plugin, the filter plugin, and the sensor plugin. The
accelerometer sensor (accel) is taken as an example to illustrate each plugin prototype
implementation.
Processor Plugin
Active component (it has a thread) that processes data or makes events from a filter or from
sensor data.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 42 of 143
44. Tizen Porting Guide
Prototype implementation of processor plugin
class accel_processor : public cprocessor_module {
public:
/*define enums*/
/*define structures*/
accel_processor();
virtual ~ accel_processor();
const char *name(void);
int id(void);
int version(void);
bool update_name(char *name);
bool update_id(int id);
bool update_version(int version);
bool add_input(csensor_module * sensor);
bool add_input(cfilter_module * filter);
long value(char *port);
long value(int id);
cprocessor_module *create_new(void);
void destroy(cprocessor_module * module);
static void *working(void *inst);
static void *stopped(void *inst);
virtual bool start(void);
virtual bool stop(void);
bool add_callback_func(cmd_reg_t * param);
bool remove_callback_func(cmd_reg_t * param);
bool check_callback_event(cmd_reg_t * param);
long set_cmd(int type, int property, long input_value);
int get_property(unsigned int property_level, void *property_data);
int get_struct_value(unsigned int struct_type, void *struct_values);
bool waiting_for_data(unsigned long time_us, bool real_update = false);
private:
/* Define private data structures and functions*/
};
Refer to the Appendix for sensor the processor plugin API’s.
Sensor Plugin
A passive component that gets raw data from the kernel node.
Prototype implementation sensor plugin
class caccel:public csensor_module {
public:
/*define enums*/
/*define structures*/
caccel();
virtual ~ caccel();
const char *name(void);
int version(void);
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 43 of 143
45. Tizen Porting Guide
int id(void);
bool is_data_ready(bool wait = false);
long value(const char *port);
long value(int id);
bool update_name(char *name);
bool update_version(int ver);
bool update_id(int id);
int port_count(void);
const char *port(int idx);
bool need_polling(void);
long polling_interval(void);
bool update_polling_interval(unsigned long val);
int get_sensor_type(void);
long set_cmd(int type, int property, long input_value);
int get_property(unsigned int property_level, void *property_data);
int get_struct_value(unsigned int struct_type, void *struct_values);
bool calibration(int iteration);
int check_hw_node(void);
bool start(void);
bool stop(void);
void reset(void);
private:
/* Define private data structures and functions*/
};
Prototype Description
bool is_data_ready(bool wait) When sensor data is available that can be read
from sensor node, then return that status. This
function waits during polling time and calls
update_value. If wait is true, then wait during
polling interval time.
int port_count(void) Returns the port count in sensor. For example,
accelerometer sensor has X, Y, Z port. In this case,
port_count function return 3.
const char *port(int idx) Returns port name by index number. When port(0)
called in the accelerometer sensor, then this
function returns ‘x’.
void reset(void) Reset s sensor node.
bool start(void) / bool This function enables or disables the sensor. It is
stop(void) the interface for the on or off function for the
sensor. It starts or stops function success, then
returns true. Otherwise, it returns false.
bool need_polling(void) This function announces that sensor’s data reading
type is polling or interrupt. If it is true, it is polling,
otherwise it is interrupt.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 44 of 143
46. Tizen Porting Guide
long polling_interval(void) It senses the need to poll data. Then returns the
polling interval time by ms.
bool Updates polling interval by ms.
update_polling_interval(unsigned long val)
void lock(void) Locks the sensor and blocks the other component’s
access.
void unlock(void) Unlocks the sensor and releases the other
component's access.
Filter Plugin
A passive component that converts sensor raw data to other types of data.
Prototype implementation filter plugin
class caccel:public csensor_module {
public:
/* Define enums*/
/* Define structures*/
caccel();
virtual ~ caccel();
const char *name(void);
int version(void);
int id(void);
bool is_data_ready(bool wait = false);
long value(const char *port);
long value(int id);
bool update_name(char *name);
bool update_version(int ver);
bool update_id(int id);
int port_count(void);
const char *port(int idx);
bool need_polling(void);
long polling_interval(void);
bool update_polling_interval(unsigned long val);
int get_sensor_type(void);
long set_cmd(int type, int property, long input_value);
int get_property(unsigned int property_level, void *property_data);
int get_struct_value(unsigned int struct_type, void *struct_values);
bool calibration(int iteration);
int check_hw_node(void);
bool start(void);
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 45 of 143
47. Tizen Porting Guide
bool stop(void);
void reset(void);
private:
/* Define private data structures and functions*/
}
Configuration
Sensor Framework loads configuration files sf_sensor.conf , sf_filter,conf , sf_processor.conf ,
sf_datastream.conf for loading sensor, filter, and processor plugins.
Each configuration file supports the following fields and values:
disable=yes/no
override=yes/no
path=Absolute path of a component
id=decimal
version=decimal
Between [ and ], the names of plugin are placed. If don’t want to use the plugin, set disable to
yes
Example of a sample configuration file:
[kxsd9_sensor]
disable=no
override=yes
path=/opt/x1/lib/sensor_framework/libkxsd9.so
id=1111
version=1
poll=100
[ak8973b_sensor]
disable=yes
override=yes
path=/opt/x1/lib/sensor_framework/libak8973b.so
id=1113
version=1 poll=100
Reference
Reference kernel configuration for sensors, will vary with different vendor types.
Sensor components Kernel Config Device nodes
/dev/input/event0/
/dev/ input/event1/
Accelerometer CONFIG_INPUT_KR3DH /dev/ input/event2/
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 46 of 143
49. Tizen Porting Guide
Graphics and UI
This figure provides a brief overview of the Tizen UI and graphics architecture.
Description:
Tizen provides high performance 3D graphics as a component of UI & Graphics, as shown in the
figure above. There are hardware-accelerated OpenGL ES (Open Graphics Library Embedded
System) and EGL (Embedded-System Graphics Library) for 3D applications, such as 3D games.
OpenGL ES is an application programming interface (API) for advanced 3D graphics, targeted at
handheld and embedded devices. To overcome device constraints, such as, limited processing
capabilities and memory availability, it provides a subset of the functionality in OpenGL.
But embedded system-specific features were added to enhance rendering efficiency, such as,
precision qualifiers to the shading language from OpenGL ES 2.0.
OpenGL
3D Graphics Library
The diagram provides an overview of the interface for Tizen high performance 3D graphics
library with OpenGL.
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 48 of 143
50. Tizen Porting Guide
Description:
EGL is a “glue” layer between OpenGL ES and the underlying native platform window system - X
window system. EGL communicates with X Window to get information from the application
window. And it creates a drawing surface and manages rendering context and resources.
Description of each component of 3D Graphics:
OpenGL ES (Open Graphics Library Embedded System)
OpenGL is a software interface to graphics hardware.
It is designed as a hardware-independent interface to be used for many different
hardware platforms.
OpenGL ES is a subset of the OpenGL designed for embedded systems.
OpenGL ES accepts primitives, such as points, lines, and triangles, and converts them
into pixels using a graphics pipeline, known as the OpenGL state machine.
EGL (Embedded-System Graphics Library)
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 49 of 143
51. Tizen Porting Guide
EGL is a (mostly) platform-independent API and an interface between rendering APIs,
such as OpenGL ES or OpenVG and an underlying native platform window system.
It communicates with X window system, and creates drawing surfaces and manages
rendering contexts.
EGLDisplay (X Display): Encapsulates all of the system dependencies for interfacing
with the native windowing system.
EGLSurface: Encapsulates rendering destinations (window surface, pixmap surface),
which are tied to X Window and X Pixmap.
EGLContext: Encapsulates OpenGL ES rendering context, which holds the state of GL
server/client.
The following diagram gives a brief overview of EGL interface.
Porting
3D graphics vendors must provide these porting requirements for OpenGL ES/EGL:
OpenGL ES
The required version of OpenGL ES: 1.1 and 2.0
The driver must support the following extensions to OpenGL ES 1.1:
GL_OES_framebuffer_object
GL_OES_blend_subtract
GL_OES_blend_func_separate
GL_OES_matrix_palette
GL_OES_draw_texture
GL_OES_texture_cube_map
GL_OES_query_matrix
ⓒ 2012 SAMSUNG Electronics Co., Ltd. Proprietary
Page 50 of 143