hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/input/touchscreen/gt9xx/gt9xx.c
....@@ -68,8 +68,8 @@
6868
6969 static const char *goodix_ts_name = "goodix-ts";
7070 static struct workqueue_struct *goodix_wq;
71
-struct i2c_client * i2c_connect_client = NULL;
72
-u8 config[GTP_CONFIG_MAX_LENGTH + GTP_ADDR_LENGTH]
71
+struct i2c_client * gtp_i2c_connect_client = NULL;
72
+static u8 config[GTP_CONFIG_MAX_LENGTH + GTP_ADDR_LENGTH]
7373 = {GTP_REG_CONFIG_DATA >> 8, GTP_REG_CONFIG_DATA & 0xff};
7474
7575 #if GTP_HAVE_TOUCH_KEY
....@@ -86,12 +86,12 @@
8686 static s8 gtp_i2c_test(struct i2c_client *client);
8787 void gtp_reset_guitar(struct i2c_client *client, s32 ms);
8888 s32 gtp_send_cfg(struct i2c_client *client);
89
-void gtp_int_sync(s32 ms, struct goodix_ts_data *ts);
89
+static void gtp_int_sync(s32 ms, struct goodix_ts_data *ts);
9090
9191 static ssize_t gt91xx_config_read_proc(struct file *, char __user *, size_t, loff_t *);
9292 static ssize_t gt91xx_config_write_proc(struct file *, const char __user *, size_t, loff_t *);
9393
94
-static struct proc_dir_entry *gt91xx_config_proc = NULL;
94
+//static struct proc_dir_entry *gt91xx_config_proc = NULL;
9595 static const struct file_operations config_proc_ops = {
9696 .owner = THIS_MODULE,
9797 .read = gt91xx_config_read_proc,
....@@ -117,15 +117,15 @@
117117
118118 //*********** For GT9XXF Start **********//
119119 #if GTP_COMPATIBLE_MODE
120
-extern s32 i2c_read_bytes(struct i2c_client *client, u16 addr, u8 *buf, s32 len);
121
-extern s32 i2c_write_bytes(struct i2c_client *client, u16 addr, u8 *buf, s32 len);
122
-extern s32 gup_clk_calibration(void);
123
-extern s32 gup_fw_download_proc(void *dir, u8 dwn_mode);
124
-extern u8 gup_check_fs_mounted(char *path_name);
120
+//extern s32 gtp_i2c_read_bytes(struct i2c_client *client, u16 addr, u8 *buf, s32 len);
121
+//extern s32 gtp_i2c_write_bytes(struct i2c_client *client, u16 addr, u8 *buf, s32 len);
122
+//extern s32 gtp_gup_clk_calibration(void);
123
+//extern s32 gtp_gup_fw_download_proc(void *dir, u8 dwn_mode);
124
+//extern u8 gtp_gup_check_fs_mounted(char *path_name);
125125
126
-void gtp_recovery_reset(struct i2c_client *client);
126
+static void gtp_recovery_reset(struct i2c_client *client);
127127 static s32 gtp_esd_recovery(struct i2c_client *client);
128
-s32 gtp_fw_startup(struct i2c_client *client);
128
+//s32 gtp_fw_startup(struct i2c_client *client);
129129 static s32 gtp_main_clk_proc(struct goodix_ts_data *ts);
130130 static s32 gtp_bak_ref_proc(struct goodix_ts_data *ts, u8 mode);
131131
....@@ -143,7 +143,7 @@
143143 static s8 gtp_enter_doze(struct goodix_ts_data *ts);
144144 #endif
145145
146
-u8 grp_cfg_version = 0;
146
+static u8 grp_cfg_version = 0;
147147
148148 /*******************************************************
149149 Function:
....@@ -157,7 +157,7 @@
157157 numbers of i2c_msgs to transfer:
158158 2: succeed, otherwise: failed
159159 *********************************************************/
160
-s32 gtp_i2c_read(struct i2c_client *client, u8 *buf, s32 len)
160
+static s32 gtp_i2c_read(struct i2c_client *client, u8 *buf, s32 len)
161161 {
162162 struct i2c_msg msgs[2];
163163 s32 ret=-1;
....@@ -230,7 +230,7 @@
230230 numbers of i2c_msgs to transfer:
231231 1: succeed, otherwise: failed
232232 *********************************************************/
233
-s32 gtp_i2c_write(struct i2c_client *client,u8 *buf,s32 len)
233
+static s32 gtp_i2c_write(struct i2c_client *client,u8 *buf,s32 len)
234234 {
235235 struct i2c_msg msg;
236236 s32 ret = -1;
....@@ -523,7 +523,7 @@
523523
524524 static void gtp_pen_down(s32 x, s32 y, s32 w, s32 id)
525525 {
526
- struct goodix_ts_data *ts = i2c_get_clientdata(i2c_connect_client);
526
+ struct goodix_ts_data *ts = i2c_get_clientdata(gtp_i2c_connect_client);
527527
528528 if (gtp_change_x2y)
529529 GTP_SWAP(x, y);
....@@ -551,7 +551,7 @@
551551
552552 static void gtp_pen_up(s32 id)
553553 {
554
- struct goodix_ts_data *ts = i2c_get_clientdata(i2c_connect_client);
554
+ struct goodix_ts_data *ts = i2c_get_clientdata(gtp_i2c_connect_client);
555555
556556 input_report_key(ts->pen_dev, BTN_TOOL_PEN, 0);
557557
....@@ -613,7 +613,7 @@
613613 #if GTP_GESTURE_WAKEUP
614614 if (DOZE_ENABLED == doze_status)
615615 {
616
- ret = gtp_i2c_read(i2c_connect_client, doze_buf, 3);
616
+ ret = gtp_i2c_read(gtp_i2c_connect_client, doze_buf, 3);
617617 GTP_DEBUG("0x814B = 0x%02X", doze_buf[2]);
618618 if (ret > 0)
619619 {
....@@ -640,7 +640,7 @@
640640 input_sync(ts->input_dev);
641641 // clear 0x814B
642642 doze_buf[2] = 0x00;
643
- gtp_i2c_write(i2c_connect_client, doze_buf, 3);
643
+ gtp_i2c_write(gtp_i2c_connect_client, doze_buf, 3);
644644 }
645645 else if ( (doze_buf[2] == 0xAA) || (doze_buf[2] == 0xBB) ||
646646 (doze_buf[2] == 0xAB) || (doze_buf[2] == 0xBA) )
....@@ -656,7 +656,7 @@
656656 input_sync(ts->input_dev);
657657 // clear 0x814B
658658 doze_buf[2] = 0x00;
659
- gtp_i2c_write(i2c_connect_client, doze_buf, 3);
659
+ gtp_i2c_write(gtp_i2c_connect_client, doze_buf, 3);
660660 }
661661 else if (0xCC == doze_buf[2])
662662 {
....@@ -668,13 +668,13 @@
668668 input_sync(ts->input_dev);
669669 // clear 0x814B
670670 doze_buf[2] = 0x00;
671
- gtp_i2c_write(i2c_connect_client, doze_buf, 3);
671
+ gtp_i2c_write(gtp_i2c_connect_client, doze_buf, 3);
672672 }
673673 else
674674 {
675675 // clear 0x814B
676676 doze_buf[2] = 0x00;
677
- gtp_i2c_write(i2c_connect_client, doze_buf, 3);
677
+ gtp_i2c_write(gtp_i2c_connect_client, doze_buf, 3);
678678 gtp_enter_doze(ts);
679679 }
680680 }
....@@ -1087,7 +1087,7 @@
10871087 Output:
10881088 None.
10891089 *******************************************************/
1090
-void gtp_int_sync(s32 ms, struct goodix_ts_data *ts)
1090
+static void gtp_int_sync(s32 ms, struct goodix_ts_data *ts)
10911091 {
10921092 GTP_GPIO_OUTPUT(ts->irq_pin, 0);
10931093 msleep(ms);
....@@ -1706,7 +1706,7 @@
17061706 ptr += sprintf(ptr, "\n");
17071707
17081708 ptr += sprintf(ptr, "==== GT9XX config real value====\n");
1709
- gtp_i2c_read(i2c_connect_client, temp_data, GTP_CONFIG_MAX_LENGTH + 2);
1709
+ gtp_i2c_read(gtp_i2c_connect_client, temp_data, GTP_CONFIG_MAX_LENGTH + 2);
17101710 for (i = 0 ; i < GTP_CONFIG_MAX_LENGTH ; i++)
17111711 {
17121712 ptr += sprintf(ptr, "0x%02X ", temp_data[i+2]);
....@@ -1734,7 +1734,7 @@
17341734 return -EFAULT;
17351735 }
17361736
1737
- ret = gtp_send_cfg(i2c_connect_client);
1737
+ ret = gtp_send_cfg(gtp_i2c_connect_client);
17381738
17391739 if (ret < 0)
17401740 {
....@@ -2144,7 +2144,7 @@
21442144 struct goodix_ts_data *ts = i2c_get_clientdata(client);
21452145 //init sw WDT
21462146 opr_buf[0] = 0xAA;
2147
- ret = i2c_write_bytes(client, 0x8041, opr_buf, 1);
2147
+ ret = gtp_i2c_write_bytes(client, 0x8041, opr_buf, 1);
21482148 if (ret < 0)
21492149 {
21502150 return FAIL;
....@@ -2152,7 +2152,7 @@
21522152
21532153 //release SS51 & DSP
21542154 opr_buf[0] = 0x00;
2155
- ret = i2c_write_bytes(client, 0x4180, opr_buf, 1);
2155
+ ret = gtp_i2c_write_bytes(client, 0x4180, opr_buf, 1);
21562156 if (ret < 0)
21572157 {
21582158 return FAIL;
....@@ -2161,7 +2161,7 @@
21612161 gtp_int_sync(25, ts);
21622162
21632163 //check fw run status
2164
- ret = i2c_read_bytes(client, 0x8041, opr_buf, 1);
2164
+ ret = gtp_i2c_read_bytes(client, 0x8041, opr_buf, 1);
21652165 if (ret < 0)
21662166 {
21672167 return FAIL;
....@@ -2175,7 +2175,7 @@
21752175 {
21762176 GTP_INFO("IC works normally, Startup success.");
21772177 opr_buf[0] = 0xAA;
2178
- i2c_write_bytes(client, 0x8041, opr_buf, 1);
2178
+ gtp_i2c_write_bytes(client, 0x8041, opr_buf, 1);
21792179 return SUCCESS;
21802180 }
21812181 }
....@@ -2193,7 +2193,7 @@
21932193 GTP_INFO("GT9XXF esd recovery mode");
21942194 for (retry = 0; retry < 5; retry++)
21952195 {
2196
- ret = gup_fw_download_proc(NULL, GTP_FL_ESD_RECOVERY);
2196
+ ret = gtp_gup_fw_download_proc(NULL, GTP_FL_ESD_RECOVERY);
21972197 if (FAIL == ret)
21982198 {
21992199 GTP_ERROR("esd recovery failed %d", retry+1);
....@@ -2219,7 +2219,7 @@
22192219 return SUCCESS;
22202220 }
22212221
2222
-void gtp_recovery_reset(struct i2c_client *client)
2222
+static void gtp_recovery_reset(struct i2c_client *client)
22232223 {
22242224 #if GTP_ESD_PROTECT
22252225 gtp_esd_switch(client, SWITCH_OFF);
....@@ -2246,7 +2246,7 @@
22462246 struct file *ref_filp = NULL;
22472247 u8 *p_bak_ref;
22482248
2249
- ret = gup_check_fs_mounted("/data");
2249
+ ret = gtp_gup_check_fs_mounted("/data");
22502250 if (FAIL == ret)
22512251 {
22522252 ts->ref_chk_fs_times++;
....@@ -2334,7 +2334,7 @@
23342334 }
23352335 }
23362336 }
2337
- ret = i2c_write_bytes(ts->client, GTP_REG_BAK_REF, p_bak_ref, ts->bak_ref_len);
2337
+ ret = gtp_i2c_write_bytes(ts->client, GTP_REG_BAK_REF, p_bak_ref, ts->bak_ref_len);
23382338 if (FAIL == ret)
23392339 {
23402340 GTP_ERROR("failed to send bak_ref because of iic comm error");
....@@ -2344,7 +2344,7 @@
23442344
23452345 case GTP_BAK_REF_STORE:
23462346 GTP_INFO("Store backup-reference");
2347
- ret = i2c_read_bytes(ts->client, GTP_REG_BAK_REF, p_bak_ref, ts->bak_ref_len);
2347
+ ret = gtp_i2c_read_bytes(ts->client, GTP_REG_BAK_REF, p_bak_ref, ts->bak_ref_len);
23482348 if (ret < 0)
23492349 {
23502350 GTP_ERROR("failed to read bak_ref info, sending default back-reference");
....@@ -2368,7 +2368,7 @@
23682368 memset(&p_bak_ref[j * ref_seg_len], 0, ref_seg_len);
23692369 p_bak_ref[j * ref_seg_len + ref_seg_len - 1] = 0x01; // checksum = 1
23702370 }
2371
- ret = i2c_write_bytes(ts->client, GTP_REG_BAK_REF, p_bak_ref, ts->bak_ref_len);
2371
+ ret = gtp_i2c_write_bytes(ts->client, GTP_REG_BAK_REF, p_bak_ref, ts->bak_ref_len);
23722372 if (!IS_ERR(ref_filp))
23732373 {
23742374 GTP_INFO("write backup-reference data into %s", GTP_BAK_REF_PATH);
....@@ -2450,7 +2450,7 @@
24502450 goto update_main_clk;
24512451 }
24522452 #else
2453
- ret = gup_check_fs_mounted("/data");
2453
+ ret = gtp_gup_check_fs_mounted("/data");
24542454 if (FAIL == ret)
24552455 {
24562456 ts->clk_chk_fs_times++;
....@@ -2496,7 +2496,7 @@
24962496 #if GTP_ESD_PROTECT
24972497 gtp_esd_switch(ts->client, SWITCH_OFF);
24982498 #endif
2499
- ret = gup_clk_calibration();
2499
+ ret = gtp_gup_clk_calibration();
25002500 gtp_esd_recovery(ts->client);
25012501
25022502 #if GTP_ESD_PROTECT
....@@ -2527,7 +2527,7 @@
25272527 }
25282528
25292529 update_main_clk:
2530
- ret = i2c_write_bytes(ts->client, GTP_REG_MAIN_CLK, p_main_clk, 6);
2530
+ ret = gtp_i2c_write_bytes(ts->client, GTP_REG_MAIN_CLK, p_main_clk, 6);
25312531 if (FAIL == ret)
25322532 {
25332533 GTP_ERROR("update main clock failed!");
....@@ -2544,11 +2544,11 @@
25442544 }
25452545
25462546
2547
-s32 gtp_gt9xxf_init(struct i2c_client *client)
2547
+static s32 gtp_gt9xxf_init(struct i2c_client *client)
25482548 {
25492549 s32 ret = 0;
25502550
2551
- ret = gup_fw_download_proc(NULL, GTP_FL_FW_BURN);
2551
+ ret = gtp_gup_fw_download_proc(NULL, GTP_FL_FW_BURN);
25522552 if (FAIL == ret)
25532553 {
25542554 return FAIL;
....@@ -2562,7 +2562,7 @@
25622562 return SUCCESS;
25632563 }
25642564
2565
-void gtp_get_chip_type(struct goodix_ts_data *ts)
2565
+static void gtp_get_chip_type(struct goodix_ts_data *ts)
25662566 {
25672567 u8 opr_buf[10] = {0x00};
25682568 s32 ret = 0;
....@@ -2626,7 +2626,7 @@
26262626 GTP_INFO("GTP Driver Version: %s", GTP_DRIVER_VERSION);
26272627 GTP_INFO("GTP I2C Address: 0x%02x", client->addr);
26282628
2629
- i2c_connect_client = client;
2629
+ gtp_i2c_connect_client = client;
26302630
26312631 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
26322632 {
....@@ -2670,8 +2670,8 @@
26702670 } else if (val == 9110) {
26712671 m89or101 = FALSE;
26722672 bgt9110 = TRUE;
2673
- gtp_change_x2y = TRUE;
2674
- gtp_x_reverse = TRUE;
2673
+ gtp_change_x2y = FALSE;
2674
+ gtp_x_reverse = FALSE;
26752675 gtp_y_reverse = FALSE;
26762676 } else if (val == 9111) {
26772677 m89or101 = FALSE;
....@@ -2804,6 +2804,7 @@
28042804
28052805 ts->irq_flags = ts->int_trigger_type ? IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING;
28062806 // Create proc file system
2807
+#if 0
28072808 gt91xx_config_proc = proc_create(GT91XX_CONFIG_PROC_FILE, 0664, NULL, &config_proc_ops);
28082809 if (gt91xx_config_proc == NULL)
28092810 {
....@@ -2813,6 +2814,7 @@
28132814 {
28142815 GTP_INFO("create proc entry %s success", GT91XX_CONFIG_PROC_FILE);
28152816 }
2817
+#endif
28162818
28172819 #if GTP_AUTO_UPDATE
28182820 ret = gup_init_update_proc(ts);
....@@ -3061,7 +3063,7 @@
30613063
30623064 GTP_DEBUG_FUNC();
30633065
3064
- ts = i2c_get_clientdata(i2c_connect_client);
3066
+ ts = i2c_get_clientdata(gtp_i2c_connect_client);
30653067
30663068 if (ts->gtp_is_suspend)
30673069 {
....@@ -3233,3 +3235,4 @@
32333235
32343236 MODULE_DESCRIPTION("GTP Series Driver");
32353237 MODULE_LICENSE("GPL");
3238
+MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver);