Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    2)  * drivers/input/touchscreen/gsl_thzy.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    4)  * Copyright (c) 2012 Shanghai Basewin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    5)  *	Guan Yuwei<guanyuwei@basewin.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    7)  *  This program is free software; you can redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    8)  *  it under the terms of the GNU General Public License version 2 as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    9)  *  published by the Free Software Foundation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   11) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   12) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   13) #include <linux/hrtimer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   14) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   15) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   16) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   17) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   18) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   19) #include <linux/async.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   20) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   21) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   22) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   23) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   24) #include <linux/proc_fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   25) #include <linux/input/mt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   26) #include <linux/wakelock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   28) #include "../tp_suspend.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   29) #include <linux/of_gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   30) #define GSL_DEBUG 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   32) #define TP2680A_ID	0x88
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   33) #define TP2680B_ID	0x82
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   34) #ifdef GSLX680_COMPATIBLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   35) static char chip_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   36) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   38) #if defined(CONFIG_BOARD_TYPE_ZM1128CE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   39) 		extern int axp_gpio_set_value(int gpio, int io_state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   40) 		extern int axp_gpio_set_io(int, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   41) 		#define PMU_GPIO_NUM    2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   42) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   44) /* RK3326 platform board */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   45) #if defined(CONFIG_BOARD_RK3326_AK47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   46) #include "rk3326_ak47.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   47) #elif defined(CONFIG_BOARD_RK3326_TH700)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   48) #include "rk3326_th700.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   49) #elif defined(CONFIG_BOARD_RK3326_TH863B_10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   50) #include "rk3326_th863_10.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   51) #elif defined(CONFIG_BOARD_RK3326_TH863B_8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   52) #include "rk3326_th863_8.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   53) #elif defined(CONFIG_BOARD_RK3326_TH1021DN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   54) #include "rk3326_th1021dn.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   55) #elif defined(CONFIG_BOARD_RK3326_TH1021DN_V20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   56) #include "rk3326_th1021dn_v20.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   57) #elif defined(CONFIG_BOARD_RK3326_TH863B_7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   58) #include "rk3326_th863_7.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   59) #elif defined(CONFIG_BOARD_RK3326_TH863B_V31_7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   60) #include "rk3326_th863_v31_7.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   61) #elif defined(CONFIG_BOARD_RK3326_TH7926_7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   62) #include "rk3326_th7926_7.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   63) #elif defined(CONFIG_BOARD_RK3326_TH7926_9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   64) #include "rk3326_th7926_9.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   65) #elif defined(CONFIG_BOARD_RK3326_MT1011)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   66) #include "rk3326_mt1011.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   67) #elif defined(CONFIG_BOARD_RK3326_M1011QR)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   68) #include "rk3326_m1011qr.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   70) /* RK3126C platform board */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   71) #elif defined(CONFIG_BOARD_RK3126C_TH1021DN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   72) #include "rk3126c_th1021dn.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   73) #elif defined(CONFIG_BOARD_RK3126C_AK47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   74) #include "rk3126c_ak47.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   75) #elif defined(CONFIG_BOARD_RK3126C_TH863_7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   76) #include "rk3126c_th863_7.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   77) #elif defined(CONFIG_BOARD_RK3126C_TH863_8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   78) #include "rk3126c_th863_8.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   79) #elif defined(CONFIG_BOARD_RK3126C_TH98V)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   80) #include "rk3126c_th98v.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   82) /* RK3368 platform board */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   83) #elif defined(CONFIG_BOARD_RK3368_TH863C_10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   84) #include "rk3368_th863c_10.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   86) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   87) #include "rk3368_th863c_10.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   88) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   93) #define REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   94) #define SLEEP_CLEAR_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   96) #ifdef FILTER_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   97) #define FILTER_MAX	9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   98) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  100) #define GSL_I2C_NAME	"gsl_thzy"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  101) #define GSL_I2C_ADDR	0x40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  103) #define GSL_DATA_REG		0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  104) #define GSL_STATUS_REG		0xe0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  105) #define GSL_PAGE_REG		0xf0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  107) #define TPD_PROC_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  108) #ifdef TPD_PROC_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  109) #include <linux/proc_fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  110) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  111) #define GSL_CONFIG_PROC_FILE "gsl_config"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  112) #define CONFIG_LEN 31
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  113) static char gsl_read[CONFIG_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  114) static u8 gsl_data_proc[8] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  115) static u8 gsl_proc_flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  116) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  117) #define PRESS_MAX			255
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  118) #define MAX_FINGERS			10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  119) #define MAX_CONTACTS		10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  120) #define DMA_TRANS_LEN		0x20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  121) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  122) static struct delayed_work gsl_monitor_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  123) static struct workqueue_struct *gsl_monitor_workqueue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  124) static u8 int_1st[4] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  125) static u8 int_2nd[4] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  126) static char b0_counter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  127) static char bc_counter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  128) static char i2c_lock_flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  129) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  131) static struct gsl_ts *this_ts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  132) static struct i2c_client *gsl_client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  133) #define WRITE_I2C_SPEED 350000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  134) #define I2C_SPEED  200000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  135) #define CLOSE_TP_POWER   0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  138) #ifdef HAVE_TOUCH_KEY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  139) static u16 key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  140) static int key_state_flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  141) struct key_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  142) 	u16 key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  143) 	u16 x_min;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  144) 	u16 x_max;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  145) 	u16 y_min;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  146) 	u16 y_max;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  147) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  149) const u16 key_array[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  150) 	KEY_HOMEPAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  151) 	KEY_BACK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  152) 	KEY_MENU,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  153) 	KEY_SEARCH,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  154) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  156) #define MAX_KEY_NUM     ARRAY_SIZE(key_array)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  158) struct key_data gsl_key_data[MAX_KEY_NUM] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  159) 	{KEY_HOMEPAGE, 860, 880, 1550, 1570},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  160) 	{KEY_BACK, 2048, 2048, 2048, 2048},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  161) 	{KEY_MENU, 2048, 2048, 2048, 2048},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  162) 	{KEY_SEARCH, 2048, 2048, 2048, 2048},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  163) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  164) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  166) struct gsl_ts_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  167) 	u8 x_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  168) 	u8 y_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  169) 	u8 z_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  170) 	u8 id_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  171) 	u8 touch_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  172) 	u8 data_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  173) 	u8 status_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  174) 	u8 data_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  175) 	u8 touch_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  176) 	u8 update_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  177) 	u8 touch_meta_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  178) 	u8 finger_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  179) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  181) static struct gsl_ts_data devices[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  182) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  183) 		.x_index = 6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  184) 		.y_index = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  185) 		.z_index = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  186) 		.id_index = 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  187) 		.data_reg = GSL_DATA_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  188) 		.status_reg = GSL_STATUS_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  189) 		.update_data = 0x4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  190) 		.touch_bytes = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  191) 		.touch_meta_data = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  192) 		.finger_size = 70,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  193) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  194) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  196) struct gsl_ts {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  197) 	struct i2c_client *client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  198) 	struct input_dev *input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  199) 	struct work_struct work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  200) 	struct workqueue_struct *wq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  201) 	struct gsl_ts_data *dd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  202) 	u8 *touch_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  203) 	u8 device_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  204) 	int irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  205) 	int rst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  206) 	int flag_irq_is_disable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  207) 	spinlock_t irq_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  208) 	struct tp_device  tp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  209) 	struct work_struct download_fw_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  210) 	struct work_struct resume_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  211) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  213) #if GSL_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  214) #define print_info(fmt, args...)   \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  215) 		do {                              \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  216) 			printk(fmt, ##args);     \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  217) 		} while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  218) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  219) #define print_info(fmt, args...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  220) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  222) static u32 id_sign[MAX_CONTACTS + 1] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  223) static u8 id_state_flag[MAX_CONTACTS + 1] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  224) static u8 id_state_old_flag[MAX_CONTACTS + 1] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  225) static u16 x_old[MAX_CONTACTS + 1] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  226) static u16 y_old[MAX_CONTACTS + 1] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  227) static u16 x_new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  228) static u16 y_new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  231) static int gsl_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  232) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  233) 	struct device_node *np = gsl_client->dev.of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  234) 	enum of_gpio_flags rst_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  235) 	unsigned long irq_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  237) 	this_ts->irq = of_get_named_gpio_flags(np, "irq_gpio_number", 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  238) 				(enum of_gpio_flags *)&irq_flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  239) 	this_ts->rst = of_get_named_gpio_flags(np, "rst_gpio_number", 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  240) 				&rst_flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  241) 	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  242) 	if (gpio_is_valid(this_ts->rst)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  243) 	if (devm_gpio_request(&this_ts->client->dev, this_ts->rst, NULL) != 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  244) 		dev_err(&this_ts->client->dev, "gpio_request this_ts->rst error\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  245) 		return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  246) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  247) 		gpio_direction_output(this_ts->rst, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  248) 		gpio_set_value(this_ts->rst, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  249) 	}else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  250) 		dev_info(&this_ts->client->dev, "rst pin invalid\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  251) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  252) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  253) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  254) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  256) static int gsl_shutdown_low(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  257) {	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  258) 	if (gpio_is_valid(this_ts->rst))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  259) 		gpio_set_value(this_ts->rst, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  260) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  261) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  263) static int gsl_shutdown_high(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  264) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  265) 	if (gpio_is_valid(this_ts->rst))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  266) 		gpio_set_value(this_ts->rst, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  267) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  268) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  270) static inline u16 join_bytes(u8 a, u8 b)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  271) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  272) 	u16 ab = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  274) 	ab = ab | a;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  275) 	ab = ab << 8 | b;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  276) 	return ab;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  277) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  278) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  279) static u32 gsl_write_interface(struct i2c_client *client, const u8 reg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  280) 				u8 *buf, u32 num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  281) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  282) 	struct i2c_msg xfer_msg[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  283) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  284) 	buf[0] = reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  285) 	xfer_msg[0].addr = client->addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  286) 	xfer_msg[0].len = num + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  287) 	xfer_msg[0].flags = client->flags & I2C_M_TEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  288) 	xfer_msg[0].buf = buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  289) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  290) 	return i2c_transfer(client->adapter, xfer_msg, 1) == 1 ? 0 : -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  291) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  293) static int gsl_ts_write(struct i2c_client *client, u8 addr, u8 *pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  294) 				int datalen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  295) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  296) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  297) 	u8 tmp_buf[128];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  298) 	unsigned int bytelen = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  300) 	if (datalen > 125) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  301) 		print_info("%s too big datalen = %d!\n", __func__, datalen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  302) 		return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  303) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  304) 	tmp_buf[0] = addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  305) 	bytelen++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  306) 	if (datalen != 0 && pdata != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  307) 		memcpy(&tmp_buf[bytelen], pdata, datalen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  308) 		bytelen += datalen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  309) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  310) 	ret = i2c_master_send(client, tmp_buf, bytelen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  311) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  312) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  313) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  314) static int gsl_ts_read(struct i2c_client *client, u8 addr, u8 *pdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  315) 				unsigned int datalen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  316) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  317) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  319) 	if (datalen > 126) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  320) 		print_info("%s too big datalen = %d!\n", __func__, datalen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  321) 		return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  322) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  323) 	ret = gsl_ts_write(client, addr, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  324) 	if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  325) 		print_info("%s set data address fail!\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  326) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  327) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  328) 	return i2c_master_recv(client, pdata, datalen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  329) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  331) #ifdef GSLX680_COMPATIBLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  332) static void judge_chip_type(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  333) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  334) 	u8 read_buf[4] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  335) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  336) 	msleep(50);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  337) 	gsl_ts_read(client, 0xfc, read_buf, sizeof(read_buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  338) 	if (read_buf[2] != 0x36 && read_buf[2] != 0x88) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  339) 		msleep(50);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  340) 		gsl_ts_read(client, 0xfc, read_buf, sizeof(read_buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  341) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  342) 	print_info("leaf ggggg buf0 =%x %x %x  %x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  343) 				read_buf[0], read_buf[1], read_buf[2], read_buf[3]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  344) 	chip_type = read_buf[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  345) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  346) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  347) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  348) static inline void fw2buf(u8 *buf, const u32 *fw)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  349) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  350) 	u32 *u32_buf = (int *)buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  351) 	*u32_buf = *fw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  352) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  353) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  354) static void gsl_load_fw(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  355) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  356) 	u8 buf[DMA_TRANS_LEN * 4 + 1] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  357) 	u8 send_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  358) 	u8 *cur = buf + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  359) 	u32 source_line = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  360) 	u32 source_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  361) 	struct fw_data const *ptr_fw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  362) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  363) #ifdef GSLX680_COMPATIBLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  364) 		if (chip_type == TP2680A_ID) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  365) 			ptr_fw = GSL2680A_FW;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  366) 			source_len = ARRAY_SIZE(GSL2680A_FW);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  367) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  368) 			ptr_fw = GSL2680B_FW;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  369) 			source_len = ARRAY_SIZE(GSL2680B_FW);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  370) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  371) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  372) 		ptr_fw = GSL_FW;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  373) 		source_len = ARRAY_SIZE(GSL_FW);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  374) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  375) 	for (source_line = 0; source_line < source_len; source_line++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  376) 		if (ptr_fw[source_line].offset == GSL_PAGE_REG) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  377) 			fw2buf(cur, &ptr_fw[source_line].val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  378) 			gsl_write_interface(client, GSL_PAGE_REG, buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  379) 			send_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  380) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  381) 			if (1 == send_flag % (DMA_TRANS_LEN < 0x20 ? DMA_TRANS_LEN : 0x20))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  382) 				buf[0] = (u8)ptr_fw[source_line].offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  383) 			fw2buf(cur, &ptr_fw[source_line].val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  384) 			cur += 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  385) 			if (0 == send_flag % (DMA_TRANS_LEN < 0x20 ? DMA_TRANS_LEN : 0x20)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  386) 					gsl_write_interface(client, buf[0], buf, cur - buf - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  387) 					cur = buf + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  388) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  389) 			send_flag++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  390) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  391) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  392) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  393) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  394) static int test_i2c(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  395) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  396) 	u8 read_buf = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  397) 	u8 write_buf = 0x12;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  398) 	int ret, rc = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  399) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  400) 	ret = gsl_ts_read(client, 0xf0, &read_buf, sizeof(read_buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  401) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  402) 		rc--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  403) 	msleep(2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  404) 	ret = gsl_ts_write(client, 0xf0, &write_buf, sizeof(write_buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  405) 	msleep(2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  406) 	ret = gsl_ts_read(client, 0xf0, &read_buf, sizeof(read_buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  407) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  408) 		rc--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  409) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  410) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  411) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  412) static void startup_chip(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  413) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  414) 	u8 tmp = 0x00;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  415) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  416) #ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  417) 	gsl_DataInit(gsl_config_data_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  418) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  419) 	gsl_ts_write(client, 0xe0, &tmp, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  420) 	mdelay(5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  421) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  422) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  423) static void reset_chip(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  424) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  425) 	u8 tmp = 0x88;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  426) 	u8 buf[4] = {0x00};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  427) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  428) 	gsl_ts_write(client, 0xe0, &tmp, sizeof(tmp));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  429) 	mdelay(5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  430) 	tmp = 0x04;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  431) 	gsl_ts_write(client, 0xe4, &tmp, sizeof(tmp));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  432) 	mdelay(5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  433) 	gsl_ts_write(client, 0xbc, buf, sizeof(buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  434) 	mdelay(5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  435) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  436) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  437) static void clr_reg(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  438) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  439) 	u8 write_buf[4]	= {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  440) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  441) 	write_buf[0] = 0x88;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  442) 	gsl_ts_write(client, 0xe0, &write_buf[0], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  443) 	msleep(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  444) 	write_buf[0] = 0x03;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  445) 	gsl_ts_write(client, 0x80, &write_buf[0], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  446) 	msleep(5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  447) 	write_buf[0] = 0x04;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  448) 	gsl_ts_write(client, 0xe4, &write_buf[0], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  449) 	msleep(5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  450) 	write_buf[0] = 0x00;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  451) 	gsl_ts_write(client, 0xe0, &write_buf[0], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  452) 	msleep(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  453) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  454) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  455) static int init_chip(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  456) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  457) 	int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  458) 	struct gsl_ts *ts = i2c_get_clientdata(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  459) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  460) 	gsl_shutdown_low();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  461) 	msleep(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  462) 	gsl_shutdown_high();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  463) 	msleep(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  464) 	rc = test_i2c(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  465) 	if (rc < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  466) 		dev_err(&client->dev, "GSL test_i2c error!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  467) 		return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  468) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  469) 	schedule_work(&ts->download_fw_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  470) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  471) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  472) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  473) static int check_mem_data(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  474) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  475) 	u8 read_buf[4]  = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  476) 	int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  477) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  478) 	mdelay(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  479) 	gsl_ts_read(client, 0xb0, read_buf, sizeof(read_buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  480) 	if (read_buf[3] != 0x5a || read_buf[2] != 0x5a || read_buf[1] !=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  481) 				0x5a || read_buf[0] != 0x5a) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  482) 		print_info("#########check mem read 0xb0 = %x %x %x %x #########\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  483) 					read_buf[3], read_buf[2], read_buf[1], read_buf[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  484) 		rc = init_chip(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  485) 		if (rc < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  486) 			return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  487) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  488) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  489) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  490) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  491) #ifdef TPD_PROC_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  492) static int char_to_int(char ch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  493) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  494) 	if (ch >= '0' && ch <= '9')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  495) 		return (ch - '0');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  496) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  497) 		return (ch - 'a' + 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  498) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  499) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  500) static int gsl_config_read_proc(struct seq_file *m, void *v)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  501) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  502) 	char temp_data[5] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  503) 	unsigned int tmp = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  504) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  505) 	if ('v' == gsl_read[0] && 's' == gsl_read[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  506) #ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  507) 		tmp = gsl_version_id();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  508) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  509) 		tmp = 0x20121215;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  510) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  511) 		seq_printf(m, "version:%x\n", tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  512) 	} else if ('r' == gsl_read[0] && 'e' == gsl_read[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  513) 		if ('i' == gsl_read[3]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  514) #ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  515) 			tmp = (gsl_data_proc[5] << 8) | gsl_data_proc[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  516) 			seq_printf(m, "gsl_config_data_id[%d] = ", tmp);	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  517) 			if (tmp >= 0 && tmp < ARRAY_SIZE(gsl_config_data_id))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  518) 				seq_printf(m, "%d\n", gsl_config_data_id[tmp]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  519) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  520) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  521) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  522) 			gsl_ts_write(gsl_client, 0Xf0, &gsl_data_proc[4], 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  523) 			if (gsl_data_proc[0] < 0x80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  524) 				gsl_ts_read(gsl_client, gsl_data_proc[0], temp_data, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  525) 			gsl_ts_read(gsl_client, gsl_data_proc[0], temp_data, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  526) 			seq_printf(m, "offset : {0x%02x,0x", gsl_data_proc[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  527) 			seq_printf(m, "%02d", temp_data[3]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  528) 			seq_printf(m, "%02d", temp_data[2]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  529) 			seq_printf(m, "%02d", temp_data[1]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  530) 			seq_printf(m, "%02d};\n", temp_data[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  531) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  532) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  533) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  534) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  535) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  536) static ssize_t gsl_config_write_proc(struct file *file, const char *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  537) 				 size_t count, loff_t *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  538) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  539) 	u8 buf[8] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  540) 	char temp_buf[CONFIG_LEN] = {};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  541) 	char *path_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  542) 	int tmp = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  543) 	int tmp1 = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  544) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  545) 	if (count > 512) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  546) 		print_info("size not match [%d:%zd]\n", CONFIG_LEN, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  547) 		return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  548) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  549) 	path_buf = kzalloc(count, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  550) 	if (!path_buf) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  551) 		print_info("alloc path_buf memory error\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  552) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  553) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  554) 	if (copy_from_user(path_buf, buffer, count)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  555) 		print_info("copy from user fail\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  556) 		goto exit_write_proc_out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  557) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  558) 	memcpy(temp_buf, path_buf, (count < CONFIG_LEN ? count : CONFIG_LEN));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  559) 	buf[3] = char_to_int(temp_buf[14]) << 4 | char_to_int(temp_buf[15]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  560) 	buf[2] = char_to_int(temp_buf[16]) << 4 | char_to_int(temp_buf[17]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  561) 	buf[1] = char_to_int(temp_buf[18]) << 4 | char_to_int(temp_buf[19]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  562) 	buf[0] = char_to_int(temp_buf[20]) << 4 | char_to_int(temp_buf[21]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  563) 	buf[7] = char_to_int(temp_buf[5]) << 4 | char_to_int(temp_buf[6]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  564) 	buf[6] = char_to_int(temp_buf[7]) << 4 | char_to_int(temp_buf[8]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  565) 	buf[5] = char_to_int(temp_buf[9]) << 4 | char_to_int(temp_buf[10]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  566) 	buf[4] = char_to_int(temp_buf[11]) << 4 | char_to_int(temp_buf[12]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  567) 	if ('v' == temp_buf[0] && 's' == temp_buf[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  568) 		memcpy(gsl_read, temp_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  569) 		print_info("gsl version\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  570) 	} else if ('s' == temp_buf[0] && 't' == temp_buf[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  571) 		gsl_proc_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  572) 		reset_chip(gsl_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  573) 	} else if ('e' == temp_buf[0] && 'n' == temp_buf[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  574) 		msleep(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  575) 		reset_chip(gsl_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  576) 		startup_chip(gsl_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  577) 		gsl_proc_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  578) 	} else if ('r' == temp_buf[0] && 'e' == temp_buf[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  579) 		memcpy(gsl_read, temp_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  580) 		memcpy(gsl_data_proc, buf, 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  581) 	} else if ('w' == temp_buf[0] && 'r' == temp_buf[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  582) 		gsl_ts_write(gsl_client, buf[4], buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  583) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  584) #ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  585) 	else if ('i' == temp_buf[0] && 'd' == temp_buf[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  586) 		tmp1 = (buf[7] << 24) | (buf[6] << 16) | (buf[5] << 8) | buf[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  587) 		tmp = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];		
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  588) 		if (tmp1 >= 0 && tmp1 < ARRAY_SIZE(gsl_config_data_id))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  589) 			gsl_config_data_id[tmp1] = tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  590) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  591) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  592) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  593) exit_write_proc_out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  594) 	kfree(path_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  595) 	return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  596) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  597) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  598) static int gsl_server_list_open(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  599) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  600) 	return single_open(file, gsl_config_read_proc, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  601) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  602) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  603) static const struct file_operations gsl_seq_fops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  604) 	.open = gsl_server_list_open,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  605) 	.read = seq_read,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  606) 	.release = single_release,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  607) 	.write = gsl_config_write_proc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  608) 	.owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  609) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  610) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  611) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  612) #ifdef FILTER_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  613) static void filter_point(u16 x, u16 y, u8 id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  614) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  615) 	u16 x_err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  616) 	u16 y_err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  617) 	u16 filter_step_x = 0, filter_step_y = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  618) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  619) 	id_sign[id] = id_sign[id] + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  620) 	if (id_sign[id] == 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  621) 		x_old[id] = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  622) 		y_old[id] = y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  623) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  624) 	x_err = x > x_old[id] ? (x - x_old[id]) : (x_old[id] - x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  625) 	y_err = y > y_old[id] ? (y - y_old[id]) : (y_old[id] - y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  626) 	if ((x_err > FILTER_MAX && y_err > FILTER_MAX / 3) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  627) 					(x_err > FILTER_MAX / 3 && y_err > FILTER_MAX)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  628) 		filter_step_x = x_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  629) 		filter_step_y = y_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  630) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  631) 		if (x_err > FILTER_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  632) 			filter_step_x = x_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  633) 		if (y_err > FILTER_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  634) 			filter_step_y = y_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  635) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  636) 	if (x_err <= 2 * FILTER_MAX && y_err <= 2 * FILTER_MAX) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  637) 		filter_step_x >>= 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  638) 		filter_step_y >>= 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  639) 	} else if (x_err <= 3 * FILTER_MAX && y_err <= 3 * FILTER_MAX) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  640) 		filter_step_x >>= 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  641) 		filter_step_y >>= 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  642) 	} else if (x_err <= 4 * FILTER_MAX && y_err <= 4 * FILTER_MAX) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  643) 		filter_step_x = filter_step_x * 3 / 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  644) 		filter_step_y = filter_step_y * 3 / 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  645) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  646) 	x_new = x > x_old[id] ? (x_old[id] + filter_step_x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  647) 				: (x_old[id] - filter_step_x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  648) 	y_new = y > y_old[id] ? (y_old[id] + filter_step_y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  649) 				: (y_old[id] - filter_step_y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  650) 	x_old[id] = x_new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  651) 	y_old[id] = y_new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  652) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  653) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  654) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  655) static void record_point(u16 x, u16 y, u8 id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  656) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  657) 	u16 x_err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  658) 	u16 y_err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  659) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  660) 	id_sign[id] = id_sign[id] + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  661) 	if (id_sign[id] == 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  662) 		x_old[id] = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  663) 		y_old[id] = y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  664) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  665) 	x = (x_old[id] + x) / 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  666) 	y = (y_old[id] + y) / 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  667) 	if (x > x_old[id])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  668) 		x_err = x - x_old[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  669) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  670) 		x_err = x_old[id] - x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  671) 	if (y > y_old[id])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  672) 		y_err = y - y_old[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  673) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  674) 		y_err = y_old[id] - y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  675) 	if ((x_err > 3 && y_err > 1) || (x_err > 1 && y_err > 3)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  676) 		x_new = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  677) 		x_old[id] = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  678) 		y_new = y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  679) 		y_old[id] = y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  680) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  681) 		if (x_err > 3) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  682) 			x_new = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  683) 			x_old[id] = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  684) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  685) 			x_new = x_old[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  686) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  687) 		if (y_err > 3) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  688) 			y_new = y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  689) 			y_old[id] = y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  690) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  691) 			y_new = y_old[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  692) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  693) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  694) 	if (id_sign[id] == 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  695) 		x_new = x_old[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  696) 		y_new = y_old[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  697) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  698) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  699) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  700) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  701) #ifdef HAVE_TOUCH_KEY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  702) static void report_key(struct gsl_ts *ts, u16 x, u16 y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  703) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  704) 	u16 i = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  705) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  706) 	for (i = 0; i < MAX_KEY_NUM; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  707) 		if ((gsl_key_data[i].x_min < x) && (x < gsl_key_data[i].x_max)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  708) 				&& (gsl_key_data[i].y_min < y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  709) 				&& (y < gsl_key_data[i].y_max)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  710) 			key = gsl_key_data[i].key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  711) 			input_report_key(ts->input, key, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  712) 			input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  713) 			key_state_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  714) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  715) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  716) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  717) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  718) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  719) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  720) static void report_data(struct gsl_ts *ts, u16 x, u16 y, u8 pressure, u8 id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  721) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  722) 	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  723) if(revert_xy)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  724) 	swap(x, y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  725) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  726) 	if (x > SCREEN_MAX_X || y > SCREEN_MAX_Y) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  727) 	#ifdef HAVE_TOUCH_KEY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  728) 		report_key(ts, x, y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  729) 	#endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  730) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  731) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  732) 	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  733) 	if(revert_x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  734) 	x = SCREEN_MAX_X-x-1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  735) 	if(revert_y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  736) 	y = SCREEN_MAX_Y-y-1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  737) 	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  738) #ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  739) 	input_mt_slot(ts->input, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  740) 	input_report_abs(ts->input, ABS_MT_TRACKING_ID, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  741) 	input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, pressure);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  742) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  743) 	input_report_abs(ts->input, ABS_MT_POSITION_X, x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  744) 	input_report_abs(ts->input, ABS_MT_POSITION_Y, (y));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  745) 	input_report_abs(ts->input, ABS_MT_WIDTH_MAJOR, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  746) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  747) 	input_report_abs(ts->input, ABS_MT_TRACKING_ID, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  748) 	input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, pressure);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  749) 	input_report_abs(ts->input, ABS_MT_POSITION_X, x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  750) 	input_report_abs(ts->input, ABS_MT_POSITION_Y, y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  751) 	input_report_abs(ts->input, ABS_MT_WIDTH_MAJOR, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  752) 	input_mt_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  753) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  754) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  755) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  756) static void ts_irq_disable(struct gsl_ts *ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  757) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  758) 	unsigned long irqflags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  759) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  760) 	spin_lock_irqsave(&ts->irq_lock, irqflags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  761) 	if (!ts->flag_irq_is_disable) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  762) 		disable_irq_nosync(ts->client->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  763) 		ts->flag_irq_is_disable = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  764) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  765) 	spin_unlock_irqrestore(&ts->irq_lock, irqflags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  766) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  767) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  768) static void ts_irq_enable(struct gsl_ts *ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  769) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  770) 	unsigned long irqflags = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  771) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  772) 	spin_lock_irqsave(&ts->irq_lock, irqflags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  773) 	if (ts->flag_irq_is_disable) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  774) 		enable_irq(ts->client->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  775) 		ts->flag_irq_is_disable = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  776) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  777) 	spin_unlock_irqrestore(&ts->irq_lock, irqflags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  778) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  779) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  780) static void gsl_ts_worker(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  781) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  782) 	int rc, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  783) 	u8 id, touches;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  784) 	u16 x, y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  785) 	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  786) #ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  787) 	u32 tmp1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  788) 	u8 buf[4] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  789) 	struct gsl_touch_info cinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  790) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  791) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  792) 	struct gsl_ts *ts = container_of(work, struct gsl_ts, work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  793) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  794) #ifdef TPD_PROC_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  795) 	if (gsl_proc_flag == 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  796) 		goto schedule;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  797) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  798) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  799) 	if (i2c_lock_flag != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  800) 		goto i2c_lock_schedule;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  801) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  802) 		i2c_lock_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  803) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  804) 	rc = gsl_ts_read(ts->client, 0x80, ts->touch_data, ts->dd->data_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  805) 	if (rc < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  806) 		dev_err(&ts->client->dev, "read failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  807) 		goto schedule;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  808) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  809) 	touches = ts->touch_data[ts->dd->touch_index];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  810) #ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  811) 	cinfo.finger_num = touches;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  812) 	for (i = 0; i < (touches < MAX_CONTACTS ? touches : MAX_CONTACTS); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  813) 		cinfo.x[i] = join_bytes((ts->touch_data[ts->dd->x_index  +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  814) 				4 * i + 1] & 0xf), ts->touch_data[ts->dd->x_index + 4 * i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  815) 		cinfo.y[i] = join_bytes(ts->touch_data[ts->dd->y_index + 4 * i + 1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  816) 				ts->touch_data[ts->dd->y_index + 4 * i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  817) 		cinfo.id[i] = ((ts->touch_data[ts->dd->x_index  + 4 * i + 1]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  818) 				& 0xf0) >> 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  819) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  820) 	cinfo.finger_num = (ts->touch_data[3] << 24) | (ts->touch_data[2] << 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  821) 		| (ts->touch_data[1] << 8) | (ts->touch_data[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  822) 	gsl_alg_id_main(&cinfo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  823) 	tmp1 = gsl_mask_tiaoping();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  824) 	if (tmp1 > 0 && tmp1 < 0xffffffff) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  825) 		buf[0] = 0xa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  826) 		buf[1] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  827) 		buf[2] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  828) 		buf[3] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  829) 		gsl_ts_write(ts->client, 0xf0, buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  830) 		buf[0] = (u8)(tmp1 & 0xff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  831) 		buf[1] = (u8)((tmp1 >> 8) & 0xff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  832) 		buf[2] = (u8)((tmp1 >> 16) & 0xff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  833) 		buf[3] = (u8)((tmp1 >> 24) & 0xff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  834) 		print_info(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  835) 				"tmp1=%08x,buf[0]=%02x,buf[1]=%02x,buf[2]=%02x,buf[3]=%02x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  836) 				tmp1, buf[0], buf[1], buf[2], buf[3]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  837) 		gsl_ts_write(ts->client, 0x8, buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  838) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  839) 	touches = cinfo.finger_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  840) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  841) 	for (i = 1; i <= MAX_CONTACTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  842) 		if (touches == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  843) 			id_sign[i] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  844) 		id_state_flag[i] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  845) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  846) 	for (i = 0; i < (touches > MAX_FINGERS ? MAX_FINGERS : touches); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  847) 	#ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  848) 		id = cinfo.id[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  849) 		x =  cinfo.x[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  850) 		y =  cinfo.y[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  851) 	#else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  852) 		x = join_bytes((ts->touch_data[ts->dd->x_index + 4 * i + 1]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  853) 				& 0xf), ts->touch_data[ts->dd->x_index + 4 * i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  854) 		y = join_bytes(ts->touch_data[ts->dd->y_index + 4 * i + 1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  855) 				ts->touch_data[ts->dd->y_index + 4 * i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  856) 		id = ts->touch_data[ts->dd->id_index + 4 * i] >> 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  857) 	#endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  858) 		if (id >= 1 && id <= MAX_CONTACTS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  859) 		#ifdef FILTER_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  860) 			filter_point(x, y, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  861) 		#else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  862) 			record_point(x, y, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  863) 		#endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  864) 			report_data(ts, x_new, y_new, 10, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  865) 			id_state_flag[id] = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  866) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  867) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  868) 	for (i = 1; i <= MAX_CONTACTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  869) 		if ((touches == 0) || ((id_state_old_flag[i] != 0) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  870) 			(id_state_flag[i] == 0))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  871) 		#ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  872) 			input_mt_slot(ts->input, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  873) 			input_report_abs(ts->input, ABS_MT_TRACKING_ID, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  874) 			input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  875) 		#endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  876) 			id_sign[i] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  877) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  878) 		id_state_old_flag[i] = id_state_flag[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  879) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  880) #if 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  881) 	#ifdef HAVE_TOUCH_KEY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  882) 		if (key_state_flag && touches == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  883) 			input_report_key(ts->input, key, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  884) 			input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  885) 			key_state_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  886) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  887) 	#endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  888) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  889) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  890) schedule:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  891) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  892) 	i2c_lock_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  893) i2c_lock_schedule:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  894) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  895) 	ts_irq_enable(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  896) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  897) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  898) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  899) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  900) static void gsl_monitor_worker(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  901) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  902) 	u8 read_buf[4]  = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  903) 	char init_chip_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  904) 	int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  905) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  906) 	if (i2c_lock_flag != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  907) 		i2c_lock_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  908) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  909) 		i2c_lock_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  910) 	gsl_ts_read(gsl_client, 0xb0, read_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  911) 	if (read_buf[3] != 0x5a || read_buf[2] != 0x5a ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  912) 				read_buf[1] != 0x5a || read_buf[0] != 0x5a)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  913) 		b0_counter++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  914) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  915) 		b0_counter = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  916) 	if (b0_counter > 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  917) 		print_info("======read 0xb0: %x %x %x %x ======\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  918) 				read_buf[3], read_buf[2], read_buf[1], read_buf[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  919) 		init_chip_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  920) 		b0_counter = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  921) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  922) 	gsl_ts_read(gsl_client, 0xb4, read_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  923) 	int_2nd[3] = int_1st[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  924) 	int_2nd[2] = int_1st[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  925) 	int_2nd[1] = int_1st[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  926) 	int_2nd[0] = int_1st[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  927) 	int_1st[3] = read_buf[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  928) 	int_1st[2] = read_buf[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  929) 	int_1st[1] = read_buf[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  930) 	int_1st[0] = read_buf[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  931) 	if (int_1st[3] == int_2nd[3] && int_1st[2] == int_2nd[2] &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  932) 				int_1st[1] == int_2nd[1] && int_1st[0] == int_2nd[0]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  933) 		print_info(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  934) 				"======int_1st: %x %x %x %x ,int_2nd: %x %x %x %x ======\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  935) 				int_1st[3], int_1st[2], int_1st[1], int_1st[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  936) 				int_2nd[3], int_2nd[2], int_2nd[1], int_2nd[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  937) 		init_chip_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  938) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  939) 	gsl_ts_read(gsl_client, 0xbc, read_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  940) 	if (read_buf[3] != 0 || read_buf[2] != 0 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  941) 				read_buf[1] != 0 || read_buf[0] != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  942) 		bc_counter++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  943) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  944) 		bc_counter = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  945) 	if (bc_counter > 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  946) 		print_info("======read 0xbc: %x %x %x %x======\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  947) 				read_buf[3], read_buf[2], read_buf[1], read_buf[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  948) 		init_chip_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  949) 		bc_counter = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  950) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  951) 	if (init_chip_flag) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  952) 		rc = init_chip(gsl_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  953) 		if (rc < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  954) 			return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  955) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  956) 	i2c_lock_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  957) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  958) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  959) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  960) static irqreturn_t gsl_ts_irq(int irq, void *dev_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  961) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  962) 	struct gsl_ts *ts = (struct gsl_ts *)dev_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  963) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  964) 	ts_irq_disable(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  965) 	if (!work_pending(&ts->work))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  966) 		queue_work(ts->wq, &ts->work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  967) 	return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  968) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  969) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  970) static int gsl_thzy_ts_init(struct i2c_client *client, struct gsl_ts *ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  971) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  972) 	struct input_dev *input_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  973) 	int rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  974) 	#ifdef HAVE_TOUCH_KEY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  975) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  976) 	#endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  977) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  978) 	ts->dd = &devices[ts->device_id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  979) 	if (ts->device_id == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  980) 		ts->dd->data_size = MAX_FINGERS * ts->dd->touch_bytes +
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  981) 				ts->dd->touch_meta_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  982) 		ts->dd->touch_index = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  983) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  984) 	ts->touch_data = devm_kzalloc(&client->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  985) 				ts->dd->data_size, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  986) 	if (!ts->touch_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  987) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  988) 	input_device = devm_input_allocate_device(&ts->client->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  989) 	if (!input_device) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  990) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  991) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  992) 	ts->input = input_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  993) 	input_device->name = GSL_I2C_NAME;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  994) 	input_device->id.bustype = BUS_I2C;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  995) 	input_device->dev.parent = &client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  996) 	input_set_drvdata(input_device, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  997) #ifdef HAVE_TOUCH_KEY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  998) 	for (i = 0; i < MAX_KEY_NUM; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  999) 		input_device->evbit[i] =  BIT_MASK(EV_SYN) | BIT_MASK(EV_KEY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) 		set_bit(key_array[i], input_device->keybit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) #ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) 	__set_bit(EV_ABS, input_device->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) 	__set_bit(EV_KEY, input_device->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) 	__set_bit(EV_REP, input_device->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) 	__set_bit(INPUT_PROP_DIRECT, input_device->propbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008) 	input_mt_init_slots(input_device, (MAX_CONTACTS + 1), 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) 	input_set_abs_params(input_device, ABS_MT_TRACKING_ID, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) 				(MAX_CONTACTS + 1), 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) 	set_bit(EV_ABS, input_device->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) 	set_bit(EV_KEY, input_device->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) 	__set_bit(INPUT_PROP_DIRECT, input_device->propbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) 	input_device->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) 	set_bit(ABS_MT_POSITION_X, input_device->absbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) 	set_bit(ABS_MT_POSITION_Y, input_device->absbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) 	set_bit(ABS_MT_TOUCH_MAJOR, input_device->absbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) 	set_bit(ABS_MT_WIDTH_MAJOR, input_device->absbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) 	input_set_abs_params(input_device, ABS_MT_POSITION_X, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) 				SCREEN_MAX_X, 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) 	input_set_abs_params(input_device, ABS_MT_POSITION_Y, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) 				SCREEN_MAX_Y, 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) 	input_set_abs_params(input_device, ABS_MT_TOUCH_MAJOR, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) 				PRESS_MAX, 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) 	input_set_abs_params(input_device, ABS_MT_WIDTH_MAJOR, 0, 200, 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) 	ts->wq = create_singlethread_workqueue("kworkqueue_ts");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) 	if (!ts->wq) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030) 		dev_err(&client->dev, "gsl Could not create workqueue\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) 	flush_workqueue(ts->wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034) 	INIT_WORK(&ts->work, gsl_ts_worker);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) 	rc = input_register_device(input_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) 	if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037) 		goto error_unreg_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) error_unreg_device:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) 	destroy_workqueue(ts->wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) static int gsl_ts_suspend(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046) 	struct gsl_ts *ts = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) 	cancel_delayed_work_sync(&gsl_monitor_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) 	ts_irq_disable(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) 	cancel_work_sync(&ts->work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) 	gsl_shutdown_low();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) #ifdef SLEEP_CLEAR_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) 	msleep(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) 	#ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) 	for (i = 1; i <= MAX_CONTACTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) 		input_mt_slot(ts->input, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) 		input_report_abs(ts->input, ABS_MT_TRACKING_ID, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) 		input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064) 	#else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) 	input_mt_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) 	#endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) 	msleep(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) 	report_data(ts, 1, 1, 10, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075) static int gsl_ts_resume(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077) 	struct gsl_ts *ts = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) 	int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) 	gsl_shutdown_high();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082) 	mdelay(5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) 	reset_chip(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) 	startup_chip(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) 	rc = check_mem_data(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) 	if (rc < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087) 		return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) #ifdef SLEEP_CLEAR_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) 	#ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090) 	for (i = 1; i <= MAX_CONTACTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) 		input_mt_slot(ts->input, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092) 		input_report_abs(ts->input, ABS_MT_TRACKING_ID, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093) 		input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095) 	#else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) 	input_mt_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097) 	#endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101) 	queue_delayed_work(gsl_monitor_workqueue, &gsl_monitor_work, 300);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103) 	ts_irq_enable(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1105) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1107) static int gsl_ts_early_suspend(struct tp_device *tp_d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1108) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1109) 	struct gsl_ts *ts = container_of(tp_d, struct gsl_ts, tp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1111) 	gsl_ts_suspend(&ts->client->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1112) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1113) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1115) static int gsl_ts_late_resume(struct tp_device *tp_d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1116) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1117) 	struct gsl_ts *ts = container_of(tp_d, struct gsl_ts, tp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1119) 	schedule_work(&ts->resume_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1121) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1122) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1124) static void gsl_download_fw_work(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1125) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1126) 	struct gsl_ts *ts = container_of(work, struct gsl_ts, download_fw_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1128) 	clr_reg(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1129) 	reset_chip(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1130) 	gsl_load_fw(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1131) 	startup_chip(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1132) 	reset_chip(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1133) 	startup_chip(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1134) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1136) static void gsl_resume_work(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1137) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1138) 	gsl_ts_resume(&gsl_client->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1139) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1141) static int  gsl_ts_probe(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1142) 			const struct i2c_device_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1143) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1144) 	struct gsl_ts *ts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1145) 	int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1146)     #if defined CONFIG_BOARD_TYPE_ZM1128CE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1147) 		axp_gpio_set_io(PMU_GPIO_NUM, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1148)     #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1150) 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1151) 		dev_err(&client->dev, "gsl I2C functionality not supported\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1152) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1153) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1154) 	ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1155) 	if (!ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1156) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1157) 	ts->tp.tp_resume = gsl_ts_late_resume;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1158) 	ts->tp.tp_suspend = gsl_ts_early_suspend;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1159) 	tp_register_fb(&ts->tp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1160) 	ts->client = client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1161) 	i2c_set_clientdata(client, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1162) 	this_ts = ts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1163) 	gsl_client = client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1164) 	gsl_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1165) 	rc = gsl_thzy_ts_init(client, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1166) 	if (rc < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1167) 		dev_err(&client->dev, "gsl GSL init failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1168) 		goto error_mutex_destroy;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1169) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1170) #ifdef GSLX680_COMPATIBLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1171) 	judge_chip_type(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1172) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1173) 	INIT_WORK(&ts->download_fw_work, gsl_download_fw_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1174) 	INIT_WORK(&ts->resume_work, gsl_resume_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1176) 	rc = init_chip(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1177) 	if (rc < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1178) 		dev_err(&client->dev, "gsl_probe: init_chip failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1179) 		goto error_init_chip_fail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1180) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1181) 	spin_lock_init(&ts->irq_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1182) 	client->irq = gpio_to_irq(ts->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1183) 	rc = devm_request_irq(&client->dev, client->irq, gsl_ts_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1184) 				IRQF_TRIGGER_RISING, client->name, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1185) 	if (rc < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1186) 		dev_err(&client->dev, "gsl_probe: request irq failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1187) 		return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1188) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1189) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1190) 	INIT_DELAYED_WORK(&gsl_monitor_work, gsl_monitor_worker);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1191) 	gsl_monitor_workqueue = create_singlethread_workqueue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1192) 				("gsl_monitor_workqueue");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1193) 	queue_delayed_work(gsl_monitor_workqueue, &gsl_monitor_work, 1000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1194) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1195) #ifdef TPD_PROC_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1196) 	proc_create(GSL_CONFIG_PROC_FILE, 0644, NULL, &gsl_seq_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1197) 	gsl_proc_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1198) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1199) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1200) error_init_chip_fail:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1201) 	cancel_work_sync(&ts->download_fw_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1202) error_mutex_destroy:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1203) 	tp_unregister_fb(&ts->tp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1204) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1205) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1207) static int gsl_ts_remove(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1208) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1209) 	struct gsl_ts *ts = i2c_get_clientdata(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1210) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1211) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1212) 	cancel_delayed_work_sync(&gsl_monitor_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1213) 	destroy_workqueue(gsl_monitor_workqueue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1214) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1215) 	device_init_wakeup(&client->dev, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1216) 	cancel_work_sync(&ts->work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1217) 	destroy_workqueue(ts->wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1218) 	cancel_work_sync(&ts->download_fw_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1219) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1220) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1222) static const struct of_device_id gsl_ts_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1223) 	{.compatible = "GSL,GSL_THZY"},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1224) 	{ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1225) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1227) static const struct i2c_device_id gsl_ts_id[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1228) 	{GSL_I2C_NAME, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1229) 	{}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1230) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1231) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1232) MODULE_DEVICE_TABLE(i2c, gsl_ts_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1234) static struct i2c_driver gsl_ts_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1235) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1236) 		.name = GSL_I2C_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1237) 		.owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1238) 		.of_match_table = of_match_ptr(gsl_ts_ids),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1239) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1240) 	.probe		= gsl_ts_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1241) 	.remove		= gsl_ts_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1242) 	.id_table	= gsl_ts_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1243) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1245) static int __init gsl_ts_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1246) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1247) 	return i2c_add_driver(&gsl_ts_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1248) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1250) static void __exit gsl_ts_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1251) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1252) 	i2c_del_driver(&gsl_ts_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1253) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1254) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1255) module_init(gsl_ts_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1256) module_exit(gsl_ts_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1258) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1259) MODULE_DESCRIPTION("GSL touchscreen controller driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1260) MODULE_AUTHOR("Guan Yuwei, guanyuwei@basewin.com");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1261) MODULE_ALIAS("platform:gsl_ts");