0% found this document useful (0 votes)
202 views45 pages

ILITEK Mstar I2C TP ProgrammingGuide V1 0 - Eng

Uploaded by

vishwahlifestyle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
202 views45 pages

ILITEK Mstar I2C TP ProgrammingGuide V1 0 - Eng

Uploaded by

vishwahlifestyle
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

ILI TP

ILITEK_Mstar TP IC
I2C Programming Guide
(For 10 Point Touch and Above)

Version: V1.0

ILI TECHNOLOGY CORP.


8F, No. 38, Taiyuan St, Jhubei City,
Taiwan 302, R.O.C.
Tel.886-3-5600099; Fax.886-3-5600585
http://www.ilitek.com
2
ILI TP I C Programming Guide for 10 Point Touch and Above ILI TP
REVISION HISTORY
Revision No. Description Date

1.0 Initial release 03/04/2017

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page ii of 45 Version: 2.0
2
ILI TP I C Programming Guide for 10 Point Touch and Above ILI TP
TABLE OF CONTENTS
REVISION HISTORY ........................................................................................................................................................ ii
TABLE OF CONTENTS ....................................................................................................................................................iii
1. Introduction ............................................................................................................................................................. 4
1.1. PURPOSE .............................................................................................................................................................................. 4
2. Function Statement ................................................................................................................................................ 5
2.1. ILITEK_DRV_COMMON.H ...................................................................................................................................................... 5
2.1.1 Compile Option ........................................................................................................................................................... 5
2.1.2 Constant Value .......................................................................................................................................................... 10
2.1.3 Enumeration Value .................................................................................................................................................... 18
2.2. ILITEK_DRV_UPDATE.C ...................................................................................................................................................... 21
2.3. ILITEK_DRV_MAIN.C .......................................................................................................................................................... 23
2.3.1 Function .................................................................................................................................................................... 23
2.4. ILITEK_DRV _MP_TEST.H & ILITEK_DRV _MP_TEST.C ......................................................................................................... 32
2.4.1 Constant Value .......................................................................................................................................................... 32
2.4.2 Function .................................................................................................................................................................... 33
2.5. MTK HOTKNOT ................................................................................................................................................................. 34
2.5.1 Hotknot Commands ................................................................................................................................................... 34
2.5.2 Hotknot Authentication Command ............................................................................................................................ 34
2.5.3 Hotknot Control/Transmitting command ................................................................................................................... 34
2.5.4 Hotknot Receiving command..................................................................................................................................... 35
2.5.5 Hotknot Shared library.............................................................................................................................................. 35
2.5.6 How to verify Hotknot procotol ................................................................................................................................. 35
2.5.7 Hotknot comprehensive verification .......................................................................................................................... 36
2.5.8 The stage of verification for Hotknot functions ......................................................................................................... 37
2.5.9 Pseudo Hotknot firmware.......................................................................................................................................... 37
2.6. ILITEK_DRV_SPRD.C ........................................................................................................................................................... 37
2.6.1 How to Register ILITEK/MStar Touch IC ................................................................................................................. 37
2.6.2 How to Compile ILITEK/MStar Touch Device Driver Code ..................................................................................... 38
2.7. ILITEK_DRV_QCOM.C ......................................................................................................................................................... 38
2.7.1 How to Register ILITEK/MStar Touch IC ................................................................................................................. 38
2.7.2 How to Compile ILITEK/MStar Touch Device Driver Code ..................................................................................... 38
2.8. ILITEK_DRV_MTK.C............................................................................................................................................................ 39
2.8.1 How to Register ILITEK/MStar Touch IC ................................................................................................................. 39
2.8.2 How to Compile ILITEK/MStar Touch Device Driver Code ..................................................................................... 39
3. Trouble Shooting .................................................................................................................................................. 40
3.1. THE LIMITATION FOR I2C READ/WRITE IN MTK PLATFORM ............................................................................................... 40
3.2. THE EFFICIENCY OF FINGER TOUCH REPORTS NOT WELL..................................................................................................... 40
3.3. TOUCH PANEL IS NOT WORKING ......................................................................................................................................... 40
3.3.1 Does Touch IC power on ? ........................................................................................................................................ 40
3.3.2 Check I2C Bus ID and I2C slave address all correct ................................................................................................ 42
3.3.3 Check INT Pin and Rest Ping all correct .................................................................................................................. 43
3.4. THE PROBLEM OF COMMUNICATION BETWEEN DRIVER AND TOUCH IC .............................................................................. 43
3.4.1 Does Touch IC power on ........................................................................................................................................... 43
3.4.2 The I2C Slave addres of DBBUS is correct ............................................................................................................... 45
3.5. THE PROBLEM OF BUILDING KERNEL IN MTK PLATFORM .................................................................................................. 45

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page iii of 45 Version: 2.0
2
ILI TP I C Programming Guide ILI TP

1. Introduction

1.1. Purpose
Since the Touch ICs made by ILITEK/Mstar have been widely used on the variety of developement
platforms (MTK/QCOM/SPRD), reduing the time for spending integrations and verifications of Touch
ICs is much more important for the FAE colleagues and customers. To do so, the device driver version
of v6.0.0.0 not only eases its complexity, but also expands its flexibilities. The latest version is able to
support ILITEK’s mutual-capacitance Touch ICs (ILI212x/ILI211xA), Mstar’s mutual-capacitance
Touch ICs (MSG26xxM/MSG28xx/MSG58xx) and self-capacitance Touch IC (MSG22xx) on the
main three various developing plaforms (MTK/QCOM/SPRD). This document explains definiations
of Touch Device Driver and discusses the use of its functions in details.

Note :
1. The document only focuses on the version of v6.0.0.0 upward, excluding older versions.
2. MTK, QCOM and SPRK stand for MediaTek Inc, Qualcoomm International, Inc and Spreadtrum
Communication Inc.
3. The FAE colleagues and customers who are porting or verifying the Touch Device Driver should
directly refer to the Capter 2.1. Additionally, based on the different development platforms, they may
also refer to the Capter 2.6, 2.7 and 2.8.

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 4 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP

2. Function Statement

2.1. ilitek_drv_common.h
The entire code in Touch Device Dirver, shared Compile Option, function and constant values are all
defined in the head file named ilitek_drv_common.h, which includes ILITEK’s mutual-capacitance
Touch ICs (ILI212x/ILI211xA), Mstar’s mutual-capacitance Touch ICs
(MSG26xxM/MSG28xx/MSG58xx) and Mstar’s self-capacitance Touch ICs
(MSG21xxA/MSG22xx).

2.1.1 Compile Option


This section will only explain the fundermantal part of compile option as description. The rest of them
please refer to the ilitek_drv_common.h

2.1.1.1. #define CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM


#define CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM
#define CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM
The compile option is used to enable the specific device driver handling for distinct smart phone
developer platform. Please enable one of them based on customer’s project and disable other two
options.

2.1.1.2. #define CONFIG_PLATFORM_USE_ANDROID_SDK_6_UPWARD


The compile option is used to enable code handling for specific MTK platforms which use Android
6.0 upward. Touch Device Driver will not work properly if customers are developing the platform
with Andriod 6.0 above and do not enable it. It is disabled by default for QCOM/SPRD platforms
.
2.1.1.3.
#define CONFIG_ENABLE_CHIP_TYPE_MSG22XX
#define CONFIG_ENABLE_CHIP_TYPE_MSG28XX
#define CONFIG_ENABLE_CHIP_TYPE_ILI21XX
When both of the compile option either CONFIG_ENABLE_ITO_MP_TEST or
CONFIG_UPDATE_FIRMWARE_BY_SW_ID is enabled, please open one of the above compile
options based on customer’s project and disable other two options. The functionality of MP test and
update SW firmware for that chip type will be active.

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 5 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
2.1.1.4. #define CONFIG_ENABLE_REGULATOR _POWER_ON
The compile option wraps a specific function called DrvTouchDeviceRegulatorPowerOn, which is
used to supply power to Touch IC for some specific BB chips, such as SC7715 (SPRD), MSM8610
(QCOM) and MT6582 (MTK). If there is a situation that the Touch IC can not get power while
integrating ILITES/Mstar’s Touch Device Driver, please check with customers to see if need to enable
the above compile option, or even modify the method of power supply in the function if required.

2.1.1.5. #define CONFIG_ENABLE_TOUCH_PIN_CONTROL


The compile option is used to enable touch pin control that uses to get a correct value of RESET Pin
and INT Pin. Some specific BB chips, particularly SPRD and QCOM platforms, must enable this
compile option to obtain the value via Pin control mechanism. You should need to confirm with
customers who use the two platforms to see if need to enable it. This compile option is disabled by
default.

2.1.1.6. #define CONFIG_USE_IRQ_INTERRUPT_FOR_MTK_PLATFORM


In the MTK platforms, they use two ways (Method A/ Method B) to create a workqueue that is used to
handle scheduling to deal with reading and analyzing of finger touch packages reported by firmware
when Touch Device Driver receives an IRQ event. In the current structure of v6.0.0.0, the two
creations of workqueue mechanism are supported. You can enable or disable this compile option based
on different situations. The compile option is disabled by default. Please refer to the related code
which is enclosed in ilitek_drv_main.c for more details. A part of code shows below.

#ifdef CONFIG_USE_IRQ_INTERRUPT_FOR_MTK_PLATFORM
/* initialize the finger touch work queue */
INIT_WORK(&_gFingerTouchWork, _DrvFingerTouchDoWork);
#else
_gThread = kthread_run(_DrvFingerTouchHandler, 0, TPD_DEVICE);
if (IS_ERR(_gThread))
{
nRetVal = PTR_ERR(_gThread);
DBG(&g_I2cClient->dev, "Failed to create kernel thread: %d\n", nRetVal);
}
#endif //CONFIG_USE_IRQ_INTERRUPT_FOR_MTK_PLATFORM

2.1.1.7. #define CONFIG_ENABLE_DMA_IIC


The complie option is used to apply DMA mode for read/write data between Touch Device Driver and

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 6 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
TP firmware (or Touch IC). The DMA mode is used to resolve the I2C read/write 8 Byte limitation for
some specific MTK BB chips (MT6572/MT6582/MT6589). This compile option is disabled by
default.

2.1.1.8. #define CONFIG_TP_HAVE_KEY


