2 * drivers/input/touchscreen/ft5x0x_ts.c
4 * FocalTech ft5x0x TouchScreen driver.
6 * Copyright (c) 2010 Focal tech Ltd.
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
18 * note: only support mulititouch Wenfs 2010-10-01
21 #include <linux/irq.h>
22 #include <asm/mach/irq.h>
23 #include <linux/slab.h>
24 #include <linux/i2c.h>
25 #include <linux/input.h>
26 #include "ft5x0x_i2c_ts.h"
27 #include <linux/interrupt.h>
28 #include <linux/delay.h>
29 #include <linux/platform_device.h>
30 #include <linux/async.h>
31 #include <mach/gpio.h>
32 #include <mach/board.h>
33 /* -------------- global variable definition -----------*/
34 static struct i2c_client *this_client;
35 static REPORT_FINGER_INFO_T _st_finger_infos[CFG_MAX_POINT_NUM];
36 //static unsigned int _sui_irq_num= IRQ_EINT(6);
37 static int _si_touch_num = 0;
39 int tsp_keycodes[CFG_NUMOFKEYS] ={
47 char *tsp_keyname[CFG_NUMOFKEYS] ={
55 static bool tsp_keystatus[CFG_NUMOFKEYS];
57 /***********************************************************************
59 callback: read data from ctpm by i2c interface;
61 buffer[in]: data buffer;
62 length[in]: the length of the data buffer;
66 ************************************************************************/
67 static bool i2c_read_interface(u8* pbt_buf, int dw_lenth)
71 ret=i2c_master_recv(this_client, pbt_buf, dw_lenth);
75 printk("[TSP]i2c_read_interface error\n");
84 /***********************************************************************
86 callback: write data to ctpm by i2c interface;
88 buffer[in]: data buffer;
89 length[in]: the length of the data buffer;
93 ************************************************************************/
94 static bool i2c_write_interface(u8* pbt_buf, int dw_lenth)
97 ret=i2c_master_send(this_client, pbt_buf, dw_lenth);
100 printk("[TSP]i2c_write_interface error line = %d, ret = %d\n", __LINE__, ret);
109 /***********************************************************************
111 callback: read register value ftom ctpm by i2c interface;
113 reg_name[in]: the register which you want to read;
114 rx_buf[in]: data buffer which is used to store register value;
115 rx_length[in]: the length of the data buffer;
119 ************************************************************************/
120 static bool fts_register_read(u8 reg_name, u8* rx_buf, int rx_length)
125 read_cmd[0] = reg_name;
128 /*send register addr*/
129 if(!i2c_write_interface(&read_cmd[0], cmd_len))
134 /*call the read callback function to get the register value*/
135 if(!i2c_read_interface(rx_buf, rx_length))
145 /***********************************************************************
147 callback: read register value ftom ctpm by i2c interface;
149 reg_name[in]: the register which you want to write;
150 tx_buf[in]: buffer which is contained of the writing value;
154 ************************************************************************/
155 static bool fts_register_write(u8 reg_name, u8* tx_buf)
157 u8 write_cmd[2] = {0};
159 write_cmd[0] = reg_name;
160 write_cmd[1] = *tx_buf;
162 /*call the write callback function*/
163 return i2c_write_interface(write_cmd, 2);
169 /***********************************************************************
171 callback: report to the input system that the finger is put up;
176 ************************************************************************/
177 static void fts_ts_release(void)
179 struct FTS_TS_DATA_T *data = i2c_get_clientdata(this_client);
182 for ( i= 0; i<CFG_MAX_POINT_NUM; ++i )
184 if ( _st_finger_infos[i].u2_pressure == -1 )
187 _st_finger_infos[i].u2_pressure = 0;
189 input_report_abs(data->input_dev, ABS_MT_POSITION_X, _st_finger_infos[i].i2_x);
190 input_report_abs(data->input_dev, ABS_MT_POSITION_Y, _st_finger_infos[i].i2_y);
191 input_report_abs(data->input_dev, ABS_MT_TOUCH_MAJOR, _st_finger_infos[i].u2_pressure);
192 input_report_abs(data->input_dev, ABS_MT_TRACKING_ID, _st_finger_infos[i].ui2_id);
193 input_mt_sync(data->input_dev);
197 if ( _st_finger_infos[i].u2_pressure == 0 )
198 _st_finger_infos[i].u2_pressure= -1;
203 input_sync(data->input_dev);
214 /***********************************************************************
216 callback: read touch data ftom ctpm by i2c interface;
218 rxdata[in]: data buffer which is used to store touch data;
219 length[in]: the length of the data buffer;
223 ************************************************************************/
224 static int fts_i2c_rxdata(u8 *rxdata, int length)
230 msg.addr = this_client->addr;
234 ret = i2c_transfer(this_client->adapter, &msg, 1);
237 pr_err("msg %s i2c write error: %d\n", __func__, ret);
239 msg.addr = this_client->addr;
240 msg.flags = I2C_M_RD;
243 ret = i2c_transfer(this_client->adapter, &msg, 1);
245 pr_err("msg %s i2c write error: %d\n", __func__, ret);
254 /***********************************************************************
256 callback: send data to ctpm by i2c interface;
258 txdata[in]: data buffer which is used to send data;
259 length[in]: the length of the data buffer;
263 ************************************************************************/
264 static int fts_i2c_txdata(u8 *txdata, int length)
270 msg.addr = this_client->addr;
274 ret = i2c_transfer(this_client->adapter, &msg, 1);
276 pr_err("%s i2c write error: %d\n", __func__, ret);
283 /***********************************************************************
285 callback: gather the finger information and calculate the X,Y
286 coordinate then report them to the input system;
291 ************************************************************************/
292 int fts_read_data(void)
294 struct FTS_TS_DATA_T *data = i2c_get_clientdata(this_client);
295 struct FTS_TS_EVENT_T *event = &data->event;
297 static int key_id=0x80;
299 int i,id,temp,i_count,ret = -1;
300 int touch_point_num = 0, touch_event, x, y, pressure, size;
301 REPORT_FINGER_INFO_T touch_info[CFG_MAX_POINT_NUM];
312 ret=fts_i2c_rxdata(buf, 6);
317 //printk("\n--the id number is %d---\n",id);
318 touch_event = buf[0]>>6;
319 if (id >= 0 && id< CFG_MAX_POINT_NUM)
324 temp = temp | buf[1];
327 temp = (buf[2])& 0x0f;
329 temp = temp | buf[3];
335 //x = (768-x)*600/768;
342 //x = 1024 - x;////////////////////////////
347 pressure = buf[4] & 0x3f;
350 touch_event = buf[0]>>6;
352 if (touch_event == 0) //press down
358 _st_finger_infos[id].u2_pressure= 1;//pressure;
359 _st_finger_infos[id].i2_x= (int16_t)x;
360 _st_finger_infos[id].i2_y= (int16_t)y;
361 _st_finger_infos[id].ui2_id = size;
363 printk("\n--report x position is %d,pressure=%d----\n",_st_finger_infos[id].i2_x, pressure);
364 printk("\n--report y position is %d,pressure=%d----\n",_st_finger_infos[id].i2_y, pressure);
368 else if(y>=850 && y<=860)
373 printk("\n---virtual key 1 press---");
375 else if ( x>=185 && x<=200)
378 printk("\n---virtual key 2 press---");
380 else if (x>=290 && x<=305)
383 printk("\n---virtual key 3 press---");
385 else if ( x>=405 && x<=420)
388 printk("\n---virtual key 4 press---");
392 input_report_key(data->input_dev, tsp_keycodes[key_id], 1);
393 tsp_keystatus[key_id] = KEY_PRESS;
399 else if (touch_event == 1) //up event
402 _st_finger_infos[id].u2_pressure= 0;
408 printk("\n---virtual key %d release---\n",++i);
410 input_report_key(data->input_dev, tsp_keycodes[key_id], 0);
417 else if (touch_event == 2) //move
419 printk("[TSP]id=%d move\n", id);
420 _st_finger_infos[id].u2_pressure= 1;//pressure;
421 _st_finger_infos[id].i2_x= (int16_t)x;
422 _st_finger_infos[id].i2_y= (int16_t)y;
423 _st_finger_infos[id].ui2_id = size;
427 /*bad event, ignore*/
431 if ( (touch_event==1) )
433 printk("[TSP]id=%d up\n", id);
437 for( i= 0; i<CFG_MAX_POINT_NUM; ++i )
440 input_report_abs(data->input_dev, ABS_MT_TRACKING_ID, _st_finger_infos[i].ui2_id);
441 input_report_abs(data->input_dev, ABS_MT_TOUCH_MAJOR, _st_finger_infos[i].u2_pressure);
442 input_report_abs(data->input_dev, ABS_MT_POSITION_X, _st_finger_infos[i].i2_x);
443 input_report_abs(data->input_dev, ABS_MT_POSITION_Y, _st_finger_infos[i].i2_y);
444 input_mt_sync(data->input_dev);
446 if(_st_finger_infos[i].u2_pressure == 0 )
448 _st_finger_infos[i].u2_pressure= -1;
453 input_sync(data->input_dev);
455 if (_si_touch_num == 0 )
466 printk("[TSP] ERROR: in %s, line %d, ret = %d\n",
467 __FUNCTION__, __LINE__, ret);
471 }while( id != 0xf && i_count < 12);
473 event->touch_point = touch_point_num;
474 if (event->touch_point == 0)
477 switch (event->touch_point) {
479 event->x5 = touch_info[4].i2_x;
480 event->y5 = touch_info[4].i2_y;
481 event->pressure5 = touch_info[4].u2_pressure;
483 event->x4 = touch_info[3].i2_x;
484 event->y4 = touch_info[3].i2_y;
485 event->pressure4= touch_info[3].u2_pressure;
487 event->x3 = touch_info[2].i2_x;
488 event->y3 = touch_info[2].i2_y;
489 event->pressure3= touch_info[2].u2_pressure;
491 event->x2 = touch_info[1].i2_x;
492 event->y2 = touch_info[1].i2_y;
493 event->pressure2= touch_info[1].u2_pressure;
495 event->x1 = touch_info[0].i2_x;
496 event->y1 = touch_info[0].i2_y;
497 event->pressure1= touch_info[0].u2_pressure;
508 static void fts_work_func(struct work_struct *work)
511 enable_irq(this_client->irq);
517 static irqreturn_t fts_ts_irq(int irq, void *dev_id)
519 struct FTS_TS_DATA_T *ft5x0x_ts = dev_id;
520 printk(KERN_ALERT "fts_tp_irq\n");
521 if (!work_pending(&ft5x0x_ts->pen_event_work)) {
522 disable_irq_nosync(this_client->irq);
523 queue_work(ft5x0x_ts->ts_workqueue, &ft5x0x_ts->pen_event_work);
531 /***********************************************************************
533 callback: send a command to ctpm.
535 btcmd[in]: command code;
536 btPara1[in]: parameter 1;
537 btPara2[in]: parameter 2;
538 btPara3[in]: parameter 3;
539 num[in]: the valid input parameter numbers,
540 if only command code needed and no
541 parameters followed,then the num is 1;
545 ************************************************************************/
546 static bool cmd_write(u8 btcmd,u8 btPara1,u8 btPara2,u8 btPara3,u8 num)
548 u8 write_cmd[4] = {0};
550 write_cmd[0] = btcmd;
551 write_cmd[1] = btPara1;
552 write_cmd[2] = btPara2;
553 write_cmd[3] = btPara3;
554 return i2c_write_interface(write_cmd, num);
560 /***********************************************************************
562 callback: write a byte data to ctpm;
564 buffer[in]: write buffer;
565 length[in]: the size of write data;
569 ************************************************************************/
570 static bool byte_write(u8* buffer, int length)
573 return i2c_write_interface(buffer, length);
579 /***********************************************************************
581 callback: read a byte data from ctpm;
583 buffer[in]: read buffer;
584 length[in]: the size of read data;
588 ************************************************************************/
589 static bool byte_read(u8* buffer, int length)
591 return i2c_read_interface(buffer, length);
598 #define FTS_PACKET_LENGTH 128
600 static unsigned char CTPM_FW[]=
602 //#include "ft_app.i"
608 /***********************************************************************
610 callback: burn the FW to ctpm.
612 pbt_buf[in]: point to Head+FW ;
613 dw_lenth[in]: the length of the FW + 6(the Head length);
616 ERR_MODE: fail to switch to UPDATE mode;
617 ERR_READID: read id fail;
618 ERR_ERASE: erase chip fail;
619 ERR_STATUS: status error;
621 ************************************************************************/
622 E_UPGRADE_ERR_TYPE fts_ctpm_fw_upgrade(u8* pbt_buf, int dw_lenth)
624 u8 cmd,reg_val[2] = {0};
625 u8 packet_buf[FTS_PACKET_LENGTH + 6];
626 u8 auc_i2c_write_buf[10];
629 int j,temp,lenght,i_ret,packet_number, i = 0;
630 int i_is_new_protocol = 0;
633 /******write 0xaa to register 0xfc******/
635 fts_register_write(0xfc,&cmd);
638 /******write 0x55 to register 0xfc******/
640 fts_register_write(0xfc,&cmd);
641 printk("[TSP] Step 1: Reset CTPM test\n");
646 /*******Step 2:Enter upgrade mode ****/
647 printk("\n[TSP] Step 2:enter new update mode\n");
648 auc_i2c_write_buf[0] = 0x55;
649 auc_i2c_write_buf[1] = 0xaa;
653 i_ret = fts_i2c_txdata(auc_i2c_write_buf, 2);
655 }while(i_ret <= 0 && i < 10 );
659 i_is_new_protocol = 1;
662 /********Step 3:check READ-ID********/
663 cmd_write(0x90,0x00,0x00,0x00,4);
664 byte_read(reg_val,2);
665 if (reg_val[0] == 0x79 && reg_val[1] == 0x3)
667 printk("[TSP] Step 3: CTPM ID,ID1 = 0x%x,ID2 = 0x%x\n",reg_val[0],reg_val[1]);
672 //i_is_new_protocol = 1;
676 /*********Step 4:erase app**********/
677 if (i_is_new_protocol)
679 cmd_write(0x61,0x00,0x00,0x00,1);
683 cmd_write(0x60,0x00,0x00,0x00,1);
686 printk("[TSP] Step 4: erase. \n");
690 /*Step 5:write firmware(FW) to ctpm flash*/
692 printk("[TSP] Step 5: start upgrade. \n");
693 dw_lenth = dw_lenth - 8;
694 packet_number = (dw_lenth) / FTS_PACKET_LENGTH;
695 packet_buf[0] = 0xbf;
696 packet_buf[1] = 0x00;
697 for (j=0;j<packet_number;j++)
699 temp = j * FTS_PACKET_LENGTH;
700 packet_buf[2] = (FTS_BYTE)(temp>>8);
701 packet_buf[3] = (FTS_BYTE)temp;
702 lenght = FTS_PACKET_LENGTH;
703 packet_buf[4] = (FTS_BYTE)(lenght>>8);
704 packet_buf[5] = (FTS_BYTE)lenght;
706 for (i=0;i<FTS_PACKET_LENGTH;i++)
708 packet_buf[6+i] = pbt_buf[j*FTS_PACKET_LENGTH + i];
709 bt_ecc ^= packet_buf[6+i];
712 byte_write(&packet_buf[0],FTS_PACKET_LENGTH + 6);
713 mdelay(FTS_PACKET_LENGTH/6 + 1);
714 if ((j * FTS_PACKET_LENGTH % 1024) == 0)
716 printk("[TSP] upgrade the 0x%x th byte.\n", ((unsigned int)j) * FTS_PACKET_LENGTH);
720 if ((dw_lenth) % FTS_PACKET_LENGTH > 0)
722 temp = packet_number * FTS_PACKET_LENGTH;
723 packet_buf[2] = (FTS_BYTE)(temp>>8);
724 packet_buf[3] = (FTS_BYTE)temp;
726 temp = (dw_lenth) % FTS_PACKET_LENGTH;
727 packet_buf[4] = (FTS_BYTE)(temp>>8);
728 packet_buf[5] = (FTS_BYTE)temp;
732 packet_buf[6+i] = pbt_buf[ packet_number*FTS_PACKET_LENGTH + i];
733 bt_ecc ^= packet_buf[6+i];
736 byte_write(&packet_buf[0],temp+6);
740 /***********send the last six byte**********/
741 for (i = 0; i<6; i++)
744 packet_buf[2] = (FTS_BYTE)(temp>>8);
745 packet_buf[3] = (FTS_BYTE)temp;
747 packet_buf[4] = (FTS_BYTE)(temp>>8);
748 packet_buf[5] = (FTS_BYTE)temp;
749 packet_buf[6] = pbt_buf[ dw_lenth + i];
750 bt_ecc ^= packet_buf[6];
752 byte_write(&packet_buf[0],7);
756 /********send the opration head************/
757 cmd_write(0xcc,0x00,0x00,0x00,1);
758 byte_read(reg_val,1);
759 printk("[TSP] Step 6: ecc read 0x%x, new firmware 0x%x. \n", reg_val[0], bt_ecc);
760 if(reg_val[0] != bt_ecc)
765 /*******Step 7: reset the new FW**********/
766 cmd_write(0x07,0x00,0x00,0x00,1);
774 int fts_ctpm_fw_upgrade_with_i_file(void)
776 u8* pbt_buf = FTS_NULL;
780 i_ret = fts_ctpm_fw_upgrade(pbt_buf,sizeof(CTPM_FW));
785 unsigned char fts_ctpm_get_upg_ver(void)
789 ui_sz = sizeof(CTPM_FW);
792 return CTPM_FW[ui_sz - 2];
800 static int fts_ts_probe(struct i2c_client *client, const struct i2c_device_id *id)
802 struct FTS_TS_DATA_T *ft5x0x_ts;
803 struct input_dev *input_dev;
806 unsigned char reg_value;
807 unsigned char reg_version;
810 struct laibao_platform_data *pdata = client->dev.platform_data;
812 client->irq = gpio_to_irq(client->irq);
813 _sui_irq_num = client->irq;
815 printk("[TSP] file(%s), function (%s), --probe start\n", __FILE__, __FUNCTION__);
817 if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
819 goto exit_check_functionality_failed;
822 ft5x0x_ts = kzalloc(sizeof(*ft5x0x_ts), GFP_KERNEL);
825 goto exit_alloc_data_failed;
828 this_client = client;
829 i2c_set_clientdata(client, ft5x0x_ts);
831 INIT_WORK(&ft5x0x_ts->pen_event_work, fts_work_func);
833 ft5x0x_ts->ts_workqueue = create_singlethread_workqueue(dev_name(&client->dev));
834 if (!ft5x0x_ts->ts_workqueue) {
836 goto exit_create_singlethread;
839 if (pdata->init_platform_hw)
840 pdata->init_platform_hw();
844 /***wait CTP to bootup normally***/
847 //fts_register_read(FT5X0X_REG_FIRMID, ®_version,1);
848 i2c_master_reg8_recv(this_client, FT5X0X_REG_FIRMID, ®_version, 1, 200*1000);
849 printk("[TSP] firmware version = 0x%2x\n", reg_version);
850 //fts_register_read(FT5X0X_REG_REPORT_RATE, ®_value,1);
851 i2c_master_reg8_recv(this_client, FT5X0X_REG_REPORT_RATE, ®_value, 1, 200*1000);
852 printk("[TSP]firmware report rate = %dHz\n", reg_value*10);
853 //fts_register_read(FT5X0X_REG_THRES, ®_value,1);
854 i2c_master_reg8_recv(this_client, FT5X0X_REG_THRES, ®_value, 1, 200*1000);
855 printk("[TSP]firmware threshold = %d\n", reg_value * 4);
856 //fts_register_read(FT5X0X_REG_NOISE_MODE, ®_value,1);
857 i2c_master_reg8_recv(this_client, FT5X0X_REG_NOISE_MODE, ®_value, 1, 200*1000);
858 printk("[TSP]nosie mode = 0x%2x\n", reg_value);
861 if (fts_ctpm_get_upg_ver() != reg_version)
863 printk("[TSP] start upgrade new verison 0x%2x\n", fts_ctpm_get_upg_ver());
865 err = fts_ctpm_fw_upgrade_with_i_file();
868 printk("[TSP] ugrade successfuly.\n");
870 fts_register_read(FT5X0X_REG_FIRMID, ®_value,1);
871 printk("FTS_DBG from old version 0x%2x to new version = 0x%2x\n", reg_version, reg_value);
875 printk("[TSP] ugrade fail err=%d, line = %d.\n",
881 printk("[TSP]=========================_sui_irq_num = %d ================\n",_sui_irq_num);
882 printk("[TSP]=========================client->dev.driver->name = %s ================\n",client->dev.driver->name);
883 err = request_irq(_sui_irq_num, fts_ts_irq, GPIOEdgelFalling, client->dev.driver->name, ft5x0x_ts);
886 dev_err(&client->dev, "[TSP]ft5x0x_probe: request irq failed\n");
887 printk("[TSP]=========================err = %d ================\n",err);
888 goto exit_irq_request_failed;
890 disable_irq(_sui_irq_num);
892 input_dev = input_allocate_device();
895 dev_err(&client->dev, "[TSP]failed to allocate input device\n");
896 goto exit_input_dev_alloc_failed;
899 ft5x0x_ts->input_dev = input_dev;
901 /***setup coordinate area******/
902 //set_bit(EV_ABS, input_dev->evbit);
903 //set_bit(ABS_MT_TOUCH_MAJOR, input_dev->absbit);
904 //set_bit(ABS_MT_POSITION_X, input_dev->absbit);
905 //set_bit(ABS_MT_POSITION_Y, input_dev->absbit);
906 //set_bit(ABS_MT_WIDTH_MAJOR, input_dev->absbit);
907 input_dev->evbit[0] = BIT_MASK(EV_SYN) | BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
909 /****** for multi-touch *******/
910 for (i=0; i<CFG_MAX_POINT_NUM; i++)
911 _st_finger_infos[i].u2_pressure = -1;
913 input_set_abs_params(input_dev,
914 ABS_MT_POSITION_X, 0, SCREEN_MAX_X, 0, 0);
915 input_set_abs_params(input_dev,
916 ABS_MT_POSITION_Y, 0, SCREEN_MAX_Y, 0, 0);
917 input_set_abs_params(input_dev,
918 ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
919 //input_set_abs_params(input_dev,
920 // ABS_MT_TRACKING_ID, 0, 30, 0, 0);
921 input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR, 0, 255, 0, 0);
922 /*****setup key code area******/
923 //set_bit(EV_SYN, input_dev->evbit);
924 //set_bit(EV_KEY, input_dev->evbit);
925 //set_bit(BTN_TOUCH, input_dev->keybit);
926 //input_dev->keycode = tsp_keycodes;
927 //for(i = 0; i < CFG_NUMOFKEYS; i++)
929 // input_set_capability(input_dev, EV_KEY, ((int*)input_dev->keycode)[i]);
930 // tsp_keystatus[i] = KEY_RELEASE;
933 input_dev->name = FT5X0X_NAME;
934 input_dev->id.bustype = BUS_I2C;
935 input_dev->id.vendor = 0xdead;
936 input_dev->id.product = 0xbeef;
937 input_dev->id.version = 10427;
939 err = input_register_device(input_dev);
941 dev_err(&client->dev,
942 "fts_ts_probe: failed to register input device: %s\n",
943 dev_name(&client->dev));
944 goto exit_input_register_device_failed;
947 enable_irq(_sui_irq_num);
948 printk("[TSP] file(%s), function (%s), -- end\n", __FILE__, __FUNCTION__);
951 exit_input_register_device_failed:
952 input_free_device(input_dev);
953 exit_input_dev_alloc_failed:
954 free_irq(_sui_irq_num, ft5x0x_ts);
955 exit_irq_request_failed:
956 cancel_work_sync(&ft5x0x_ts->pen_event_work);
957 destroy_workqueue(ft5x0x_ts->ts_workqueue);
958 exit_create_singlethread:
959 printk("[TSP] ==singlethread error =\n");
960 i2c_set_clientdata(client, NULL);
962 exit_alloc_data_failed:
963 exit_check_functionality_failed:
969 static int __devexit fts_ts_remove(struct i2c_client *client)
971 struct FTS_TS_DATA_T *ft5x0x_ts;
972 int _sui_irq_num=client->irq;
974 ft5x0x_ts = (struct FTS_TS_DATA_T *)i2c_get_clientdata(client);
975 free_irq(_sui_irq_num, ft5x0x_ts);
976 input_unregister_device(ft5x0x_ts->input_dev);
978 cancel_work_sync(&ft5x0x_ts->pen_event_work);
979 destroy_workqueue(ft5x0x_ts->ts_workqueue);
980 i2c_set_clientdata(client, NULL);
985 static const struct i2c_device_id ft5x0x_ts_id[] = {
991 MODULE_DEVICE_TABLE(i2c, ft5x0x_ts_id);
993 static struct i2c_driver fts_ts_driver = {
994 .probe = fts_ts_probe,
995 .remove = fts_ts_remove,//devexit_p(fts_ts_remove),
996 .id_table = ft5x0x_ts_id,
1002 static void __init fts_ts_initasync(void *unused, async_cookie_t cookie)
1004 i2c_add_driver(&fts_ts_driver);
1007 static int __init fts_ts_init(void)
1009 async_schedule(fts_ts_initasync, NULL);
1013 static void __exit fts_ts_exit(void)
1015 i2c_del_driver(&fts_ts_driver);
1018 module_init(fts_ts_init);
1019 module_exit(fts_ts_exit);
1021 MODULE_AUTHOR("<duxx@Focaltech-systems.com>");
1022 MODULE_DESCRIPTION("FocalTech ft5x0x TouchScreen driver");
1023 MODULE_LICENSE("GPL");