1. DTS 
Refer to sample.dtsi. Accordin to platform GPIO number to modify 'irq-gpio' and 'rst-gpio'.
Note: You can use gpio_to_irq() to map the 'irq-gpio' number to its IRQ number

2. Select the platform, bus type and boot type from sitronix_ts.h

Platform:
	#define SITRONIX_PLATFORM_NORMAL
	//#define SITRONIX_PLATFORM_SPRD
	//#define SITRONIX_PLATFORM_MTK_TDP
	//#define SITRONIX_PLATFORM_QUALCOMM_DRM

BUS interface:
	#define SITRONIX_INTERFACE_I2C
	//#define SITRONIX_INTERFACE_SPI

Boot type:	define SITRONIX_TP_WITH_FLASH for flash boot, otherwise for host download.
	#define SITRONIX_TP_WITH_FLASH
	For host download usage, put dump file (firmware + CFG) into the foloder or request_firmware().
	The folder depends on platform.


3. Kernel log will contains following messages after adding the touch device driver:

<6>[   31.029470] [ST MSG] Sitronix ST7123 Touch Driver v43.00.220505
<6>[   31.029532] [ST MSG] sitronix_ts_spi_parse_dt: SPI max frequency = 8000000.
<6>[   31.029641] [ST MSG] sitronix_ts_spi_parse_dt: Interrupt GPIO = 143. (flag=0)
<6>[   31.029674] [ST MSG] sitronix_ts_spi_parse_dt: Reset GPIO = 145. (flag=0)
<6>[   31.029681] [ST MSG] sitronix_ts_spi_parse_dt: SPI Mode = 3.
<6>[   31.039394] [ST MSG] start of sitronix_ts_probe
<6>[   31.039403] [ST MSG] sitronix_ts_reset_device: Hardware Reset device.
<6>[   31.055312] [ST MSG] IC SFR VER = 0x43
<6>[   31.056484] [ST MSG] Display id = 0x80 0xA0 0xFB
<6>[   31.062006] [ST MSG] TOUCH_FW_INFO offset = 0xDFA4
<6>[   31.062016] [ST MSG] fwOff = 0x0
<6>[   31.062024] [ST MSG] fwSize = 0xDFB8
<6>[   31.062033] [ST MSG] fwInfoOff = 0xDFA4
<6>[   31.062041] [ST MSG] cfgFlashOff = 0x10000
<6>[   31.062049] [ST MSG] cfgDramOff = 0x300
<6>[   31.062057] [ST MSG] cfgSize = 0xA7C
<6>[   31.062067] [ST MSG] sitronix_ts_reset_device: Hardware Reset device.
<6>[   31.463548] [ST MSG] sitronix_spi_hdl_fw success
<6>[   31.516634] [ST MSG] buf = 0, 0, 0, 0, 2, D0, 6, 40
<6>[   31.516663] [ST MSG] Status register = 0.
<6>[   31.517213] [ST MSG] FW Version (hex) = 2
<6>[   31.517825] [ST MSG] FW revision (hex) = 1 17 1 17
<6>[   31.519438] [ST MSG] Customer Info (hex) = 0 0 6 1
<6>[   31.520500] [ST MSG] Resolution = 720 x 1600
<6>[   31.521036] [ST MSG] Max touches = 10.
<6>[   31.521573] [ST MSG] Chip ID = 0x83.
<6>[   31.535712] [ST MSG] X_chs = 18.
<6>[   31.535740] [ST MSG] Y_chs = 32.
<6>[   31.536281] [ST MSG] Misc. Info = 0x8F.

Note:
[ST MSG] IC SFR VER = 0x43 
The IC SFR verison could be 0x43 or other number. If the value of IC SFR VER is 0x00 or 0xFF, the communication bus (SPI or I2C) might not be ready.

[ST MSG] FW revision (hex) = 1 17 1 17
If the revision is in different format, the firmware could be incorrect. Please update the firmware.

If messages are correct, but the touch function did not work. Please contact with FAE for touch performance tuning.


3. Smart wakeup (SWK) feature
If the SWK was not supported, comment #define SITRONIX_SUPPORT_SWU of sitronix_ts.h to disable SWK.