The compile option is used to enable the specific Touch Device Drive code handling virtual keys
(Menu、Home、Back、Search) on touch panel. This compile option is enabled by default.

2.1.1.9. #define CONFIG_ENABLE_REPORT_KEY_WITH_COORDINATE


Since Touch Device Driver in MTK platforms reports the coordinate instead of key codes to Linux’s
input subsystem, the compile option must be enabled on the platforms. This compile option is enabled
by default for MTK platforms, while the default is disabled for QCOM/SPRD platforms.

2.1.1.10. #define CONFIG_ENABLE_FIRMWARE_DATA_LOG (1)


This flag allows TP firmware being able to switch Debug Mode from Demo Mode through
MTPTool.apk provided by ILITEK/Mstar. The Debug mode outputs data log to a .csv file stored in T
Card with a smart phone, and TP firmware colleagus can analyze the file by MxViewer tool to find out
firmware problems effectively. The flag sets 1 as default (0: disable, 1: enable).

Note that if you are wondering how uses the tools or gets related docuements and instructions, please
ask for a help to ILITEK/Mstart FAE members.

2.1.1.11. #define CONFIG_ENABLE_SEGMENT_READ_FINGER_TOUCH_DATA


The compile option allows Touch Device Driver reading finger touch data from TP firmware by
segment method. In some cases, there is the limited length for I2C read/write on development
platforms, and that will cause a problem that Touch Device Driver cannot be able to retrieve data log
from TP firmware in Debug Mode due to the limitation if the flag
(CONFIG_ENABLE_FIRMWARE_DATA_LOG) is open. This compile option is enabled by default.

2.1.1.12. #define CONFIG_ENABLE_GESTURE_WAKEUP


The compile option is used to enable the handling function of gesture wakeup for ILITEK/Mstar
Touch IC. Touch Device Driver has already supported the function on LITEK’s mutual-capacitance
Touch ICs (ILI212x/ILI211xA), Mstar’s mutual-capacitance Touch ICs
(MSG26xxM/MSG28xx/MSG58xx) and Mstar’s self-capacitance Touch ICs (MSG22xx) since
v6.0.0.0. This compile option is disabled by default.
2.1.1.13. #define CONFIG_SUPPORT 64_TYPES_GESTURE_WAKEUP_MODE
The compile option is used to enable Touch Device Driver to support at most 64 types of gesture
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 7 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
wakeup mode. In terms of ILITEK’s mutual-capacitance Touch IC (ILI211xA), Mstar’s
mutual-capacitance Touch ICs (MSG28xx/MSG58xx/MSG58xxA) and Mstar’s self-capacitance
Touch IC (MSG22xx), they support either at most 64 or at most 16 types of gesture wakup mode if the
compile option is defined or not. The compile option is disabled by default.

2.1.1.14. #define CONFIG_ENABLE_GESTURE_DEBUG_MODE


The compile option is used to enable a function that allows TP firmware members to debug the
problems of gesture wakeup, which is required to use MTPTool APK together. For customer’s projects,
this function will not be used. This compile option is disabled by default.

2.1.1.15. #define CONFIG_ENABLE_GESTURE_INFORMATION_MODE


The compile option is used to enable gesture information mode in Touch Device Driver, allowing
gesture information sending to APK from TP firmware. This compile option is disabled by default.

DCC provides two different versions of instruction of gesture wakeup for FAE memebers
(ilitek/mstar_ctp_手勢喚醒功能規格說明_internal.pdf) and customers (ilitek/mstar_ctp_手勢喚醒
功能規格說明_customer.pdf). Please apply for the doucments with them for more details if necessary.

2.1.1.16. #define CONFIG_ENABLE_ITO_MP_TEST


The compile option is used to enable phone level MP Test hanlding in Touch Device Driver. In
addition, Mstar’s mutual-capacitance Touch ICs (MSG28xx/MSG58xx) and self-capacitance Touch IC
(MSG22xx) have already been supported phone level Open Test and Short Test by the version of
6.0.0.0. This compile option is disabled by default.

DCC provides two different versions of instruction of MP Test for FAE memebers
(ilitek/mstar_ctp_phone_level_mp_test_user_guideline_internal.pdf) and customers
(ilitek/mstar_ctp_phone_level_mp_test_user_guideline_customer.pdf). Please apply for the documents
with them for more details if necessary.

2.1.1.17. #define CONFIG_ENABLE_MP_TEST_ITEM_FOR_2R_TRIANGLE


If the compile option CONFIG_ENABLE_ITO_MP_TEST is enabled, self-capacitive Touch IC is
also used, and TP’s pattern is 2R Triangle Pattern, then it is necessary to enable this compile ption,
otherwise it should be disabled if TP’s pattern is Horizontal Triangle Pattern. This compile option is
enable by default.

2.1.1.18. #define CONFIG_UPDATE_FIRMWARE_BY_SW_ID


The compile option is used to enable a method that updates TP firmware via the SW ID mechanism
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 8 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
while smart phones power on. This function has been supported on ILITEK’s mutual-capacitance
Touch IC (ILI212x/ILI211xA), Mstar’s mutual-capacitance Touch ICs
(MSG28xx/MSG58xx/MSG58xxA) and self-capacitance Touch IC (MSG22xx). This compile option
is disabled by default.

DCC provides the instruction of SW ID operation only for MSG22xx and MSG28xx to FAE
memebers. Please apply for the document (ilitek/mstar_ctp_sw_id_user_guideline.pdf ) with them if
necessary.

2.1.1.19. #define CONFIG_UPDATE_FIRMWARE_BY_TWO_DIMENSIONAL_ARRAY


The compile option is used to select a way for updating firmware bin file. If it is enabled, Touch
Device Driver only accepts the format of two-dimensional array to update TP firmware. Else, the
update firmware bin file will be stored in one-dimensional array format. It should be careful that the
size of firwame bin file in MSG22xx has 48.5K, which can only be stored as one-dimensional arrary
format.

2.1.1.20. #define CONFIG_ENABLE_HOTKNOT


The compile option is used to enable HotKnot function that works on the self-capacitive Touch IC
(MSG28xx) only. This compile option is disabled by default.

2.1.1.21. #define CONFIG_ENABLE_PROXIMITY_DETECTION


The compile option is used to enable Proximity Dectection function that supports mutual-capacitive
touch ICs (MSG28xx/MSG58xx/MSG58xxA/ILI212x/ILI211xA) and self-capacitive touch IC
(MSG22xx). This compile option is disabled by default.

2.1.1.22. #define CONFIG_ENABLE_NOTIFIER_FB


The compile option is used to enable notifier feedback, including suspend or resume, sent by Linux
system to Touch Device Driver while the screen on smart phones lights on or off. This notification
works for SPRD/QCOM platforms only. This compile option is disabled by default.

2.1.1.23. #define CONFIG_ENABLE_COUNT_REPORT_RATE


The compile option is used to enable report rate calculation generated by TP Firmware. This function
needs to be used with MTP Tool APK if TP firmware members have to analyze the problems of report
rate calculation. This compile option is enabled by default.
2.1.1.24. #define CONFIG_ENABLE_GLOVE_MODE
The compile option is used to enable Glove mode handling. Only mutual-capacitive Touch ICs
(MSG28xx/MSG58xx/MSG58xxA/ILI211xA) supports it. This compile option is disabled by default.
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 9 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP

2.1.1.25. #define CONFIG_ENABLE_LEATHER_SHEATH_MODE


The compile option is used to enable Leather mode handling. Only mutual-capacitive Touch ICs
(MSG28xx/MSG58xx/MSG58xxA/ILI211xA) supports it. This compile option is disabled by default.

2.1.1.26. #define CONFIG_ENABLE_JNI_INTERFACE


The compile option is used to enable JNI interface used to communicate with MTPTool APK. This
compile option is enabled by default.

2.1.1.27. #define CONFIG_ENABLE_CHARGER_DETECTION


The compile option is used to enable charger detection for notifiying the charger plug in / plug out
status to TP firmware. If the charge is plugging in, TP firwamre can be able to get rid of the effect of
noise. This compile option is disabled by default.

2.1.1.28. #define CONFIG_ENABLE_ESD_PROTECTION


The compile option is used to enable ESD protection handling. This compile option is disabled by
default.

2.1.1.29. #define CONFIG_ENABLE_TYPE_B_PROTOCOL


If the ESD proection is enabled, Touch Device Driver will use multi-touch type B mechanism to
report touch point/key to Linux’s input subsystem. Else, it will use multi-touch type A mechanism to
report it to the subsystem.

2.1.2 Constant Value


This section will only explain fundermantal part of constant value as description. The rest of them
please refer to the ilitek_drv_common.h

2.1.2.1. Chip Type


#define CHIP_TYPE_MSG21XX (0x01) // EX. MSG2133
#define CHIP_TYPE_MSG21XXA (0x02) // EX. MSG2133A/MSG2138A
#define CHIP_TYPE_MSG26XXM (0x03) // EX. MSG2633M
#define CHIP_TYPE_MSG22XX (0x7A) // EX. MSG2238/MSG2256
#define CHIP_TYPE_MSG28XX (0x85) // EX. MSG2833/MSG2835/MSG2836/MSG2840/MSG2856
/MSG5846
#define CHIP_TYPE_MSG58XXA (0xBF) // EX. MSG5846A
#define CHIP_TYPE_ILI2117A (0x2117) // EX. ILI2117A

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 10 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
#define CHIP_TYPE_ILI2118A (0x2118) // EX. ILI2118A
#define CHIP_TYPE_ILI2121 (0x2121) // EX. ILI2121
#define CHIP_TYPE_ILI2120 (0x2120) // EX. ILI2120

The constant values define Chip ID in each ILITEK/MStar mutual-capactivie Touch IC. Touch Device
Drive gets a specific Chip ID by calling the function DrvGetChipType(). The different Chip IDs will
have different handling methods in Touch Device Driver. You are not expected to modify the constant
values.

2.1.2.2. Width & Height for Touch Panel


#define TOUCH_SCREEN_X_MAX (720) //LCD_WIDTH
#define TOUCH_SCREEN_Y_MAX (1280) //LCD_HEIGHT

The constant values define the width and height of a touch panel, which sould be modified depending
on the size of panel that customers use.

2.1.2.3. Authority for proc File Node


#define PROCFS_AUTHORITY (0666)

