.. | .. |
---|
68 | 68 | |
---|
69 | 69 | static const char *goodix_ts_name = "goodix-ts"; |
---|
70 | 70 | 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] |
---|
73 | 73 | = {GTP_REG_CONFIG_DATA >> 8, GTP_REG_CONFIG_DATA & 0xff}; |
---|
74 | 74 | |
---|
75 | 75 | #if GTP_HAVE_TOUCH_KEY |
---|
.. | .. |
---|
86 | 86 | static s8 gtp_i2c_test(struct i2c_client *client); |
---|
87 | 87 | void gtp_reset_guitar(struct i2c_client *client, s32 ms); |
---|
88 | 88 | 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); |
---|
90 | 90 | |
---|
91 | 91 | static ssize_t gt91xx_config_read_proc(struct file *, char __user *, size_t, loff_t *); |
---|
92 | 92 | static ssize_t gt91xx_config_write_proc(struct file *, const char __user *, size_t, loff_t *); |
---|
93 | 93 | |
---|
94 | | -static struct proc_dir_entry *gt91xx_config_proc = NULL; |
---|
| 94 | +//static struct proc_dir_entry *gt91xx_config_proc = NULL; |
---|
95 | 95 | static const struct file_operations config_proc_ops = { |
---|
96 | 96 | .owner = THIS_MODULE, |
---|
97 | 97 | .read = gt91xx_config_read_proc, |
---|
.. | .. |
---|
117 | 117 | |
---|
118 | 118 | //*********** For GT9XXF Start **********// |
---|
119 | 119 | #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); |
---|
125 | 125 | |
---|
126 | | -void gtp_recovery_reset(struct i2c_client *client); |
---|
| 126 | +static void gtp_recovery_reset(struct i2c_client *client); |
---|
127 | 127 | 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); |
---|
129 | 129 | static s32 gtp_main_clk_proc(struct goodix_ts_data *ts); |
---|
130 | 130 | static s32 gtp_bak_ref_proc(struct goodix_ts_data *ts, u8 mode); |
---|
131 | 131 | |
---|
.. | .. |
---|
143 | 143 | static s8 gtp_enter_doze(struct goodix_ts_data *ts); |
---|
144 | 144 | #endif |
---|
145 | 145 | |
---|
146 | | -u8 grp_cfg_version = 0; |
---|
| 146 | +static u8 grp_cfg_version = 0; |
---|
147 | 147 | |
---|
148 | 148 | /******************************************************* |
---|
149 | 149 | Function: |
---|
.. | .. |
---|
157 | 157 | numbers of i2c_msgs to transfer: |
---|
158 | 158 | 2: succeed, otherwise: failed |
---|
159 | 159 | *********************************************************/ |
---|
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) |
---|
161 | 161 | { |
---|
162 | 162 | struct i2c_msg msgs[2]; |
---|
163 | 163 | s32 ret=-1; |
---|
.. | .. |
---|
230 | 230 | numbers of i2c_msgs to transfer: |
---|
231 | 231 | 1: succeed, otherwise: failed |
---|
232 | 232 | *********************************************************/ |
---|
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) |
---|
234 | 234 | { |
---|
235 | 235 | struct i2c_msg msg; |
---|
236 | 236 | s32 ret = -1; |
---|
.. | .. |
---|
523 | 523 | |
---|
524 | 524 | static void gtp_pen_down(s32 x, s32 y, s32 w, s32 id) |
---|
525 | 525 | { |
---|
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); |
---|
527 | 527 | |
---|
528 | 528 | if (gtp_change_x2y) |
---|
529 | 529 | GTP_SWAP(x, y); |
---|
.. | .. |
---|
551 | 551 | |
---|
552 | 552 | static void gtp_pen_up(s32 id) |
---|
553 | 553 | { |
---|
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); |
---|
555 | 555 | |
---|
556 | 556 | input_report_key(ts->pen_dev, BTN_TOOL_PEN, 0); |
---|
557 | 557 | |
---|
.. | .. |
---|
613 | 613 | #if GTP_GESTURE_WAKEUP |
---|
614 | 614 | if (DOZE_ENABLED == doze_status) |
---|
615 | 615 | { |
---|
616 | | - ret = gtp_i2c_read(i2c_connect_client, doze_buf, 3); |
---|
| 616 | + ret = gtp_i2c_read(gtp_i2c_connect_client, doze_buf, 3); |
---|
617 | 617 | GTP_DEBUG("0x814B = 0x%02X", doze_buf[2]); |
---|
618 | 618 | if (ret > 0) |
---|
619 | 619 | { |
---|
.. | .. |
---|
640 | 640 | input_sync(ts->input_dev); |
---|
641 | 641 | // clear 0x814B |
---|
642 | 642 | 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); |
---|
644 | 644 | } |
---|
645 | 645 | else if ( (doze_buf[2] == 0xAA) || (doze_buf[2] == 0xBB) || |
---|
646 | 646 | (doze_buf[2] == 0xAB) || (doze_buf[2] == 0xBA) ) |
---|
.. | .. |
---|
656 | 656 | input_sync(ts->input_dev); |
---|
657 | 657 | // clear 0x814B |
---|
658 | 658 | 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); |
---|
660 | 660 | } |
---|
661 | 661 | else if (0xCC == doze_buf[2]) |
---|
662 | 662 | { |
---|
.. | .. |
---|
668 | 668 | input_sync(ts->input_dev); |
---|
669 | 669 | // clear 0x814B |
---|
670 | 670 | 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); |
---|
672 | 672 | } |
---|
673 | 673 | else |
---|
674 | 674 | { |
---|
675 | 675 | // clear 0x814B |
---|
676 | 676 | 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); |
---|
678 | 678 | gtp_enter_doze(ts); |
---|
679 | 679 | } |
---|
680 | 680 | } |
---|
.. | .. |
---|
1087 | 1087 | Output: |
---|
1088 | 1088 | None. |
---|
1089 | 1089 | *******************************************************/ |
---|
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) |
---|
1091 | 1091 | { |
---|
1092 | 1092 | GTP_GPIO_OUTPUT(ts->irq_pin, 0); |
---|
1093 | 1093 | msleep(ms); |
---|
.. | .. |
---|
1706 | 1706 | ptr += sprintf(ptr, "\n"); |
---|
1707 | 1707 | |
---|
1708 | 1708 | 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); |
---|
1710 | 1710 | for (i = 0 ; i < GTP_CONFIG_MAX_LENGTH ; i++) |
---|
1711 | 1711 | { |
---|
1712 | 1712 | ptr += sprintf(ptr, "0x%02X ", temp_data[i+2]); |
---|
.. | .. |
---|
1734 | 1734 | return -EFAULT; |
---|
1735 | 1735 | } |
---|
1736 | 1736 | |
---|
1737 | | - ret = gtp_send_cfg(i2c_connect_client); |
---|
| 1737 | + ret = gtp_send_cfg(gtp_i2c_connect_client); |
---|
1738 | 1738 | |
---|
1739 | 1739 | if (ret < 0) |
---|
1740 | 1740 | { |
---|
.. | .. |
---|
2144 | 2144 | struct goodix_ts_data *ts = i2c_get_clientdata(client); |
---|
2145 | 2145 | //init sw WDT |
---|
2146 | 2146 | 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); |
---|
2148 | 2148 | if (ret < 0) |
---|
2149 | 2149 | { |
---|
2150 | 2150 | return FAIL; |
---|
.. | .. |
---|
2152 | 2152 | |
---|
2153 | 2153 | //release SS51 & DSP |
---|
2154 | 2154 | 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); |
---|
2156 | 2156 | if (ret < 0) |
---|
2157 | 2157 | { |
---|
2158 | 2158 | return FAIL; |
---|
.. | .. |
---|
2161 | 2161 | gtp_int_sync(25, ts); |
---|
2162 | 2162 | |
---|
2163 | 2163 | //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); |
---|
2165 | 2165 | if (ret < 0) |
---|
2166 | 2166 | { |
---|
2167 | 2167 | return FAIL; |
---|
.. | .. |
---|
2175 | 2175 | { |
---|
2176 | 2176 | GTP_INFO("IC works normally, Startup success."); |
---|
2177 | 2177 | opr_buf[0] = 0xAA; |
---|
2178 | | - i2c_write_bytes(client, 0x8041, opr_buf, 1); |
---|
| 2178 | + gtp_i2c_write_bytes(client, 0x8041, opr_buf, 1); |
---|
2179 | 2179 | return SUCCESS; |
---|
2180 | 2180 | } |
---|
2181 | 2181 | } |
---|
.. | .. |
---|
2193 | 2193 | GTP_INFO("GT9XXF esd recovery mode"); |
---|
2194 | 2194 | for (retry = 0; retry < 5; retry++) |
---|
2195 | 2195 | { |
---|
2196 | | - ret = gup_fw_download_proc(NULL, GTP_FL_ESD_RECOVERY); |
---|
| 2196 | + ret = gtp_gup_fw_download_proc(NULL, GTP_FL_ESD_RECOVERY); |
---|
2197 | 2197 | if (FAIL == ret) |
---|
2198 | 2198 | { |
---|
2199 | 2199 | GTP_ERROR("esd recovery failed %d", retry+1); |
---|
.. | .. |
---|
2219 | 2219 | return SUCCESS; |
---|
2220 | 2220 | } |
---|
2221 | 2221 | |
---|
2222 | | -void gtp_recovery_reset(struct i2c_client *client) |
---|
| 2222 | +static void gtp_recovery_reset(struct i2c_client *client) |
---|
2223 | 2223 | { |
---|
2224 | 2224 | #if GTP_ESD_PROTECT |
---|
2225 | 2225 | gtp_esd_switch(client, SWITCH_OFF); |
---|
.. | .. |
---|
2246 | 2246 | struct file *ref_filp = NULL; |
---|
2247 | 2247 | u8 *p_bak_ref; |
---|
2248 | 2248 | |
---|
2249 | | - ret = gup_check_fs_mounted("/data"); |
---|
| 2249 | + ret = gtp_gup_check_fs_mounted("/data"); |
---|
2250 | 2250 | if (FAIL == ret) |
---|
2251 | 2251 | { |
---|
2252 | 2252 | ts->ref_chk_fs_times++; |
---|
.. | .. |
---|
2334 | 2334 | } |
---|
2335 | 2335 | } |
---|
2336 | 2336 | } |
---|
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); |
---|
2338 | 2338 | if (FAIL == ret) |
---|
2339 | 2339 | { |
---|
2340 | 2340 | GTP_ERROR("failed to send bak_ref because of iic comm error"); |
---|
.. | .. |
---|
2344 | 2344 | |
---|
2345 | 2345 | case GTP_BAK_REF_STORE: |
---|
2346 | 2346 | 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); |
---|
2348 | 2348 | if (ret < 0) |
---|
2349 | 2349 | { |
---|
2350 | 2350 | GTP_ERROR("failed to read bak_ref info, sending default back-reference"); |
---|
.. | .. |
---|
2368 | 2368 | memset(&p_bak_ref[j * ref_seg_len], 0, ref_seg_len); |
---|
2369 | 2369 | p_bak_ref[j * ref_seg_len + ref_seg_len - 1] = 0x01; // checksum = 1 |
---|
2370 | 2370 | } |
---|
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); |
---|
2372 | 2372 | if (!IS_ERR(ref_filp)) |
---|
2373 | 2373 | { |
---|
2374 | 2374 | GTP_INFO("write backup-reference data into %s", GTP_BAK_REF_PATH); |
---|
.. | .. |
---|
2450 | 2450 | goto update_main_clk; |
---|
2451 | 2451 | } |
---|
2452 | 2452 | #else |
---|
2453 | | - ret = gup_check_fs_mounted("/data"); |
---|
| 2453 | + ret = gtp_gup_check_fs_mounted("/data"); |
---|
2454 | 2454 | if (FAIL == ret) |
---|
2455 | 2455 | { |
---|
2456 | 2456 | ts->clk_chk_fs_times++; |
---|
.. | .. |
---|
2496 | 2496 | #if GTP_ESD_PROTECT |
---|
2497 | 2497 | gtp_esd_switch(ts->client, SWITCH_OFF); |
---|
2498 | 2498 | #endif |
---|
2499 | | - ret = gup_clk_calibration(); |
---|
| 2499 | + ret = gtp_gup_clk_calibration(); |
---|
2500 | 2500 | gtp_esd_recovery(ts->client); |
---|
2501 | 2501 | |
---|
2502 | 2502 | #if GTP_ESD_PROTECT |
---|
.. | .. |
---|
2527 | 2527 | } |
---|
2528 | 2528 | |
---|
2529 | 2529 | 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); |
---|
2531 | 2531 | if (FAIL == ret) |
---|
2532 | 2532 | { |
---|
2533 | 2533 | GTP_ERROR("update main clock failed!"); |
---|
.. | .. |
---|
2544 | 2544 | } |
---|
2545 | 2545 | |
---|
2546 | 2546 | |
---|
2547 | | -s32 gtp_gt9xxf_init(struct i2c_client *client) |
---|
| 2547 | +static s32 gtp_gt9xxf_init(struct i2c_client *client) |
---|
2548 | 2548 | { |
---|
2549 | 2549 | s32 ret = 0; |
---|
2550 | 2550 | |
---|
2551 | | - ret = gup_fw_download_proc(NULL, GTP_FL_FW_BURN); |
---|
| 2551 | + ret = gtp_gup_fw_download_proc(NULL, GTP_FL_FW_BURN); |
---|
2552 | 2552 | if (FAIL == ret) |
---|
2553 | 2553 | { |
---|
2554 | 2554 | return FAIL; |
---|
.. | .. |
---|
2562 | 2562 | return SUCCESS; |
---|
2563 | 2563 | } |
---|
2564 | 2564 | |
---|
2565 | | -void gtp_get_chip_type(struct goodix_ts_data *ts) |
---|
| 2565 | +static void gtp_get_chip_type(struct goodix_ts_data *ts) |
---|
2566 | 2566 | { |
---|
2567 | 2567 | u8 opr_buf[10] = {0x00}; |
---|
2568 | 2568 | s32 ret = 0; |
---|
.. | .. |
---|
2626 | 2626 | GTP_INFO("GTP Driver Version: %s", GTP_DRIVER_VERSION); |
---|
2627 | 2627 | GTP_INFO("GTP I2C Address: 0x%02x", client->addr); |
---|
2628 | 2628 | |
---|
2629 | | - i2c_connect_client = client; |
---|
| 2629 | + gtp_i2c_connect_client = client; |
---|
2630 | 2630 | |
---|
2631 | 2631 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) |
---|
2632 | 2632 | { |
---|
.. | .. |
---|
2670 | 2670 | } else if (val == 9110) { |
---|
2671 | 2671 | m89or101 = FALSE; |
---|
2672 | 2672 | bgt9110 = TRUE; |
---|
2673 | | - gtp_change_x2y = TRUE; |
---|
2674 | | - gtp_x_reverse = TRUE; |
---|
| 2673 | + gtp_change_x2y = FALSE; |
---|
| 2674 | + gtp_x_reverse = FALSE; |
---|
2675 | 2675 | gtp_y_reverse = FALSE; |
---|
2676 | 2676 | } else if (val == 9111) { |
---|
2677 | 2677 | m89or101 = FALSE; |
---|
.. | .. |
---|
2804 | 2804 | |
---|
2805 | 2805 | ts->irq_flags = ts->int_trigger_type ? IRQF_TRIGGER_FALLING : IRQF_TRIGGER_RISING; |
---|
2806 | 2806 | // Create proc file system |
---|
| 2807 | +#if 0 |
---|
2807 | 2808 | gt91xx_config_proc = proc_create(GT91XX_CONFIG_PROC_FILE, 0664, NULL, &config_proc_ops); |
---|
2808 | 2809 | if (gt91xx_config_proc == NULL) |
---|
2809 | 2810 | { |
---|
.. | .. |
---|
2813 | 2814 | { |
---|
2814 | 2815 | GTP_INFO("create proc entry %s success", GT91XX_CONFIG_PROC_FILE); |
---|
2815 | 2816 | } |
---|
| 2817 | +#endif |
---|
2816 | 2818 | |
---|
2817 | 2819 | #if GTP_AUTO_UPDATE |
---|
2818 | 2820 | ret = gup_init_update_proc(ts); |
---|
.. | .. |
---|
3061 | 3063 | |
---|
3062 | 3064 | GTP_DEBUG_FUNC(); |
---|
3063 | 3065 | |
---|
3064 | | - ts = i2c_get_clientdata(i2c_connect_client); |
---|
| 3066 | + ts = i2c_get_clientdata(gtp_i2c_connect_client); |
---|
3065 | 3067 | |
---|
3066 | 3068 | if (ts->gtp_is_suspend) |
---|
3067 | 3069 | { |
---|
.. | .. |
---|
3233 | 3235 | |
---|
3234 | 3236 | MODULE_DESCRIPTION("GTP Series Driver"); |
---|
3235 | 3237 | MODULE_LICENSE("GPL"); |
---|
| 3238 | +MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); |
---|