.. | .. |
---|
26 | 26 | * 3. add update file cal checksum. |
---|
27 | 27 | * By Andrew, 2012/12/12 |
---|
28 | 28 | * V1.6: |
---|
29 | | - * 1. replace guitar_client with i2c_connect_client; |
---|
| 29 | + * 1. replace guitar_client with gtp_i2c_connect_client; |
---|
30 | 30 | * 2. support firmware header array update. |
---|
31 | 31 | * By Meta, 2013/03/11 |
---|
32 | 32 | * V2.2: |
---|
.. | .. |
---|
106 | 106 | u32 fw_burned_len; |
---|
107 | 107 | }st_update_msg; |
---|
108 | 108 | |
---|
109 | | -st_update_msg update_msg; |
---|
110 | | -u16 show_len; |
---|
111 | | -u16 total_len; |
---|
112 | | -u8 got_file_flag = 0; |
---|
113 | | -u8 searching_file = 0; |
---|
| 109 | +static st_update_msg update_msg; |
---|
| 110 | +static u16 show_len; |
---|
| 111 | +static u16 total_len; |
---|
| 112 | +//static u8 got_file_flag = 0; |
---|
| 113 | +static u8 searching_file = 0; |
---|
114 | 114 | |
---|
115 | | -extern u8 config[GTP_CONFIG_MAX_LENGTH + GTP_ADDR_LENGTH]; |
---|
116 | | -extern void gtp_reset_guitar(struct i2c_client *client, s32 ms); |
---|
117 | | -extern s32 gtp_send_cfg(struct i2c_client *client); |
---|
118 | | -extern s32 gtp_read_version(struct i2c_client *, u16* ); |
---|
119 | | -extern struct i2c_client * i2c_connect_client; |
---|
120 | | -extern void gtp_irq_enable(struct goodix_ts_data *ts); |
---|
121 | | -extern void gtp_irq_disable(struct goodix_ts_data *ts); |
---|
122 | | -extern s32 gtp_i2c_read_dbl_check(struct i2c_client *, u16, u8 *, int); |
---|
123 | | -static u8 gup_burn_fw_gwake_section(struct i2c_client *client, u8 *fw_section, u16 start_addr, u32 len, u8 bank_cmd ); |
---|
| 115 | +//extern u8 config[GTP_CONFIG_MAX_LENGTH + GTP_ADDR_LENGTH]; |
---|
| 116 | +//extern void gtp_reset_guitar(struct i2c_client *client, s32 ms); |
---|
| 117 | +//extern s32 gtp_send_cfg(struct i2c_client *client); |
---|
| 118 | +//extern s32 gtp_read_version(struct i2c_client *, u16* ); |
---|
| 119 | +//extern struct i2c_client * gtp_i2c_connect_client; |
---|
| 120 | +//extern void gtp_irq_enable(struct goodix_ts_data *ts); |
---|
| 121 | +//extern void gtp_irq_disable(struct goodix_ts_data *ts); |
---|
| 122 | +//extern s32 gtp_i2c_read_dbl_check(struct i2c_client *, u16, u8 *, int); |
---|
| 123 | +//static u8 gup_burn_fw_gwake_section(struct i2c_client *client, u8 *fw_section, u16 start_addr, u32 len, u8 bank_cmd ); |
---|
124 | 124 | |
---|
125 | 125 | #define _CLOSE_FILE(p_file) if (p_file && !IS_ERR(p_file)) \ |
---|
126 | 126 | { \ |
---|
.. | .. |
---|
132 | 132 | #endif |
---|
133 | 133 | |
---|
134 | 134 | #if GTP_COMPATIBLE_MODE |
---|
135 | | -s32 gup_fw_download_proc(void *dir, u8 dwn_mode); |
---|
| 135 | +s32 gtp_gup_fw_download_proc(void *dir, u8 dwn_mode); |
---|
136 | 136 | #endif |
---|
137 | 137 | /******************************************************* |
---|
138 | 138 | Function: |
---|
.. | .. |
---|
146 | 146 | numbers of i2c_msgs to transfer: |
---|
147 | 147 | 2: succeed, otherwise: failed |
---|
148 | 148 | *********************************************************/ |
---|
149 | | -s32 gup_i2c_read(struct i2c_client *client, u8 *buf, s32 len) |
---|
| 149 | +static s32 gup_i2c_read(struct i2c_client *client, u8 *buf, s32 len) |
---|
150 | 150 | { |
---|
151 | 151 | struct i2c_msg msgs[2]; |
---|
152 | 152 | s32 ret=-1; |
---|
.. | .. |
---|
192 | 192 | numbers of i2c_msgs to transfer: |
---|
193 | 193 | 1: succeed, otherwise: failed |
---|
194 | 194 | *********************************************************/ |
---|
195 | | -s32 gup_i2c_write(struct i2c_client *client,u8 *buf,s32 len) |
---|
| 195 | +static s32 gup_i2c_write(struct i2c_client *client,u8 *buf,s32 len) |
---|
196 | 196 | { |
---|
197 | 197 | struct i2c_msg msg; |
---|
198 | 198 | s32 ret=-1; |
---|
.. | .. |
---|
218 | 218 | return ret; |
---|
219 | 219 | } |
---|
220 | 220 | |
---|
| 221 | +#if 0 |
---|
221 | 222 | static s32 gup_init_panel(struct goodix_ts_data *ts) |
---|
222 | 223 | { |
---|
223 | 224 | s32 ret = 0; |
---|
.. | .. |
---|
329 | 330 | msleep(10); |
---|
330 | 331 | return 0; |
---|
331 | 332 | } |
---|
| 333 | +#endif |
---|
332 | 334 | |
---|
333 | 335 | |
---|
334 | 336 | static u8 gup_get_ic_msg(struct i2c_client *client, u16 addr, u8* msg, s32 len) |
---|
.. | .. |
---|
381 | 383 | return SUCCESS; |
---|
382 | 384 | } |
---|
383 | 385 | |
---|
| 386 | +#if 0 |
---|
384 | 387 | static u8 gup_get_ic_fw_msg(struct i2c_client *client) |
---|
385 | 388 | { |
---|
386 | 389 | s32 ret = -1; |
---|
.. | .. |
---|
462 | 465 | return SUCCESS; |
---|
463 | 466 | } |
---|
464 | 467 | |
---|
465 | | -s32 gup_enter_update_mode(struct i2c_client *client) |
---|
| 468 | +static s32 gup_enter_update_mode(struct i2c_client *client) |
---|
466 | 469 | { |
---|
467 | 470 | s32 ret = -1; |
---|
468 | 471 | s32 retry = 0; |
---|
.. | .. |
---|
519 | 522 | return ret; |
---|
520 | 523 | } |
---|
521 | 524 | |
---|
522 | | -void gup_leave_update_mode(struct goodix_ts_data *ts) |
---|
| 525 | +static void gup_leave_update_mode(struct goodix_ts_data *ts) |
---|
523 | 526 | { |
---|
524 | 527 | gpio_direction_input(ts->irq_pin); |
---|
525 | 528 | //s3c_gpio_setpull(pin, S3C_GPIO_PULL_NONE); |
---|
526 | 529 | //s3c_gpio_cfgpin(pin, GTP_INT_CFG); |
---|
527 | 530 | |
---|
528 | 531 | GTP_DEBUG("[leave_update_mode]reset chip."); |
---|
529 | | - gtp_reset_guitar(i2c_connect_client, 20); |
---|
| 532 | + gtp_reset_guitar(gtp_i2c_connect_client, 20); |
---|
530 | 533 | } |
---|
531 | 534 | |
---|
532 | 535 | // Get the correct nvram data |
---|
.. | .. |
---|
646 | 649 | |
---|
647 | 650 | return FAIL; |
---|
648 | 651 | } |
---|
| 652 | +#endif |
---|
649 | 653 | |
---|
650 | 654 | |
---|
651 | 655 | |
---|
.. | .. |
---|
869 | 873 | #endif |
---|
870 | 874 | |
---|
871 | 875 | |
---|
| 876 | +#if 0 |
---|
872 | 877 | static u8 gup_check_update_file(struct i2c_client *client, st_fw_head* fw_head, u8* path) |
---|
873 | 878 | { |
---|
874 | 879 | s32 ret = 0; |
---|
.. | .. |
---|
924 | 929 | gup_search_file(AUTO_SEARCH_BIN | AUTO_SEARCH_CFG); |
---|
925 | 930 | if (got_file_flag & CFG_FILE_READY) |
---|
926 | 931 | { |
---|
927 | | - ret = gup_update_config(i2c_connect_client); |
---|
| 932 | + ret = gup_update_config(gtp_i2c_connect_client); |
---|
928 | 933 | if(ret <= 0) |
---|
929 | 934 | { |
---|
930 | 935 | GTP_ERROR("Update config failed."); |
---|
.. | .. |
---|
2271 | 2276 | } |
---|
2272 | 2277 | return FAIL; |
---|
2273 | 2278 | } |
---|
2274 | | -s32 gup_update_proc(void *dir) |
---|
| 2279 | +static s32 gup_update_proc(void *dir) |
---|
2275 | 2280 | { |
---|
2276 | 2281 | s32 ret = 0; |
---|
2277 | 2282 | s32 update_ret = FAIL; |
---|
.. | .. |
---|
2281 | 2286 | |
---|
2282 | 2287 | GTP_DEBUG("[update_proc]Begin update ......"); |
---|
2283 | 2288 | |
---|
2284 | | - ts = i2c_get_clientdata(i2c_connect_client); |
---|
| 2289 | + ts = i2c_get_clientdata(gtp_i2c_connect_client); |
---|
2285 | 2290 | |
---|
2286 | 2291 | #if GTP_AUTO_UPDATE |
---|
2287 | 2292 | if (searching_file) |
---|
.. | .. |
---|
2302 | 2307 | #if GTP_COMPATIBLE_MODE |
---|
2303 | 2308 | if (CHIP_TYPE_GT9F == ts->chip_type) |
---|
2304 | 2309 | { |
---|
2305 | | - return gup_fw_download_proc(dir, GTP_FL_FW_BURN); |
---|
| 2310 | + return gtp_gup_fw_download_proc(dir, GTP_FL_FW_BURN); |
---|
2306 | 2311 | } |
---|
2307 | 2312 | #endif |
---|
2308 | 2313 | |
---|
2309 | 2314 | update_msg.file = NULL; |
---|
2310 | | - ret = gup_check_update_file(i2c_connect_client, &fw_head, (u8*)dir); //20121211 |
---|
| 2315 | + ret = gup_check_update_file(gtp_i2c_connect_client, &fw_head, (u8*)dir); //20121211 |
---|
2311 | 2316 | if(FAIL == ret) |
---|
2312 | 2317 | { |
---|
2313 | 2318 | GTP_ERROR("[update_proc]check update file fail."); |
---|
2314 | 2319 | goto file_fail; |
---|
2315 | 2320 | } |
---|
2316 | 2321 | |
---|
2317 | | - ret = gup_get_ic_fw_msg(i2c_connect_client); |
---|
| 2322 | + ret = gup_get_ic_fw_msg(gtp_i2c_connect_client); |
---|
2318 | 2323 | if(FAIL == ret) |
---|
2319 | 2324 | { |
---|
2320 | 2325 | GTP_ERROR("[update_proc]get ic message fail."); |
---|
.. | .. |
---|
2333 | 2338 | #if GTP_ESD_PROTECT |
---|
2334 | 2339 | gtp_esd_switch(ts->client, SWITCH_OFF); |
---|
2335 | 2340 | #endif |
---|
2336 | | - ret = gup_enter_update_mode(i2c_connect_client); |
---|
| 2341 | + ret = gup_enter_update_mode(gtp_i2c_connect_client); |
---|
2337 | 2342 | if(FAIL == ret) |
---|
2338 | 2343 | { |
---|
2339 | 2344 | GTP_ERROR("[update_proc]enter update mode fail."); |
---|
.. | .. |
---|
2345 | 2350 | show_len = 10; |
---|
2346 | 2351 | total_len = 100; |
---|
2347 | 2352 | update_msg.fw_burned_len = 0; |
---|
2348 | | - ret = gup_burn_dsp_isp(i2c_connect_client); |
---|
| 2353 | + ret = gup_burn_dsp_isp(gtp_i2c_connect_client); |
---|
2349 | 2354 | if(FAIL == ret) |
---|
2350 | 2355 | { |
---|
2351 | 2356 | GTP_ERROR("[update_proc]burn dsp isp fail."); |
---|
.. | .. |
---|
2353 | 2358 | } |
---|
2354 | 2359 | |
---|
2355 | 2360 | show_len = 20; |
---|
2356 | | - ret = gup_burn_fw_ss51(i2c_connect_client); |
---|
| 2361 | + ret = gup_burn_fw_ss51(gtp_i2c_connect_client); |
---|
2357 | 2362 | if(FAIL == ret) |
---|
2358 | 2363 | { |
---|
2359 | 2364 | GTP_ERROR("[update_proc]burn ss51 firmware fail."); |
---|
.. | .. |
---|
2361 | 2366 | } |
---|
2362 | 2367 | |
---|
2363 | 2368 | show_len = 30; |
---|
2364 | | - ret = gup_burn_fw_dsp(i2c_connect_client); |
---|
| 2369 | + ret = gup_burn_fw_dsp(gtp_i2c_connect_client); |
---|
2365 | 2370 | if(FAIL == ret) |
---|
2366 | 2371 | { |
---|
2367 | 2372 | GTP_ERROR("[update_proc]burn dsp firmware fail."); |
---|
.. | .. |
---|
2369 | 2374 | } |
---|
2370 | 2375 | |
---|
2371 | 2376 | show_len = 40; |
---|
2372 | | - ret = gup_burn_fw_boot(i2c_connect_client); |
---|
| 2377 | + ret = gup_burn_fw_boot(gtp_i2c_connect_client); |
---|
2373 | 2378 | if(FAIL == ret) |
---|
2374 | 2379 | { |
---|
2375 | 2380 | GTP_ERROR("[update_proc]burn bootloader firmware fail."); |
---|
.. | .. |
---|
2377 | 2382 | } |
---|
2378 | 2383 | show_len = 50; |
---|
2379 | 2384 | |
---|
2380 | | - ret = gup_burn_fw_boot_isp(i2c_connect_client); |
---|
| 2385 | + ret = gup_burn_fw_boot_isp(gtp_i2c_connect_client); |
---|
2381 | 2386 | if (FAIL == ret) |
---|
2382 | 2387 | { |
---|
2383 | 2388 | GTP_ERROR("[update_proc]burn boot_isp firmware fail."); |
---|
.. | .. |
---|
2385 | 2390 | } |
---|
2386 | 2391 | |
---|
2387 | 2392 | show_len = 60; |
---|
2388 | | - ret = gup_burn_fw_link(i2c_connect_client); |
---|
| 2393 | + ret = gup_burn_fw_link(gtp_i2c_connect_client); |
---|
2389 | 2394 | if (FAIL == ret) |
---|
2390 | 2395 | { |
---|
2391 | 2396 | GTP_ERROR("[update_proc]burn link firmware fail."); |
---|
.. | .. |
---|
2393 | 2398 | } |
---|
2394 | 2399 | |
---|
2395 | 2400 | show_len = 70; |
---|
2396 | | - ret = gup_burn_fw_gwake(i2c_connect_client); |
---|
| 2401 | + ret = gup_burn_fw_gwake(gtp_i2c_connect_client); |
---|
2397 | 2402 | if (FAIL == ret) |
---|
2398 | 2403 | { |
---|
2399 | 2404 | GTP_ERROR("[update_proc]burn app_code firmware fail."); |
---|
.. | .. |
---|
2401 | 2406 | } |
---|
2402 | 2407 | show_len = 80; |
---|
2403 | 2408 | |
---|
2404 | | - ret = gup_burn_fw_finish(i2c_connect_client); |
---|
| 2409 | + ret = gup_burn_fw_finish(gtp_i2c_connect_client); |
---|
2405 | 2410 | if (FAIL == ret) |
---|
2406 | 2411 | { |
---|
2407 | 2412 | GTP_ERROR("[update_proc]burn finish fail."); |
---|
.. | .. |
---|
2439 | 2444 | else |
---|
2440 | 2445 | { |
---|
2441 | 2446 | GTP_DEBUG("[update_proc]send config."); |
---|
2442 | | - ret = gtp_send_cfg(i2c_connect_client); |
---|
| 2447 | + ret = gtp_send_cfg(gtp_i2c_connect_client); |
---|
2443 | 2448 | if (ret < 0) |
---|
2444 | 2449 | { |
---|
2445 | 2450 | GTP_ERROR("[update_proc]send config fail."); |
---|
.. | .. |
---|
2472 | 2477 | gup_search_file(AUTO_SEARCH_CFG); |
---|
2473 | 2478 | if (got_file_flag & CFG_FILE_READY) |
---|
2474 | 2479 | { |
---|
2475 | | - ret = gup_update_config(i2c_connect_client); |
---|
| 2480 | + ret = gup_update_config(gtp_i2c_connect_client); |
---|
2476 | 2481 | if(ret <= 0) |
---|
2477 | 2482 | { |
---|
2478 | 2483 | GTP_ERROR("Update config failed."); |
---|
.. | .. |
---|
2495 | 2500 | return FAIL; |
---|
2496 | 2501 | } |
---|
2497 | 2502 | } |
---|
| 2503 | +#endif |
---|
2498 | 2504 | |
---|
2499 | 2505 | #if GTP_AUTO_UPDATE |
---|
2500 | 2506 | u8 gup_init_update_proc(struct goodix_ts_data *ts) |
---|
.. | .. |
---|
2570 | 2576 | |
---|
2571 | 2577 | #if GTP_COMPATIBLE_MODE |
---|
2572 | 2578 | |
---|
2573 | | -u8 i2c_opr_buf[GTP_ADDR_LENGTH + FL_PACK_SIZE] = {0}; |
---|
2574 | | -u8 chk_cmp_buf[FL_PACK_SIZE] = {0}; |
---|
| 2579 | +static u8 i2c_opr_buf[GTP_ADDR_LENGTH + FL_PACK_SIZE] = {0}; |
---|
| 2580 | +static u8 chk_cmp_buf[FL_PACK_SIZE] = {0}; |
---|
2575 | 2581 | |
---|
2576 | | -extern s32 gtp_fw_startup(struct i2c_client *client); |
---|
| 2582 | +//extern s32 gtp_fw_startup(struct i2c_client *client); |
---|
2577 | 2583 | static u8 gup_download_fw_dsp(struct i2c_client *client, u8 dwn_mode); |
---|
2578 | 2584 | static s32 gup_burn_fw_proc(struct i2c_client *client, u16 start_addr, s32 start_index, s32 burn_len); |
---|
2579 | 2585 | static s32 gup_check_and_repair(struct i2c_client *client, u16 start_addr, s32 start_index, s32 chk_len); |
---|
2580 | 2586 | |
---|
2581 | 2587 | |
---|
2582 | | -u8 gup_check_fs_mounted(char *path_name) |
---|
| 2588 | +u8 gtp_gup_check_fs_mounted(char *path_name) |
---|
2583 | 2589 | { |
---|
2584 | 2590 | struct path root_path; |
---|
2585 | 2591 | struct path path; |
---|
.. | .. |
---|
2617 | 2623 | #endif |
---|
2618 | 2624 | } |
---|
2619 | 2625 | |
---|
2620 | | -s32 i2c_write_bytes(struct i2c_client *client, u16 addr, u8 *buf, s32 len) |
---|
| 2626 | +s32 gtp_i2c_write_bytes(struct i2c_client *client, u16 addr, u8 *buf, s32 len) |
---|
2621 | 2627 | { |
---|
2622 | 2628 | s32 ret = 0; |
---|
2623 | 2629 | s32 write_bytes = 0; |
---|
.. | .. |
---|
2658 | 2664 | return 1; |
---|
2659 | 2665 | } |
---|
2660 | 2666 | |
---|
2661 | | -s32 i2c_read_bytes(struct i2c_client *client, u16 addr, u8 *buf, s32 len) |
---|
| 2667 | +s32 gtp_i2c_read_bytes(struct i2c_client *client, u16 addr, u8 *buf, s32 len) |
---|
2662 | 2668 | { |
---|
2663 | 2669 | s32 ret = 0; |
---|
2664 | 2670 | s32 read_bytes = 0; |
---|
.. | .. |
---|
2705 | 2711 | static void gup_bit_write(s32 addr, s32 bit, s32 val) |
---|
2706 | 2712 | { |
---|
2707 | 2713 | u8 buf; |
---|
2708 | | - i2c_read_bytes(i2c_connect_client, addr, &buf, 1); |
---|
| 2714 | + gtp_i2c_read_bytes(gtp_i2c_connect_client, addr, &buf, 1); |
---|
2709 | 2715 | |
---|
2710 | 2716 | buf = (buf & (~((u8)1 << bit))) | ((u8)val << bit); |
---|
2711 | 2717 | |
---|
2712 | | - i2c_write_bytes(i2c_connect_client, addr, &buf, 1); |
---|
| 2718 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, addr, &buf, 1); |
---|
2713 | 2719 | } |
---|
2714 | 2720 | |
---|
2715 | 2721 | static void gup_clk_count_init(s32 bCh, s32 bCNT) |
---|
.. | .. |
---|
2722 | 2728 | gup_bit_write(_fRW_MISCTL__MEA, 1, 1); |
---|
2723 | 2729 | //_bRW_MISCTL__MEA_MODE = 0; //Pulse mode |
---|
2724 | 2730 | buf = 0; |
---|
2725 | | - i2c_write_bytes(i2c_connect_client, _bRW_MISCTL__MEA_MODE, &buf, 1); |
---|
| 2731 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, _bRW_MISCTL__MEA_MODE, &buf, 1); |
---|
2726 | 2732 | //_bRW_MISCTL__MEA_SRCSEL = 8 + bCh; //From GIO1 |
---|
2727 | 2733 | buf = 8 + bCh; |
---|
2728 | | - i2c_write_bytes(i2c_connect_client, _bRW_MISCTL__MEA_SRCSEL, &buf, 1); |
---|
| 2734 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, _bRW_MISCTL__MEA_SRCSEL, &buf, 1); |
---|
2729 | 2735 | //_wRW_MISCTL__MEA_MAX_NUM = bCNT; //Set the Measure Counts = 1 |
---|
2730 | 2736 | buf = bCNT; |
---|
2731 | | - i2c_write_bytes(i2c_connect_client, _wRW_MISCTL__MEA_MAX_NUM, &buf, 1); |
---|
| 2737 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, _wRW_MISCTL__MEA_MAX_NUM, &buf, 1); |
---|
2732 | 2738 | //_fRW_MISCTL__MEA_CLR = 0; //Frequency measure not clear |
---|
2733 | 2739 | gup_bit_write(_fRW_MISCTL__MEA, 1, 0); |
---|
2734 | 2740 | //_fRW_MISCTL__MEA_EN = 1; |
---|
.. | .. |
---|
2743 | 2749 | |
---|
2744 | 2750 | while (ready == 0) //Wait for measurement complete |
---|
2745 | 2751 | { |
---|
2746 | | - i2c_read_bytes(i2c_connect_client, _bRO_MISCTL__MEA_RDY, buf, 1); |
---|
| 2752 | + gtp_i2c_read_bytes(gtp_i2c_connect_client, _bRO_MISCTL__MEA_RDY, buf, 1); |
---|
2747 | 2753 | ready = buf[0]; |
---|
2748 | 2754 | } |
---|
2749 | 2755 | |
---|
.. | .. |
---|
2751 | 2757 | |
---|
2752 | 2758 | //_fRW_MISCTL__MEA_EN = 0; |
---|
2753 | 2759 | gup_bit_write(_fRW_MISCTL__MEA, 0, 0); |
---|
2754 | | - i2c_read_bytes(i2c_connect_client, _dRO_MISCTL__MEA_VAL, buf, 4); |
---|
| 2760 | + gtp_i2c_read_bytes(gtp_i2c_connect_client, _dRO_MISCTL__MEA_VAL, buf, 4); |
---|
2755 | 2761 | GTP_DEBUG("Clk_count 0: %2X", buf[0]); |
---|
2756 | 2762 | GTP_DEBUG("Clk_count 1: %2X", buf[1]); |
---|
2757 | 2763 | GTP_DEBUG("Clk_count 2: %2X", buf[2]); |
---|
.. | .. |
---|
2761 | 2767 | GTP_INFO("Clk_count : %d", temp); |
---|
2762 | 2768 | return temp; |
---|
2763 | 2769 | } |
---|
2764 | | -u8 gup_clk_dac_setting(int dac) |
---|
| 2770 | +static u8 gup_clk_dac_setting(int dac) |
---|
2765 | 2771 | { |
---|
2766 | 2772 | s8 buf1, buf2; |
---|
2767 | 2773 | |
---|
2768 | | - i2c_read_bytes(i2c_connect_client, _wRW_MISCTL__RG_DMY, &buf1, 1); |
---|
2769 | | - i2c_read_bytes(i2c_connect_client, _bRW_MISCTL__RG_OSC_CALIB, &buf2, 1); |
---|
| 2774 | + gtp_i2c_read_bytes(gtp_i2c_connect_client, _wRW_MISCTL__RG_DMY, &buf1, 1); |
---|
| 2775 | + gtp_i2c_read_bytes(gtp_i2c_connect_client, _bRW_MISCTL__RG_OSC_CALIB, &buf2, 1); |
---|
2770 | 2776 | |
---|
2771 | 2777 | buf1 = (buf1 & 0xFFCF) | ((dac & 0x03) << 4); |
---|
2772 | 2778 | buf2 = (dac >> 2) & 0x3f; |
---|
2773 | 2779 | |
---|
2774 | | - i2c_write_bytes(i2c_connect_client, _wRW_MISCTL__RG_DMY, &buf1, 1); |
---|
2775 | | - i2c_write_bytes(i2c_connect_client, _bRW_MISCTL__RG_OSC_CALIB, &buf2, 1); |
---|
| 2780 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, _wRW_MISCTL__RG_DMY, &buf1, 1); |
---|
| 2781 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, _bRW_MISCTL__RG_OSC_CALIB, &buf2, 1); |
---|
2776 | 2782 | |
---|
2777 | 2783 | return 0; |
---|
2778 | 2784 | } |
---|
2779 | 2785 | |
---|
2780 | | -static u8 gup_clk_calibration_pin_select(s32 bCh) |
---|
| 2786 | +static u8 gtp_gup_clk_calibration_pin_select(s32 bCh) |
---|
2781 | 2787 | { |
---|
2782 | 2788 | s32 i2c_addr; |
---|
2783 | 2789 | |
---|
.. | .. |
---|
2822 | 2828 | case 9: |
---|
2823 | 2829 | i2c_addr = _fRW_MISCTL__GIO9; |
---|
2824 | 2830 | break; |
---|
| 2831 | + |
---|
| 2832 | + default: |
---|
| 2833 | + return -1; |
---|
2825 | 2834 | } |
---|
2826 | 2835 | |
---|
2827 | 2836 | gup_bit_write(i2c_addr, 1, 0); |
---|
.. | .. |
---|
2829 | 2838 | return 0; |
---|
2830 | 2839 | } |
---|
2831 | 2840 | |
---|
2832 | | -void gup_output_pulse(int t) |
---|
| 2841 | +static void gup_output_pulse(int t) |
---|
2833 | 2842 | { |
---|
2834 | 2843 | unsigned long flags; |
---|
2835 | 2844 | struct goodix_ts_data *ts; |
---|
2836 | 2845 | |
---|
2837 | | - ts = i2c_get_clientdata(i2c_connect_client); |
---|
| 2846 | + ts = i2c_get_clientdata(gtp_i2c_connect_client); |
---|
2838 | 2847 | |
---|
2839 | 2848 | GTP_GPIO_OUTPUT(ts->irq_pin, 0); |
---|
2840 | 2849 | msleep(10); |
---|
.. | .. |
---|
2861 | 2870 | gup_bit_write(_rRW_MISCTL__ANA_RXADC_B0_, 5, 0); |
---|
2862 | 2871 | //_bRW_MISCTL__RG_LDO_A18_PWD = 0; //DrvMISCTL_A18_PowerON |
---|
2863 | 2872 | buf = 0; |
---|
2864 | | - i2c_write_bytes(i2c_connect_client, _bRW_MISCTL__RG_LDO_A18_PWD, &buf, 1); |
---|
| 2873 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, _bRW_MISCTL__RG_LDO_A18_PWD, &buf, 1); |
---|
2865 | 2874 | //_bRW_MISCTL__RG_BG_PWD = 0; //DrvMISCTL_BG_PowerON |
---|
2866 | 2875 | buf = 0; |
---|
2867 | | - i2c_write_bytes(i2c_connect_client, _bRW_MISCTL__RG_BG_PWD, &buf, 1); |
---|
| 2876 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, _bRW_MISCTL__RG_BG_PWD, &buf, 1); |
---|
2868 | 2877 | //_bRW_MISCTL__RG_CLKGEN_PWD = 0; //DrvMISCTL_CLKGEN_PowerON |
---|
2869 | 2878 | buf = 0; |
---|
2870 | | - i2c_write_bytes(i2c_connect_client, _bRW_MISCTL__RG_CLKGEN_PWD, &buf, 1); |
---|
| 2879 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, _bRW_MISCTL__RG_CLKGEN_PWD, &buf, 1); |
---|
2871 | 2880 | //_fRW_MISCTL__RG_RXADC_PWD = 0; //DrvMISCTL_RX_ADC_PowerON |
---|
2872 | 2881 | gup_bit_write(_rRW_MISCTL__ANA_RXADC_B0_, 0, 0); |
---|
2873 | 2882 | //_fRW_MISCTL__RG_RXADC_REF_PWD = 0; //DrvMISCTL_RX_ADCREF_PowerON |
---|
.. | .. |
---|
2875 | 2884 | //gup_clk_dac_setting(60); |
---|
2876 | 2885 | //_bRW_MISCTL__OSC_CK_SEL = 1;; |
---|
2877 | 2886 | buf = 1; |
---|
2878 | | - i2c_write_bytes(i2c_connect_client, _bRW_MISCTL__OSC_CK_SEL, &buf, 1); |
---|
| 2887 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, _bRW_MISCTL__OSC_CK_SEL, &buf, 1); |
---|
2879 | 2888 | } |
---|
2880 | 2889 | |
---|
2881 | | -s32 gup_clk_calibration(void) |
---|
| 2890 | +s32 gtp_gup_clk_calibration(void) |
---|
2882 | 2891 | { |
---|
2883 | 2892 | u8 buf; |
---|
2884 | 2893 | //u8 trigger; |
---|
2885 | 2894 | s32 i; |
---|
2886 | | - struct timeval start, end; |
---|
| 2895 | + //struct timeval start, end; |
---|
2887 | 2896 | s32 count; |
---|
2888 | | - s32 count_ref; |
---|
2889 | | - s32 sec; |
---|
2890 | | - s32 usec; |
---|
| 2897 | + //s32 count_ref; |
---|
| 2898 | + //s32 sec; |
---|
| 2899 | + //s32 usec; |
---|
2891 | 2900 | //unsigned long flags; |
---|
2892 | 2901 | struct goodix_ts_data *ts; |
---|
2893 | 2902 | |
---|
2894 | | - ts = i2c_get_clientdata(i2c_connect_client); |
---|
| 2903 | + ts = i2c_get_clientdata(gtp_i2c_connect_client); |
---|
2895 | 2904 | |
---|
2896 | 2905 | buf = 0x0C; // hold ss51 and dsp |
---|
2897 | | - i2c_write_bytes(i2c_connect_client, _rRW_MISCTL__SWRST_B0_, &buf, 1); |
---|
| 2906 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, _rRW_MISCTL__SWRST_B0_, &buf, 1); |
---|
2898 | 2907 | |
---|
2899 | 2908 | //_fRW_MISCTL__CLK_BIAS = 0; //disable clock bias |
---|
2900 | 2909 | gup_bit_write(_rRW_MISCTL_RG_DMY83, 7, 0); |
---|
.. | .. |
---|
2906 | 2915 | gup_bit_write(_rRW_MISCTL__GIO1CTL_B1_, 1, 0); |
---|
2907 | 2916 | |
---|
2908 | 2917 | //buf = 0x00; |
---|
2909 | | - //i2c_write_bytes(i2c_connect_client, _rRW_MISCTL__SWRST_B0_, &buf, 1); |
---|
| 2918 | + //gtp_i2c_write_bytes(gtp_i2c_connect_client, _rRW_MISCTL__SWRST_B0_, &buf, 1); |
---|
2910 | 2919 | //msleep(1000); |
---|
2911 | 2920 | |
---|
2912 | 2921 | GTP_INFO("CLK calibration GO"); |
---|
2913 | 2922 | gup_sys_clk_init(); |
---|
2914 | | - gup_clk_calibration_pin_select(1);//use GIO1 to do the calibration |
---|
| 2923 | + gtp_gup_clk_calibration_pin_select(1);//use GIO1 to do the calibration |
---|
2915 | 2924 | |
---|
2916 | 2925 | GTP_GPIO_OUTPUT(ts->irq_pin, 0); |
---|
2917 | 2926 | |
---|
.. | .. |
---|
2928 | 2937 | gup_clk_dac_setting(i); |
---|
2929 | 2938 | gup_clk_count_init(1, CLK_AVG_TIME); |
---|
2930 | 2939 | |
---|
2931 | | - #if 0 |
---|
| 2940 | + #if 1 |
---|
2932 | 2941 | gup_output_pulse(PULSE_LENGTH); |
---|
2933 | 2942 | count = gup_clk_count_get(); |
---|
2934 | 2943 | |
---|
.. | .. |
---|
2975 | 2984 | |
---|
2976 | 2985 | //clk_dac = i; |
---|
2977 | 2986 | |
---|
2978 | | - gtp_reset_guitar(i2c_connect_client, 20); |
---|
| 2987 | + gtp_reset_guitar(gtp_i2c_connect_client, 20); |
---|
2979 | 2988 | |
---|
2980 | 2989 | #if 0//for debug |
---|
2981 | 2990 | //-- ouput clk to GPIO 4 |
---|
2982 | 2991 | buf = 0x00; |
---|
2983 | | - i2c_write_bytes(i2c_connect_client, 0x41FA, &buf, 1); |
---|
| 2992 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, 0x41FA, &buf, 1); |
---|
2984 | 2993 | buf = 0x00; |
---|
2985 | | - i2c_write_bytes(i2c_connect_client, 0x4104, &buf, 1); |
---|
| 2994 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, 0x4104, &buf, 1); |
---|
2986 | 2995 | buf = 0x00; |
---|
2987 | | - i2c_write_bytes(i2c_connect_client, 0x4105, &buf, 1); |
---|
| 2996 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, 0x4105, &buf, 1); |
---|
2988 | 2997 | buf = 0x00; |
---|
2989 | | - i2c_write_bytes(i2c_connect_client, 0x4106, &buf, 1); |
---|
| 2998 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, 0x4106, &buf, 1); |
---|
2990 | 2999 | buf = 0x01; |
---|
2991 | | - i2c_write_bytes(i2c_connect_client, 0x4107, &buf, 1); |
---|
| 3000 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, 0x4107, &buf, 1); |
---|
2992 | 3001 | buf = 0x06; |
---|
2993 | | - i2c_write_bytes(i2c_connect_client, 0x41F8, &buf, 1); |
---|
| 3002 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, 0x41F8, &buf, 1); |
---|
2994 | 3003 | buf = 0x02; |
---|
2995 | | - i2c_write_bytes(i2c_connect_client, 0x41F9, &buf, 1); |
---|
| 3004 | + gtp_i2c_write_bytes(gtp_i2c_connect_client, 0x41F9, &buf, 1); |
---|
2996 | 3005 | #endif |
---|
2997 | 3006 | |
---|
2998 | 3007 | /*GTP_GPIO_AS_INT(ts->irq_pin);*/ |
---|
.. | .. |
---|
3002 | 3011 | |
---|
3003 | 3012 | |
---|
3004 | 3013 | |
---|
3005 | | -s32 gup_hold_ss51_dsp(struct i2c_client *client) |
---|
| 3014 | +static s32 gup_hold_ss51_dsp(struct i2c_client *client) |
---|
3006 | 3015 | { |
---|
3007 | 3016 | s32 ret = -1; |
---|
3008 | 3017 | s32 retry = 0; |
---|
.. | .. |
---|
3083 | 3092 | return SUCCESS; |
---|
3084 | 3093 | } |
---|
3085 | 3094 | |
---|
3086 | | -s32 gup_enter_update_mode_fl(struct i2c_client *client) |
---|
| 3095 | +static s32 gup_enter_update_mode_fl(struct i2c_client *client) |
---|
3087 | 3096 | { |
---|
3088 | 3097 | s32 ret = -1; |
---|
3089 | 3098 | //s32 retry = 0; |
---|
.. | .. |
---|
3215 | 3224 | |
---|
3216 | 3225 | GTP_DEBUG("burn firmware: 0x%04X, %d bytes, start_index: 0x%04X", start_addr, burn_len, start_index); |
---|
3217 | 3226 | |
---|
3218 | | - ret = i2c_write_bytes(client, start_addr, (u8*)>p_default_FW_fl[FW_HEAD_LENGTH + start_index], burn_len); |
---|
| 3227 | + ret = gtp_i2c_write_bytes(client, start_addr, (u8*)>p_default_FW_fl[FW_HEAD_LENGTH + start_index], burn_len); |
---|
3219 | 3228 | if (ret < 0) |
---|
3220 | 3229 | { |
---|
3221 | 3230 | GTP_ERROR("burn 0x%04X, %d bytes failed!", start_addr, burn_len); |
---|
.. | .. |
---|
3248 | 3257 | GTP_ERROR("Check failed, buffer overflow\n"); |
---|
3249 | 3258 | break; |
---|
3250 | 3259 | } |
---|
3251 | | - ret = i2c_read_bytes(client, cmp_addr, chk_cmp_buf, cmp_len); |
---|
| 3260 | + ret = gtp_i2c_read_bytes(client, cmp_addr, chk_cmp_buf, cmp_len); |
---|
3252 | 3261 | if (ret < 0) |
---|
3253 | 3262 | { |
---|
3254 | 3263 | chk_fail = 1; |
---|
.. | .. |
---|
3259 | 3268 | if (chk_cmp_buf[i] != gtp_default_FW_fl[FW_HEAD_LENGTH + start_index +i]) |
---|
3260 | 3269 | { |
---|
3261 | 3270 | chk_fail = 1; |
---|
3262 | | - i2c_write_bytes(client, cmp_addr+i, >p_default_FW_fl[FW_HEAD_LENGTH + start_index + i], cmp_len-i); |
---|
| 3271 | + gtp_i2c_write_bytes(client, cmp_addr+i, >p_default_FW_fl[FW_HEAD_LENGTH + start_index + i], cmp_len-i); |
---|
3263 | 3272 | GTP_ERROR("Check failed index: %d(%d != %d), redownload chuck", i, chk_cmp_buf[i], |
---|
3264 | 3273 | gtp_default_FW_fl[FW_HEAD_LENGTH + start_index +i]); |
---|
3265 | 3274 | break; |
---|
.. | .. |
---|
3373 | 3382 | s32 ret = 0; |
---|
3374 | 3383 | s32 i = 0; |
---|
3375 | 3384 | s32 timeout = 0; |
---|
3376 | | - struct goodix_ts_data *ts = i2c_get_clientdata(i2c_connect_client); |
---|
| 3385 | + struct goodix_ts_data *ts = i2c_get_clientdata(gtp_i2c_connect_client); |
---|
3377 | 3386 | |
---|
3378 | 3387 | if (!memcmp(path, "update", 6)) |
---|
3379 | 3388 | { |
---|
.. | .. |
---|
3512 | 3521 | return ret; |
---|
3513 | 3522 | } |
---|
3514 | 3523 | |
---|
3515 | | -s32 gup_fw_download_proc(void *dir, u8 dwn_mode) |
---|
| 3524 | +s32 gtp_gup_fw_download_proc(void *dir, u8 dwn_mode) |
---|
3516 | 3525 | { |
---|
3517 | 3526 | s32 ret = 0; |
---|
3518 | 3527 | u8 retry = 0; |
---|
3519 | 3528 | st_fw_head fw_head; |
---|
3520 | 3529 | struct goodix_ts_data *ts; |
---|
3521 | 3530 | |
---|
3522 | | - ts = i2c_get_clientdata(i2c_connect_client); |
---|
| 3531 | + ts = i2c_get_clientdata(gtp_i2c_connect_client); |
---|
3523 | 3532 | if (NULL == dir) |
---|
3524 | 3533 | { |
---|
3525 | 3534 | if(GTP_FL_FW_BURN == dwn_mode) // GT9XXF firmware burn mode |
---|
.. | .. |
---|
3543 | 3552 | total_len = 100; |
---|
3544 | 3553 | show_len = 0; |
---|
3545 | 3554 | |
---|
3546 | | - ret = gup_check_update_file_fl(i2c_connect_client, &fw_head, (char *)dir); |
---|
| 3555 | + ret = gup_check_update_file_fl(gtp_i2c_connect_client, &fw_head, (char *)dir); |
---|
3547 | 3556 | show_len = 10; |
---|
3548 | 3557 | |
---|
3549 | 3558 | if (FAIL == ret) |
---|
.. | .. |
---|
3570 | 3579 | #endif |
---|
3571 | 3580 | } |
---|
3572 | 3581 | |
---|
3573 | | - ret = gup_enter_update_mode_fl(i2c_connect_client); |
---|
| 3582 | + ret = gup_enter_update_mode_fl(gtp_i2c_connect_client); |
---|
3574 | 3583 | show_len = 20; |
---|
3575 | 3584 | if (FAIL == ret) |
---|
3576 | 3585 | { |
---|
.. | .. |
---|
3580 | 3589 | |
---|
3581 | 3590 | while (retry++ < 5) |
---|
3582 | 3591 | { |
---|
3583 | | - ret = gup_download_fw_ss51(i2c_connect_client, dwn_mode); |
---|
| 3592 | + ret = gup_download_fw_ss51(gtp_i2c_connect_client, dwn_mode); |
---|
3584 | 3593 | show_len = 60; |
---|
3585 | 3594 | if (FAIL == ret) |
---|
3586 | 3595 | { |
---|
.. | .. |
---|
3588 | 3597 | continue; |
---|
3589 | 3598 | } |
---|
3590 | 3599 | |
---|
3591 | | - ret = gup_download_fw_dsp(i2c_connect_client, dwn_mode); |
---|
| 3600 | + ret = gup_download_fw_dsp(gtp_i2c_connect_client, dwn_mode); |
---|
3592 | 3601 | show_len = 80; |
---|
3593 | 3602 | if (FAIL == ret) |
---|
3594 | 3603 | { |
---|