The constant value is used to set an authority of procfs used to communicate with APK from Touch
Device Driver. The default value of 0666 means that it has the authority to read/write the proc node.

2.1.2.4. Wakeup Mode for Gesture Wakeup


#ifdef CONFIG_ENABLE_GESTURE_WAKEUP
#define GESTURE_WAKEUP_MODE_DOUBLE_CLICK_FLAG 0x00000001 //0000 0000 0000 0000
0000 0000 0000 0001
#define GESTURE_WAKEUP_MODE_UP_DIRECT_FLAG 0x00000002 //0000 0000 0000 0000
0000 0000 0000 0010
#define GESTURE_WAKEUP_MODE_DOWN_DIRECT_FLAG 0x00000004 //0000 0000 0000 0000
0000 0000 0000 0100
#define GESTURE_WAKEUP_MODE_LEFT_DIRECT_FLAG 0x00000008 //0000 0000 0000 0000
0000 0000 0000 1000
#define GESTURE_WAKEUP_MODE_RIGHT_DIRECT_FLAG 0x00000010 //0000 0000 0000 0000
0000 0000 0001 0000
#define GESTURE_WAKEUP_MODE_m_CHARACTER_FLAG 0x00000020 //0000 0000 0000 0000
0000 0000 0010 0000
#define GESTURE_WAKEUP_MODE_W_CHARACTER_FLAG 0x00000040 //0000 0000 0000 0000
0000 0000 0100 0000
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 11 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
#define GESTURE_WAKEUP_MODE_C_CHARACTER_FLAG 0x00000080 //0000 0000 0000 0000
0000 0000 1000 0000
#define GESTURE_WAKEUP_MODE_e_CHARACTER_FLAG 0x00000100 //0000 0000 0000 0000
0000 0001 0000 0000
#define GESTURE_WAKEUP_MODE_V_CHARACTER_FLAG 0x00000200 //0000 0000 0000 0000
0000 0010 0000 0000
#define GESTURE_WAKEUP_MODE_O_CHARACTER_FLAG 0x00000400 //0000 0000 0000 0000
0000 0100 0000 0000
#define GESTURE_WAKEUP_MODE_S_CHARACTER_FLAG 0x00000800 //0000 0000 0000 0000
0000 1000 0000 0000
#define GESTURE_WAKEUP_MODE_Z_CHARACTER_FLAG 0x00001000 //0000 0000 0000 0000
0001 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE1_FLAG 0x00002000 //0000 0000 0000 0000
0010 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE2_FLAG 0x00004000 //0000 0000 0000 0000
0100 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE3_FLAG 0X00008000 //0000 0000 0000 0000
1000 0000 0000 0000

#ifdef CONFIG_SUPPORT_64_TYPES_GESTURE_WAKEUP_MODE
#define GESTURE_WAKEUP_MODE_RESERVE4_FLAG 0x00010000 //0000 0000 0000 0001
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE5_FLAG 0x00020000 //0000 0000 0000 0010
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE6_FLAG 0x00040000 //0000 0000 0000 0100
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE7_FLAG 0x00080000 //0000 0000 0000 1000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE8_FLAG 0x00100000 //0000 0000 0001 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE9_FLAG 0x00200000 //0000 0000 0010 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE10_FLAG 0x00400000 //0000 0000 0100 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE11_FLAG 0x00800000 //0000 0000 1000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE12_FLAG 0x01000000 //0000 0001 0000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE13_FLAG 0x02000000 //0000 0010 0000 0000
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 12 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE14_FLAG 0x04000000 //0000 0100 0000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE15_FLAG 0x08000000 //0000 1000 0000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE16_FLAG 0x10000000 //0001 0000 0000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE17_FLAG 0x20000000 //0010 0000 0000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE18_FLAG 0x40000000 //0100 0000 0000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE19_FLAG 0x80000000 //1000 0000 0000 0000
0000 0000 0000 0000

#define GESTURE_WAKEUP_MODE_RESERVE20_FLAG 0x00000001 //0000 0000 0000 0000


0000 0000 0000 0001
#define GESTURE_WAKEUP_MODE_RESERVE21_FLAG 0x00000002 //0000 0000 0000 0000
0000 0000 0000 0010
#define GESTURE_WAKEUP_MODE_RESERVE22_FLAG 0x00000004 //0000 0000 0000 0000
0000 0000 0000 0100
#define GESTURE_WAKEUP_MODE_RESERVE23_FLAG 0x00000008 //0000 0000 0000 0000
0000 0000 0000 1000
#define GESTURE_WAKEUP_MODE_RESERVE24_FLAG 0x00000010 //0000 0000 0000 0000
0000 0000 0001 0000
#define GESTURE_WAKEUP_MODE_RESERVE25_FLAG 0x00000020 //0000 0000 0000 0000
0000 0000 0010 0000
#define GESTURE_WAKEUP_MODE_RESERVE26_FLAG 0x00000040 //0000 0000 0000 0000
0000 0000 0100 0000
#define GESTURE_WAKEUP_MODE_RESERVE27_FLAG 0x00000080 //0000 0000 0000 0000
0000 0000 1000 0000
#define GESTURE_WAKEUP_MODE_RESERVE28_FLAG 0x00000100 //0000 0000 0000 0000
0000 0001 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE29_FLAG 0x00000200 //0000 0000 0000 0000
0000 0010 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE30_FLAG 0x00000400 //0000 0000 0000 0000
0000 0100 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE31_FLAG 0x00000800 //0000 0000 0000 0000
0000 1000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE32_FLAG 0x00001000 //0000 0000 0000 0000
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 13 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
0001 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE33_FLAG 0x00002000 //0000 0000 0000 0000
0010 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE34_FLAG 0x00004000 //0000 0000 0000 0000
0100 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE35_FLAG 0X00008000 //0000 0000 0000 0000
1000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE36_FLAG 0x00010000 //0000 0000 0000 0001
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE37_FLAG 0x00020000 //0000 0000 0000 0010
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE38_FLAG 0x00040000 //0000 0000 0000 0100
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE39_FLAG 0x00080000 //0000 0000 0000 1000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE40_FLAG 0x00100000 //0000 0000 0001 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE41_FLAG 0x00200000 //0000 0000 0010 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE42_FLAG 0x00400000 //0000 0000 0100 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE43_FLAG 0x00800000 //0000 0000 1000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE44_FLAG 0x01000000 //0000 0001 0000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE45_FLAG 0x02000000 //0000 0010 0000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE46_FLAG 0x04000000 //0000 0100 0000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE47_FLAG 0x08000000 //0000 1000 0000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE48_FLAG 0x10000000 //0001 0000 0000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE49_FLAG 0x20000000 //0010 0000 0000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE50_FLAG 0x40000000 //0100 0000 0000 0000
0000 0000 0000 0000
#define GESTURE_WAKEUP_MODE_RESERVE51_FLAG 0x80000000 //1000 0000 0000 0000
0000 0000 0000 0000
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 14 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
#endif //CONFIG_SUPPORT_64_TYPES_GESTURE_WAKEUP_MODE

#define GESTURE_WAKEUP_PACKET_LENGTH (6)


#endif //CONFIG_ENABLE_GESTURE_WAKEUP

At the beginning, there are13 types of gesture wakeup mode been defined for ILITEK/Mstar touch ICs
(double click, up direct, down direct, left direct, right direct, m~z character etc.). There also define 64
types of gesture wakeup mode if the compile option
CONFIG_SUPPORT_64_TYPES_GESTURE_WAKEUP_MODE is enabled. The constant value
named GESTURE_WAKEUP_PACKET_LENGTH at the last line is for MSG22xx and MSG28xx TP
firmware, which use the packet format of 0xA7 to report gesture information to Touch Device Driver.
The length of gesture wakeup packet is fixed as 6 Byte.

Do not modify the constant values.

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 15 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
2.1.2.5. Packet Type for 0xA7 Packet
#define PACKET_TYPE_TOOTH_PATTERN (0x20)
#define PACKET_TYPE_GESTURE_WAKEUP (0x50)
#define PACKET_TYPE_GESTURE_DEBUG (0x51)
#define PACKET_TYPE_GESTURE_INFORMATION (0x52)
#define PACKET_TYPE_ESD_CHECK_HW_RESET (0x60)

These constant values are packet types of 0xA7 packet used to report information to Touch Device
Driver from TP firmware. Given the returned packet type, Touch Device Driver can be able to
recognize of which one is sent by TP Firmware. Do not modify the constant values.

2.1.2.6. Maximum Input Register Number


#define MAX_DEBUG_REGISTER_NUM (10)

The constant value is to define how many numbers of register you can use for debugging. In this case,
there are 10 registers you can type with bank and address for reading a value of the register on Touch
IC through ADB commands.

2.1.2.7. Maximum Temp Update Firmware Buffer


#define MAX_UPDATE_FIRMWARE_BUFFER_SIZE (130)

The constant value is to define how much size of temp data buffer is used to update TP Firmware. The
size of buffer must be large enough to store different firmware size in the different need of Touch ICs.
Do not modify this constant value.

2.1.2.8. BIT0~BIT15 Value


#define BIT0 (1<<0) // 0x0001
#define BIT1 (1<<1) // 0x0002
#define BIT2 (1<<2) // 0x0004
#define BIT3 (1<<3) // 0x0008
#define BIT4 (1<<4) // 0x0010
#define BIT5 (1<<5) // 0x0020
#define BIT6 (1<<6) // 0x0040
#define BIT7 (1<<7) // 0x0080
#define BIT8 (1<<8) // 0x0100
#define BIT9 (1<<9) // 0x0200
#define BIT10 (1<<10) // 0x0400

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 16 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
#define BIT11 (1<<11) // 0x0800
#define BIT12 (1<<12) // 0x1000
#define BIT13 (1<<13) // 0x2000
#define BIT14 (1<<14) // 0x4000
#define BIT15 (1<<15) // 0x8000

The constant values define common values from Bit 0 to Bit 15. Do not modify these constant values.

2.1.2.9. Enable/Disable Kernel Log for Touch Device Driver

#define CONFIG_TOUCH_DRIVER_DEBUG_LOG_LEVEL (1)

The flag is used to enable a function outputting Kernel log while Touch Device Driver is running.
Usually it will be used to debug effectively at the stage of development, and close it when the stage
completes. This flat is enabled by default.

