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/gslX680.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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   12) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   13) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   14) #include <linux/hrtimer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   15) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   16) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   17) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   18) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   19) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   20) #include <linux/async.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   21) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   22) #include <asm/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   23) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   24) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   25) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   26) #include <linux/proc_fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   27) #include <linux/input/mt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   28) //#include "rockchip_gslX680_rk3168.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   29) #include "tp_suspend.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   30) #include "gslx680.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   31) #include <linux/of_gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   32) #include <linux/wakelock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   33) #include <linux/of_platform.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   35) #define GSL_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   37) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   38) struct fw_data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   40) 	u32 offset : 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   41) 	u32 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   42) 	u32 val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   43) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   44) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   46) #define RK_GEAR_TOUCH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   47) #define REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   48) #define HAVE_TOUCH_KEY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   49) //#define SLEEP_CLEAR_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   51) //#define FILTER_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   53) #ifdef FILTER_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   54) #define FILTER_MAX	9	//6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   55) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   57) #define GSLX680_I2C_NAME	"gslX680"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   58) #define GSLX680_I2C_ADDR	0x40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   60) //#define IRQ_PORT	RK2928_PIN1_PB0//RK30_PIN1_PB7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   61) //#define WAKE_PORT	RK30_PIN0_PA1//RK30_PIN0_PB6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   63) #define GSL_DATA_REG		0x80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   64) #define GSL_STATUS_REG		0xe0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   65) #define GSL_PAGE_REG		0xf0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   67) #define TPD_PROC_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   68) #ifdef TPD_PROC_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   69) #include <linux/proc_fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   70) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   71) #include <linux/seq_file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   72) //static struct proc_dir_entry *gsl_config_proc = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   73) #define GSL_CONFIG_PROC_FILE "gsl_config"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   74) #define CONFIG_LEN 31
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   75) static char gsl_read[CONFIG_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   76) static u8 gsl_data_proc[8] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   77) static u8 gsl_proc_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   78) static struct i2c_client *i2c_client = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   79) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   80) #define GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   81) #define PRESS_MAX		255
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   82) #define MAX_FINGERS		10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   83) #define MAX_CONTACTS		10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   84) #define DMA_TRANS_LEN		0x20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   85) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   87) #ifdef RK_GEAR_TOUCH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   88) static int g_istouch=0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   89) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   91) static struct workqueue_struct *gsl_monitor_workqueue = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   92) static u8 int_1st[4] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   93) static u8 int_2nd[4] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   94) //static char dac_counter = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   95) static char b0_counter = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   96) static char bc_counter = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   97) static char i2c_lock_flag = 0;
^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 WRITE_I2C_SPEED	(350*1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  101) #define I2C_SPEED	(200*1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  102) #define CLOSE_TP_POWER   0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  103) //add by yuandan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  104) //#define HAVE_CLICK_TIMER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  106) #ifdef HAVE_CLICK_TIMER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  108) static struct workqueue_struct *gsl_timer_workqueue = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  109) bool send_key = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  110) struct semaphore my_sem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  111) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  113) #ifdef HAVE_TOUCH_KEY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  114) static u16 key = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  115) static int key_state_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  116) struct key_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  117) 	u16 key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  118) 	u16 x_min;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  119) 	u16 x_max;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  120) 	u16 y_min;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  121) 	u16 y_max;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  122) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  124) const u16 key_array[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  125) 	KEY_LEFT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  126) 	KEY_RIGHT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  127) 	KEY_UP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  128) 	KEY_DOWN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  129) 	KEY_ENTER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  130) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  132) #define MAX_KEY_NUM     (sizeof(key_array)/sizeof(key_array[0]))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  133) //add by yuandan
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  134) static int key_x[512];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  135) static int key_y[512];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  136) static int key_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  137) #ifdef SLEEP_CLEAR_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  138) static const struct key_data gsl_key_data[MAX_KEY_NUM] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  139) 	{KEY_BACK, 550, 650, 1400, 1600},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  140) 	{KEY_HOMEPAGE, 350, 450, 1400, 1600},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  141) 	{KEY_MENU, 150, 250, 1400, 1600},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  142) 	{KEY_SEARCH, 2048, 2048, 2048, 2048},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  143) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  144) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  145) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  147) struct gsl_ts_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  148) 	u8 x_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  149) 	u8 y_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  150) 	u8 z_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  151) 	u8 id_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  152) 	u8 touch_index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  153) 	u8 data_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  154) 	u8 status_reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  155) 	u8 data_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  156) 	u8 touch_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  157) 	u8 update_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  158) 	u8 touch_meta_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  159) 	u8 finger_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  160) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  162) static struct gsl_ts_data devices[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  163) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  164) 	 .x_index = 6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  165) 	 .y_index = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  166) 	 .z_index = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  167) 	 .id_index = 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  168) 	 .data_reg = GSL_DATA_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  169) 	 .status_reg = GSL_STATUS_REG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  170) 	 .update_data = 0x4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  171) 	 .touch_bytes = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  172) 	 .touch_meta_data = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  173) 	 .finger_size = 70,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  174) 	 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  175) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  177) struct gsl_ts_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  178) 	struct fw_data *fw_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  179) 	unsigned int fw_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  180) 	enum gsl_quirk quirks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  181) 	unsigned int *cfg_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  182) 	int max_x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  183) 	int max_y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  184) 	bool x_pol;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  185) 	bool y_pol;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  186) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  188) struct gsl_ts {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  189) 	struct i2c_client *client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  190) 	struct input_dev *input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  191) 	struct work_struct work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  192) 	struct workqueue_struct *wq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  193) 	struct gsl_ts_data *dd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  194) 	int flag_irq_is_disable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  195) 	spinlock_t irq_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  196) 	u8 *touch_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  197) 	u8 device_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  198) 	int irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  199) 	int rst;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  200) 	struct delayed_work gsl_monitor_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  201) #if defined(CONFIG_HAS_EARLYSUSPEND)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  202) 	struct early_suspend early_suspend;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  203) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  204) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  205) #if defined (HAVE_CLICK_TIMER)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  206) 	struct work_struct click_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  207) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  209) 	struct tp_device tp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  210) 	struct pinctrl *pinctrl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  211) 	struct pinctrl_state *pins_default;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  212) 	struct pinctrl_state *pins_sleep;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  213) 	struct pinctrl_state *pins_inactive;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  214) 	const struct gsl_ts_cfg *ts_cfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  215) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  217) #ifdef GSL_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  218) #define print_info(fmt, args...)	printk(fmt, ##args);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  219) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  220) #define print_info(fmt, args...)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  221) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  223) static u32 id_sign[MAX_CONTACTS + 1] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  224) static u8 id_state_flag[MAX_CONTACTS + 1] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  225) static u8 id_state_old_flag[MAX_CONTACTS + 1] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  226) static u16 x_old[MAX_CONTACTS + 1] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  227) static u16 y_old[MAX_CONTACTS + 1] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  228) static u16 x_new = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  229) static u16 y_new = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  231) static const struct gsl_ts_cfg gslx680_vr_cfg = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  232) 	.fw_ptr		= GSLX680_FW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  233) 	.fw_size	= ARRAY_SIZE(GSLX680_FW),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  234) 	.quirks		= GSL_QUIRK_VR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  235) 	.cfg_id		= gsl_config_data_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  236) 	.max_x		= SCREEN_MAX_X,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  237) 	.max_y		= SCREEN_MAX_Y,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  238) 	.x_pol		= false,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  239) 	.y_pol		= false,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  240) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  242) static const struct gsl_ts_cfg gslx680_tve_cfg = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  243) 	.fw_ptr		= GSLX680_FW_TVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  244) 	.fw_size	= ARRAY_SIZE(GSLX680_FW_TVE),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  245) 	.quirks		= GSL_QUIRK_TVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  246) 	.cfg_id		= gsl_tve_cfg_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  247) 	.max_x		= SCREEN_MAX_X_TVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  248) 	.max_y		= SCREEN_MAX_Y_TVE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  249) 	.x_pol		= true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  250) 	.y_pol		= true,
^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) int gslx680_set_pinctrl_state(struct gsl_ts *ts, struct pinctrl_state *state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  254) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  255) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  257) 	if (!IS_ERR(state)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  258) 		ret = pinctrl_select_state(ts->pinctrl, state);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  259) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  260) 			printk("could not set pins \n");
^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) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  264) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  266) static int gslX680_init(struct gsl_ts *ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  267) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  268) 	struct device_node *np = ts->client->dev.of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  269) 	int err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  270) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  271) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  272) 	ts->irq = of_get_named_gpio_flags(np, "touch-gpio", 0, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  273) 	ts->rst = of_get_named_gpio_flags(np, "reset-gpio", 0, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  275) 	//msleep(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  276) #if 0	//#if defined (CONFIG_BOARD_ZM71C)||defined (CONFIG_BOARD_ZM72CP) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  277) 	defined(CONFIG_BOARD_ZM726C) || defined(CONFIG_BOARD_ZM726CE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  278) 	    if (gpio_request(ts->rst, NULL) != 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  279) 		gpio_free(ts->rst);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  280) 		printk("gslX680_init gpio_request error\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  281) 		return -EIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  282) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  283) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  285) 	/* pinctrl */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  286) 	ts->pinctrl = devm_pinctrl_get(&ts->client->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  287) 	if (IS_ERR(ts->pinctrl)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  288) 		ret = PTR_ERR(ts->pinctrl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  289) 		//goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  290) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  291) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  292) 	ts->pins_default =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  293) 	    pinctrl_lookup_state(ts->pinctrl, PINCTRL_STATE_DEFAULT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  294) 	//if (IS_ERR(ts->pins_default))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  295) 	//      dev_err(&client->dev, "could not get default pinstate\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  296) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  297) 	ts->pins_sleep = pinctrl_lookup_state(ts->pinctrl, PINCTRL_STATE_SLEEP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  298) 	//if (IS_ERR(ts->pins_sleep))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  299) 	//      dev_err(&client->dev, "could not get sleep pinstate\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  300) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  301) 	ts->pins_inactive = pinctrl_lookup_state(ts->pinctrl, "inactive");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  302) 	//if (IS_ERR(ts->pins_inactive))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  303) 	//      dev_err(&client->dev, "could not get inactive pinstate\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  304) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  305) 	err = gpio_request(ts->rst, "tp reset");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  306) 	if (err) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  307) 		printk("gslx680 reset gpio request failed.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  308) 		return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  309) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  310) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  311) 	gslx680_set_pinctrl_state(ts, ts->pins_default);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  312) 	gpio_direction_output(ts->rst, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  313) 	gpio_set_value(ts->rst, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  314) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  315) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  316) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  317) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  318) static int gslX680_shutdown_low(struct gsl_ts *ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  319) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  320) 	printk("gsl  gslX680_shutdown_low\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  321) 	gpio_direction_output(ts->rst, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  322) 	gpio_set_value(ts->rst, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  324) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  325) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  326) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  327) static int gslX680_shutdown_high(struct gsl_ts *ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  328) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  329) 	printk("gsl  gslX680_shutdown_high\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  330) 	gpio_direction_output(ts->rst, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  331) 	gpio_set_value(ts->rst, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  332) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  333) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  334) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  335) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  336) static inline u16 join_bytes(u8 a, u8 b)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  337) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  338) 	u16 ab = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  339) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  340) 	ab = ab | a;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  341) 	ab = ab << 8 | b;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  342) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  343) 	return ab;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  344) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  345) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  346) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  347) static u32 gsl_read_interface(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  348) 	u8 reg, u8 *buf, u32 num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  349) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  350) 	struct i2c_msg xfer_msg[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  351) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  352) 	xfer_msg[0].addr = client->addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  353) 	xfer_msg[0].len = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  354) 	xfer_msg[0].flags = client->flags & I2C_M_TEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  355) 	xfer_msg[0].buf = &reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  356) 	xfer_msg[0].scl_rate=300*1000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  357) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  358) 	xfer_msg[1].addr = client->addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  359) 	xfer_msg[1].len = num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  360) 	xfer_msg[1].flags |= I2C_M_RD;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  361) 	xfer_msg[1].buf = buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  362) 	xfer_msg[1].scl_rate=300*1000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  363) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  364) 	if (reg < 0x80) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  365) 		i2c_transfer(client->adapter, xfer_msg, ARRAY_SIZE(xfer_msg));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  366) 		msleep(5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  367) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  368) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  369) 	return i2c_transfer(client->adapter, xfer_msg, ARRAY_SIZE(xfer_msg)) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  370) 		== ARRAY_SIZE(xfer_msg) ? 0 : -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  371) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  372)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  373) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  374) static u32 gsl_write_interface(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  375) 			       const u8 reg, u8 *buf, u32 num)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  376) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  377) 	struct i2c_msg xfer_msg[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  378) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  379) 	buf[0] = reg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  381) 	xfer_msg[0].addr = client->addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  382) 	xfer_msg[0].len = num + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  383) 	xfer_msg[0].flags = client->flags & I2C_M_TEN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  384) 	xfer_msg[0].buf = buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  385) 	//xfer_msg[0].scl_rate = 100 * 1000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  386) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  387) 	return i2c_transfer(client->adapter, xfer_msg, 1) == 1 ? 0 : -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  388) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  389) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  390) static int gsl_ts_write(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  391) 			u8 addr, u8 *pdata, int datalen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  392) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  393) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  394) 	u8 tmp_buf[128];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  395) 	unsigned int bytelen = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  396) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  397) 	if (datalen > 125) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  398) 		printk("%s too big datalen = %d!\n", __func__, datalen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  399) 		return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  400) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  401) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  402) 	tmp_buf[0] = addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  403) 	bytelen++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  404) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  405) 	if (datalen != 0 && pdata != NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  406) 		memcpy(&tmp_buf[bytelen], pdata, datalen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  407) 		bytelen += datalen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  408) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  409) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  410) 	ret = i2c_master_send(client, tmp_buf, bytelen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  411) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  412) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  413) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  414) static int gsl_ts_read(struct i2c_client *client, u8 addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  415) 		       u8 *pdata, unsigned int datalen)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  416) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  417) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  418) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  419) 	if (datalen > 126) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  420) 		printk("%s too big datalen = %d!\n", __func__, datalen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  421) 		return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  422) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  423) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  424) 	ret = gsl_ts_write(client, addr, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  425) 	if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  426) 		printk("%s set data address fail!\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  427) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  428) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  429) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  430) 	return i2c_master_recv(client, pdata, datalen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  431) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  432) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  433) static __inline__ void fw2buf(u8 *buf, const u32 *fw)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  434) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  435) 	u32 *u32_buf = (int *)buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  436) 	*u32_buf = *fw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  437) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  438) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  439) static void gsl_load_fw(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  440) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  441) 	u8 buf[DMA_TRANS_LEN * 4 + 1] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  442) 	u8 send_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  443) 	u8 *cur = buf + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  444) 	u32 source_line = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  445) 	u32 source_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  446) 	//u8 read_buf[4] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  447) 	struct gsl_ts *ts =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  448) 		(struct gsl_ts *)i2c_get_clientdata(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  449) 	struct fw_data const *ptr_fw = ts->ts_cfg->fw_ptr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  450) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  451) 	source_len = ts->ts_cfg->fw_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  452) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  453) 	for (source_line = 0; source_line < source_len; source_line++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  454) 		/* init page trans, set the page val */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  455) 		if (GSL_PAGE_REG == ptr_fw[source_line].offset) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  456) 			fw2buf(cur, &ptr_fw[source_line].val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  457) 			gsl_write_interface(client, GSL_PAGE_REG, buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  458) 			send_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  459) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  460) 			if (1 ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  461) 			    send_flag % (DMA_TRANS_LEN <
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  462) 					 0x20 ? DMA_TRANS_LEN : 0x20))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  463) 				buf[0] = (u8) ptr_fw[source_line].offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  464) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  465) 			fw2buf(cur, &ptr_fw[source_line].val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  466) 			cur += 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  467) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  468) 			if (0 ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  469) 			    send_flag % (DMA_TRANS_LEN <
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  470) 					 0x20 ? DMA_TRANS_LEN : 0x20)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  471) 				gsl_write_interface(client, buf[0], buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  472) 						    cur - buf - 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  473) 				cur = buf + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  474) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  475) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  476) 			send_flag++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  477) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  478) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  479) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  480) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  481) static int test_i2c(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  482) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  483) 	u8 read_buf = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  484) 	u8 write_buf = 0x12;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  485) 	int ret, rc = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  486) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  487) 	ret = gsl_ts_read(client, 0xf0, &read_buf, sizeof(read_buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  488) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  489) 		rc--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  490) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  491) 		printk("gsl I read reg 0xf0 is %x\n", read_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  492) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  493) 	msleep(2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  494) 	ret = gsl_ts_write(client, 0xf0, &write_buf, sizeof(write_buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  495) 	if (ret >= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  496) 		printk("gsl I write reg 0xf0 0x12\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  497) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  498) 	msleep(2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  499) 	ret = gsl_ts_read(client, 0xf0, &read_buf, sizeof(read_buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  500) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  501) 		rc--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  502) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  503) 		printk("gsl I read reg 0xf0 is 0x%x\n", read_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  504) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  505) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  506) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  507) static void startup_chip(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  508) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  509) 	struct gsl_ts *ts =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  510) 		(struct gsl_ts *)i2c_get_clientdata(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  511) 	u8 tmp = 0x00;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  512) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  513) 	printk("gsl  startup_chip\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  514) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  515) #ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  516) 	gsl_DataInit(ts->ts_cfg->cfg_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  517) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  518) 	gsl_ts_write(client, 0xe0, &tmp, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  519) 	mdelay(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  520) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  521) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  522) static void reset_chip(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  523) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  524) 	u8 tmp = 0x88;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  525) 	u8 buf[4] = { 0x00 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  526) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  527) 	printk("gsl  reset_chip\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  528) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  529) 	gsl_ts_write(client, 0xe0, &tmp, sizeof(tmp));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  530) 	mdelay(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  531) 	tmp = 0x04;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  532) 	gsl_ts_write(client, 0xe4, &tmp, sizeof(tmp));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  533) 	mdelay(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  534) 	gsl_ts_write(client, 0xbc, buf, sizeof(buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  535) 	mdelay(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  536) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  537) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  538) static void clr_reg(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  539) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  540) 	u8 write_buf[4] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  541) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  542) 	write_buf[0] = 0x88;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  543) 	gsl_ts_write(client, 0xe0, &write_buf[0], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  544) 	mdelay(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  545) 	write_buf[0] = 0x03;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  546) 	gsl_ts_write(client, 0x80, &write_buf[0], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  547) 	mdelay(5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  548) 	write_buf[0] = 0x04;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  549) 	gsl_ts_write(client, 0xe4, &write_buf[0], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  550) 	mdelay(5);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  551) 	write_buf[0] = 0x00;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  552) 	gsl_ts_write(client, 0xe0, &write_buf[0], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  553) 	mdelay(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  554) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  555) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  556) static void init_chip(struct i2c_client *client, struct gsl_ts *ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  557) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  558) 	int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  559) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  560) 	printk("gsl  init_chip\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  561) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  562) 	gslX680_shutdown_low(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  563) 	mdelay(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  564) 	gslX680_shutdown_high(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  565) 	mdelay(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  566) 	rc = test_i2c(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  567) 	if (rc < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  568) 		printk("gslX680 test_i2c error\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  569) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  570) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  571) 	clr_reg(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  572) 	reset_chip(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  573) 	gsl_load_fw(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  574) 	startup_chip(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  575) 	reset_chip(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  576) 	startup_chip(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  577) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  578) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  579) static void check_mem_data(struct i2c_client *client, struct gsl_ts *ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  580) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  581) 	u8 read_buf[4] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  582) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  583) 	mdelay(30);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  584) 	gsl_ts_read(client, 0xb0, read_buf, sizeof(read_buf));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  585) 	if (read_buf[3] != 0x5a || read_buf[2] != 0x5a ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  586) 		read_buf[1] != 0x5a || read_buf[0] != 0x5a) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  587) 		init_chip(client, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  588) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  589) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  590) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  591) #ifdef TPD_PROC_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  592) static int char_to_int(char ch)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  593) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  594) 	if (ch >= '0' && ch <= '9')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  595) 		return (ch - '0');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  596) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  597) 		return (ch - 'a' + 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  598) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  599) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  600) static int gsl_config_read_proc(struct seq_file *m, void *v)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  601) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  602) 	//char *ptr = page;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  603) 	char temp_data[5] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  604) 	unsigned int tmp = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  605) 	//unsigned int *ptr_fw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  606) 	struct gsl_ts *ts =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  607) 		(struct gsl_ts *)i2c_get_clientdata(i2c_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  608) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  609) 	if ('v' == gsl_read[0] && 's' == gsl_read[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  610) #ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  611) 		tmp = gsl_version_id();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  612) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  613) 		tmp = 0x20121215;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  614) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  615) 		seq_printf(m, "version:%x\n", tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  616) 	} else if ('r' == gsl_read[0] && 'e' == gsl_read[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  617) 		if ('i' == gsl_read[3]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  618) #ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  619) 			/*      tmp=(gsl_data_proc[5]<<8) | gsl_data_proc[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  620) 			   seq_printf(m,"gsl_config_data_id[%d] = ",tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  621) 			   if(tmp>=0&&tmp<gsl_cfg_table[gsl_cfg_index].data_size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  622) 			   seq_printf(m,"%d\n",gsl_cfg_table[gsl_cfg_index].data_id[tmp]); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  623) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  624) 			tmp = (gsl_data_proc[5] << 8) | gsl_data_proc[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  625) 			seq_printf(m, "gsl_config_data_id[%d] = ", tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  626) 			if (tmp >= 0 && tmp < 512)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  627) 				seq_printf(m, "%d\n", ts->ts_cfg->cfg_id[tmp]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  628) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  629) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  630) 			i2c_smbus_write_i2c_block_data(i2c_client, 0xf0, 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  631) 						       &gsl_data_proc[4]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  632) 			if (gsl_data_proc[0] < 0x80)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  633) 				i2c_smbus_read_i2c_block_data(i2c_client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  634) 							      gsl_data_proc[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  635) 							      4, temp_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  636) 			i2c_smbus_read_i2c_block_data(i2c_client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  637) 						      gsl_data_proc[0], 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  638) 						      temp_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  639) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  640) 			seq_printf(m, "offset : {0x%02x,0x", gsl_data_proc[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  641) 			seq_printf(m, "%02x", temp_data[3]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  642) 			seq_printf(m, "%02x", temp_data[2]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  643) 			seq_printf(m, "%02x", temp_data[1]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  644) 			seq_printf(m, "%02x};\n", temp_data[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  645) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  646) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  647) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  648) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  649) static ssize_t gsl_config_write_proc(struct file *file, const char *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  650) 				 size_t count, loff_t *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  651) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  652) 	u8 buf[8] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  653) 	char temp_buf[CONFIG_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  654) 	char *path_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  655) 	int tmp = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  656) 	int tmp1 = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  657) 	struct gsl_ts *ts =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  658) 		(struct gsl_ts *)i2c_get_clientdata(i2c_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  659) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  660) 	print_info("[tp-gsl][%s] \n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  661) 	if (count > 512) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  662) 		//print_info("size not match [%d:%d]\n", CONFIG_LEN, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  663) 		return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  664) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  665) 	path_buf = kzalloc(count, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  666) 	if (!path_buf) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  667) 		printk("alloc path_buf memory error \n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  668) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  669) 	if (copy_from_user(path_buf, buffer, count)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  670) 		print_info("copy from user fail\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  671) 		goto exit_write_proc_out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  672) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  673) 	memcpy(temp_buf, path_buf, (count < CONFIG_LEN ? count : CONFIG_LEN));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  674) 	print_info("[tp-gsl][%s][%s]\n", __func__, temp_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  675) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  676) 	buf[3] = char_to_int(temp_buf[14]) << 4 | char_to_int(temp_buf[15]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  677) 	buf[2] = char_to_int(temp_buf[16]) << 4 | char_to_int(temp_buf[17]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  678) 	buf[1] = char_to_int(temp_buf[18]) << 4 | char_to_int(temp_buf[19]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  679) 	buf[0] = char_to_int(temp_buf[20]) << 4 | char_to_int(temp_buf[21]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  680) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  681) 	buf[7] = char_to_int(temp_buf[5]) << 4 | char_to_int(temp_buf[6]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  682) 	buf[6] = char_to_int(temp_buf[7]) << 4 | char_to_int(temp_buf[8]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  683) 	buf[5] = char_to_int(temp_buf[9]) << 4 | char_to_int(temp_buf[10]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  684) 	buf[4] = char_to_int(temp_buf[11]) << 4 | char_to_int(temp_buf[12]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  685) 	if ('v' == temp_buf[0] && 's' == temp_buf[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  686) 		//version //vs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  687) 		memcpy(gsl_read, temp_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  688) 		printk("gsl version\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  689) 	} else if ('s' == temp_buf[0] && 't' == temp_buf[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  690) 		//start //st
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  691) 		gsl_proc_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  692) 		reset_chip(i2c_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  693) 	} else if ('e' == temp_buf[0] && 'n' == temp_buf[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  694) 		//end //en
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  695) 		mdelay(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  696) 		reset_chip(i2c_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  697) 		startup_chip(i2c_client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  698) 		gsl_proc_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  699) 	} else if ('r' == temp_buf[0] && 'e' == temp_buf[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  700) 		//read buf //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  701) 		memcpy(gsl_read, temp_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  702) 		memcpy(gsl_data_proc, buf, 8);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  703) 	} else if ('w' == temp_buf[0] && 'r' == temp_buf[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  704) 		//write buf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  705) 		i2c_smbus_write_i2c_block_data(i2c_client, buf[4], 4, buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  706) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  707) #ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  708) 	else if ('i' == temp_buf[0] && 'd' == temp_buf[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  709) 		//write id config //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  710) 		tmp1 = (buf[7] << 24) | (buf[6] << 16) | (buf[5] << 8) | buf[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  711) 		tmp = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  712) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  713) 		if (tmp1 >= 0 && tmp1 < 512) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  714) 			ts->ts_cfg->cfg_id[tmp1] = tmp;
^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) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  718) 	exit_write_proc_out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  719) 	kfree(path_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  720) 	return count;
^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) static int gsl_server_list_open(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  724) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  725) 	return single_open(file, gsl_config_read_proc, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  726) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  727) static const struct file_operations gsl_seq_fops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  728) 	.open = gsl_server_list_open,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  729) 	.read = seq_read,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  730) 	.release = single_release,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  731) 	.write = gsl_config_write_proc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  732) 	.owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  733) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  734) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  735) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  736) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  737) #ifdef FILTER_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  738) static void filter_point(u16 x, u16 y, u8 id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  739) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  740) 	u16 x_err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  741) 	u16 y_err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  742) 	u16 filter_step_x = 0, filter_step_y = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  743) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  744) 	id_sign[id] = id_sign[id] + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  745) 	if (id_sign[id] == 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  746) 		x_old[id] = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  747) 		y_old[id] = y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  748) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  749) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  750) 	x_err = x > x_old[id] ? (x - x_old[id]) : (x_old[id] - x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  751) 	y_err = y > y_old[id] ? (y - y_old[id]) : (y_old[id] - y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  752) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  753) 	if ((x_err > FILTER_MAX && y_err > FILTER_MAX / 3) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  754) 		(x_err > FILTER_MAX / 3 && y_err > FILTER_MAX)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  755) 		filter_step_x = x_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  756) 		filter_step_y = y_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  757) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  758) 		if (x_err > FILTER_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  759) 			filter_step_x = x_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  760) 		if (y_err > FILTER_MAX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  761) 			filter_step_y = y_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  762) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  763) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  764) 	if (x_err <= 2 * FILTER_MAX && y_err <= 2 * FILTER_MAX) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  765) 		filter_step_x >>= 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  766) 		filter_step_y >>= 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  767) 	} else if (x_err <= 3 * FILTER_MAX && y_err <= 3 * FILTER_MAX) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  768) 		filter_step_x >>= 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  769) 		filter_step_y >>= 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  770) 	} else if (x_err <= 4 * FILTER_MAX && y_err <= 4 * FILTER_MAX) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  771) 		filter_step_x = filter_step_x * 3 / 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  772) 		filter_step_y = filter_step_y * 3 / 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  773) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  774) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  775) 	x_new =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  776) 	    x >
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  777) 	    x_old[id] ? (x_old[id] + filter_step_x) : (x_old[id] -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  778) 						       filter_step_x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  779) 	y_new =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  780) 	    y >
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  781) 	    y_old[id] ? (y_old[id] + filter_step_y) : (y_old[id] -
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  782) 						       filter_step_y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  783) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  784) 	x_old[id] = x_new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  785) 	y_old[id] = y_new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  786) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  787) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  788) static void record_point(u16 x, u16 y, u8 id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  789) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  790) 	u16 x_err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  791) 	u16 y_err = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  792) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  793) 	id_sign[id] = id_sign[id] + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  794) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  795) 	if (id_sign[id] == 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  796) 		x_old[id] = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  797) 		y_old[id] = y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  798) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  799) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  800) 	x = (x_old[id] + x) / 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  801) 	y = (y_old[id] + y) / 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  802) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  803) 	if (x > x_old[id]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  804) 		x_err = x - x_old[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  805) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  806) 		x_err = x_old[id] - x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  807) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  808) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  809) 	if (y > y_old[id]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  810) 		y_err = y - y_old[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  811) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  812) 		y_err = y_old[id] - y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  813) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  814) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  815) 	if ((x_err > 3 && y_err > 1) || (x_err > 1 && y_err > 3)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  816) 		x_new = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  817) 		x_old[id] = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  818) 		y_new = y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  819) 		y_old[id] = y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  820) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  821) 		if (x_err > 3) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  822) 			x_new = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  823) 			x_old[id] = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  824) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  825) 			x_new = x_old[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  826) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  827) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  828) 		if (y_err > 3) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  829) 			y_new = y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  830) 			y_old[id] = y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  831) 		} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  832) 			y_new = y_old[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  833) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  834) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  835) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  836) 	if (id_sign[id] == 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  837) 		x_new = x_old[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  838) 		y_new = y_old[id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  839) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  840) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  841) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  842) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  843) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  844) #ifdef SLEEP_CLEAR_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  845) #ifdef HAVE_TOUCH_KEY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  846) static void report_key(struct gsl_ts *ts, u16 x, u16 y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  847) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  848) 	u16 i = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  849) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  850) 	for (i = 0; i < MAX_KEY_NUM; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  851) 		if ((gsl_key_data[i].x_min < x)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  852) 		    && (x < gsl_key_data[i].x_max)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  853) 		    && (gsl_key_data[i].y_min < y)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  854) 		    && (y < gsl_key_data[i].y_max)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  855) 			key = gsl_key_data[i].key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  856) 			input_report_key(ts->input, key, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  857) 			input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  858) 			key_state_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  859) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  860) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  861) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  862) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  863) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  864) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  865) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  866) #ifdef RK_GEAR_TOUCH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  867) 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  868) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  869) #ifdef RK_GEAR_TOUCH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  870) 	int delt_x,delt_y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  871) 	static int old_x=0, old_y=0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  872) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  873) 	int max_x = ts->ts_cfg->max_x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  874) 	int max_y = ts->ts_cfg->max_y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  875) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  876) 	//#ifndef SWAP_XY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  877) 	//      swap(x, y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  878) 	//#endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  879) 	//printk("#####id=%d,x=%d,y=%d######\n",id,x,y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  880) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  881) 	if (x > max_x || y > max_y) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  882) #ifdef HAVE_TOUCH_KEY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  883) 		//report_key(ts, x, y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  884) 		//printk("#####report_key x=%d,y=%d######\n",x,y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  885) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  886) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  887) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  888) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  889) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  890) 	   input_mt_slot(ts->input_dev, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  891) 	   input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  892) 	   input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  893) 	   input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  894) 	   input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  895) 	   input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);
^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) #ifdef RK_GEAR_TOUCH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  899) 	if (ts->ts_cfg->quirks == GSL_QUIRK_VR) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  900) 		if (g_istouch == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  901) 			g_istouch = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  902) 			input_event(ts->input, EV_MSC, MSC_SCAN, 0x90001);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  903) 			input_report_key(ts->input, 0x110, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  904) 			input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  905) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  906) 		delt_x = (int)x - old_x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  907) 		delt_y = (int)y - old_y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  908) 		delt_x /= 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  909) 		delt_y /= 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  910) 		input_report_rel(ts->input, REL_Y, -delt_x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  911) 		input_report_rel(ts->input, REL_X, -delt_y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  912) 		input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  913) 		old_x = x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  914) 		old_y = y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  915) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  916) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  917) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  918) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  919) #ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  920) 	//printk("#####REPORT_DATA_ANDROID_4_0######\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  921) 	input_mt_slot(ts->input, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  922) 	//input_report_abs(ts->input, ABS_MT_TRACKING_ID, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  923) 	input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  924) 	input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, pressure);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  925) 	if (ts->ts_cfg->x_pol)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  926) 		input_report_abs(ts->input, ABS_MT_POSITION_X, max_x - x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  927) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  928) 		input_report_abs(ts->input, ABS_MT_POSITION_X, x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  929) 	if (ts->ts_cfg->y_pol)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  930) 		input_report_abs(ts->input, ABS_MT_POSITION_Y, (max_y - y));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  931) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  932) 		input_report_abs(ts->input, ABS_MT_POSITION_Y, (y));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  933) 	input_report_abs(ts->input, ABS_MT_WIDTH_MAJOR, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  934) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  935) 	//printk("#####nonono REPORT_DATA_ANDROID_4_0######\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  936) 	input_report_abs(ts->input, ABS_MT_TRACKING_ID, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  937) 	input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, pressure);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  938) 	input_report_abs(ts->input, ABS_MT_POSITION_X, x);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  939) 	input_report_abs(ts->input, ABS_MT_POSITION_Y, y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  940) 	input_report_abs(ts->input, ABS_MT_WIDTH_MAJOR, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  941) 	input_mt_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  942) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  943) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  944) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  945) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  946) void glsx680_ts_irq_disable(struct gsl_ts *ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  947) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  948) 	unsigned long irqflags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  949) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  950) 	spin_lock_irqsave(&ts->irq_lock, irqflags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  951) 	if (!ts->flag_irq_is_disable) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  952) 		disable_irq_nosync(ts->client->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  953) 		ts->flag_irq_is_disable = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  954) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  955) 	spin_unlock_irqrestore(&ts->irq_lock, irqflags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  956) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  957) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  958) void glsx680_ts_irq_enable(struct gsl_ts *ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  959) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  960) 	unsigned long irqflags = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  961) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  962) 	spin_lock_irqsave(&ts->irq_lock, irqflags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  963) 	if (ts->flag_irq_is_disable) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  964) 		enable_irq(ts->client->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  965) 		ts->flag_irq_is_disable = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  966) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  967) 	spin_unlock_irqrestore(&ts->irq_lock, irqflags);
^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 void gslX680_ts_worker(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  971) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  972) 	int rc, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  973) 	u8 id, touches;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  974) 	u16 x, y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  975) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  976) #ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  977) 	u32 tmp1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  978) 	u8 buf[4] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  979) 	struct gsl_touch_info cinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  980) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  981) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  982) 	struct gsl_ts *ts = container_of(work, struct gsl_ts, work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  983) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  984) #ifdef TPD_PROC_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  985) 	if (gsl_proc_flag == 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  986) 		goto schedule;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  987) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  988) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  989) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  990) 	if (i2c_lock_flag != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  991) 		goto i2c_lock_schedule;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  992) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  993) 		i2c_lock_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  994) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  995) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  996) 	rc = gsl_ts_read(ts->client, 0x80, ts->touch_data, ts->dd->data_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  997) 	if (rc < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  998) 		dev_err(&ts->client->dev, "read failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  999) 		goto schedule;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) 	touches = ts->touch_data[ts->dd->touch_index];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) 	//print_info("-----touches: %d -----\n", touches);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) #ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) 	cinfo.finger_num = touches;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) 	//print_info("tp-gsl  finger_num = %d\n",cinfo.finger_num);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008) 	for (i = 0; i < (touches < MAX_CONTACTS ? touches : MAX_CONTACTS); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) 		cinfo.x[i] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) 		    join_bytes((ts->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) 				touch_data[ts->dd->x_index + 4 * i + 1] & 0xf),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) 			       ts->touch_data[ts->dd->x_index + 4 * i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) 		cinfo.y[i] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) 		    join_bytes(ts->touch_data[ts->dd->y_index + 4 * i + 1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) 			       ts->touch_data[ts->dd->y_index + 4 * i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) 		cinfo.id[i] =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) 		    ((ts->touch_data[ts->dd->x_index + 4 * i + 1] & 0xf0) >> 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) 		/*print_info("tp-gsl  before: x[%d] = %d, y[%d] = %d,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) 		 id[%d] = %d \n",i,cinfo.x[i],i,cinfo.y[i],i,cinfo.id[i]);*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) 	cinfo.finger_num = (ts->touch_data[3] << 24) | (ts->touch_data[2] << 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) 	    | (ts->touch_data[1] << 8) | (ts->touch_data[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) 	gsl_alg_id_main(&cinfo);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) 	tmp1 = gsl_mask_tiaoping();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) 	//print_info("[tp-gsl] tmp1 = %x\n", tmp1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) 	if (tmp1 > 0 && tmp1 < 0xffffffff) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) 		buf[0] = 0xa;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) 		buf[1] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) 		buf[2] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030) 		buf[3] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) 		gsl_ts_write(ts->client, 0xf0, buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032) 		buf[0] = (u8) (tmp1 & 0xff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) 		buf[1] = (u8) ((tmp1 >> 8) & 0xff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034) 		buf[2] = (u8) ((tmp1 >> 16) & 0xff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) 		buf[3] = (u8) ((tmp1 >> 24) & 0xff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) 		print_info("tmp1=%08x,buf[0]=%02x,buf[1]=%02x,buf[2]=%02x, \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037) 			buf[3]=%02x\n", tmp1, buf[0], buf[1], buf[2], buf[3]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) 		gsl_ts_write(ts->client, 0x8, buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) 	touches = cinfo.finger_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) 	for (i = 1; i <= MAX_CONTACTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) 		if (touches == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045) 			id_sign[i] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046) 		id_state_flag[i] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048) 	for (i = 0; i < (touches > MAX_FINGERS ? MAX_FINGERS : touches); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) #ifdef GSL_NOID_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) 		id = cinfo.id[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) 		x = cinfo.x[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) 		y = cinfo.y[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) 		x = join_bytes((ts->
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) 				touch_data[ts->dd->x_index + 4 * i + 1] & 0xf),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) 			       ts->touch_data[ts->dd->x_index + 4 * i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) 		y = join_bytes(ts->touch_data[ts->dd->y_index + 4 * i + 1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) 			       ts->touch_data[ts->dd->y_index + 4 * i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) 		id = ts->touch_data[ts->dd->id_index + 4 * i] >> 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) 		if (1 <= id && id <= MAX_CONTACTS) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) #ifdef FILTER_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064) 			filter_point(x, y, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) 			record_point(x, y, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) #ifdef RK_GEAR_TOUCH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) 			report_data(ts, x_new, y_new, 10, id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) 			if (key_count < 512) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) 				key_x[key_count] = x_new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) 				key_y[key_count] = y_new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074) 				key_count++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075) 				/*printk("test in key store in here,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076) 				x_new is %d , y_new is %d ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077) 				key_count is %d \n", x_new ,y_new,key_count);*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) 			id_state_flag[id] = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082) 	for (i = 1; i <= MAX_CONTACTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) 		if ((0 == touches)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) 		    || ((0 != id_state_old_flag[i])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) 			&& (0 == id_state_flag[i]))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) #ifdef RK_GEAR_TOUCH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087) 			if (g_istouch == 1){
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) 				g_istouch = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) 				input_event(ts->input, EV_MSC, MSC_SCAN, 0x90001);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090) 				input_report_key(ts->input, 0x110, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) 				input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093) 			g_istouch = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095) #ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) 			input_mt_slot(ts->input, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097) 			//input_report_abs(ts->input, ABS_MT_TRACKING_ID, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098) 			input_mt_report_slot_state(ts->input, MT_TOOL_FINGER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099) 						   false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101) 			id_sign[i] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103) 		id_state_old_flag[i] = id_state_flag[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1106) 	if (0 == touches) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1107) #ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1108) #ifndef RK_GEAR_TOUCH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1109) 		//input_report_abs(ts->input, ABS_MT_TOUCH_MAJOR, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1110) 		//input_report_abs(ts->input, ABS_MT_WIDTH_MAJOR, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1111) 		//input_mt_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1113) 		int temp_x = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1114) 		int temp_y = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1115) 		temp_x =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1116) 		    (((key_x[key_count - 1] - key_x[0]) >
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1117) 		      0) ? (key_x[key_count - 1] - key_x[0])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1118) 		     : (key_x[0] - key_x[key_count - 1]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1119) 		temp_y =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1120) 		    (((key_y[key_count - 1] - key_y[0]) >
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1121) 		      0) ? (key_y[key_count - 1] - key_y[0])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1122) 		     : (key_y[0] - key_y[key_count - 1]));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1123) 		if (key_count <= 512) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1124) 			if (temp_x > temp_y) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1125) 				if ((key_x[key_count - 1] - key_x[0]) > 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1126) 					printk(" send up key \n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1127) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1128) 							 key_array[2], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1129) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1130) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1131) 							 key_array[2], 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1132) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1133) 				} else if ((key_x[0] - key_x[key_count - 1]) >
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1134) 					   100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1135) 					printk(" send down key \n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1136) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1137) 							 key_array[3], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1138) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1139) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1140) 							 key_array[3], 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1141) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1142) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1143) 			} else if (temp_x <= temp_y) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1144) 				if ((key_y[key_count - 1] - key_y[0]) > 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1145) 					printk(" send left key \n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1146) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1147) 							 key_array[0], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1148) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1149) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1150) 							 key_array[0], 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1151) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1152) 				} else if ((key_y[0] - key_y[key_count - 1]) >
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1153) 					   100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1154) 					printk(" send right key \n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1155) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1156) 							 key_array[1], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1157) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1158) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1159) 							 key_array[1], 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1160) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1161) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1162) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1163) 			/*printk(" key_x[key_count -1],  key_x[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1164) 			key_y[key_count -1], key_y[0] is %d ,%d , %d , %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1165) 			key_x[key_count -1], key_x[0], key_y[key_count -1],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1166) 			key_y[0]);*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1167) 			if ((key_x[key_count - 1] - key_x[0] < 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1168) 			    && (key_x[key_count - 1] - key_x[0] >= -50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1169) 			    && (key_y[key_count - 1] - key_y[0] < 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1170) 			    && (key_y[key_count - 1] - key_y[0] >= -50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1171) 			    && (key_x[0] != 0) && (key_y[0] != 0)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1172) 				//queue_work(gsl_timer_workqueue,&ts->click_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1173) 				//printk(" send enter2 key by yuandan \n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1174) 				//if(send_key)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1175) 				//      {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1176) 				printk(" send enter key \n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1177) 				input_report_key(ts->input, key_array[4], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1178) 				input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1179) 				input_report_key(ts->input, key_array[4], 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1180) 				input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1181) 				//      }else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1182) 				//              {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1183) 				//down(&my_sem);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1184) 				//                      send_key = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1185) 				//up(&my_sem);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1186) 				//              }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1187) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1188) 		} else if (key_count > 512) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1189) 			if (temp_x > temp_y) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1190) 				if ((key_x[511] - key_x[0]) > 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1191) 					printk(" send up key \n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1192) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1193) 							 key_array[2], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1194) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1195) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1196) 							 key_array[2], 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1197) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1198) 				} else if ((key_x[0] - key_x[511]) > 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1199) 					printk(" send down key \n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1200) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1201) 							 key_array[3], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1202) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1203) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1204) 							 key_array[3], 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1205) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1206) 				}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1207) 			} else if (temp_x <= temp_y) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1209) 				if ((key_y[511] - key_y[0]) > 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1210) 					printk(" send left key \n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1211) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1212) 							 key_array[0], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1213) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1214) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1215) 							 key_array[0], 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1216) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1217) 				} else if ((key_y[0] - key_y[511]) > 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1218) 					printk(" send right key \n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1219) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1220) 							 key_array[1], 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1221) 					input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1222) 					input_report_key(ts->input,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1223) 							 key_array[1], 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1224) 					input_sync(ts->input);
^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) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1228) 		memset(key_y, 0, sizeof(int) * 512);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1229) 		memset(key_x, 0, sizeof(int) * 512);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1230) 		key_count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1231) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1232) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1233) #ifdef HAVE_TOUCH_KEY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1234) 		if (key_state_flag) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1235) 			input_report_key(ts->input, key, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1236) 			input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1237) 			key_state_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1238) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1239) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1241) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1243) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1245)       schedule:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1246) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1247) 	i2c_lock_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1248)       i2c_lock_schedule:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1249) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1250) 	glsx680_ts_irq_enable(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1252) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1254) #ifdef HAVE_CLICK_TIMER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1256) static void click_timer_worker(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1257) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1258) 	while (true) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1259) 		mdelay(500);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1260) 		//down(&my_sem);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1261) 		send_key = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1262) 		//up(&my_sem);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1263) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1264) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1266) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1267) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1268) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1269) static void gsl_monitor_worker(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1270) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1271) 	//u8 write_buf[4] = {0};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1272) 	u8 read_buf[4] = { 0 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1273) 	char init_chip_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1275) 	//print_info("gsl_monitor_worker\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1276) 	struct gsl_ts *ts =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1277) 	    container_of(work, struct gsl_ts, gsl_monitor_work.work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1278) 	if (i2c_lock_flag != 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1279) 		i2c_lock_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1280) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1281) 	//goto queue_monitor_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1282) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1283) 		i2c_lock_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1284) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1285) 	//gsl_ts_read(ts->client, 0x80, read_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1286) 	/*printk("======read 0x80: %x %x %x %x ======tony0geshu\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1287) 	read_buf[3], read_buf[2], read_buf[1], read_buf[0]);*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1289) 	gsl_ts_read(ts->client, 0xb0, read_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1290) 	if (read_buf[3] != 0x5a || read_buf[2] != 0x5a || read_buf[1] != 0x5a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1291) 	    || read_buf[0] != 0x5a)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1292) 		b0_counter++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1293) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1294) 		b0_counter = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1296) 	if (b0_counter > 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1297) 		/*printk("======read 0xb0: %x %x %x %x ======\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1298) 		read_buf[3], read_buf[2], read_buf[1], read_buf[0]);*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1299) 		init_chip_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1300) 		b0_counter = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1301) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1302) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1303) 	gsl_ts_read(ts->client, 0xb4, read_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1304) 	int_2nd[3] = int_1st[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1305) 	int_2nd[2] = int_1st[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1306) 	int_2nd[1] = int_1st[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1307) 	int_2nd[0] = int_1st[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1308) 	int_1st[3] = read_buf[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1309) 	int_1st[2] = read_buf[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1310) 	int_1st[1] = read_buf[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1311) 	int_1st[0] = read_buf[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1312) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1313) 	/*printk("int_1st: %x %x %x %x , int_2nd: %x %x %x %x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1314) 	int_1st[3], int_1st[2], int_1st[1], int_1st[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1315) 	int_2nd[3], int_2nd[2],int_2nd[1],int_2nd[0]);*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1316) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1317) 	if (int_1st[3] == int_2nd[3] && int_1st[2] == int_2nd[2]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1318) 	    && int_1st[1] == int_2nd[1] && int_1st[0] == int_2nd[0]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1319) 		/*printk("int_1st: %x %x %x %x , int_2nd: %x %x %x %x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1320) 		int_1st[3], int_1st[2], int_1st[1], int_1st[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1321) 		int_2nd[3], int_2nd[2],int_2nd[1],int_2nd[0]);*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1322) 		init_chip_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1323) 		//goto queue_monitor_init_chip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1324) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1326) 	gsl_ts_read(ts->client, 0xbc, read_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1327) 	if (read_buf[3] != 0 || read_buf[2] != 0 || read_buf[1] != 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1328) 	    || read_buf[0] != 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1329) 		bc_counter++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1330) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1331) 		bc_counter = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1332) 	if (bc_counter > 1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1333) 		/*printk("======read 0xbc: %x %x %x %x======\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1334) 		read_buf[3], read_buf[2], read_buf[1], read_buf[0]);*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1335) 		init_chip_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1336) 		bc_counter = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1337) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1338) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1339) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1340) 	   write_buf[3] = 0x01;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1341) 	   write_buf[2] = 0xfe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1342) 	   write_buf[1] = 0x10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1343) 	   write_buf[0] = 0x00;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1344) 	   gsl_ts_write(ts->client, 0xf0, write_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1345) 	   gsl_ts_read(ts->client, 0x10, read_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1346) 	   gsl_ts_read(ts->client, 0x10, read_buf, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1347) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1348) 	   if(read_buf[3] < 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1349) 	   	&& read_buf[2] < 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1350) 		&& read_buf[1] < 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1351) 		&& read_buf[0] < 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1352) 	   dac_counter ++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1353) 	   else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1354) 	   dac_counter = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1355) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1356) 	   if(dac_counter > 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1357) 	   {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1358) 	   printk("read DAC1_0: %x %x %x %x\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1359) 	   	read_buf[3], read_buf[2], read_buf[1], read_buf[0]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1360) 	   init_chip_flag = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1361) 	   dac_counter = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1362) 	   }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1363) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1364) 	//queue_monitor_init_chip:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1365) 	if (init_chip_flag)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1366) 		init_chip(ts->client, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1367) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1368) 	i2c_lock_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1369) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1370) 	//queue_monitor_work:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1371) 	//queue_delayed_work(gsl_monitor_workqueue, &ts->gsl_monitor_work, 100);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1372) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1373) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1374) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1375) static irqreturn_t gsl_ts_irq(int irq, void *dev_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1376) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1377) 	///struct gsl_ts *ts = dev_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1378) 	struct gsl_ts *ts = (struct gsl_ts *)dev_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1379) 	//print_info("========gslX680 Interrupt=========\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1380) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1381) 	glsx680_ts_irq_disable(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1382) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1383) 	if (!work_pending(&ts->work)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1384) 		queue_work(ts->wq, &ts->work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1385) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1386) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1387) 	return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1388) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1389) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1390) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1391) static int gslX680_ts_init(struct i2c_client *client, struct gsl_ts *ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1392) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1393) 	struct input_dev *input_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1394) 	int rc = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1395) 	int i = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1396) 	int max_x = ts->ts_cfg->max_x;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1397) 	int max_y = ts->ts_cfg->max_y;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1398) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1399) 	printk("[GSLX680] Enter %s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1400) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1401) 	ts->dd = &devices[ts->device_id];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1402) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1403) 	if (ts->device_id == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1404) 		ts->dd->data_size =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1405) 		    MAX_FINGERS * ts->dd->touch_bytes + ts->dd->touch_meta_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1406) 		ts->dd->touch_index = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1407) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1408) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1409) 	ts->touch_data =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1410) 	    devm_kzalloc(&client->dev, ts->dd->data_size, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1411) 	if (!ts->touch_data) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1412) 		pr_err("%s: Unable to allocate memory\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1413) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1414) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1415) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1416) 	input_device = devm_input_allocate_device(&ts->client->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1417) 	if (!input_device) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1418) 		rc = -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1419) 		goto init_err_ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1420) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1421) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1422) 	ts->input = input_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1423) 	input_device->name = GSLX680_I2C_NAME;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1424) 	input_device->id.bustype = BUS_I2C;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1425) 	input_device->dev.parent = &client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1426) 	input_set_drvdata(input_device, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1427) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1428) #ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1429) 	__set_bit(EV_ABS, input_device->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1430) 	__set_bit(EV_KEY, input_device->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1431) 	__set_bit(EV_REP, input_device->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1432) 	__set_bit(EV_SYN, input_device->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1433) 	__set_bit(INPUT_PROP_DIRECT, input_device->propbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1434) 	__set_bit(MT_TOOL_FINGER, input_device->keybit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1435) 	input_mt_init_slots(input_device, (MAX_CONTACTS + 1), 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1436) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1437) 	input_set_abs_params(input_device, ABS_MT_TRACKING_ID, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1438) 			     (MAX_CONTACTS + 1), 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1439) 	set_bit(EV_ABS, input_device->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1440) 	set_bit(EV_KEY, input_device->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1441) 	__set_bit(INPUT_PROP_DIRECT, input_device->propbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1442) 	input_device->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1443) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1444) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1445) #ifdef HAVE_TOUCH_KEY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1446) 	input_device->evbit[0] = BIT_MASK(EV_KEY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1447) 	/*input_device->evbit[0] = BIT_MASK(EV_SYN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1448) 		| BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1449) 	for (i = 0; i < MAX_KEY_NUM; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1450) 		set_bit(key_array[i], input_device->keybit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1451) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1452) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1453) #ifdef RK_GEAR_TOUCH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1454) 	set_bit(EV_REL, input_device->evbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1455) 	input_set_capability(input_device, EV_REL, REL_X);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1456) 	input_set_capability(input_device, EV_REL, REL_Y);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1457) 	input_set_capability(input_device, EV_MSC, MSC_SCAN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1458) 	input_set_capability(input_device, EV_KEY, 0x110);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1459) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1460) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1461) 	set_bit(ABS_MT_POSITION_X, input_device->absbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1462) 	set_bit(ABS_MT_POSITION_Y, input_device->absbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1463) 	set_bit(ABS_MT_TOUCH_MAJOR, input_device->absbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1464) 	set_bit(ABS_MT_WIDTH_MAJOR, input_device->absbit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1465) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1466) 	input_set_abs_params(input_device, ABS_MT_POSITION_X, 0, max_x,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1467) 			     0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1468) 	input_set_abs_params(input_device, ABS_MT_POSITION_Y, 0, max_y,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1469) 			     0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1470) 	input_set_abs_params(input_device, ABS_MT_TOUCH_MAJOR, 0, PRESS_MAX, 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1471) 			     0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1472) 	input_set_abs_params(input_device, ABS_MT_WIDTH_MAJOR, 0, 200, 0, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1473) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1474) 	//client->irq = IRQ_PORT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1475) 	//ts->irq = client->irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1476) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1477) 	ts->wq = create_singlethread_workqueue("kworkqueue_ts");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1478) 	if (!ts->wq) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1479) 		dev_err(&client->dev, "gsl Could not create workqueue\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1480) 		goto init_err_ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1481) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1482) 	flush_workqueue(ts->wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1483) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1484) 	INIT_WORK(&ts->work, gslX680_ts_worker);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1485) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1486) 	rc = input_register_device(input_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1487) 	if (rc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1488) 		goto error_unreg_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1489) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1490) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1491) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1492)       error_unreg_device:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1493) 	destroy_workqueue(ts->wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1494)       init_err_ret:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1495) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1496) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1497) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1498) #if 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1499) static int gsl_ts_suspend(struct i2c_client *dev, pm_message_t mesg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1500) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1501) #if 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1502) 	struct gsl_ts *ts = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1503) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1504) 	printk("I'am in gsl_ts_suspend() start\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1505) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1506) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1507) 	printk("gsl_ts_suspend () : cancel gsl_monitor_work\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1508) 	cancel_delayed_work_sync(&ts->gsl_monitor_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1509) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1510) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1511) #ifdef HAVE_CLICK_TIMER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1512) 	//cancel_work_sync(&ts->click_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1513) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1514) 	disable_irq_nosync(ts->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1515) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1516) 	gslX680_shutdown_low(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1517) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1518) #ifdef SLEEP_CLEAR_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1519) 	mdelay(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1520) #ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1521) 	for (i = 1; i <= MAX_CONTACTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1522) 		input_mt_slot(ts->input, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1523) 		input_report_abs(ts->input, ABS_MT_TRACKING_ID, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1524) 		input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1525) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1526) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1527) 	input_mt_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1528) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1529) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1530) 	mdelay(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1531) 	report_data(ts, 1, 1, 10, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1532) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1533) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1534) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1535) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1536) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1537) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1538) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1539) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1540) #if 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1541) static int gsl_ts_resume(struct i2c_client *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1542) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1543) #if 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1544) 	struct gsl_ts *ts = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1545) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1546) 	printk("I'am in gsl_ts_resume() start\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1547) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1548) 	gslX680_shutdown_high(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1549) 	msleep(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1550) 	reset_chip(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1551) 	startup_chip(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1552) 	check_mem_data(ts->client, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1553) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1554) #ifdef SLEEP_CLEAR_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1555) #ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1556) 	for (i = 1; i <= MAX_CONTACTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1557) 		input_mt_slot(ts->input, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1558) 		input_report_abs(ts->input, ABS_MT_TRACKING_ID, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1559) 		input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1560) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1561) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1562) 	input_mt_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1563) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1564) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1565) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1566) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1567) 	printk("gsl_ts_resume () : queue gsl_monitor_work\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1568) 	queue_delayed_work(gsl_monitor_workqueue, &ts->gsl_monitor_work, 300);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1569) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1570) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1571) #ifdef HAVE_CLICK_TIMER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1572) 	//queue_work(gsl_timer_workqueue,&ts->click_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1573) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1574) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1575) 	disable_irq_nosync(ts->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1576) 	enable_irq(ts->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1577) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1578) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1579) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1580) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1581) #endif 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1582) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1583) static int gsl_ts_early_suspend(struct tp_device *tp_d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1584) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1585) 	struct gsl_ts *ts = container_of(tp_d, struct gsl_ts, tp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1586) 	printk("[GSLX680] Enter %s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1587) 	//gsl_ts_suspend(&ts->client->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1588) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1589) 	printk("gsl_ts_suspend () : cancel gsl_monitor_work\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1590) 	cancel_delayed_work_sync(&ts->gsl_monitor_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1591) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1592) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1593) 	glsx680_ts_irq_disable(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1594) 	cancel_work_sync(&ts->work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1595) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1596) #ifdef SLEEP_CLEAR_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1597) 	msleep(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1598) #ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1599) 	for (i = 1; i <= MAX_CONTACTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1600) 		input_mt_slot(ts->input, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1601) 		input_report_abs(ts->input, ABS_MT_TRACKING_ID, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1602) 		input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1603) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1604) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1605) 	input_mt_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1606) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1607) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1608) 	msleep(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1609) 	report_data(ts, 1, 1, 10, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1610) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1611) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1612) 	gslX680_shutdown_low(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1613) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1614) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1615) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1616) static int gsl_ts_late_resume(struct tp_device *tp_d)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1617) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1618) 	struct gsl_ts *ts = container_of(tp_d, struct gsl_ts, tp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1619) 	printk("[GSLX680] Enter %s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1620) 	//gsl_ts_resume(&ts->client->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1621) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1622) 	printk("I'am in gsl_ts_resume() start\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1623) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1624) 	gslX680_shutdown_high(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1625) 	msleep(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1626) 	reset_chip(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1627) 	startup_chip(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1628) 	check_mem_data(ts->client, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1629) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1630) #ifdef SLEEP_CLEAR_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1631) #ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1632) 	for (i = 1; i <= MAX_CONTACTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1633) 		input_mt_slot(ts->input, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1634) 		input_report_abs(ts->input, ABS_MT_TRACKING_ID, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1635) 		input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1636) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1637) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1638) 	input_mt_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1639) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1640) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1641) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1642) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1643) 	printk("gsl_ts_resume () : queue gsl_monitor_work\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1644) 	queue_delayed_work(gsl_monitor_workqueue, &ts->gsl_monitor_work, 300);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1645) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1646) 	glsx680_ts_irq_enable(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1647) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1648) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1649) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1650) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1651) #ifdef CONFIG_HAS_EARLYSUSPEND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1652) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1653) static void gsl_ts_early_suspend(struct early_suspend *h)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1654) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1655) 	struct gsl_ts *ts = container_of(h, struct gsl_ts, early_suspend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1656) 	printk("[GSLX680] Enter %s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1657) 	//gsl_ts_suspend(&ts->client->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1658) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1659) 	printk("gsl_ts_suspend () : cancel gsl_monitor_work\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1660) 	cancel_delayed_work_sync(&ts->gsl_monitor_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1661) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1662) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1663) 	glsx680_ts_irq_disable(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1664) 	cancel_work_sync(&ts->work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1665) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1666) #ifdef SLEEP_CLEAR_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1667) 	msleep(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1668) #ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1669) 	for (i = 1; i <= MAX_CONTACTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1670) 		input_mt_slot(ts->input, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1671) 		input_report_abs(ts->input, ABS_MT_TRACKING_ID, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1672) 		input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1673) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1674) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1675) 	input_mt_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1676) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1677) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1678) 	msleep(10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1679) 	report_data(ts, 1, 1, 10, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1680) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1681) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1682) 	gslX680_shutdown_low(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1683) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1684) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1685) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1686) static void gsl_ts_late_resume(struct early_suspend *h)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1687) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1688) 	struct gsl_ts *ts = container_of(h, struct gsl_ts, early_suspend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1689) 	printk("[GSLX680] Enter %s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1690) 	//gsl_ts_resume(&ts->client->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1691) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1692) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1693) 	printk("I'am in gsl_ts_resume() start\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1694) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1695) 	gslX680_shutdown_high(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1696) 	msleep(20);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1697) 	reset_chip(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1698) 	startup_chip(ts->client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1699) 	check_mem_data(ts->client, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1700) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1701) #ifdef SLEEP_CLEAR_POINT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1702) #ifdef REPORT_DATA_ANDROID_4_0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1703) 	for (i = 1; i <= MAX_CONTACTS; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1704) 		input_mt_slot(ts->input, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1705) 		input_report_abs(ts->input, ABS_MT_TRACKING_ID, -1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1706) 		input_mt_report_slot_state(ts->input, MT_TOOL_FINGER, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1707) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1708) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1709) 	input_mt_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1710) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1711) 	input_sync(ts->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1712) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1713) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1714) 	printk("gsl_ts_resume () : queue gsl_monitor_work\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1715) 	queue_delayed_work(gsl_monitor_workqueue, &ts->gsl_monitor_work, 300);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1716) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1717) 	glsx680_ts_irq_enable(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1718) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1719) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1720) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1721) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1722) //static struct wake_lock touch_wakelock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1723) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1724) static const struct of_device_id gsl_ts_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1725) 	{ .compatible = "gslX680", .data = &gslx680_vr_cfg },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1726) 	{ .compatible = "gslX680_tve", .data = &gslx680_tve_cfg },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1727) 	{}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1728) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1729) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1730) static int gsl_ts_probe(struct i2c_client *client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1731) 			const struct i2c_device_id *id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1732) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1733) 	const struct of_device_id *match;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1734) 	struct gsl_ts *ts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1735) 	int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1736) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1737) 	printk("GSLX680 Enter %s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1738) 	//wake_lock_init(&touch_wakelock, WAKE_LOCK_SUSPEND, "touch");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1739) 	//wake_lock(&touch_wakelock); //system do not enter deep sleep
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1740) 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1741) 		dev_err(&client->dev, "gsl I2C functionality not supported\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1742) 		return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1743) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1744) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1745) 	ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1746) 	if (!ts)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1747) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1748) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1749) 	match = of_match_device(of_match_ptr(gsl_ts_ids), &client->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1750) 	if (!match)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1751) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1752) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1753) 	ts->ts_cfg  = (const struct gsl_ts_cfg *)match->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1754) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1755) 	ts->tp.tp_suspend = gsl_ts_early_suspend;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1756) 	ts->tp.tp_resume = gsl_ts_late_resume;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1757) 	tp_register_fb(&ts->tp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1758) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1759) 	ts->client = client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1760) 	i2c_set_clientdata(client, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1761) 	//ts->device_id = id->driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1762) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1763) 	gslX680_init(ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1764) 	rc = gslX680_ts_init(client, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1765) 	if (rc < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1766) 		dev_err(&client->dev, "gsl GSLX680 init failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1767) 		goto porbe_err_ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1768) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1769) 	//#ifdef GSLX680_COMPATIBLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1770) 	//      judge_chip_type(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1771) 	//#endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1772) 	//printk("#####################  probe [2]chip_type=%c .\n",chip_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1773) 	init_chip(ts->client, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1774) 	check_mem_data(ts->client, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1775) 	spin_lock_init(&ts->irq_lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1776) 	client->irq = gpio_to_irq(ts->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1777) 	rc = request_irq(client->irq, gsl_ts_irq, IRQF_TRIGGER_RISING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1778) 			 client->name, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1779) 	if (rc < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1780) 		printk("gsl_probe: request irq failed\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1781) 		goto porbe_err_ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1782) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1783) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1784) 	/* create debug attribute */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1785) 	//rc = device_create_file(&ts->input->dev, &dev_attr_debug_enable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1786) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1787) #ifdef CONFIG_HAS_EARLYSUSPEND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1788) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1789) 	ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1790) 	//ts->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1791) 	ts->early_suspend.suspend = gsl_ts_early_suspend;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1792) 	ts->early_suspend.resume = gsl_ts_late_resume;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1793) 	register_early_suspend(&ts->early_suspend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1794) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1795) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1796) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1797) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1798) 	INIT_DELAYED_WORK(&ts->gsl_monitor_work, gsl_monitor_worker);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1799) 	gsl_monitor_workqueue =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1800) 	    create_singlethread_workqueue("gsl_monitor_workqueue");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1801) 	queue_delayed_work(gsl_monitor_workqueue, &ts->gsl_monitor_work, 1000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1802) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1803) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1804) #ifdef HAVE_CLICK_TIMER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1805) 	sema_init(&my_sem, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1806) 	INIT_WORK(&ts->click_work, click_timer_worker);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1807) 	gsl_timer_workqueue = create_singlethread_workqueue("click_timer");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1808) 	queue_work(gsl_timer_workqueue, &ts->click_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1809) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1810) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1811) #ifdef TPD_PROC_DEBUG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1812) #if 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1813) 	gsl_config_proc = create_proc_entry(GSL_CONFIG_PROC_FILE, 0666, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1814) 	printk("[tp-gsl] [%s] gsl_config_proc = %x \n", __func__,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1815) 	       gsl_config_proc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1816) 	if (gsl_config_proc == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1817) 		print_info("create_proc_entry %s failed\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1818) 			   GSL_CONFIG_PROC_FILE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1819) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1820) 		gsl_config_proc->read_proc = gsl_config_read_proc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1821) 		gsl_config_proc->write_proc = gsl_config_write_proc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1822) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1823) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1824) 	i2c_client = client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1825) 	proc_create(GSL_CONFIG_PROC_FILE, 0666, NULL, &gsl_seq_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1826) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1827) 	gsl_proc_flag = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1828) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1829) 	//disable_irq_nosync(->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1830) 	printk("[GSLX680] End %s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1831) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1832) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1833) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1834)       porbe_err_ret:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1835) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1836) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1837) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1838) static int gsl_ts_remove(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1839) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1840) 	struct gsl_ts *ts = i2c_get_clientdata(client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1841) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1842) #ifdef CONFIG_HAS_EARLYSUSPEND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1843) 	unregister_early_suspend(&ts->early_suspend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1844) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1845) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1846) #ifdef GSL_MONITOR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1847) 	cancel_delayed_work_sync(&ts->gsl_monitor_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1848) 	destroy_workqueue(gsl_monitor_workqueue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1849) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1850) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1851) #ifdef HAVE_CLICK_TIMER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1852) 	cancel_work_sync(&ts->click_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1853) 	destroy_workqueue(gsl_timer_workqueue);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1854) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1855) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1856) 	device_init_wakeup(&client->dev, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1857) 	cancel_work_sync(&ts->work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1858) 	free_irq(ts->client->irq, ts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1859) 	destroy_workqueue(ts->wq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1860) 	//device_remove_file(&ts->input->dev, &dev_attr_debug_enable);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1861) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1862) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1863) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1864) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1865) static const struct i2c_device_id gsl_ts_id[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1866) 	{GSLX680_I2C_NAME, 0},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1867) 	{}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1868) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1869) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1870) MODULE_DEVICE_TABLE(i2c, gsl_ts_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1871) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1872) static struct i2c_driver gsl_ts_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1873) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1874) 		   .name = GSLX680_I2C_NAME,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1875) 		   .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1876) 		   .of_match_table = of_match_ptr(gsl_ts_ids),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1877) 		   },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1878) #if 0 //ndef CONFIG_HAS_EARLYSUSPEND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1879) 	.suspend = gsl_ts_suspend,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1880) 	.resume = gsl_ts_resume,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1881) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1882) 	.probe = gsl_ts_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1883) 	.remove = gsl_ts_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1884) 	.id_table = gsl_ts_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1885) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1886) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1887) static int __init gsl_ts_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1888) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1889) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1890) 	ret = i2c_add_driver(&gsl_ts_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1891) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1892) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1893) static void __exit gsl_ts_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1894) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1895) 	i2c_del_driver(&gsl_ts_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1896) 	return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1897) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1898) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1899) module_init(gsl_ts_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1900) module_exit(gsl_ts_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1901) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1902) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1903) MODULE_DESCRIPTION("GSLX680 touchscreen controller driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1904) MODULE_AUTHOR("Guan Yuwei, guanyuwei@basewin.com");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1905) MODULE_ALIAS("platform:gsl_ts");