.. | .. |
---|
240 | 240 | msleep(ms); |
---|
241 | 241 | |
---|
242 | 242 | gtp_set_int_value(0); |
---|
243 | | - msleep(2); |
---|
| 243 | + msleep(50); |
---|
244 | 244 | |
---|
245 | 245 | ctp_wakeup(1, 0); |
---|
246 | | - msleep(6); |
---|
| 246 | + msleep(60); |
---|
247 | 247 | |
---|
248 | 248 | |
---|
249 | 249 | #if GTP_ESD_PROTECT |
---|
.. | .. |
---|
289 | 289 | } |
---|
290 | 290 | |
---|
291 | 291 | if(retries >= 2) { |
---|
292 | | - printk("%s:I2C retry timeout, reset chip.", __func__); |
---|
| 292 | + printk("%s:I2C retry timeout, reset chip. \n", __func__); |
---|
293 | 293 | } |
---|
294 | 294 | return ret; |
---|
295 | 295 | } |
---|
.. | .. |
---|
659 | 659 | } |
---|
660 | 660 | |
---|
661 | 661 | |
---|
662 | | - |
---|
| 662 | +static s32 gtp_init_panel(struct goodix_ts_data *ts); |
---|
663 | 663 | |
---|
664 | 664 | /******************************************************* |
---|
665 | 665 | Function: |
---|
.. | .. |
---|
708 | 708 | *******************************************************/ |
---|
709 | 709 | static s8 gtp_wakeup_sleep(struct goodix_ts_data * ts) |
---|
710 | 710 | { |
---|
711 | | - u8 retry = 0; |
---|
712 | | - s8 ret = -1; |
---|
713 | | - |
---|
| 711 | + //u8 retry = 0; |
---|
| 712 | + s8 ret = 0; |
---|
| 713 | + printk("hcm gtp_wakeup_sleep !\n"); |
---|
714 | 714 | gtp_io_init(20); |
---|
715 | 715 | gtp_set_io_int(); |
---|
716 | 716 | |
---|
717 | | -#if GTP_POWER_CTRL_SLEEP |
---|
| 717 | +//#if GTP_POWER_CTRL_SLEEP |
---|
| 718 | +#if 0 |
---|
718 | 719 | while(retry++ < 5) |
---|
719 | 720 | { |
---|
720 | 721 | ret = gtp_send_cfg(ts->client); |
---|
.. | .. |
---|
726 | 727 | } |
---|
727 | 728 | |
---|
728 | 729 | printk("GTP wakeup sleep failed."); |
---|
729 | | - return ret; |
---|
| 730 | + |
---|
| 731 | +#endif |
---|
| 732 | + |
---|
| 733 | + ret = gtp_i2c_test(ts->client); |
---|
| 734 | + if (ret < 0){ |
---|
| 735 | + printk("hcm I2C communication ERROR!\n"); |
---|
| 736 | + msleep(50); |
---|
| 737 | + gtp_set_io_int(); |
---|
| 738 | + ret = gtp_i2c_test(ts->client); |
---|
| 739 | + if (ret < 0){ |
---|
| 740 | + printk("I2C communication ERROR 2!\n"); |
---|
| 741 | + } |
---|
| 742 | + } |
---|
| 743 | + |
---|
| 744 | + ret = gtp_init_panel(ts); |
---|
| 745 | + if (ret < 0) { |
---|
| 746 | + printk("GTP init panel failed.\n"); |
---|
| 747 | + } |
---|
| 748 | + |
---|
| 749 | + |
---|
| 750 | +#if GTP_CREATE_WR_NODE |
---|
| 751 | + init_wr_node(ts->client); |
---|
730 | 752 | #endif |
---|
731 | 753 | |
---|
| 754 | + return ret; |
---|
732 | 755 | } |
---|
733 | 756 | |
---|
734 | 757 | |
---|
.. | .. |
---|
978 | 1001 | if (ret > 0) { |
---|
979 | 1002 | return ret; |
---|
980 | 1003 | } |
---|
981 | | - printk("GTP i2c test failed time %d.",retry); |
---|
| 1004 | + printk("GTP i2c test failed time %d. \n",retry); |
---|
982 | 1005 | msleep(10); |
---|
983 | 1006 | } |
---|
984 | 1007 | return ret; |
---|
.. | .. |
---|
1060 | 1083 | return 0; |
---|
1061 | 1084 | } |
---|
1062 | 1085 | |
---|
| 1086 | +static int goodix_ts_suspend(struct device *dev); |
---|
| 1087 | +static int goodix_ts_resume(struct device *dev); |
---|
| 1088 | +extern void gt9xx_resume_extern(void); |
---|
| 1089 | +extern void gt9xx_suspend_extern(void); |
---|
| 1090 | +struct goodix_ts_data *cur_ts; |
---|
| 1091 | + |
---|
| 1092 | +void gt9xx_suspend_extern(void) |
---|
| 1093 | +{ |
---|
| 1094 | + // goodix_ts_suspend(config_info.dev); |
---|
| 1095 | + |
---|
| 1096 | + gtp_irq_disable(cur_ts); |
---|
| 1097 | + cancel_work_sync(&goodix_resume_work); |
---|
| 1098 | + flush_workqueue(goodix_resume_wq); |
---|
| 1099 | + cancel_work_sync(&cur_ts->work); |
---|
| 1100 | + flush_workqueue(goodix_wq); |
---|
| 1101 | + |
---|
| 1102 | +} |
---|
| 1103 | +EXPORT_SYMBOL(gt9xx_suspend_extern); |
---|
| 1104 | + |
---|
| 1105 | +void gt9xx_resume_extern(void) |
---|
| 1106 | +{ |
---|
| 1107 | + // goodix_ts_resume(config_info.dev); |
---|
| 1108 | + printk("%s goodix_ts_resume v1\n", goodix_ts_name); |
---|
| 1109 | + __gpio_set_value(config_info.wakeup_gpio.gpio, 1); |
---|
| 1110 | + input_set_power_enable(&(config_info.input_type), 1); |
---|
| 1111 | + msleep(10); |
---|
| 1112 | + // goodix_resume_events |
---|
| 1113 | + queue_work(goodix_resume_wq, &goodix_resume_work);//gandy |
---|
| 1114 | + |
---|
| 1115 | +} |
---|
| 1116 | +EXPORT_SYMBOL(gt9xx_resume_extern); |
---|
1063 | 1117 | |
---|
1064 | 1118 | /******************************************************* |
---|
1065 | 1119 | Function: |
---|
.. | .. |
---|
1102 | 1156 | |
---|
1103 | 1157 | |
---|
1104 | 1158 | ret = gtp_i2c_test(client); |
---|
1105 | | - if (ret < 0){ |
---|
1106 | | - printk("I2C communication ERROR!\n"); |
---|
| 1159 | + if (ret < 0 && client->addr == 0x5d){ |
---|
| 1160 | + printk("I2C communication ERROR! reset chip and retry \n"); |
---|
| 1161 | + gtp_set_io_int(); |
---|
| 1162 | + ret = gtp_i2c_test(client); |
---|
| 1163 | + if (ret < 0){ |
---|
| 1164 | + printk("I2C communication ERROR 2!\n"); |
---|
| 1165 | + goto exit_device_detect; |
---|
| 1166 | + } |
---|
| 1167 | + } else if (ret < 0) { |
---|
| 1168 | + printk("I2C communication ERROR %02x !\n", client->addr); |
---|
1107 | 1169 | goto exit_device_detect; |
---|
1108 | 1170 | } |
---|
1109 | 1171 | |
---|
.. | .. |
---|
1165 | 1227 | queue_delayed_work(gtp_esd_check_workqueue, >p_esd_check_work, GTP_ESD_CHECK_CIRCLE); |
---|
1166 | 1228 | #endif |
---|
1167 | 1229 | dprintk(DEBUG_INIT, "gt9xx probe success!\n"); |
---|
| 1230 | + |
---|
| 1231 | + cur_ts = ts; |
---|
| 1232 | + |
---|
1168 | 1233 | return 0; |
---|
1169 | 1234 | exit_device_detect: |
---|
1170 | 1235 | i2c_set_clientdata(client, NULL); |
---|
.. | .. |
---|
1221 | 1286 | { |
---|
1222 | 1287 | int ret; |
---|
1223 | 1288 | struct goodix_ts_data *ts = i2c_get_clientdata(i2c_connect_client); |
---|
1224 | | - |
---|
| 1289 | + printk("goodix_resume_events \n"); |
---|
1225 | 1290 | ret = gtp_wakeup_sleep(ts); |
---|
1226 | 1291 | if (ret < 0) |
---|
1227 | 1292 | printk("resume power on failed\n"); |
---|
.. | .. |
---|
1438 | 1503 | .driver = { |
---|
1439 | 1504 | .name = CTP_NAME, |
---|
1440 | 1505 | .owner = THIS_MODULE, |
---|
1441 | | -#ifndef CONFIG_HAS_EARLYSUSPEND |
---|
1442 | | -#ifdef CONFIG_PM |
---|
1443 | | - .pm = GT9XX_PM_OPS, |
---|
1444 | | -#endif |
---|
1445 | | -#endif |
---|
| 1506 | +// #ifndef CONFIG_HAS_EARLYSUSPEND |
---|
| 1507 | +// #ifdef CONFIG_PM |
---|
| 1508 | +// .pm = GT9XX_PM_OPS, |
---|
| 1509 | +// #endif |
---|
| 1510 | +// #endif |
---|
1446 | 1511 | }, |
---|
1447 | 1512 | .address_list = normal_i2c, |
---|
1448 | 1513 | }; |
---|
.. | .. |
---|
1521 | 1586 | //of_property_read_u32(np, "ctp_exchange_x_y_flag", &exchange_x_y_flag); |
---|
1522 | 1587 | #endif |
---|
1523 | 1588 | sunxi_gpio_to_name(CTP_IRQ_NUMBER,irq_pin_name); |
---|
| 1589 | + pr_err("gt %s, line:%d irq_pin_name = %s \n",__FUNCTION__, __LINE__, irq_pin_name); |
---|
1524 | 1590 | gtp_io_init(20); |
---|
1525 | 1591 | |
---|
1526 | 1592 | goodix_wq = create_singlethread_workqueue("goodix_wq"); |
---|