SWK gesutre and key code mapping:
typedef enum {
	ST_KEY_GESTURE_POWER		= KEY_POWER,
	ST_KEY_GESTURE_LEFT		= KEY_LEFT,
	ST_KEY_GESTURE_RIGHT		= KEY_RIGHT,
	ST_KEY_GESTURE_UP		= KEY_UP,
	ST_KEY_GESTURE_DOWN		= KEY_DOWN,
	ST_KEY_GESTURE_TWO_FINGER_DOWN	= KEY_DOWN,
	ST_KEY_GESTURE_U		= KEY_U,
	ST_KEY_GESTURE_O		= KEY_O,
	ST_KEY_GESTURE_E		= KEY_E,
	ST_KEY_GESTURE_M		= KEY_M,
	ST_KEY_GESTURE_W		= KEY_W,
	ST_KEY_GESTURE_L		= KEY_L,
	ST_KEY_GESTURE_S		= KEY_S,
	ST_KEY_GESTURE_V		= KEY_V,
	ST_KEY_GESTURE_Z		= KEY_Z,
	ST_KEY_GESTURE_C		= KEY_C
} SWU_KEYCODE;

SWK ON/OFFG
The function, int sitronix_mode_switch(int modeID, bool flag), is in sitronix_st7123_utility.c.

The 'modeID' of SWK is 1. 
Set the 'flag' as 'true' to enable SWK, 'false' to disable SWK.

The touch device creates both 'sysfs' and 'device node' to enable or disable SWK:
	(1) /sys/sitronix_ts_attrs/stmodeswitch
		"echo 01 00 > /sys/sitronix_ts_attrs/stmodeswitch"    //disable SWK
		"echo 01 01 > /sys/sitronix_ts_attrs/stmodeswitch"    //enable SWK

	(2) /proc/sitronix/swu
		"echo off > /proc/sitronix/swu"	//disable SWK
		"echo on > /proc/sitronix/swu"	//enable SWK
		

4.Self test

	After executing the Self test, normal / open / short / uniformity (currently only collecting data, default disabled) / STD (RAW data stability) test will be performed.
	Settings and functions are located in sitronix_ts_test.c
	After execution, a test file will be created:
	#define ST_SELFTEST_LOG_PATH "/sdcard/ST_SELFTEST_LOG.txt"

	Currently existing external test entry points:
	/sys/sitronix_ts_attrs/stselftest
	"echo 1 > /sys/sitronix_ts_attrs/stselftest" starts the test
	"cat /sys/sitronix_ts_attrs/stselftest" to see the test results

	Or the program calls: void sitronix_touch_selftest(void) to start the test
	int sitronix_selftest_result_read(void) Get test results, 1 ok, 0 fail

	Modify the test condition value:
	- According to the applied TDDI IC (ST7123/ST7121P/ST7123P), open the following define of the corresponding IC in sitronix_ts_test.c and block other IC define (such as opening SITRONIX_TEST_ST7123).

	#define SITRONIX_TEST_ST7123
	//#define SITRONIX_TEST_ST7121P
	//#define SITRONIX_TEST_ST7123P

	- ST7123:
		a. Open #define ST_REQUEST_SELF_TEST_INI in sitronix_ts_test_st7123.h, and load the ini file in request_firmware mode.
			The default test criteria file name is "st_selftest_criteria.ini" and can be set by #define ST_SELFTEST_INI_PATH.
			If it is not enabled, the default define value in sitronix_ts_test_st7123.h is used.
		b. Adjust the default test criterias: (set in sitronix_ts_test_st7123.h, the setting value can be relaxed according to the mass production criteria value of the module)
			- Normal Rawdata Test: ST_SELFTEST_NORMAL_MIN, ST_SELFTEST_NORMAL_MAX
			- Open Test:			ST_SELFTEST_OPEN_MIN, ST_SELFTEST_OPEN_MIN
			- Short Test:			ST_SELFTEST_SHORT_MAX
			- Uniformity Test:		ST_SELFTEST_UNIFORMITY_MIN, ST_SELFTEST_UNIFORMITY_MAX
			- STD Test:				ST_SELFTEST_STD_MAX
	- ST7121P:
		a. Open #define ST_REQUEST_SELF_TEST_INI in sitronix_ts_test_st7121p.h, and load the ini file in request_firmware mode.
			The default test criteria file name is "st_selftest_criteria.ini" and can be set by #define ST_SELFTEST_INI_PATH.
			If it is not enabled, the default define value in sitronix_ts_test_st7121p.h is used.
		b. Adjust the default test criterias: (set in sitronix_ts_test_st7121p.h, the setting value can be relaxed according to the mass production criteria value of the module)
			- Normal Rawdata Test:	ST_SELFTEST_NORMAL_MIN, ST_SELFTEST_NORMAL_MAX
			- Open MUX On/Off Test:	ST_SELFTEST_OPEN_MUX_ON_OFF_MIN
			- Short Test:			ST_SELFTEST_SHORT_MAX
			- Uniformity Test:		ST_SELFTEST_UNIFORMITY_MIN, ST_SELFTEST_UNIFORMITY_MAX
			- STD Test:				ST_SELFTEST_STD_MAX
	- ST7123P:
		a. Open #define ST_REQUEST_SELF_TEST_INI in sitronix_ts_test_st7123p.h and load the ini file in request_firmware mode.
			The default test criteria file name is "st_selftest_criteria.ini" and can be set by #define ST_SELFTEST_INI_PATH.
			If it is not enabled, the default define value in sitronix_ts_test_st7123p.h is used.
		b. Adjust the default test criterias: (set in sitronix_ts_test_st7123p.h, the setting value can be relaxed according to the mass production criteria value of the module)
			- Normal Rawdata Test:	ST_SELFTEST_NORMAL_MIN, ST_SELFTEST_NORMAL_MAX
			- Open MUX On/Off Test:	ST_SELFTEST_OPEN_MUX_ON_OFF_MIN
			- Short Test:			ST_SELFTEST_SHORT_MAX
			- Uniformity Test:		ST_SELFTEST_UNIFORMITY_MIN, ST_SELFTEST_UNIFORMITY_MAX
			- STD Test:				ST_SELFTEST_STD_MAX