2.1.2.10. Maximum Finger Touch Number


#define MUTUAL_MAX_TOUCH_NUM (10)

The constant value is to define how many numbers of fingers support on mutual-capacity Touch ICs at
the same time. Do not modify this value.

2.1.2.11. Firmware Size


#define MSG22XX_FIRMWARE_MAIN_BLOCK_SIZE (48) //48K
#define MSG22XX_FIRMWARE_INFO_BLOCK_SIZE (512) //512Byte

// for MSG28xx/MSG58xx/MSG58xxA/ILI211xA
#define MSG28XX_FIRMWARE_MAIN_BLOCK_SIZE (128) //128K
#define MSG28XX_FIRMWARE_INFO_BLOCK_SIZE (2) //2K
#define MSG28XX_FIRMWARE_WHOLE_SIZE
(MSG28XX_FIRMWARE_MAIN_BLOCK_SIZE+MSG28XX_FIRMWARE_INFO_BLOCK_SIZE) //130K

#define ILITEK_ILI21XX_FIRMWARE_SIZE (160) // 160KB. The xxx.hex file size of ILI212X shall be smaller
than 160KB.

The constant values define the size of TP firmware for ILITEK’s mutual-capacitive
(ILI212x/ILI211xA), Mstar’s mutual-capacitive (MSG28xx/MSG58xx/MSG58xxA) and
self-capacitive (MSG22xx). The size is fixed and unchanged so do not modify it.
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 17 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
2.1.2.12. Firmware Mode
#define MSG22XX_FIRMWARE_MODE_DEMO_MODE (0x00)
#define MSG22XX_FIRMWARE_MODE_DEBUG_MODE (0x01)
#define MSG22XX_FIRMWARE_MODE_RAW_DATA_MODE (0x02)

// for MSG28xx/MSG58xx/MSG58xxA/ILI211xA#define MSG28XX_FIRMWARE_MODE_DEMO_MODE


(0x00)#define MSG28XX_FIRMWARE_MODE_DEBUG_MODE (0x01)
#define MSG22XX_FIRMWARE_MODE_RAW_DATA_MODE (0x02)

#define MSG28XX_FIRMWARE_MODE_UNKNOWN_MODE (0xFF)


#define MSG28XX_FIRMWARE_MODE_DEMO_MODE (0x00)
#define MSG28XX_FIRMWARE_MODE_DEBUG_MODE (0x01)

The constant values define Firmware mode for ILITEK’s mutual-capacitive (ILI212x/ILI211xA),
Mstar’s mutual-capacitive (MSG28xx/MSG58xx/MSG58xxA) and self-capacitive (MSG22xx). Each
value is fixed and unchanged so do not modify it.

2.1.2.13. SW ID
#ifdef CONFIG_UPDATE_FIRMWARE_BY_SW_ID
#define UPDATE_FIRMWARE_RETRY_COUNT (2)
#endif //CONFIG_UPDATE_FIRMWARE_BY_SW_ID

The constant value is to define retry count while updating TP firmware via SW ID mechanism at
power on stage. Changing the value depends on customer’s requirement.

2.1.3 Enumeration Value


This section will only explain fundermantal part of enumeration value as description. The rest of them
please refer to the ilitek_drv_common.h

2.1.3.1. SW ID
* Note.
* The following is sw id enum definition for MSG22XX.
* 0x0000 and 0xFFFF are not allowed to be defined as SW ID.
* SW_ID_UNDEFINED is a reserved enum value, do not delete it or modify it.
* Please modify the SW ID of the below enum value depends on the TP vendor that you are using.
*/
typedef enum {

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 18 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
MSG22XX_SW_ID_XXXX = 0x0001,
MSG22XX_SW_ID_YYYY = 0x0002,
MSG22XX_SW_ID_UNDEFINED = 0xFFFF
} Msg22xxSwId_e;

/*
* Note.
* The following is sw id enum definition for MSG28XX/MSG58XX/MSG58XXA/ILI2117A/ILI2118A.
* 0x0000 and 0xFFFF are not allowed to be defined as SW ID.
* SW_ID_UNDEFINED is a reserved enum value, do not delete it or modify it.
* Please modify the SW ID of the below enum value depends on the TP vendor that you are using.
*/
typedef enum {
MSG28XX_SW_ID_XXXX = 0x0001,
MSG28XX_SW_ID_YYYY = 0x0002,
MSG28XX_SW_ID_UNDEFINED = 0xFFFF
} Msg28xxSwId_e;
#endif //CONFIG_UPDATE_FIRMWARE_BY_SW_ID

The enumerations define SW IDs for ILITEK’s mutual-capacitive (ILI212x/ILI211xA), Mstar’s


mutual-capacitive (MSG28xx/MSG58xx/MSG58xxA) and self-capacitive (MSG22xx). The SW IDs
should be defined in Touch Devide Driver and TP firmware by depending on TP suppliers provided.
Modifing the SW IDs depends on customer’s requirement.

2.1.3.2. SPRD Platform


// TODO : Please FAE colleague to confirm with customer device driver engineer about the value of RST and
INT GPIO setting
#ifndef CONFIG_ENABLE_TOUCH_PIN_CONTROL
#define MS_TS_MSG_IC_GPIO_RST GPIO_TOUCH_RESET //53 //35
#define MS_TS_MSG_IC_GPIO_INT GPIO_TOUCH_IRQ //52 //37
#endif //CONFIG_ENABLE_TOUCH_PIN_CONTROL

#ifdef CONFIG_TP_HAVE_KEY
#define TOUCH_KEY_MENU (139) //229
#define TOUCH_KEY_HOME (172) //102
#define TOUCH_KEY_BACK (158)
#define TOUCH_KEY_SEARCH (217)

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 19 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
#define MAX_KEY_NUM (4)
#endif //CONFIG_TP_HAVE_KEY

If customers use SPRD platforms to develop products, please confirme with their engineers to set the
GPIO of INT and REST correctly. However, some BB Chips on SPRD platforms require Pin Control
mechanism to get them so that you need to enable the compile option
CONFIG_ENABLE_TOUCH_PIN_CONTROL in the specific situation. In addition, you are expected
to modify the definition of virtual key in Touch Device Driver as it is different with SPRD platform
that customers use.

2.1.3.3. QCOM Platform


// TODO : Please FAE colleague to confirm with customer device driver engineer about the value of RST and
INT GPIO setting
#ifndef CONFIG_ENABLE_TOUCH_PIN_CONTROL
#define MS_TS_MSG_IC_GPIO_RST 0
#define MS_TS_MSG_IC_GPIO_INT 1
#endif //CONFIG_ENABLE_TOUCH_PIN_CONTROL

#ifdef CONFIG_TP_HAVE_KEY
#define TOUCH_KEY_MENU (139) //229
#define TOUCH_KEY_HOME (172) //102
#define TOUCH_KEY_BACK (158)
#define TOUCH_KEY_SEARCH (217)

#define MAX_KEY_NUM (4)


#endif //CONFIG_TP_HAVE_KEY

If customers use QCOM platforms to develop products, please confirme with their engineers to set the
GPIO of INT and REST correctly. However, some BB Chips on QCOM platforms require Pin Control
mechanism to get them so that you need to enable the compile option
CONFIG_ENABLE_TOUCH_PIN_CONTROL in the specific situation. In addition, you are expected
to modify the definition of virtual key in Touch Device Driver as it is different with QCOM platform
that customers use.

2.1.3.4. MTK Platform


#ifndef CONFIG_PLATFORM_USE_ANDROID_SDK_6_UPWARD
#define MS_TS_MSG_IC_GPIO_RST (GPIO_CTP_RST_PIN)
#define MS_TS_MSG_IC_GPIO_INT (GPIO_CTP_EINT_PIN)
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 20 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
#endif //CONFIG_PLATFORM_USE_ANDROID_SDK_6_UPWARD

#ifdef CONFIG_TP_HAVE_KEY
#define TOUCH_KEY_MENU KEY_MENU
#define TOUCH_KEY_HOME KEY_HOMEPAGE
#define TOUCH_KEY_BACK KEY_BACK
#define TOUCH_KEY_SEARCH KEY_SEARCH

#define MAX_KEY_NUM (4)


#endif //CONFIG_TP_HAVE_KEY

If customers use MTK platforms with Android 5.x downward to develop products, the GPIO of INT
and RESET might not require to be modified as usual. However, if the system is Android 6.x upward
on, it is required to enable the compile option
CONFIG_PLATFORM_USE_ANDROID_SDK_6_UPWARD, Touch Device Driver will set up the
GPIOs somehow if the option is enabled. Also, the virtual keys in Touch Device Driver are not
necessary to modify if the platform is MTK.

2.2. Ilitek_drv_update.c
This section will explain all the functions used for upgrading Touch Firmware in ilitek_drv_update.c.

2.2.1.1. CRC Calculation


_DrvMsg28xxCalculateCrc (u32 nRef, s8 nCh);
_DrvMsg28xxGetFirmwareCrcByHardware(EmemType_e eEmemType) ;
_DrvMsg28xxRetrieveFirmwareCrcFromEFlash(EmemType_e eEmemType);
_DrvMsg28xxRetrieveFrimwareCrcFromBinFile(u8 szTmpBuf[][1024], EmemType_e eEmemType);

The functions are used to verify whether the CRC of TP firmware sent by an apk or SW ID
mechanism is correct or not.

2.2.1.2. Get Chip type


u16 DrvGetChipType(void)

The function is used to determine which format of IC report protocol is used by identifying the type of
Touch IC.

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 21 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
2.2.1.3. Upgrade Firmware
static s32 _DrvMsg22xxUpdateFirmware(u8 szFwData[][1024], EmemType_e eEmemType);
static s32 _DrvMsg28xxUpdateFirmware(u8 szFwData[][1024], EmemType_e eEmemType);
#ifdef CONFIG_UPDATE_FIRMWARE_BY_SW_ID
static void _DrvUpdateFirmwareBySwIdDoWork(struct work_struct *pWork);
#ifdef CONFIG_ENABLE_CHIP_TYPE_MSG22XX
static void _DrvMsg22xxCheckFirmwareUpdateBySwId(void);
#endif //CONFIG_ENABLE_CHIP_TYPE_MSG22XX
#ifdef CONFIG_ENABLE_CHIP_TYPE_MSG28XX
static void _DrvMsg28xxCheckFirmwareUpdateBySwId(void);
#endif //CONFIG_ENABLE_CHIP_TYPE_MSG28XX
#ifdef CONFIG_ENABLE_CHIP_TYPE_ILI21XX
static void _DrvIliTekCheckFirmwareUpdateBySwId(void);
#endif CONFIG_ENABLE_CHIP_TYPE_ILI21XX
#endif CONFIG_UPDATE_FIRMWARE_BY_SW_ID

