static int tpd_local_init(void) {
    boot_mode = get_boot_mode();
    // Software reset mode will be treated as normal boot
    if(boot_mode==3) boot_mode = NORMAL_BOOT;
    //boot_mode = UNKNOWN_BOOT;
    if(i2c_add_driver(&tpd_i2c_driver)!=0) {
      TPD_DMESG("unable to add i2c driver.\n");
      return -1;
    }
#ifdef TPD_HAVE_BUTTON     
    tpd_button_setting(TPD_KEY_COUNT, tpd_keys_local, tpd_keys_dim_local);// initialize tpd button data
#endif   
  
#if (defined(TPD_WARP_START) && defined(TPD_WARP_END))    
    TPD_DO_WARP = 1;
    memcpy(tpd_wb_start, tpd_wb_start_local, TPD_WARP_CNT*4);
    memcpy(tpd_wb_end, tpd_wb_start_local, TPD_WARP_CNT*4);
#endif 

#if (defined(TPD_HAVE_CALIBRATION) && !defined(TPD_CUSTOM_CALIBRATION))
    memcpy(tpd_calmat, tpd_def_calmat_local, 8*4);
    memcpy(tpd_def_calmat, tpd_def_calmat_local, 8*4);	
#endif  
		TPD_DMESG("end %s, %d\n", __FUNCTION__, __LINE__);  
		tpd_type_cap = 1;
    return 0;
}
int get_module_id()
{
	char read_num = 0;
	int ret = 0, verdor_id = 0,id = 0;
	ret = fts_read_reg(i2c_client,FTS_REG_VENDOR_ID,&verdor_id);
	TPD_DMESG("fts ret = %d ,verdor_id = 0x%x.\n",ret,verdor_id);
	while(ret != 1 && read_num < 5)
	{
		ret = fts_read_reg(i2c_client,FTS_REG_VENDOR_ID,&verdor_id);
		read_num++;
	}
	TPD_DMESG("fts ret = %d ,verdor_id = 0x%x.\n",ret,verdor_id);
	switch(verdor_id)
	{
		case MODULE_ID0:
			id = 0;
			break;
		case MODULE_ID1:
			id = 1;
			break;
		case MODULE_ID2:
			id = 2;
			break;
		case MODULE_ID3:
			id = 3;
			break;
		case MODULE_ID4:
			id = 4;
			break;
		default:
			id = 8;
			break;
	}
	return id;
}
예제 #3
0
/* Add driver: if find TPD_TYPE_CAPACITIVE driver sucessfully, loading it */
int tpd_driver_add(struct tpd_driver_t *tpd_drv)
{
	int i;
	
	if(g_tpd_drv != NULL)
	{
		TPD_DMESG("touch driver exist \n");
		return -1;
	}
	/* check parameter */
	if(tpd_drv == NULL)
	{
		return -1;
	}
	/* R-touch */
	if(strcmp(tpd_drv->tpd_device_name, "generic") == 0)
	{
			tpd_driver_list[0].tpd_device_name = tpd_drv->tpd_device_name;
			tpd_driver_list[0].tpd_local_init = tpd_drv->tpd_local_init;
			tpd_driver_list[0].suspend = tpd_drv->suspend;
			tpd_driver_list[0].resume = tpd_drv->resume;
			tpd_driver_list[0].tpd_have_button = tpd_drv->tpd_have_button;
            
            //LINE <tp> <DATE20130422> tp version> zhangxiaofei
            tpd_driver_list[0].tpd_get_fw_version = NULL;
            tpd_driver_list[0].tpd_get_fw_vendor_name = NULL;
            
			return 0;
	}
	for(i = 1; i < TP_DRV_MAX_COUNT; i++)
	{
		/* add tpd driver into list */
		if(tpd_driver_list[i].tpd_device_name == NULL)
		{
			tpd_driver_list[i].tpd_device_name = tpd_drv->tpd_device_name;
			tpd_driver_list[i].tpd_local_init = tpd_drv->tpd_local_init;
			tpd_driver_list[i].suspend = tpd_drv->suspend;
			tpd_driver_list[i].resume = tpd_drv->resume;
			tpd_driver_list[i].tpd_have_button = tpd_drv->tpd_have_button;
			tpd_driver_list[i].attrs = tpd_drv->attrs;
            //LINE <tp> <DATE20130422> tp version> zhangxiaofei
            tpd_driver_list[i].tpd_get_fw_version = tpd_drv->tpd_get_fw_version;
            tpd_driver_list[i].tpd_get_fw_vendor_name = tpd_drv->tpd_get_fw_vendor_name;
			#if 0
			if(tpd_drv->tpd_local_init()==0)
			{
				TPD_DMESG("load %s sucessfully\n", tpd_driver_list[i].tpd_device_name);
				g_tpd_drv = &tpd_driver_list[i];
			}
			#endif
			break;
		}
		if(strcmp(tpd_driver_list[i].tpd_device_name, tpd_drv->tpd_device_name) == 0)
		{
			return 1; // driver exist
		}
	}
	
	return 0;
}
/* switch touch panel back to normal mode */
 void _tpd_switch_normal_mode(void) {
    
    char wakeup[2] = {0x07,0x02};
    char threshold[2] = {0x09, 0x04};
    char gesture[2] = {0x08, 0x11};
    char sleeptime[2] = {0x0d, 0x01};
    char idletime[2] = {0x0c, 0xff};
    int i;
    
    if (tpd_status) {
        TPD_DMESG("do not need to switch tpd back to normal mode\n");
        return;
    }
    
    TPD_DMESG("switch tpd back to normal mode\n");
    
    for(i=0;i<TPD_WAKEUP_TRIAL;i++) {
        i2c_master_send(i2c_client,wakeup,2);
        if(i2c_master_send(i2c_client,wakeup,2)==2) break;
        msleep(TPD_WAKEUP_DELAY);
    }
    i2c_master_send(i2c_client,gesture,2);
    i2c_master_send(i2c_client,threshold,2);
    i2c_master_send(i2c_client,idletime,2);
    i2c_master_send(i2c_client,sleeptime,2);
    
    MT6516_IRQUnmask(MT6516_TOUCH_IRQ_LINE);    
    MT6516_EINTIRQUnmask(CUST_EINT_TOUCH_PANEL_NUM);    
    
    tpd_status = 1; 
}
예제 #5
0
int tpd_local_init(void) 
{
     if(i2c_add_driver(&tpd_i2c_driver)!=0)
     {
          TPD_DMESG("unable to add i2c driver.\n");
          return -1;
     }
     
#ifdef TPD_HAVE_BUTTON     
    tpd_button_setting(TPD_KEY_COUNT, tpd_keys_local, tpd_keys_dim_local);// initialize tpd button data
#endif   
  
#if (defined(TPD_WARP_START) && defined(TPD_WARP_END))    
    TPD_DO_WARP = 1;
    memcpy(tpd_wb_start, tpd_wb_start_local, TPD_WARP_CNT*4);
    memcpy(tpd_wb_end, tpd_wb_start_local, TPD_WARP_CNT*4);
#endif 

#if (defined(TPD_HAVE_CALIBRATION) && !defined(TPD_CUSTOM_CALIBRATION))
    memcpy(tpd_calmat, tpd_def_calmat_local, 8*4);
    memcpy(tpd_def_calmat, tpd_def_calmat_local, 8*4);	
#endif  
		TPD_DMESG("end %s, %d\n", __FUNCTION__, __LINE__);  
		tpd_type_cap = 1;
    return 0;
}
예제 #6
0
 static int tpd_local_init(void)
{
	TPD_DMESG("Focaltech FT6x06 I2C Touchscreen Driver (Built %s @ %s)\n", __DATE__, __TIME__);
	if(i2c_add_driver(&tpd_i2c_driver)!=0)
	{
		TPD_DMESG("unable to add i2c driver.\n");
		return -1;
	}
#ifdef TPD_HAVE_BUTTON     
		tinno_update_tp_button_dim(FTS_CTP_VENDOR_NANBO);
#endif   
	TPD_DMESG("end %s, %d\n", __FUNCTION__, __LINE__);  
	tpd_type_cap = 1;
	return 0; 
}
예제 #7
0
static ssize_t tsp_fw_compare(char *string, int size)
{
	off_t fsize; 
	loff_t pos;
	mm_segment_t old_fs;
	struct file* fp = NULL;
	TPD_DMESG("%s \n", __func__ );
	fp= filp_open("/data/system/touchp", O_CREAT | O_RDWR | O_TRUNC, 0777);
	
		if(IS_ERR(fp)){
			DSX_FW("%s:error occured while opening file.\n", __func__);	
			return -1;
		}

		 fsize = size; 
		 old_fs = get_fs();
		 set_fs(KERNEL_DS);
		 pos = 0;
	
		 vfs_write(fp, string, fsize, &pos);
		 //vfs_read(fp, &temple, fsize, &pos);
		 DSX_FW("Exit %s@%d temple:%s\n", __func__,__LINE__,string);
		 filp_close(fp, NULL);
		set_fs(old_fs);	

	return 0;
}
예제 #8
0
/**
 * tpd_classdev_register - register a new object of tpd_classdev_t class.
 * @parent: The device to register.
 * @tsp_fw_cdev: the tpd_classdev_t structure for this device.
 */
