hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/input/touchscreen/gsl3673_800x1280.c
....@@ -28,6 +28,7 @@
2828 #include "tp_suspend.h"
2929 #include <linux/of_gpio.h>
3030 #define GSL_DEBUG 0
31
+#define GSL9XX_VDDIO_1800
3132
3233 #define TP2680A_ID 0x88
3334 #define TP2680B_ID 0x82
....@@ -59,9 +60,10 @@
5960 #include "gsl3680_tab106.h"
6061 #define TP_SIZE_1366X768
6162 #define Y_POL
62
-#elif defined(CONFIG_TOUCHSCREEN_GSL3673_800X1280)
63
+#elif IS_ENABLED(CONFIG_TOUCHSCREEN_GSL3673_800X1280)
6364 #define TP_SIZE_800X1280
64
- #include "gsl3673_800x1280.h"
65
+ #include "rochkchip_gslX680_8inch_800x1280_tg806_10.h"
66
+// #include "gsl3673_800x1280.h"
6567 #else
6668 #include "gsl3680b_zm97f.h"
6769 #define HAVE_TOUCH_KEY
....@@ -103,7 +105,7 @@
103105 #define GSL_STATUS_REG 0xe0
104106 #define GSL_PAGE_REG 0xf0
105107
106
-#define TPD_PROC_DEBUG
108
+//#define TPD_PROC_DEBUG
107109 #ifdef TPD_PROC_DEBUG
108110 #include <linux/proc_fs.h>
109111 #include <linux/uaccess.h>
....@@ -206,6 +208,7 @@
206208 struct tp_device tp;
207209 struct work_struct download_fw_work;
208210 struct work_struct resume_work;
211
+ struct delayed_work delayed_work_init;
209212 };
210213
211214 #if GSL_DEBUG
....@@ -400,6 +403,29 @@
400403 return rc;
401404 }
402405
406
+static void gsl_io_control(struct i2c_client *client)
407
+{
408
+#ifdef GSL9XX_VDDIO_1800
409
+ u8 buf[4] = {0};
410
+ int i;
411
+
412
+ for (i = 0; i < 5; i++) {
413
+ buf[0] = 0;
414
+ buf[1] = 0;
415
+ buf[2] = 0xfe;
416
+ buf[3] = 0x1;
417
+ gsl_ts_write(client, 0xf0, buf, 4);
418
+ buf[0] = 0x5;
419
+ buf[1] = 0;
420
+ buf[2] = 0;
421
+ buf[3] = 0x80;
422
+ gsl_ts_write(client, 0x78, buf, 4);
423
+ usleep_range(5*1000, 5*1100);
424
+ }
425
+ usleep_range(50*1000, 50*1100);
426
+#endif
427
+}
428
+
403429 static void startup_chip(struct i2c_client *client)
404430 {
405431 u8 tmp = 0x00;
....@@ -409,6 +435,7 @@
409435 #endif
410436 gsl_ts_write(client, 0xe0, &tmp, 1);
411437 mdelay(5);
438
+ gsl_io_control(client);
412439 }
413440
414441 static void reset_chip(struct i2c_client *client)
....@@ -459,6 +486,20 @@
459486 }
460487 schedule_work(&ts->download_fw_work);
461488 return 0;
489
+}
490
+
491
+static void gsl_delayed_work_init(struct work_struct *work)
492
+{
493
+ struct delayed_work *dwork = to_delayed_work(work);
494
+ struct gsl_ts *gsl3673_ts = container_of(dwork, struct gsl_ts,
495
+ delayed_work_init);
496
+ int rc;
497
+
498
+ rc = init_chip(gsl3673_ts->client);
499
+ if (rc < 0) {
500
+ dev_err(&gsl3673_ts->client->dev, "gsl_probe: init_chip failed\n");
501
+ cancel_work_sync(&gsl3673_ts->download_fw_work);
502
+ }
462503 }
463504
464505 static int check_mem_data(struct i2c_client *client)
....@@ -1158,20 +1199,19 @@
11581199 #endif
11591200 INIT_WORK(&ts->download_fw_work, gsl_download_fw_work);
11601201 INIT_WORK(&ts->resume_work, gsl_resume_work);
1202
+ INIT_DELAYED_WORK(&ts->delayed_work_init, gsl_delayed_work_init);
11611203
1162
- rc = init_chip(ts->client);
1163
- if (rc < 0) {
1164
- dev_err(&client->dev, "gsl_probe: init_chip failed\n");
1165
- goto error_init_chip_fail;
1166
- }
11671204 spin_lock_init(&ts->irq_lock);
11681205 client->irq = gpio_to_irq(ts->irq);
11691206 rc = devm_request_irq(&client->dev, client->irq, gsl_ts_irq,
11701207 IRQF_TRIGGER_RISING, client->name, ts);
11711208 if (rc < 0) {
11721209 dev_err(&client->dev, "gsl_probe: request irq failed\n");
1173
- return rc;
1210
+ goto error_mutex_destroy;
11741211 }
1212
+
1213
+ schedule_delayed_work(&ts->delayed_work_init,
1214
+ msecs_to_jiffies(800));
11751215 #ifdef GSL_MONITOR
11761216 INIT_DELAYED_WORK(&gsl_monitor_work, gsl_monitor_worker);
11771217 gsl_monitor_workqueue = create_singlethread_workqueue
....@@ -1183,8 +1223,6 @@
11831223 gsl_proc_flag = 0;
11841224 #endif
11851225 return 0;
1186
-error_init_chip_fail:
1187
- cancel_work_sync(&ts->download_fw_work);
11881226 error_mutex_destroy:
11891227 tp_unregister_fb(&ts->tp);
11901228 return rc;
....@@ -1198,9 +1236,11 @@
11981236 cancel_delayed_work_sync(&gsl_monitor_work);
11991237 destroy_workqueue(gsl_monitor_workqueue);
12001238 #endif
1239
+ tp_unregister_fb(&ts->tp);
12011240 device_init_wakeup(&client->dev, 0);
12021241 cancel_work_sync(&ts->work);
12031242 destroy_workqueue(ts->wq);
1243
+ cancel_delayed_work_sync(&ts->delayed_work_init);
12041244 cancel_work_sync(&ts->download_fw_work);
12051245 return 0;
12061246 }