The functions are used to upgrade TP firmware.

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 22 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
2.3. ilitek_drv_main.c
The transmission of data between ILITEK/Mstar’s APK and Touch Device Driver goes through Linux
proc virtual file system. The APK uses the file system to tell Touch Device Driver to update TP
firmware on Touch ICs or other operations. This section wil explain the functions used for that
propose in ilitek_drv_main.c for more details.

2.3.1 Function
The following only describes fundamental parts of the functions in ilitek_drv_main.c.

2.3.1.1. I2C Read/Write for TP Firmware or Touch IC


s32 IicWriteData(u8 nSlaveId, u8* pBuf, u16 nSize);
s32 IicReadData(u8 nSlaveId, u8* pBuf, u16 nSize);

The functions are used for I2C read/write by either SMBUS with TP Firwamre or DBBUS with Touch
IC.

2.3.1.2. I2C Read/Write for Register of Touch IC


extern u16 RegGet16BitValue(u16 nAddr);
extern u8 RegGetLByteValue(u16 nAddr);
extern u8 RegGetHByteValue(u16 nAddr);
extern void RegGetXBitValue(u16 nAddr, u8 * pRxData, u16 nLength, u16 nMaxI2cLengthLimit);
extern s32 RegSet16BitValue(u16 nAddr, u16 nData);
extern s32 RetryRegSet16BitValue(u16 nAddr, u16 nData);
extern void RegSetLByteValue(u16 nAddr, u8 nData);
extern void RegSetHByteValue(u16 nAddr, u8 nData);
extern void RegSet16BitValueOn(u16 nAddr, u16 nData);
extern void RegSet16BitValueOff(u16 nAddr, u16 nData);
extern u16 RegGet16BitValueByAddressMode(u16 nAddr, AddressMode_e eAddressMode);
extern void RegSet16BitValueByAddressMode(u16 nAddr, u16 nData, AddressMode_e eAddressMode);
extern void RegMask16BitValue(u16 nAddr, u16 nMask, u16 nData, AddressMode_e eAddressMode);

The function is used to transmite data between Touch Device Driver and the register of Touch IC by
DBBUS on I2C line.

2.3.1.3. Switch I2C to Use DBBUS


extern s32 DbBusEnterSerialDebugMode(void);
extern void DbBusExitSerialDebugMode(void);

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 23 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
extern void DbBusIICUseBus(void);
extern void DbBusIICNotUseBus(void);
extern void DbBusIICReshape(void);
extern void DbBusStopMCU(void);
extern void DbBusNotStopMCU(void);
extern void DbBusResetSlave(void);
extern void DbBusWaitMCU(void);

Before transmitting data with Touch IC by DDBUS on I2C line, you must use the functions to swtich
I2C to use DDBUS, and swtching to not use DBBUS after transmission.

2.3.1.4. DMA Mode


#ifdef CONFIG_ENABLE_DMA_IIC
extern void DmaAlloc(void);
extern void DmaReset(void);
extern void DmaFree(void);

The functions are used to deal with the limitation of I2C read/write for some BB chips on MTK
platforms. DmaAlloc executes once while Touch Device Driver is calling the register function at the
running stage, while DmaFree is executed once while unregisering before the system turns off. All the
functions that deal with the limitation and handle DMA mode (see IicWriteData and IicReadData
functions) have been completed in the newest version of Touch Device Driver, just notice that calling
DMARest before doing I2C read/write.

2.3.1.5. Device Driver Initialization


s32 DrvTouchDeviceInitialize(void);

The function is used to initialize Touch devices, such as creating a file node under the virtual file
system of proc, getting Chip Type from a Touch IC and so on.

2.3.1.6. Display Customer/Platform Firmware Version


static ssize_t _DrvProcfsCustomerFirmwareVersionRead(struct file *pFile, char __user *pBuffer, size_t nCount,
loff_t *pPos);
static ssize_t _DrvProcfsCustomerFirmwareVersionWrite(struct file *pFile, const char __user *pBuffer, size_t
nCount, loff_t *pPos);
static ssize_t _DrvProcfsPlatformFirmwareVersionRead(struct file *pFile, char __user *pBuffer, size_t nCount,
loff_t *pPos);
static ssize_t _DrvProcfsPlatformFirmwareVersionWrite(struct file *pFile, const char __user *pBuffer, size_t
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 24 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
nCount, loff_t *pPos);

The function is to deal with a request sent by an APK to check out the customer firmware version and
the platform firmware version via /proc.

2.3.1.7. Gesture Wakeup


#ifdef CONFIG_ENABLE_GESTURE_WAKEUP
static ssize_t _DrvProcfsGestureWakeupModeRead(struct file *pFile, char __user *pBuffer, size_t nCount, loff_t
*pPos);
static ssize_t _DrvProcfsGestureWakeupModeWrite(struct file *pFile, const char __user *pBuffer, size_t nCount,
loff_t *pPos);

#ifdef CONFIG_ENABLE_GESTURE_DEBUG_MODE
static ssize_t _DrvProcfsGestureDebugModeRead(struct file *pFile, char __user *pBuffer, size_t nCount, loff_t
*pPos);
static ssize_t _DrvProcfsGestureDebugModeWrite(struct file *pFile, const char __user *pBuffer, size_t nCount,
loff_t *pPos);
static ssize_t _DrvKObjectGestureDebugShow(struct kobject *pKObj, struct kobj_attribute *pAttr, char *pBuf);
static ssize_t _DrvKObjectGestureDebugStore(struct kobject *pKObj, struct kobj_attribute *pAttr, const char
*pBuf, size_t nCount);
#endif //CONFIG_ENABLE_GESTURE_DEBUG_MODE

#ifdef CONFIG_ENABLE_GESTURE_INFORMATION_MODE
static ssize_t _DrvProcfsGestureInforModeRead(struct file *pFile, char __user *pBuffer, size_t nCount, loff_t
*pPos);
static ssize_t _DrvProcfsGestureInforModeWrite(struct file *pFile, const char __user *pBuffer, size_t nCount,
loff_t *pPos);
#endif //CONFIG_ENABLE_GESTURE_INFORMATION_MODE
#endif //CONFIG_ENABLE_GESTURE_WAKEUP

The above functions are used to verify whether the gesture wakeup works well. The APK will read
from and write to the node under proc for communicating with Touch Device Driver. Once the driver
retrieves the command, it will tell TP firmware to enable or disable the function of geusture wakeup.
Both of gesture debug mode and gesture information mode can also be set by the upper layer.

#ifdef CONFIG_ENABLE_GESTURE_WAKEUP
extern void DrvOpenGestureWakeup(u32 *pMode);
extern void DrvCloseGestureWakeup(void);

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 25 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP

#ifdef CONFIG_ENABLE_GESTURE_DEBUG_MODE
extern void DrvOpenGestureDebugMode(u8 nGestureFlag);
extern void DrvCloseGestureDebugMode(void);
#endif //CONFIG_ENABLE_GESTURE_DEBUG_MODE
#endif //CONFIG_ENABLE_GESTURE_WAKEUP

The above functions are used as a gate to enable or disable the gesture wakeup and gesture debug
mode.

2.3.1.8. MP Test
#ifdef CONFIG_ENABLE_ITO_MP_TEST
ssize_t DrvProcfsMpTestRead(struct file *pFile, char __user *pBuffer, size_t nCount, loff_t *pPos);
ssize_t DrvProcfsMpTestWrite(struct file *pFile, const char __user *pBuffer, size_t nCount, loff_t *pPos);
ssize_t DrvProcfsMpTestLogRead(struct file *pFile, char __user *pBuffer, size_t nCount, loff_t *pPos);
ssize_t DrvProcfsMpTestLogWrite(struct file *pFile, const char __user *pBuffer, size_t nCount, loff_t *pPos);

extern ssize_t DrvProcfsMpTestFailChannelRead(struct file *pFile, char __user *pBuffer, size_t nCount, loff_t
*pPos);
extern ssize_t DrvProcfsMpTestFailChannelWrite(struct file *pFile, const char __user *pBuffer, size_t nCount,
loff_t *pPos);
extern ssize_t DrvProcfsMpTestScopeRead(struct file *pFile, char __user *pBuffer, size_t nCount, loff_t *pPos);
extern ssize_t DrvProcfsMpTestScopeWrite(struct file *pFile, const char __user *pBuffer, size_t nCount, loff_t
*pPos);

#ifdef CONFIG_ENABLE_CHIP_TYPE_MSG28XX
extern ssize_t DrvProcfsMpTestLogAllRead(struct file *pFile, char __user *pBuffer, size_t nCount, loff_t *pPos);
extern ssize_t DrvProcfsMpTestLogAllWrite(struct file *pFile, const char __user *pBuffer, size_t nCount, loff_t
*pPos);
#endif //CONFIG_ENABLE_CHIP_TYPE_MSG28XX
#endif //CONFIG_ENABLE_ITO_MP_TEST

When the APK reads from or writes to the data for MP Test via /proc, these functions handle the event
and reture results to the APK.

2.3.1.9. Firmware Debug Mode Data Log


#ifdef CONFIG_ENABLE_FIRMWARE_DATA_LOG
extern ssize_t DrvProcfsFirmwareModeRead(struct file *pFile, char __user *pBuffer, size_t nCount, loff_t
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 26 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
*pPos);
extern ssize_t DrvProcfsFirmwareModeWrite(struct file *pFile, const char __user *pBuffer, size_t nCount, loff_t
*pPos);
extern ssize_t DrvProcfsFirmwareSensorRead(struct file *pFile, char __user *pBuffer, size_t nCount, loff_t
*pPos);
extern ssize_t DrvProcfsFirmwareSensorWrite(struct file *pFile, const char __user *pBuffer, size_t nCount, loff_t
*pPos);
extern ssize_t DrvProcfsFirmwarePacketHeaderRead(struct file *pFile, char __user *pBuffer, size_t nCount,
loff_t *pPos);
extern ssize_t DrvProcfsFirmwarePacketHeaderWrite(struct file *pFile, const char __user *pBuffer, size_t
nCount, loff_t *pPos);
extern ssize_t DrvKObjectPacketShow(struct kobject *pKObj, struct kobj_attribute *pAttr, char *pBuf);
extern ssize_t DrvKObjectPacketStore(struct kobject *pKObj, struct kobj_attribute *pAttr, const char *pBuf,
size_t nCount);
#endif //CONFIG_ENABLE_FIRMWARE_DATA_LOG