int tpd_classdev_register(struct device *parent, struct tpd_classdev_t *tsp_fw_cdev)
{
	int error = 0;
	
	tsp_fw_cdev->dev = device_create(tsp_fw_class, parent, 0, tsp_fw_cdev,
					  "%s", tsp_fw_cdev->name);
	if (IS_ERR(tsp_fw_cdev->dev))
		return PTR_ERR(tsp_fw_cdev->dev);

	error = device_create_bin_file(tsp_fw_cdev->dev, &firmware_attr_data);
	if (error) {
		dev_err(tsp_fw_cdev->dev, "%s: sysfs_create_bin_file failed\n", __func__);
	}

	/* add to the list of tp_firmware */
	down_write(&tp_firmware_list_lock);
	list_add_tail(&tsp_fw_cdev->node, &tp_firmware_list);
	up_write(&tp_firmware_list_lock);

	g_cdev = tsp_fw_cdev;

	mutex_init(&tsp_fw_cdev->flash_mutex);
	mutex_init(&tpd_sys_cmd_mutex);
	init_waitqueue_head(&tsp_fw_cdev->wait);
	INIT_WORK(&tsp_fw_cdev->sdcard_upgrade_work, tpd_image_file_work);
	INIT_WORK(&tsp_fw_cdev->check_fwinfo_work,tsp_fw_compare_work);
	TPD_DMESG(KERN_DEBUG "Registered tsp_fw device: %s\n",
			tsp_fw_cdev->name);
       DSX_FW("Exit %s@%d %s\n",__func__,__LINE__,tsp_fw_cdev->name); 
	return 0;
}
static void msg_dma_alloct(){
	g_dma_buff_va = (u8 *)dma_alloc_coherent(NULL, 4096, &g_dma_buff_pa, GFP_KERNEL);
    if(!g_dma_buff_va){
        TPD_DMESG("[DMA][Error] Allocate DMA I2C Buffer failed!\n");
    }
	memset(g_dma_buff_va, 0, 4096);
}
예제 #10
0
/* called when loaded into kernel */
static int __init tpd_driver_init(void) {
    printk("MediaTek cy8ctma300 touch panel driver init\n");
    i2c_register_board_info(0, &cy8ctma300_i2c_tpd, 1);
		if(tpd_driver_add(&tpd_device_driver) < 0)
			TPD_DMESG("add generic driver failed\n");
    return 0;
}
예제 #11
0
/* Function to manage low power suspend */
void tpd_suspend(struct early_suspend *h)
{
	if(tpd_debuglog==1) {
		TPD_DMESG("[mtk-tpd] %s\n", __FUNCTION__); 
	}
  	tpd_halt = 1;	
	while(1){
		if(tpd_flag == 1) msleep(1000);
		else break;	
	}
    mt65xx_eint_mask(CUST_EINT_TOUCH_PANEL_NUM);

#ifdef TPD_POWER_SOURCE_CUSTOM
    hwPowerDown(TPD_POWER_SOURCE_CUSTOM, "TP");
#endif
#ifdef TPD_POWER_SOURCE_1800
    hwPowerDown(TPD_POWER_SOURCE_1800, "TP");
#endif
#ifdef GPIO_CTP_EN_PIN
    mt_set_gpio_mode(GPIO_CTP_EN_PIN, GPIO_CTP_EN_PIN_M_GPIO);
    mt_set_gpio_dir(GPIO_CTP_EN_PIN, GPIO_DIR_OUT);
    mt_set_gpio_out(GPIO_CTP_EN_PIN, GPIO_OUT_ZERO);
#endif
    mdelay(1);
    mt_set_gpio_mode(GPIO_CTP_RST_PIN, GPIO_CTP_RST_PIN_M_GPIO);
    mt_set_gpio_dir(GPIO_CTP_RST_PIN, GPIO_DIR_OUT);
    mt_set_gpio_out(GPIO_CTP_RST_PIN, GPIO_OUT_ZERO);    
}
void tpd_eint_interrupt_handler(void) {
//	if(tpd_debuglog==1) TPD_DMESG("[mtk-tpd], %s\n", __FUNCTION__);
    if(1) TPD_DMESG("[mtk-tpd], %s\n", __FUNCTION__);
    TPD_DEBUG_PRINT_INT;
    tpd_flag=1;
    wake_up_interruptible(&waiter);
}
/* switch touch panel into multiple scan mode for better performance */
 void _tpd_switch_multiple_mode(void) {
    
    char mode[2] = {0x0b,0x00};
    TPD_DMESG("switch tpd into multiple scan mode\n");
    i2c_master_send(i2c_client,mode,2);
    
}
예제 #14
0
static ssize_t tsp_gesture_enable_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t size)
{
	struct tpd_classdev_t *cdev = dev_get_drvdata(dev);
	int ret = -1;
	char *after;
	unsigned long enable = simple_strtoul(buf, &after, 10);
	size_t count = after - buf;

	if (isspace(*after))
		count++;

	if (count == size) {
		ret = count;
	}
	
	TPD_DMESG("%s val %ld.\n", __func__, enable);

	mutex_lock(&tpd_sys_cmd_mutex);
	if(cdev->wake_gesture) {
		cdev->wake_gesture(cdev, enable);
	}
	cdev->b_gesture_enable = enable;
	mutex_unlock(&tpd_sys_cmd_mutex);

	return size;
}
static void msg_dma_alloct(void)
{
	g_dma_buff_va = (u8 *) dma_alloc_coherent(NULL, 128, &g_dma_buff_pa, GFP_KERNEL);	/*DMA size 4096 for customer*/
	if (!g_dma_buff_va) {
		TPD_DMESG("[DMA][Error] Allocate DMA I2C Buffer failed!\n");
	}
}
/* called when loaded into kernel */
static int __init tpd_driver_init(void) {
	TPD_DEBUG("MediaTek FT5316 touch panel driver init\n");
	i2c_register_board_info(TPD_I2C_NUMBER, &ft5316_i2c_tpd, 1);    
	if(tpd_driver_add(&tpd_device_driver) < 0)
	TPD_DMESG("add generic driver failed\n");
	return 0;
}
void tpd_button_init(void) {
    int ret = 0, i = 0;
#if 0
	for(i=0; i<TPD_VIRTUAL_KEY_MAX; i++)
	{
		for(j=0; j<4; j++)
		{
			tpd_keys_dim[i][j]=0;
		}
	}
#endif	
//    if((tpd->kpd=input_allocate_device())==NULL) return -ENOMEM;
    tpd->kpd=input_allocate_device();
    /* struct input_dev kpd initialization and registration */
    tpd->kpd->name = TPD_DEVICE "-kpd";
    set_bit(EV_KEY, tpd->kpd->evbit);
    //set_bit(EV_REL, tpd->kpd->evbit);
    //set_bit(EV_ABS, tpd->kpd->evbit);
    for(i=0;i<tpd_keycnt;i++)
        __set_bit(tpd_keys[i], tpd->kpd->keybit);
    tpd->kpd->id.bustype = BUS_HOST;
    tpd->kpd->id.vendor  = 0x0001;
    tpd->kpd->id.product = 0x0001;
    tpd->kpd->id.version = 0x0100;
    if(input_register_device(tpd->kpd))
        TPD_DMESG("input_register_device failed.(kpd)\n");
    set_bit(EV_KEY, tpd->dev->evbit);
    for(i=0;i<tpd_keycnt;i++)
        __set_bit(tpd_keys[i], tpd->dev->keybit);
    properties_kobj = kobject_create_and_add("board_properties", NULL);
    if(properties_kobj)
        ret = sysfs_create_group(properties_kobj,&mtk_properties_attr_group);
    if(!properties_kobj || ret)
    printk("failed to create board_properties\n");
}
예제 #18
0
int tpd_driver_remove(struct tpd_driver_t *tpd_drv)
{
	int i = 0;
	/* check parameter */
	if(tpd_drv == NULL)
	{
		return -1;
	}
//gionee wld porting from mt6573 20120328 begin
#if defined (GN_MTK_BSP)
    if(i = tpd_delete_attr(&tpd_driver.driver))
    {
        TPD_DMESG("TPD_delete_attr fail: %d\n", i);
    }
#endif
//gionee wld porting from mt6573 20120328 end
	for(i = 0; i < TP_DRV_MAX_COUNT; i++)
	{
		/* find it */
		if (strcmp(tpd_driver_list[i].tpd_device_name, tpd_drv->tpd_device_name) == 0)
		{
			memset(&tpd_driver_list[i], 0, sizeof(struct tpd_driver_t));
			break;
		}
	}
	return 0;
}
static void tpd_fw_init()
{
#ifdef CTP_DETECT_SUPPLIER_THROUGH_GPIO
	int tpd_choice[2] = {0};

#ifdef GPIO_CTP_COMPAT_PIN1
	mt_set_gpio_mode(GPIO_CTP_COMPAT_PIN1, GPIO_MODE_00);
	mt_set_gpio_dir(GPIO_CTP_COMPAT_PIN1, GPIO_DIR_IN);
	tpd_choice[0] = mt_get_gpio_in(GPIO_CTP_COMPAT_PIN1);
#endif

#ifdef GPIO_CTP_COMPAT_PIN2
	mt_set_gpio_mode(GPIO_CTP_COMPAT_PIN2, GPIO_MODE_00);
	mt_set_gpio_dir(GPIO_CTP_COMPAT_PIN2, GPIO_DIR_IN);
	tpd_choice[1] = mt_get_gpio_in(GPIO_CTP_COMPAT_PIN2);
#endif
    TPD_DMESG("[TPD] tpd_choice[0] = 0x%x,tpd_choice[1] = 0x%x\n", tpd_choice[0], tpd_choice[1]);

	if(tpd_choice[0] || tpd_choice[1])
	{
		tpd_compat.tpd_pt = TPD_FW0;
		tpd_compat.size = sizeof(TPD_FW0);
		tpd_supplier = TPD_SUPPLIER_0;
	}
	else
	{
		tpd_compat.tpd_pt = TPD_FW1;
		tpd_compat.size = sizeof(TPD_FW1);
		tpd_supplier = TPD_SUPPLIER_1;
	}
#else //CTP_DETECT_SUPPLIER_THROUGH_GPIO
	tpd_compat.tpd_pt = TPD_FW;
	tpd_compat.size = sizeof(TPD_FW);
#endif //CTP_DETECT_SUPPLIER_THROUGH_GPIO
}
static void msg_dma_release(){
	if(g_dma_buff_va){
     	dma_free_coherent(NULL, 4096, g_dma_buff_va, g_dma_buff_pa);
        g_dma_buff_va = NULL;
        g_dma_buff_pa = NULL;
		TPD_DMESG("[DMA][release] Allocate DMA I2C Buffer release!\n");
    }
}
예제 #21
0
 /* called when loaded into kernel */
 static int __init tpd_driver_init(void) 
 {
	printk("MediaTek FT6x06 touch panel driver init\n");
	i2c_register_board_info(TPD_I2C_GROUP_ID, &ft6x06_i2c_tpd, sizeof(ft6x06_i2c_tpd)/sizeof(ft6x06_i2c_tpd[0]));
	if(tpd_driver_add(&tpd_device_driver) < 0)
		TPD_DMESG("add FT6x06 driver failed\n");
	return 0;
 }