5. Touch performance tuning
Please proivde root privilege and SOP of kernel image upgrading for TP tuning.


6. The GRIP function is used for handling the rotaion of the device.
The funcion, int sitronix_mode_switch_value(int modeID, bool flag, unsigned char value), is in sitronix_st7123_utility.c.
The 'modeID' of GRIP is 7. 
Set the 'flag' as 'true' to enable SWK, 'false' to disable SWK.
Set the 'value' for rotation, the degree is in clockwise.
typedef enum {
	ST_MODE_GRIP_ROTATE_0		=	0,
	ST_MODE_GRIP_ROTATE_90		=	1,
	ST_MODE_GRIP_ROTATE_180		=	2,
	ST_MODE_GRIP_ROTATE_270		=	3,	
} ST_MODE_GRIP_ROTATE_VALUE;

The deivce nodes for GRIP are:
	(1)/sys/sitronix_ts_attrs/stmodeswitch
		"echo 07 0 > /sys/sitronix_ts_attrs/stmodeswitch"			//Turn on GRIP, set value as ST_MODE_GRIP_ROTATE_0
		"echo 07 1 > /sys/sitronix_ts_attrs/stmodeswitch" 			//Turn on GRIP, set value as ST_MODE_GRIP_ROTATE_90
		"echo 07 2 > /sys/sitronix_ts_attrs/stmodeswitch"			//Turn on GRIP, set value as ST_MODE_GRIP_ROTATE_180
		"echo 07 3 > /sys/sitronix_ts_attrs/stmodeswitch"			//Turn on GRIP, set value as ST_MODE_GRIP_ROTATE_270
		"echo 07 {not 0 1 2 3} > /sys/sitronix_ts_attrs/stmodeswitch"	//Trun off GRIP

	(2)/proc/sitronix/grip
		"echo 0 > /proc/sitronix/grip"		//Turn on GRIP, set value as ST_MODE_GRIP_ROTATE_0
		"echo 90 > /proc/sitronix/grip"		//Turn on GRIP, set value as ST_MODE_GRIP_ROTATE_90
		"echo 180 > /proc/sitronix/grip"	//Turn on GRIP, set value as ST_MODE_GRIP_ROTATE_180
		"echo 270 > /proc/sitronix/grip"	//Turn on GRIP, set value as ST_MODE_GRIP_ROTATE_270
		"echo on > /proc/sitronix/grip"		//Turn on GRIP, keep the last rotation.
		"echo off > /proc/sitronix/grip"	//Trun off GRIP



7. /proc/sitronix/headphone
	adb shell "echo on > /proc/sitronix/headphone"	//enable headphone suppression
	adb shell "echo off > /proc/sitronix/headphone"	//disable headphone suppression

8.  /proc/sitronix/glove
	adb shell "echo on > /proc/sitronix/glove"	//enable GLOVE mode
	adb shell "echo off > /proc/sitronix/glove"	//disable GLOVE mode

========================================================================