When the APK reads from or writes to the data for switching firmware mode via /proc, these functions
handle the event and tell TP firmware switching to debug mode from demo mode. The Debug mode
outputs data log to a .csv file stored in T Card with a smart phone, and TP firmware colleagus can
analyze the file by MxViewer tool to find out firmware problems effectively.

2.3.1.10. Adb Command Debug


extern ssize_t DrvProcfsFirmwareDebugRead(struct file *pFile, char __user *pBuffer, size_t nCount, loff_t
*pPos);
extern ssize_t DrvProcfsFirmwareDebugWrite(struct file *pFile, const char __user *pBuffer, size_t nCount, loff_t
*pPos);
extern ssize_t DrvProcfsFirmwareSetDebugValueRead(struct file *pFile, char __user *pBuffer, size_t nCount,
loff_t *pPos);
extern ssize_t DrvProcfsFirmwareSetDebugValueWrite(struct file *pFile, const char __user *pBuffer, size_t
nCount, loff_t *pPos);
extern ssize_t DrvProcfsFirmwareSmBusDebugRead(struct file *pFile, char __user *pBuffer, size_t nCount,
loff_t *pPos);
extern ssize_t DrvProcfsFirmwareSmBusDebugWrite(struct file *pFile, const char __user *pBuffer, size_t
nCount, loff_t *pPos);

These functions are used to handle commands from ADB tool. The event is to read the register of
Touch IC for debugging, you can also type register values that you are looking for. The maximum
number of register is 10 as default and you can expand the number as you want. It can also set values

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 27 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
on the register of Touch IC or send SmBus commands to TP firmware.

2.3.1.11. Firmware Debug Mode Data Log


static u16 _DrvChangeFirmwareMode(u16 nMode) ;
static void DrvMutualGetFirmwareInfo(MutualFirmwareInfo_t *pInfo);
static u16 DrvGetFirmwareMode(void);
static void DrvRestoreFirmwareModeToLogDataMode(void);

These functions handle the event that tells TP firmware switching to debug mode from demo mode.
The Debug mode outputs data log to a .csv file stored in T Card with a smart phone, and TP firmware
colleagus can analyze the file by MxViewer tool to find out firmware problems effectively.

2.3.1.12. Update Firmware


static ssize_t _DrvProcfsFirmwareDataRead(struct file *pFile, char __user *pBuffer, size_t nCount, loff_t *pPos);
static ssize_t _DrvProcfsFirmwareDataWrite(struct file *pFile, const char __user *pBuffer, size_t nCount, loff_t
*pPos);
static ssize_t _DrvProcfsFirmwareUpdateRead(struct file *pFile, char __user *pBuffer, size_t nCount, loff_t
*pPos);
static ssize_t _DrvProcfsFirmwareUpdateWrite(struct file *pFile, const char __user *pBuffer, size_t nCount, loff_t
*pPos);
static ssize_t _DrvProcfsSdCardFirmwareUpdateRead(struct file *pFile, char __user *pBuffer, size_t nCount,
loff_t *pPos);
static ssize_t _DrvProcfsSdCardFirmwareUpdateWrite(struct file *pFile, const char __user *pBuffer, size_t
nCount, loff_t *pPos);

When the APK reads from or writes to the file or path for updating TP firmware via /proc, these
functions will update TP firmware based on the path and filename that users send.

2.3.1.13. SW ID
#ifdef CONFIG_UPDATE_FIRMWARE_BY_SW_ID
static void DrvCheckFirmwareUpdateBySwId(void);
#endif //CONFIG_UPDATE_FIRMWARE_BY_SW_ID

The function is used to check whether TP firmware needs to be updated via SW ID mechanism at the
stage of power on.

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 28 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
2.3.1.14. Optimize Current Consumption
extern void DrvOptimizeCurrentConsumption(void);

The function is to optimize curremnt cusomption of Touch IC in the power saving mode. This function
will only be called when the device is going to the sleep. Notice that the function is expected to
optimize some specific Touch ICs, such as mutual-capacitive (MSG28xx/MSG58xx/ILI211xA) and
self-capactive (MSG22xx).

2.3.1.15. Glove Mode


#ifdef CONFIG_ENABLE_GLOVE_MODE
static void DrvOpenGloveMode(void);
static void DrvCloseGloveMode(void);
static void DrvGetGloveInfo(u8 *pGloveMode);
#endif //CONFIG_ENABLE_GLOVE_MODE

The functions are used to open or close Glove mode of TP firmware.

2.3.1.16. Leather Sheath Mode


#ifdef CONFIG_ENABLE_LEATHER_SHEATH_MODE
static void DrvOpenLeatherSheathMode(void);
static void DrvCloseLeatherSheathMode(void);
static void DrvGetLeatherSheathInfo(u8 *pLeatherSheathMode);
#endif //CONFIG_ENABLE_LEATHER_SHEATH_MODE

The functions are used to open or close Leather Seath mode of TP firmware.

2.3.1.17. Input Device Registration


extern s32 DrvInputDeviceInitialize(struct i2c_client *pClient);

Given the difference of development platforms, the function will register a touch input device with
settings by the different compile option.

2.3.1.18. Enable/Disable Finger Touch


extern void DrvDisableFingerTouchReport(void);
extern void DrvEnableFingerTouchReport(void);

Given the difference of development platforms, the way to read finger touch packets is also slightly
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 29 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
different. The function is to handle the event by the different compile option.

2.3.1.19. Power On/Power Off Touch IC


extern void DrvTouchDevicePowerOff(void);
extern void DrvTouchDevicePowerOn(void);
#ifdef CONFIG_ENABLE_REGULATOR_POWER_ON
extern void DrvTouchDeviceRegulatorPowerOn(bool nFlag);
#endif //CONFIG_ENABLE_REGULATOR_POWER_ON
extern void DrvTouchDeviceHwReset(void);

Given the difference of development platforms, the way to power on or off Touch IC is also slightly
different. The function is to handle the event by the different compile option.

2.3.1.20. Report Touch Up/Touch Down to Input Sub-System


extern void DrvFingerTouchPressed(s32 nX, s32 nY, s32 nPressure, s32 nId);
extern void DrvFingerTouchReleased(s32 nX, s32 nY, s32 nId);

Given the difference of development platforms, the way to report finger touch information to Linux’s
input subsystem is also slightly different. The function is to handle the event by the different compile
option.

2.3.1.21. Interrupt Handler Registration


extern s32 DrvTouchDeviceRegisterFingerTouchInterruptHandler(void);

Given the difference of development platforms, the way to register interrupt hanlder for reading finger
touch packets is also slightly different. The function is to handle the event by the different compile
option.

2.3.1.22. Request GPIO Usage


extern s32 DrvTouchDeviceRequestGPIO(struct i2c_client *pClient);

Given the difference of development platforms, the way to request GPIO usage of INT pin and
RESET pin is also slightly different. The function is to handle the event by the different compile
option.

2.3.1.23. Set I2C Data Rate


extern void DrvSetIicDataRate(struct i2c_client *pClient, u32 nIicDataRate);
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 30 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
Given the difference of development platforms, the way to set I2C data rate is also slightly different.
Currently, MTK platforms are confirmed, while you need to make sure with customers about the way
if they are using SPRD/QCOM platforms.

2.3.1.24. Report Finger Touch by Coordinate


#ifdef CONFIG_ENABLE_REPORT_KEY_WITH_COORDINATE
#if defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM)
#define BUTTON_W (100)
#define BUTTON_H (100)

int g_TpVirtualKeyDimLocal[MAX_KEY_NUM][4] =
{{BUTTON_W/2*1,TOUCH_SCREEN_Y_MAX+BUTTON_H/2,BUTTON_W,BUTTON_H},{BUTTON_W/2*3,TO
UCH_SCREEN_Y_MAX+BUTTON_H/2,BUTTON_W,BUTTON_H},{BUTTON_W/2*5,TOUCH_SCREEN_Y_MA
X+BUTTON_H/2,BUTTON_W,BUTTON_H},{BUTTON_W/2*7,TOUCH_SCREEN_Y_MAX+BUTTON_H/2,BUT
TON_W,BUTTON_H}};
#endif // CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM
#endif //CONFIG_ENABLE_REPORT_KEY_WITH_COORDINATE

Since Touch Device Driver in MTK platforms reports coordinate instead of key codes to Linux’s input
subsystem, the coordinate of virtual key should be adjusted based on the size of touch panel in order
to get the correct position. You can modify the definitions in ilitek_drv_main.c.

2.3.1.25. Device Driver Initialization


extern s32 /*__devinit*/ MsDrvInterfaceTouchDeviceProbe(struct i2c_client *pClient, const struct i2c_device_id
*pDeviceId);

The function is as an interface used for different development platforms to initialize Touch Device
Driver.

2.3.1.26. Device Driver Suspend/Resume


#ifdef CONFIG_ENABLE_NOTIFIER_FB
extern int MsDrvInterfaceTouchDeviceFbNotifierCallback(struct notifier_block *pSelf, unsigned long nEvent, void
*pData);
#else
#ifdef CONFIG_PLATFORM_USE_ANDROID_SDK_6_UPWARD
extern void MsDrvInterfaceTouchDeviceResume(struct device *pDevice);
extern void MsDrvInterfaceTouchDeviceSuspend(struct device *pDevice);
#else
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 31 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
extern void MsDrvInterfaceTouchDeviceResume(struct early_suspend *pSuspend);
extern void MsDrvInterfaceTouchDeviceSuspend(struct early_suspend *pSuspend);
#endif //CONFIG_PLATFORM_USE_ANDROID_SDK_6_UPWARD
#endif //CONFIG_ENABLE_NOTIFIER_FB