예제 #22
0
/* should never be called */
static void __exit tpd_device_exit(void) {
    TPD_DMESG("MediaTek touch panel driver exit\n");
    //input_unregister_device(tpd->dev);
    platform_driver_unregister(&tpd_driver);
    #ifdef CONFIG_HAS_EARLYSUSPEND
    unregister_early_suspend(&MTK_TS_early_suspend_handler);
    #endif
}
예제 #23
0
/* called when loaded into kernel */
static int __init tpd_device_init(void) {
    printk("MediaTek touch panel driver init\n");
    if(platform_driver_register(&tpd_driver)!=0) {
        TPD_DMESG("unable to register touch panel driver.\n");
        return -1;
    }   
    return 0;
}
예제 #24
0
int tpd_local_init(void) {
    boot_mode = get_boot_mode();
    // Software reset mode will be treated as normal boot
    if(boot_mode==3) boot_mode = NORMAL_BOOT;
    if(i2c_add_driver(&tpd_i2c_driver)!=0)
        TPD_DMESG("unable to add i2c driver.\n");
    return 0;
}
예제 #25
0
static int tpd_cmd_exec(struct tpd_classdev_t *cdev, int cmd)
{
	int retval = 0;
	cdev->cmd = cmd;
	DSX_FW("%s@%d cmd:%d\n", __func__, __LINE__,cmd);
	switch(cmd) {
	case CMD_WRITE_FW:
	case CMD_READ_FW:
	case CMD_WRITE_REG:
	case CMD_READ_REG:
	case CMD_CHECK_CHANNEL:
		cdev->status = STATUS_NULL;
		cdev->b_cmd_done = 0;
		break;
	case CMD_TP_CALIB:
		if(cdev->tpd_calib) {
			cdev->status = cdev->tpd_calib(cdev);
		} else {
			cdev->status = STATUS_OK;
		}
		break;
	case CMD_FW_UPG:
		tpd_flash_image(cdev, cmd, 0);
		break;
	case CMD_CLEAN_BUF:
		tpd_free_buffer(cdev);
		break;
	case CMD_SDCARD_UPG:
		g_upgrade_status=1;
		cdev->status = STATUS_BUF_NULL;
		g_force_upgrade = 1;
		tpd_store_file_info(cdev);
		if(0 == cdev->b_fwloader) {
			cdev->b_fwloader = 1;
			tpd_sdcard_image_flash(cdev);
		}
		g_upgrade_status=0;
		break;
	case CMD_FORCE_UPG:
		cdev->status = STATUS_BUF_NULL;
		g_force_upgrade = 1;
		tpd_read_file_info(cdev);
		if(0 == cdev->b_fwloader) {
			cdev->b_fwloader = 1;
			tpd_sdcard_image_flash(cdev);
		}
		g_upgrade_status=0;
		break;
	case CMD_CHECK_FW: 
		tsp_fw_compare_info(cdev);
		break;
	default:
		TPD_DMESG("%s Not support this cmd:0x%x\n", __func__, cmd);
		break;
	}

	return retval;
}
예제 #26
0
static ssize_t show_update_pro(struct device_driver *ddri, char *buf)
{
    TPD_DMESG(" show_update_fw_pro\n");
    char ver[20];
    int time_reg = 0,i;
    for(i = 1; i < TP_DRV_MAX_COUNT; i++)
    {
        /* add tpd driver into list */
        if(tpd_driver_list[i].tpd_device_name != NULL && tpd_driver_list[i].update_show != NULL)
        {
            tpd_driver_list[i].update_show(ver);
            TPD_DMESG(" store_update_fw_pro***-%d\n",i);
            break;
        }
    }       

    return snprintf(buf, VAR_CHAR_NUM_MAX, "%s\n", ver);        
}
예제 #27
0
static ssize_t tsp_fw_reg_store(struct device *dev,
		struct device_attribute *attr, const char *buf, size_t size)
{
	struct tpd_classdev_t *cdev = dev_get_drvdata(dev);
	TPD_DMESG("%s write %d byte.\n", __func__, size);

