| .. | .. |
|---|
| 28 | 28 | #include "tp_suspend.h" |
|---|
| 29 | 29 | #include <linux/of_gpio.h> |
|---|
| 30 | 30 | #define GSL_DEBUG 0 |
|---|
| 31 | +#define GSL9XX_VDDIO_1800 |
|---|
| 31 | 32 | |
|---|
| 32 | 33 | #define TP2680A_ID 0x88 |
|---|
| 33 | 34 | #define TP2680B_ID 0x82 |
|---|
| .. | .. |
|---|
| 59 | 60 | #include "gsl3680_tab106.h" |
|---|
| 60 | 61 | #define TP_SIZE_1366X768 |
|---|
| 61 | 62 | #define Y_POL |
|---|
| 62 | | -#elif defined(CONFIG_TOUCHSCREEN_GSL3673_800X1280) |
|---|
| 63 | +#elif IS_ENABLED(CONFIG_TOUCHSCREEN_GSL3673_800X1280) |
|---|
| 63 | 64 | #define TP_SIZE_800X1280 |
|---|
| 64 | | - #include "gsl3673_800x1280.h" |
|---|
| 65 | + #include "rochkchip_gslX680_8inch_800x1280_tg806_10.h" |
|---|
| 66 | +// #include "gsl3673_800x1280.h" |
|---|
| 65 | 67 | #else |
|---|
| 66 | 68 | #include "gsl3680b_zm97f.h" |
|---|
| 67 | 69 | #define HAVE_TOUCH_KEY |
|---|
| .. | .. |
|---|
| 103 | 105 | #define GSL_STATUS_REG 0xe0 |
|---|
| 104 | 106 | #define GSL_PAGE_REG 0xf0 |
|---|
| 105 | 107 | |
|---|
| 106 | | -#define TPD_PROC_DEBUG |
|---|
| 108 | +//#define TPD_PROC_DEBUG |
|---|
| 107 | 109 | #ifdef TPD_PROC_DEBUG |
|---|
| 108 | 110 | #include <linux/proc_fs.h> |
|---|
| 109 | 111 | #include <linux/uaccess.h> |
|---|
| .. | .. |
|---|
| 206 | 208 | struct tp_device tp; |
|---|
| 207 | 209 | struct work_struct download_fw_work; |
|---|
| 208 | 210 | struct work_struct resume_work; |
|---|
| 211 | + struct delayed_work delayed_work_init; |
|---|
| 209 | 212 | }; |
|---|
| 210 | 213 | |
|---|
| 211 | 214 | #if GSL_DEBUG |
|---|
| .. | .. |
|---|
| 400 | 403 | return rc; |
|---|
| 401 | 404 | } |
|---|
| 402 | 405 | |
|---|
| 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 | + |
|---|
| 403 | 429 | static void startup_chip(struct i2c_client *client) |
|---|
| 404 | 430 | { |
|---|
| 405 | 431 | u8 tmp = 0x00; |
|---|
| .. | .. |
|---|
| 409 | 435 | #endif |
|---|
| 410 | 436 | gsl_ts_write(client, 0xe0, &tmp, 1); |
|---|
| 411 | 437 | mdelay(5); |
|---|
| 438 | + gsl_io_control(client); |
|---|
| 412 | 439 | } |
|---|
| 413 | 440 | |
|---|
| 414 | 441 | static void reset_chip(struct i2c_client *client) |
|---|
| .. | .. |
|---|
| 459 | 486 | } |
|---|
| 460 | 487 | schedule_work(&ts->download_fw_work); |
|---|
| 461 | 488 | 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 | + } |
|---|
| 462 | 503 | } |
|---|
| 463 | 504 | |
|---|
| 464 | 505 | static int check_mem_data(struct i2c_client *client) |
|---|
| .. | .. |
|---|
| 1158 | 1199 | #endif |
|---|
| 1159 | 1200 | INIT_WORK(&ts->download_fw_work, gsl_download_fw_work); |
|---|
| 1160 | 1201 | INIT_WORK(&ts->resume_work, gsl_resume_work); |
|---|
| 1202 | + INIT_DELAYED_WORK(&ts->delayed_work_init, gsl_delayed_work_init); |
|---|
| 1161 | 1203 | |
|---|
| 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 | | - } |
|---|
| 1167 | 1204 | spin_lock_init(&ts->irq_lock); |
|---|
| 1168 | 1205 | client->irq = gpio_to_irq(ts->irq); |
|---|
| 1169 | 1206 | rc = devm_request_irq(&client->dev, client->irq, gsl_ts_irq, |
|---|
| 1170 | 1207 | IRQF_TRIGGER_RISING, client->name, ts); |
|---|
| 1171 | 1208 | if (rc < 0) { |
|---|
| 1172 | 1209 | dev_err(&client->dev, "gsl_probe: request irq failed\n"); |
|---|
| 1173 | | - return rc; |
|---|
| 1210 | + goto error_mutex_destroy; |
|---|
| 1174 | 1211 | } |
|---|
| 1212 | + |
|---|
| 1213 | + schedule_delayed_work(&ts->delayed_work_init, |
|---|
| 1214 | + msecs_to_jiffies(800)); |
|---|
| 1175 | 1215 | #ifdef GSL_MONITOR |
|---|
| 1176 | 1216 | INIT_DELAYED_WORK(&gsl_monitor_work, gsl_monitor_worker); |
|---|
| 1177 | 1217 | gsl_monitor_workqueue = create_singlethread_workqueue |
|---|
| .. | .. |
|---|
| 1183 | 1223 | gsl_proc_flag = 0; |
|---|
| 1184 | 1224 | #endif |
|---|
| 1185 | 1225 | return 0; |
|---|
| 1186 | | -error_init_chip_fail: |
|---|
| 1187 | | - cancel_work_sync(&ts->download_fw_work); |
|---|
| 1188 | 1226 | error_mutex_destroy: |
|---|
| 1189 | 1227 | tp_unregister_fb(&ts->tp); |
|---|
| 1190 | 1228 | return rc; |
|---|
| .. | .. |
|---|
| 1198 | 1236 | cancel_delayed_work_sync(&gsl_monitor_work); |
|---|
| 1199 | 1237 | destroy_workqueue(gsl_monitor_workqueue); |
|---|
| 1200 | 1238 | #endif |
|---|
| 1239 | + tp_unregister_fb(&ts->tp); |
|---|
| 1201 | 1240 | device_init_wakeup(&client->dev, 0); |
|---|
| 1202 | 1241 | cancel_work_sync(&ts->work); |
|---|
| 1203 | 1242 | destroy_workqueue(ts->wq); |
|---|
| 1243 | + cancel_delayed_work_sync(&ts->delayed_work_init); |
|---|
| 1204 | 1244 | cancel_work_sync(&ts->download_fw_work); |
|---|
| 1205 | 1245 | return 0; |
|---|
| 1206 | 1246 | } |
|---|