The function is as an interface used for different development platforms to handle suspend/resume
event. For instance, if the platform is QCOM or SPRD, the compile option
CONFIG_ENABLE_NOTIFIER_FB must be enabled as it uses the method of Notify Callback to
retrieve suspend/resume notification.

2.3.1.27. Others
static void DrvVariableInitialize(void);
static void DrvGetCustomerFirmwareVersion(u16 *pMajor, u16 *pMinor, u8 **ppVersion);
static void DrvGetPlatformFirmwareVersion(u8 **ppVersion);
static void DrvHandleFingerTouch(void);
static s32 DrvUpdateFirmware(u8 szFwData[][1024], EmemType_e eEmemType);
static s32 DrvUpdateFirmwareBySdCard(const char *pFilePath);

These functions include Get Chip Type, Get customer/Platform Firmware version, update firmware by
APK and finger touch handling.

2.4. ilitek_drv _mp_test.h & ilitek_drv _mp_test.c


MP Test for mutual-capacitive (MSG26xxM/MSG28xx/ILI211xA) and self-capactive (MSG22xx) is
implemented in ilitek_drv _mp_test.h and ilitek_drv _mp_test.c.

2.4.1 Constant Value


This section will only explain fundermantal part of constant value as description. The rest of them
please refer to the ilitek_drv _mp_test.h

2.4.1.1. MP Test Retry Count


#define CTP_MP_TEST_RETRY_COUNT (3)

The constant value is about the retry count for MP Test. You can modify it given the customer’s need.

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 32 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
2.4.2 Function
This section will only explain fundermantal part of function as description. The rest of them please
refer to the ilitek_drv _mp_test.h and ilitek_drv _mp_test.c.

2.4.2.1. MP Test
extern void DrvMpTestCreateMpTestWorkQueue(void);
extern void DrvMpTestGetTestDataLog(ItoTestMode_e eItoTestMode, u8 *pDataLog, u32 *pLength);
extern void DrvMpTestGetTestFailChannel(ItoTestMode_e eItoTestMode, u8 *pFailChannel, u32
*pFailChannelCount);
extern s32 DrvMpTestGetTestResult(void);
#ifdef CONFIG_ENABLE_CHIP_TYPE_MSG28XX
extern void DrvMpTestGetTestScope(TestScopeInfo_t *pInfo);
extern void DrvMpTestGetTestLogAll(u8 *pDataLog, u32 *pLength);
#endif //CONFIG_ENABLE_CHIP_TYPE_MSG28XX
extern void DrvMpTestScheduleMpTestWork(ItoTestMode_e eItoTestMode);

When you plan to use the functions of MP Test, the above functions provide all you need. The
information includes the test result of open/short circuit, the data for testing short circuit etc., which
are all stored into a .csv file.

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 33 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
2.5. MTK Hotknot
MTK Hotknot is a protocol of transmitting data in the short distance. You can enable this function by
compile option called CONFIG_ENABLE_HOTKNOT in ilitek_drv_common.h. The Hotknot is
sending commands (or data) via the native layer by ioctl, and the relevant are all defined in
ilitek_drv_hotknot.c and ilitek_drv_hotknot.h

2.5.1 Hotknot Commands


The Hotknot commands can be divided into the three types: authentication, control/transmitting and
receieving. Each command has its own hanlding function. Tthe following lists the name of function in
order:

 void _DrvHandleHotKnotAuth(DrvCmd_t *pCmd)


 int _DrvHandleHotKnotCmd(DrvCmd_t *pCmd, unsigned long nArg)
 void _DrvHandleHotKnotRcv(DrvCmd_t *pCmd)

2.5.2 Hotknot Authentication Command


The authentication command is used to send a request to TP firmware in which verifies the Hotknot
protocol in a system. After TP firmware receieved the command, it will execute a function of
computation to verify Hotknot data and return the data to the device driver, and the device driver will
return the result to the native layer.

2.5.3 Hotknot Control/Transmitting command


When the device driver receives the transmitting command from the native layer, the device driver
sends data to TP firmware, and TP firmware then transmits it to a slave site from its site (or master
site). Note that the device driver is waiting for a result that will be sent back by TP firmware with its
interrupt hanlder after sent the command. If the device driver can not get the result in a specific time,
the timeout function will be active and send an error to the native layer. You can refer to the below
functions dealing with such an event:

 void ReportHotKnotCmd(u8 *pPacket, u16 nLength)


 void _HotKnotTimeOutHandler()

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 34 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
2.5.4 Hotknot Receiving command
If your device is slave, it turns into the transfer mode and waits for Hotknot data from a master to
receive. Once the device driver at the slave site retrieved the Hotknot data from TP firmware with its
interrupt hanlder, it will create a queue to store the data coming from the host. The following lists
some main functions that deal with the event:

 void CreateQueue() // create a queue


 PushQueue(u8 * pBuf, u16 nLength) // push data to a queue
 PopQueue(u8 * pBuf, u16 nLength) // get data from a queue
 DeleteQueue(void) // delete a queue

Note that the native layer will send a command to driver in a fixed time for checking if the Hotknot
data stores in a queue. The driver will return an error over the timeout.

2.5.5 Hotknot Shared library


MTK Hotknot provides three shard libraries and you must compile them with Touch Device Driver
together if enabled the compile option for Hotknot function. The two libraries, libhotknot.so and
libhotknot_dev.so, are in charge of hanlding the system call from the framework layer; MTK provides
the libraries in case. The last one calls libhotkont_vendor.so, which is responsible for building an
interface between the driver and firmware to make sure the communication smoothly.

2.5.6 How to verify Hotknot procotol


To verify Hotkot protocol working well between Touch Device Driver and firmware, you need to
install the shared library, libhotknot_vendor.so, and a test tool called hotknot_test. Please follow the
installation as bellow:

1. Install ADB tool.


2. Click the start menu to open Window console.
3. Install libhotknot_vendor.so and hotknot_test.
(a) adb root
(b) adb remount
(c) adb push <windows_path/ libhotknot_vender.so (for 32bit)> /system/lib
or
adb push <windows_path/ libhotknot_vender.so (for 64bit)> /system/lib64
(d) adb push <windows_path/hotknot_test> /system/bin
(e) adb shell chmod 755 /system/bin/hotknot_test
(f) adb reboot

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 35 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
4. Run hotknot_test
(a) adb shell
(b) ./system/bin/hotknot_test
5. Test Hotknot Authentication
(a) select “2. Authentication Test
6. Test Hotknot sending (master)
(a) select “3. Send Test”
7. Test Hotknot receiving (slaver)
(a) select “4. Receive Test”

If you run the transmitting test, the distance between the two devices should be closed as much as
possible. A successful message will show up, otherwise it fails.

2.5.7 Hotknot comprehensive verification


To run the test, you must install the other two libraries, libhotknot.so and libhotknot_dev.so. The
process of this installation is the same as the library libhotknot_vendor.so above, changing the
filename and the path that you saved. Once the installation is completed and successful, you will see
an option of Hotknot showing up in the settings of Android UI.

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 36 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
2.5.8 The stage of verification for Hotknot functions
In general, the stage of verification for Hotknot functions can be divided into three stages:

1. Firmware without Hotknot: The purpose of this stage is to ensure that the shared libraries can be
called successfully, and can also test the timeout function (it must be called becase the driver can not
be able to get any repsonses from the firmware).

2. Firmware with Pseudo Hotknot: The stage is to ensure that the communication between the native
layer and firmware is clear. At the stage, the data the driver received is not acutal information from a
device, which is generated by firmware in default.

3. Firmware with all Hotknot functions: In this stage the driver receives real data from the firmware that
can be used to test all Hotknot functions.

2.5.9 Pseudo Hotknot firmware


You are expected to be aware of the following before putting Pseudo Hotknot into the firmware.

1. The goal of Pseudo Hotknot is just for testing the functions of Hotknot only, not for touch finger
reports. It is better to finish the test of touch finger reports before updating Pseudo Hotknot to the
firmware.

2. If you realize that the touch is not working well after updated Pseudo Hotknot, you might need a
thrity party application ( ex: Android Screen Monitor) to control the screen.

2.6. ilitek_drv_sprd.c
If you are using a SPRO platform as your smart phone device, you can use the sample code on that
platform without any problems. However, there is a little bit modification for the compile and the use
of ILITD/Mstar Touch IC.

2.6.1 How to Register ILITEK/MStar Touch IC


You need to check the string in that sample colde that is taken to register ILITEK/Mstar Touch IC.
Both of the strings must be same.

#define MSG_TP_IC_NAME "msg2xxx"

// I2C bus register


static struct i2c_board_info __initdata i2c1_boardinfo[] = {

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 37 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
{ I2C_BOARD_INFO("msg2xxx", (0x4C>>1)), }, //SLAVE_I2C_ID_DWI2C
};

2.6.2 How to Compile ILITEK/MStar Touch Device Driver Code


The following is a Makefile used to build Touch device driver on SPRD platform.

obj-$(CONFIG_TOUCHSCREEN_MSG2238) += msg2238_ts.o

msg2238_ts-objs := ilitek_drv_sprd.o
msg2238_ts-objs += ilitek_drv_mp_test.o
msg2238_ts-objs += ilitek_drv_main.o
msg2238_ts-objs += ilitek_drv_update.o
msg2238_ts-objs += ilitek_drv_iliproc.o

2.7. ilitek_drv_qcom.c
If you are using a QCOM platform as your smart phone device, you can use the sample code on that
platform without any problems. However, there is a little bit modification for the compile and the use
of ILITK/Mstar Touch IC.

2.7.1 How to Register ILITEK/MStar Touch IC


You need to check the string in that sample colde that is taken to register ILITEK/Mstar Touch IC.
Both of the strings must be same.

#define MSG_TP_IC_NAME "msg2xxx"

// I2C bus register


static struct i2c_board_info __initdata i2c1_boardinfo[] = {
{ I2C_BOARD_INFO("msg2xxx", (0x4C>>1)), }, //SLAVE_I2C_ID_DWI2C
};

2.7.2 How to Compile ILITEK/MStar Touch Device Driver Code