	mutex_lock(&tpd_sys_cmd_mutex);
	cdev->tp_fw.size = 0;
	tpd_load_buffer(cdev, (unsigned char *)&buf[0], 0, size);
	
	if(cdev->write_block) {
		cdev->write_block(cdev, 0x02, &cdev->tp_fw.data[0], 1);
	}
	TPD_DMESG("%s write val:%d.\n", __func__, cdev->tp_fw.data[0]);
	mutex_unlock(&tpd_sys_cmd_mutex);

	return size;
}
s32 init_update_proc(struct i2c_client *client)
{
    u8 flag = 0;
    struct task_struct *thread = NULL;
    s32 retry = 0;

    DEBUG_UPDATE("Ready to run update thread.\n");

    update_msg.fw_flag = get_ic_fw_msg(client);
    if (fail == update_msg.fw_flag)
    {
        DEBUG_UPDATE("Try get ic msg in update mode.\n");
        for (retry = 0; retry < 5; retry++)
        {
            if (success == guitar_update_mode(client))
            {
                break;
            }
        }
        if (retry >= 5)
        {
            update_msg.fw_flag = fail;
        }
        else
        {
            DEBUG_UPDATE("Get ic msg in update mode.\n");
            update_msg.fw_flag = get_ic_fw_msg(client);
            update_msg.ic_fw_msg.version = 0xfff0;
            if (update_msg.force_update == 0xAA)
            {
                flag = 0xff;
            }
        }
        guitar_leave_update_mode();
    }
    else
    {
        guitar_reset(10);
    }

    if (success == update_msg.fw_flag)
    {
        update_msg.gt_loc = -1;
        thread = kthread_run(guitar_update_proc, (void*)client, "guitar_update");
        if (IS_ERR(thread))
        {
            TPD_DMESG("Failed to create update thread\n");
        }
        if (0xff == flag)
        {
            return 0xff;
        }
    }

    return success;
}
예제 #29
0
static void tpd_resume(struct early_suspend *h)
{
    char data;
    
#ifdef TPD_PROXIMITY	
	if (tpd_proximity_flag == 1)
	{
		if(tpd_proximity_flag_one == 1)
		{
			tpd_proximity_flag_one = 0;	
			TPD_DMESG(TPD_DEVICE " tpd_proximity_flag_one \n"); 
			return;
		}
	}
#endif	
    
	if ( g_pts ){
		CTP_DBG("TPD wake up\n");
		if (atomic_read(&g_pts->isp_opened)){
			CTP_DBG("isp is already opened.");
			return;
		}

#ifdef CONFIG_TOUCHSCREEN_POWER_DOWN_WHEN_SLEEP
		fts_6x06_hw_init();
#else //!CONFIG_TOUCHSCREEN_POWER_DOWN_WHEN_SLEEP
        //BEGIN <JIRA ID (KeyCode)> <DATE> <BUG INFO> zhangxiaofei
		//mt_set_gpio_mode(GPIO_CTP_WAKE_PIN, GPIO_CTP_WAKE_PIN_M_GPIO);
		//mt_set_gpio_dir(GPIO_CTP_WAKE_PIN, GPIO_DIR_OUT);
		//mt_set_gpio_out(GPIO_CTP_WAKE_PIN, GPIO_OUT_ZERO);
		//msleep(1);  
		//mt_set_gpio_mode(GPIO_CTP_WAKE_PIN, GPIO_CTP_WAKE_PIN_M_GPIO);
		//mt_set_gpio_dir(GPIO_CTP_WAKE_PIN, GPIO_DIR_OUT);
		//mt_set_gpio_out(GPIO_CTP_WAKE_PIN, GPIO_OUT_ONE);
		//END <JIRA ID (KeyCode)> <DATE> <BUG INFO> zhangxiaofei

//BEGIN <tp> <DATE20130507> <tp resume> zhangxiaofei
    // reset ctp
    mt_set_gpio_mode(GPIO_CTP_RST_PIN, GPIO_CTP_RST_PIN_M_GPIO);
    mt_set_gpio_dir(GPIO_CTP_RST_PIN, GPIO_DIR_OUT);
    mt_set_gpio_out(GPIO_CTP_RST_PIN, GPIO_OUT_ZERO);  
    msleep(10);  
    mt_set_gpio_mode(GPIO_CTP_RST_PIN, GPIO_CTP_RST_PIN_M_GPIO);
    mt_set_gpio_dir(GPIO_CTP_RST_PIN, GPIO_DIR_OUT);
    mt_set_gpio_out(GPIO_CTP_RST_PIN, GPIO_OUT_ONE);
	msleep(200);//add this line 
	CTP_DBG("TPD wake up done\n");
//END <tp> <DATE20130507> <tp resume> zhangxiaofei		
		
#endif//CONFIG_TOUCHSCREEN_POWER_DOWN_WHEN_SLEEP
	mutex_unlock(&g_pts->mutex);//Lock on suspend 	
		mt_eint_unmask(CUST_EINT_TOUCH_PANEL_NUM);  
		atomic_set( &g_pts->ts_sleepState, 0 );
	}
 }
예제 #30
0
static int tpd_create_attr(struct device_driver *driver) 
{
    int idx, err = 0;
    int num = (int)(sizeof(tp_update_attr_list)/sizeof(tp_update_attr_list[0]));
    if (driver == NULL)
    {
        return -EINVAL;
    }
    TPD_DMESG("tpd_create_attr ----0 \n");
    for(idx = 0; idx < num; idx++)
    {
        if(err = driver_create_file(driver, tp_update_attr_list[idx]))
        {            
            TPD_DMESG("TPD  driver_create_file ");
            break;
        }
    }    
    TPD_DMESG("TPD  driver_create_file success---2\n");
    return err;
}