Its Makefile is similar to the QCOM’s, you can refer to the aboe section to write the script.

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 38 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
2.8. ilitek_drv_mtk.c
If you are using a MTK platform as your smart phone device, you can use the sample code on that
platform without any problems. However, there is a little bit modification for the compile and the use
of ILITK/Mstar Touch IC.

2.8.1 How to Register ILITEK/MStar Touch IC


You need to check the string in that sample colde that is taken to register ILITEK/Mstar Touch IC.
Both of the strings must be same.

#define MSG_TP_IC_NAME "msg2xxx"

// I2C bus register


static struct i2c_board_info __initdata i2c_tpd = {I2C_BOARD_INFO(MSG_TP_IC_NAME, (0x4C>>1))};
//SLAVE_I2C_ID_DW I2C

2.8.2 How to Compile ILITEK/MStar Touch Device Driver Code


There are two diferent ways for compilation depending on which of platforms you are using.

If the platform is older (ex: MT6582/MT6589/..), you need to create a folder under the directory of
touch panel and put Touch Device Driver in there. Note that the name of the folder you created must
be the same as the name in that Makefile. In contrary, if the platform is newer (ex:
MT6735/MT6753/…), the way of compilation is similar to the way that SPRD and QCOM platforms
do.

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 39 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP

3. Trouble Shooting

3.1. The limitation for I2C read/write in MTK platform


As mentioned before, some BB chips in MTK platform have I2C read/write limitation. Apart from the
compile option, you may also need to understand what kinds of limitation are in the BB chip that
customer currently use. Generelly, in MTK codebase (ex: MT6582), you can find some related
information in the following file:

../mediatek/platform/mt6582/kernel/driver/i2c/mt_i2c.h

3.2. The efficiency of finger touch reports not well


What you can do for this problem is that you might check wheter the compile option for debug log is
disable or not, and remember that you must recompile again if you change anything in the driver. If
the problem still occurs, you may check that from the firmware.

3.3. Touch Panel is not working


If there is no any response from touch panel after integrated Touch Device Driver into a platform, you
might check the status as following first.

3.3.1 Does Touch IC power on ?


The below is a part of code for the function of power on. You should check with customers if the
power sequence needs to be modified.

#ifdef CONFIG_ENABLE_REGULATOR_POWER_ON
void DrvTouchDeviceRegulatorPowerOn(bool nFlag)
{
#if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) ||
defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM)
s32 nRetVal = 0;

DBG(&g_I2cClient->dev, "*** %s() ***\n", __func__);

if (nFlag == true)
{
nRetVal = regulator_enable(g_ReguVdd);
if (nRetVal)
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 40 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
{
DBG(&g_I2cClient->dev, "regulator_enable(g_ReguVdd) failed. nRetVal=%d\n", nRetVal);
}
mdelay(20);

nRetVal = regulator_enable(g_ReguVcc_i2c);
if (nRetVal)
{
DBG(&g_I2cClient->dev, "regulator_enable(g_ReguVcc_i2c) failed. nRetVal=%d\n", nRetVal);
}
mdelay(20);
}
else
{
nRetVal = regulator_disable(g_ReguVdd);
if (nRetVal)
{
DBG(&g_I2cClient->dev, "regulator_disable(g_ReguVdd) failed. nRetVal=%d\n", nRetVal);
}
mdelay(20);

nRetVal = regulator_disable(g_ReguVcc_i2c);
if (nRetVal)
{
DBG(&g_I2cClient->dev, "regulator_disable(g_ReguVcc_i2c) failed. nRetVal=%d\n", nRetVal);
}
mdelay(20);
}
#elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM)

#ifdef CONFIG_PLATFORM_USE_ANDROID_SDK_6_UPWARD
s32 nRetVal = 0;

DBG(&g_I2cClient->dev, "*** %s() ***\n", __func__);

if (nFlag == true)
{
nRetVal = regulator_enable(g_ReguVdd);
if (nRetVal)
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 41 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
{
DBG(&g_I2cClient->dev, "regulator_enable(g_ReguVdd) failed. nRetVal=%d\n", nRetVal);
}
mdelay(20);
}
else
{
nRetVal = regulator_disable(g_ReguVdd);
if (nRetVal)
{
DBG(&g_I2cClient->dev, "regulator_disable(g_ReguVdd) failed. nRetVal=%d\n", nRetVal);
}
mdelay(20);
}
#else
DBG(&g_I2cClient->dev, "*** %s() ***\n", __func__);

// hwPowerOn(MT6323_POWER_LDO_VGP1, VOL_2800, "TP"); // For specific MTK BB chip(ex. MT6582),


need to enable this function call for correctly power on Touch IC.
hwPowerOn(PMIC_APP_CAP_TOUCH_VDD, VOL_2800, "TP"); // For specific MTK BB chip(ex. MT6735),
need to enable this function call for correctly power on Touch IC.
#endif //CONFIG_PLATFORM_USE_ANDROID_SDK_6_UPWARD
#endif
}
#endif //CONFIG_ENABLE_REGULATOR_POWER_ON

3.3.2 Check I2C Bus ID and I2C slave address all correct
The one of root causes probably is the I2C not working so that you might check whether the I2C bus
and I2C Slave address are set properly.

#define I2C_BUS_ID (1) // i2c bus id : 0 or 1

static struct i2c_board_info __initdata i2c_tpd = {I2C_BOARD_INFO(MSG_TP_IC_NAME, (0x4C>>1))};


//SLAVE_I2C_ID_DW I2C

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 42 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
3.3.3 Check INT Pin and Rest Ping all correct
The two pings are pretty much important for Touch ICs. If the Reset pin is not correct, the Touch IC
can not be powered on and TP firmware can not be initialized. If the INT Pin is not correct, TP
firmware can not be able to use an interrupt hanlder to notify Touch Device Driver to get its data.
Check the two setting value MS_TS_MSG_IC_GPIO_RST and MS_TS_MSG_IC_GPIO_INT are
correct in ilitek_drv_common.h

3.4. The problem of communication between driver and Touch IC


If Touch Device Drive can not communicate with Touch IC via I2C, you might check the status as
following first.

3.4.1 Does Touch IC power on


The below is a part of code for the function of power on. You should check with customers if the
power sequence needs to be modified.

#ifdef CONFIG_ENABLE_REGULATOR_POWER_ONvoid DrvTouchDeviceRegulatorPowerOn(bool nFlag)


{
#if defined(CONFIG_TOUCH_DRIVER_RUN_ON_SPRD_PLATFORM) ||
defined(CONFIG_TOUCH_DRIVER_RUN_ON_QCOM_PLATFORM)
s32 nRetVal = 0;

DBG(&g_I2cClient->dev, "*** %s() ***\n", __func__);

if (nFlag == true)
{
nRetVal = regulator_enable(g_ReguVdd);
if (nRetVal)
{
DBG(&g_I2cClient->dev, "regulator_enable(g_ReguVdd) failed. nRetVal=%d\n", nRetVal);
}
mdelay(20);

nRetVal = regulator_enable(g_ReguVcc_i2c);
if (nRetVal)
{
DBG(&g_I2cClient->dev, "regulator_enable(g_ReguVcc_i2c) failed. nRetVal=%d\n", nRetVal);
}
mdelay(20);
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 43 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
}
else
{
nRetVal = regulator_disable(g_ReguVdd);
if (nRetVal)
{
DBG(&g_I2cClient->dev, "regulator_disable(g_ReguVdd) failed. nRetVal=%d\n", nRetVal);
}
mdelay(20);

nRetVal = regulator_disable(g_ReguVcc_i2c);
if (nRetVal)
{
DBG(&g_I2cClient->dev, "regulator_disable(g_ReguVcc_i2c) failed. nRetVal=%d\n", nRetVal);
}
mdelay(20);
}
#elif defined(CONFIG_TOUCH_DRIVER_RUN_ON_MTK_PLATFORM)

#ifdef CONFIG_PLATFORM_USE_ANDROID_SDK_6_UPWARD
s32 nRetVal = 0;

DBG(&g_I2cClient->dev, "*** %s() ***\n", __func__);

if (nFlag == true)
{
nRetVal = regulator_enable(g_ReguVdd);
if (nRetVal)
{
DBG(&g_I2cClient->dev, "regulator_enable(g_ReguVdd) failed. nRetVal=%d\n", nRetVal);
}
mdelay(20);
}
else
{
nRetVal = regulator_disable(g_ReguVdd);
if (nRetVal)
{
DBG(&g_I2cClient->dev, "regulator_disable(g_ReguVdd) failed. nRetVal=%d\n", nRetVal);
The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 44 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.
2
ILI TP I C Programming Guide ILI TP
}
mdelay(20);
}
#else
DBG(&g_I2cClient->dev, "*** %s() ***\n", __func__);

// hwPowerOn(MT6323_POWER_LDO_VGP1, VOL_2800, "TP"); // For specific MTK BB chip(ex. MT6582),


need to enable this function call for correctly power on Touch IC.
hwPowerOn(PMIC_APP_CAP_TOUCH_VDD, VOL_2800, "TP"); // For specific MTK BB chip(ex. MT6735),
need to enable this function call for correctly power on Touch IC.
#endif //CONFIG_PLATFORM_USE_ANDROID_SDK_6_UPWARD
#endif
}
#endif //CONFIG_ENABLE_REGULATOR_POWER_ON

3.4.2 The I2C Slave addres of DBBUS is correct


Since Touch Device Driver is communicating with Touch IC by I2C with DBBUS, you need to check
if the I2C slave addres of DBBUS is correct.

SLAVE_I2C_ID_DBBUS :
(0xB2>>1) //0x59 //for MSG22xx
(0xC4>>1) //0x62 //for MSG21xxA/MSG26xxM/MSG28xx/MSG58xx/ILI211xA

3.5. The problem of building Kernel in MTK platform


When the kernel is being compiled, the process will copy the latest kernel’s source code under
kernel\mediatek\custom\out\kernel\touchpanel and compile it at this directory. But here is a problem.
If you attempt to revert the source code to an old version, these older may not be copied by the
compiler. It is better to clean all compiled code after any modifications.

The information contained herein is the exclusive property of ILI Technology Corp. and shall not be distributed,
reproduced, or disclosed in whole or in part without prior written permission of ILI Technology Corp.
Page 45 of 45 Version: 1.00
Copyright © 2017 ILI Technology Corp. All Rights Reserved.
ILI Confidential Disclosed Under NDA.

You might also like