static ssize_t touchkey_firmup_show(struct device *dev, struct device_attribute *attr, char *buf) { printk(TCHKEY_KERN_DEBUG "Touchkey firm-up start!\n"); if(version_info[2]==MCS5000_CHIP) mcsdl_download_binary_data(MCS5000_CHIP); else if(version_info[2]==MCS5080_CHIP) mcsdl_download_binary_data(MCS5080_CHIP); else printk(KERN_ERR "Touchkey IC module is old, can't update!"); get_touchkey_data(version_info, 3); printk(TCHKEY_KERN_DEBUG "Updated F/W version: 0x%x, Module version:0x%x\n", version_info[1], version_info[2]); return sprintf(buf,"%02x\n",version_info[1]); }
static ssize_t touchkey_firmup_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size) { if(Flip_status){ printk(KERN_ERR "[TKEY] flip opened\n"); melfas_touchkey_switch_early_resume(Flip_status,1); }else{ disable_irq(touchkey_driver->client->irq); } printk(TCHKEY_KERN_DEBUG "Touchkey firm-up start!\n"); get_touchkey_data(version_info, 3); printk(TCHKEY_KERN_DEBUG "F/W version: 0x%x, Module version:0x%x\n", version_info[1], version_info[2]); if ((version_info[1] < MCS5080_last_ver) || (version_info[1] == 0xff)){ mdelay(350); mcsdl_download_binary_data(MCS5080_CHIP); mdelay(100); get_touchkey_data(version_info, 3); printk(TCHKEY_KERN_DEBUG "Updated F/W version: 0x%x, Module version:0x%x\n", version_info[1], version_info[2]); } else printk(KERN_ERR "Touchkey IC module is new, can't update!"); if(Flip_status){ printk(KERN_ERR "[TKEY] flip opened\n"); melfas_touchkey_switch_early_suspend(Flip_status,1); }else{ enable_irq(touchkey_driver->client->irq); } return size; }
static int __init touchkey_init(void) { int ret = 0; int retry=10; char FW_VER, MODULE_VER; unsigned int bNeedToUpdateFirmware = 0; //touchkey_keycode[2] = KEY_ENTER; printk("melfas touchkey_init\n"); ret = misc_register(&touchkey_update_device); if (ret) { printk("%s misc_register fail\n",__FUNCTION__); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touch_version) < 0) { printk("%s device_create_file fail dev_attr_touch_version\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touch_version.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_brightness) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_brightness.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_enable_disable) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_enable_disable.attr.name); } init_hw(); #if 0 if (request_irq(IRQ_TOUCH_INT, touchkey_interrupt, 0, DEVICE_NAME, NULL)) { printk(KERN_ERR "%s Can't allocate irq ..\n", __FUNCTION__); return -EBUSY; } #endif while(retry--) { if(mcsdl_download_binary_data()) { break; } printk("%s F/W download fail\n",__FUNCTION__); } ret = i2c_add_driver(&touchkey_i2c_driver); if(ret) { printk("melfas touch keypad registration failed, module not inserted.ret= %d\n",ret); } return ret; }
static int __init touchkey_init(void) { int ret = 0; int retry=10; #if 0 touchkey_keycode[2] = KEY_ENTER; #endif printk("melfas touchkey_init\n"); ret = misc_register(&touchkey_update_device); if (ret) { printk("%s misc_register fail\n",__FUNCTION__); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touch_version) < 0) { printk("%s device_create_file fail dev_attr_touch_version\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touch_version.attr.name); } //touch_update sys fs removed #if 0 if (device_create_file(touchkey_update_device.this_device, &dev_attr_touch_update) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touch_update.attr.name); } #endif if (device_create_file(touchkey_update_device.this_device, &dev_attr_brightness) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_brightness.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_enable_disable) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_enable_disable.attr.name); } init_hw(); while(retry--) { if(mcsdl_download_binary_data()) { break; } printk("%s F/W download fail\n",__FUNCTION__); } ret = i2c_add_driver(&touchkey_i2c_driver); if(ret) { printk("melfas touch keypad registration failed, module not inserted.ret= %d\n",ret); } return ret; }
void touchkey_update_func(struct work_struct * p) { int retry=10; touchkey_update_status = 1; printk("%s start\n",__FUNCTION__); while(retry--) { if(mcsdl_download_binary_data() == 1) { touchkey_update_status = 0; printk("touchkey_update successed\n"); enable_irq(IRQ_TOUCH_INT); return; } } touchkey_update_status = -1; printk("touchkey_update failed\n"); return ; }
static int __init touchkey_init(void) { int ret = 0; int retry=10; char data[3] = { 0, }; #if !(defined( CONFIG_S5PC110_T959_BOARD) || defined(CONFIG_S5PC110_KEPLER_BOARD)) #if defined(CONFIG_S5PC110_HAWK_BOARD) || defined(CONFIG_S5PC110_VIBRANTPLUS_BOARD) #else touchkey_keycode[2] = KEY_ENTER; #endif #endif #if !(defined(CONFIG_ARIES_NTT) || defined(CONFIG_S5PC110_CELOX_BOARD)) if (ret = gpio_request(_3_GPIO_TOUCH_CE, "_3_GPIO_TOUCH_CE")) printk(KERN_ERR "Failed to request gpio %s:%d\n", __func__, __LINE__); #endif if (ret = gpio_request(_3_GPIO_TOUCH_EN, "_3_GPIO_TOUCH_EN")) printk(KERN_ERR "Failed to request gpio %s:%d\n", __func__, __LINE__); if (ret = gpio_request(_3_TOUCH_SDA_28V, "_3_TOUCH_SDA_28V")) printk(KERN_ERR "Failed to request gpio %s:%d\n", __func__, __LINE__); if (ret = gpio_request(_3_TOUCH_SCL_28V, "_3_TOUCH_SCL_28V")) printk(KERN_ERR "Failed to request gpio %s:%d\n", __func__, __LINE__); ret = misc_register(&touchkey_update_device); if (ret) { printk("%s misc_register fail\n",__FUNCTION__); } if (device_create_file (touchkey_update_device.this_device, &dev_attr_touch_version) < 0) { printk("%s device_create_file fail dev_attr_touch_version\n", __FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touch_version.attr.name); } if (device_create_file (touchkey_update_device.this_device, &dev_attr_touch_update) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n", __FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touch_update.attr.name); } if (device_create_file (touchkey_update_device.this_device, &dev_attr_brightness) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n", __FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_brightness.attr.name); } if (device_create_file (touchkey_update_device.this_device, &dev_attr_enable_disable) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n", __FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_enable_disable.attr.name); } //NAGSM_Android_SEL_Kernel_Aakash_20100320 if (device_create_file(touchkey_update_device.this_device, &dev_attr_melfasevtcntrl) < 0) { printk("%s device_create_file fail dev_attr_melfasevtcntrl\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_melfasevtcntrl.attr.name); } //NAGSM_Android_SEL_Kernel_Aakash_20100320 touchkey_wq = create_singlethread_workqueue("melfas_touchkey_wq"); if (!touchkey_wq) return -ENOMEM; INIT_WORK(&touchkey_work, touchkey_work_func); init_hw(); while (retry--) { if(get_touchkey_firmware(data) == 0) //melfas need delay for multiple read break; } printk("%s F/W version: 0x%x, Module version:0x%x\n", __FUNCTION__, data[1], data[2]); touch_version = data[1]; retry=3; #ifndef CONFIG_S5PC110_CELOX_BOARD #ifdef CONFIG_S5PC110_KEPLER_BOARD if((data[1] == 0xFF) || (data[2] == 0xFF) || ((HWREV == 0x08 || HWREV == 0x04 || HWREV == 0x0C || HWREV == 0x02 || HWREV == 0x0A) && !((data[1] == 0x14) && (data[2] == 0x00))) || ((HWREV == 0x06 || HWREV == 0x0E || HWREV == 0x01) && !((data[1] >= 0x16) && (data[2] >= 0x00)))) { while(retry--) { if(mcsdl_download_binary_data() == 1) { printk("touchkey_update successed\n"); set_touchkey_debug('C'); break; } printk("touchkey_update failed... retry...\n"); set_touchkey_debug('f'); } if (retry <= 0) { gpio_direction_output(_3_GPIO_TOUCH_EN, 0); #if !defined(CONFIG_ARIES_NTT) gpio_direction_output(_3_GPIO_TOUCH_CE, 0); #endif msleep(300); } init_hw(); //after update, re initalize. } #endif #endif ret = i2c_add_driver(&touchkey_i2c_driver); if (ret) { printk ("melfas touch keypad registration failed, module not inserted.ret= %d\n", ret); } return ret; }
static int __init touchkey_init(void) { int ret = 0; int retry = 10; char data[3]={0,}; #if defined(CONFIG_MACH_S5PC110_LATONA) /* Latona does not use Melfas Touchkey, but used Cypress TSP + Touchkey */ return 0; #endif ret = misc_register(&touchkey_update_device); if (ret) { printk("%s misc_register fail\n", __FUNCTION__); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touch_version) < 0) { printk("%s device_create_file fail dev_attr_touch_version\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touch_version.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touch_update) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touch_update.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_brightness) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_brightness.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_enable_disable) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_enable_disable.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_show_sensitivity) < 0) { //printk("%s device_create_file fail dev_attr_show_sensitivity\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_show_sensitivity.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touchkey_version) < 0) { //printk("%s device_create_file fail dev_attr_touchkey_version\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touchkey_version.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touchkey_recommend) < 0) { //printk("%s device_create_file fail dev_attr_touchkey_recommend\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touchkey_recommend.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touchkey_menu) < 0) { //printk("%s device_create_file fail dev_attr_touchkey_menu\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touchkey_menu.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touchkey_back) < 0) { //printk("%s device_create_file fail dev_attr_touchkey_back\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touchkey_back.attr.name); } #if defined (CONFIG_MACH_S5PC110_PRESTIGE) if (device_create_file(touchkey_update_device.this_device, &dev_attr_touchkey_home) < 0) { //printk("%s device_create_file fail dev_attr_touchkey_home\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touchkey_home.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touchkey_search) < 0) { //printk("%s device_create_file fail dev_attr_touchkey_search\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touchkey_search.attr.name); } #endif init_hw(); while(retry--) { if(get_touchkey_firmware(data) == 0) //melfas need delay for multiple read break; } printk(KERN_DEBUG "%s F/W version: 0x%x, Module version:0x%x\n",__FUNCTION__, data[1], data[2]); touch_version = data[1]; retry = 3; printk(KERN_DEBUG "HWREV is 0x%x\n",HWREV); if ((1 <= data[1]) && (data[1] <= 20)) { s5pc110_upper_board_touchkey = 1; } printk("Upper Board Touchkey is 0x%x\n", s5pc110_upper_board_touchkey); #if 0 if((data[1]==0x0) || (data[1]==0xff)) { // do nothing } else if (data[1] < 0x08) { set_touchkey_debug('U'); while (retry--) { if (mcsdl_download_binary_data() == 1) { printk("touchkey_update successed\n"); set_touchkey_debug('C'); break; } printk("touchkey_update failed... retry...\n"); set_touchkey_debug('f'); } if(retry <= 0) { gpio_direction_output(_3_GPIO_TOUCH_EN, 0); gpio_direction_output(_3_GPIO_TOUCH_CE, 0); msleep(300); } init_hw(); //after update, re initalize. } #endif ret = i2c_add_driver(&touchkey_i2c_driver); if (ret) { printk ("melfas touch keypad registration failed, module not inserted.ret= %d\n", ret); } return ret; }
int firm_update( void ) { int ret = 0; int cnt = 0; struct vreg *vreg_touch; printk(KERN_INFO "[TSP] %s, %d\n", __func__, __LINE__); printk("[TSP] disable_irq : %d\n", __LINE__ ); firmware_ret_val = -1; vreg_touch = vreg_get(NULL, "ldo6"); if (ts_global->use_irq) { printk("[TSP] disable_irq : %d\n", __LINE__ ); disable_irq(ts_global->client->irq); } ret = vreg_disable(vreg_touch); if (ret) { printk(KERN_ERR "%s: vreg enable failed (%d)\n", __func__, ret); ret=-EIO; } printk("[F/W D/L] Entry gpio_tlmm_config\n"); gpio_configure( TSP_SCL, GPIOF_DRIVE_OUTPUT ); gpio_configure( TSP_SDA, GPIOF_DRIVE_OUTPUT ); gpio_configure( TSP_INT, GPIOF_INPUT ); gpio_set_value( TSP_SCL , 0 ); gpio_set_value( TSP_SDA , 0 ); gpio_set_value( TSP_INT , 0 ); gpio_set_value( VTOUCH_EN , 0 ); //I2C Pullup for (cnt=0; cnt <5 ; cnt++){ mdelay(200); printk("[F/W D/L] Entry mcsdl_download_binary_data, try=%d\n", cnt ); ret = mcsdl_download_binary_data( HW_ver ); mdelay(200); if(ret > 0) { ret = read_ver(); if ( ret> 0) { firmware_ret_val = 1; printk("[TSP] Firmware update success! HW rev 0x%02x., SW rev 0x%02x.]\n", HW_ver, SW_ver); break; } } else { printk("[TSP] Firmware update failed.. RESET!, try=%d\n", cnt); mcsdl_vdd_off(); mdelay(500); mcsdl_vdd_on(); mdelay(200); if ( cnt >= 4 ) { printk("[TSP] Firmware update failed.. RESET!, try=%d\n", cnt); printk("[TSP] check i2c lines.\n"); firmware_ret_val = 0; break; } } } gpio_set_value( TSP_SCL , 1 ); gpio_set_value( TSP_SDA , 1 ); gpio_set_value( TSP_INT , 1 ); gpio_set_value( VTOUCH_EN , 1 ); //I2C Pullup msleep(10); if (ts_global->use_irq) { enable_irq(ts_global->client->irq); } return 0; }
static int __init touchkey_init(void) { int ret = 0; int retry = 10; char data[3]; touchkey_keycode[2] = KEY_ENTER; ret = misc_register(&touchkey_update_device); if (ret) { printk("%s misc_register fail\n", __FUNCTION__); } if (device_create_file (touchkey_update_device.this_device, &dev_attr_touch_version) < 0) { printk("%s device_create_file fail dev_attr_touch_version\n", __FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touch_version.attr.name); } if (device_create_file (touchkey_update_device.this_device, &dev_attr_touch_update) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n", __FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touch_update.attr.name); } if (device_create_file (touchkey_update_device.this_device, &dev_attr_brightness) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n", __FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_brightness.attr.name); } if (device_create_file (touchkey_update_device.this_device, &dev_attr_enable_disable) < 0) { printk("%s device_create_file fail dev_attr_touch_update\n", __FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_enable_disable.attr.name); } init_hw(); while (retry--) { get_touchkey_firmware(data); printk("%s F/W version: 0x%x, Module version:0x%x\n", __FUNCTION__, data[1], data[2]); if ((data[1] != 0xff) && (data[2] != 0xff)) break; } retry = 3; if (((data[1] < 0x9) || (data[1] == 0xff))) { set_touchkey_debug('U'); while (retry--) { if (mcsdl_download_binary_data() == 1) { printk("touchkey_update successed\n"); set_touchkey_debug('C'); break; } printk("touchkey_update failed... retry...\n"); set_touchkey_debug('f'); } } ret = i2c_add_driver(&touchkey_i2c_driver); if (ret) { printk ("melfas touch keypad registration failed, module not inserted.ret= %d\n", ret); } return ret; }
static int melfas_ts_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct melfas_ts_data *ts; struct melfas_tsi_platform_data *data; #ifdef SEC_TSP struct device *sec_touchscreen; struct device *qt602240_noise_test; char lcd_id, *temp; #endif int ret = 0, i; uint8_t buf[4] = {0,}; #if DEBUG_PRINT printk(KERN_ERR "%s start.\n", __func__); #endif if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { printk(KERN_ERR "%s: need I2C_FUNC_I2C\n", __func__); ret = -ENODEV; goto err_check_functionality_failed; } ts = kmalloc(sizeof(struct melfas_ts_data), GFP_KERNEL); if (ts == NULL) { printk(KERN_ERR "%s: failed to create a state of melfas-ts\n", __func__); ret = -ENOMEM; goto err_alloc_data_failed; } ts_data = ts; data = client->dev.platform_data; ts->power = data->power; ts->gpio = data->gpio; ts->client = client; i2c_set_clientdata(client, ts); ts->power(true); ret = i2c_master_send(ts->client, &buf, 1); #if DEBUG_PRINT printk(KERN_ERR "%s: i2c_master_send() [%d], Add[%d]\n", __func__, ret, ts->client->addr); #endif #if SET_DOWNLOAD_BY_GPIO buf[0] = TS_READ_VERSION_ADDR; ret = i2c_master_send(ts->client, &buf, 1); if(ret < 0) { printk(KERN_ERR "%s: i2c_master_send [%d]\n", __func__, ret); } ret = i2c_master_recv(ts->client, &buf, 4); if(ret < 0) { printk(KERN_ERR "%s: i2c_master_recv [%d]\n", __func__, ret); } printk(KERN_ERR "FW_VERSION: 0x%02x\n", buf[3]); temp = get_s6e8aa0_id_buffer(); lcd_id = *(temp+1); printk(KERN_ERR "LCD_ID : 0x%02x 0x%02x\n", *temp, lcd_id); if(lcd_id != 0x23 && lcd_id != 0x80 && buf[3] < FW_VERSION) { printk(KERN_ERR "FW Upgrading... FW_VERSION: 0x%02x\n", buf[3]); ret = mcsdl_download_binary_data(data); if(ret == 0) { printk(KERN_ERR "SET Download Fail - error code [%d]\n", ret); } } #endif // SET_DOWNLOAD_BY_GPIO ts->input_dev = input_allocate_device(); if (!ts->input_dev) { printk(KERN_ERR "%s: Not enough memory\n", __func__); ret = -ENOMEM; goto err_input_dev_alloc_failed; } ts->input_dev->name = "sec_touchscreen" ; ts->input_dev->evbit[0] = BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY); ts->input_dev->keybit[BIT_WORD(KEY_MENU)] |= BIT_MASK(KEY_MENU); ts->input_dev->keybit[BIT_WORD(KEY_HOME)] |= BIT_MASK(KEY_HOME); ts->input_dev->keybit[BIT_WORD(KEY_BACK)] |= BIT_MASK(KEY_BACK); ts->input_dev->keybit[BIT_WORD(KEY_SEARCH)] |= BIT_MASK(KEY_SEARCH); // __set_bit(BTN_TOUCH, ts->input_dev->keybit); // __set_bit(EV_ABS, ts->input_dev->evbit); // ts->input_dev->evbit[0] = BIT_MASK(EV_SYN) | BIT_MASK(EV_ABS) | BIT_MASK(EV_KEY); input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 0, TS_MAX_X_COORD, 0, 0); input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, 0, TS_MAX_Y_COORD, 0, 0); input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, TS_MAX_Z_TOUCH, 0, 0); input_set_abs_params(ts->input_dev, ABS_MT_TRACKING_ID, 0, MELFAS_MAX_TOUCH-1, 0, 0); input_set_abs_params(ts->input_dev, ABS_MT_WIDTH_MAJOR, 0, TS_MAX_W_TOUCH, 0, 0); // __set_bit(EV_SYN, ts->input_dev->evbit); // __set_bit(EV_KEY, ts->input_dev->evbit); ret = input_register_device(ts->input_dev); if (ret) { printk(KERN_ERR "%s: Failed to register device\n", __func__); ret = -ENOMEM; goto err_input_register_device_failed; } if (ts->client->irq) { #if DEBUG_PRINT printk(KERN_ERR "%s: trying to request irq: %s-%d\n", __func__, ts->client->name, ts->client->irq); #endif ret = request_threaded_irq(client->irq, NULL, melfas_ts_irq_handler, IRQF_ONESHOT | IRQF_TRIGGER_LOW, ts->client->name, ts); if (ret > 0) { printk(KERN_ERR "%s: Can't allocate irq %d, ret %d\n", __func__, ts->client->irq, ret); ret = -EBUSY; goto err_request_irq; } } for (i = 0; i < MELFAS_MAX_TOUCH ; i++) /* _SUPPORT_MULTITOUCH_ */ g_Mtouch_info[i].strength = -1; tsp_enabled = true; #if DEBUG_PRINT printk(KERN_ERR "%s: succeed to register input device\n", __func__); #endif #ifdef SEC_TSP sec_touchscreen = device_create(sec_class, NULL, 0, ts, "sec_touchscreen"); if (IS_ERR(sec_touchscreen)) pr_err("[TSP] Failed to create device for the sysfs\n"); ret = sysfs_create_group(&sec_touchscreen->kobj, &sec_touch_attr_group); if (ret) pr_err("[TSP] Failed to create sysfs group\n"); #endif #ifdef TSP_FACTORY_TEST qt602240_noise_test = device_create(sec_class, NULL, 0, ts, "qt602240_noise_test"); if (IS_ERR(qt602240_noise_test)) pr_err("[TSP] Failed to create device for the sysfs\n"); ret = sysfs_create_group(&qt602240_noise_test->kobj, &sec_touch_factory_attr_group); if (ret) pr_err("[TSP] Failed to create sysfs group\n"); #endif #if CONFIG_HAS_EARLYSUSPEND ts->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 1; ts->early_suspend.suspend = melfas_ts_early_suspend; ts->early_suspend.resume = melfas_ts_late_resume; register_early_suspend(&ts->early_suspend); #endif #ifdef SET_TSP_CONFIG melfas_set_config(ts->client, MIP_ACTIVE_REPORT_RATE, 60); // melfas_set_config(ts->client, MIP_CONTACT_ON_EVENT_THRES, 60); // melfas_set_config(ts->client, MIP_MOVING_EVENT_THRES, 20); // melfas_set_config(ts->client, MIP_POSITION_FILTER_LEVEL, 10); #endif #if DEBUG_PRINT printk(KERN_INFO "%s: Start touchscreen. name: %s, irq: %d\n", __func__, ts->client->name, ts->client->irq); #endif return 0; err_request_irq: printk(KERN_ERR "melfas-ts: err_request_irq failed\n"); free_irq(client->irq, ts); err_input_register_device_failed: printk(KERN_ERR "melfas-ts: err_input_register_device failed\n"); input_free_device(ts->input_dev); err_input_dev_alloc_failed: printk(KERN_ERR "melfas-ts: err_input_dev_alloc failed\n"); err_alloc_data_failed: printk(KERN_ERR "melfas-ts: err_alloc_data failed_\n"); err_detect_failed: printk(KERN_ERR "melfas-ts: err_detect failed\n"); kfree(ts); err_check_functionality_failed: printk(KERN_ERR "melfas-ts: err_check_functionality failed_\n"); return ret; }
static int __init touchkey_init(void) { int ret = 0; u8 updated = 0; if ((ret = gpio_request(_3_GPIO_TOUCH_EN, "_3_GPIO_TOUCH_EN"))) printk(KERN_ERR "Failed to request gpio %s:%d\n", __func__, __LINE__); // if (ret = gpio_request(_3_GPIO_TOUCH_INT, "_3_GPIO_TOUCH_INT")) // printk(KERN_ERR "Failed to request gpio %s:%d\n", __func__, __LINE__); ret = misc_register(&touchkey_update_device); if (ret) { printk(KERN_ERR "%s misc_register fail\n",__FUNCTION__); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touchkey_activation) < 0) { printk(KERN_ERR "%s device_create_file fail dev_attr_touchkey_activation\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touchkey_activation.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touchkey_version) < 0) { printk(KERN_ERR "%s device_create_file fail dev_attr_touchkey_version\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touchkey_version.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touchkey_recommend) < 0) { printk(KERN_ERR "%s device_create_file fail dev_attr_touchkey_recommend\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touchkey_recommend.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touchkey_firmup) < 0) { printk(KERN_ERR "%s device_create_file fail dev_attr_touchkey_firmup\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touchkey_firmup.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touchkey_init) < 0) { printk(KERN_ERR "%s device_create_file fail dev_attr_touchkey_init\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touchkey_init.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touchkey_menu) < 0) { printk(KERN_ERR "%s device_create_file fail dev_attr_touchkey_menu\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touchkey_menu.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_touchkey_back) < 0) { printk(KERN_ERR "%s device_create_file fail dev_attr_touchkey_back\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_touchkey_back.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_brightness) < 0) { printk(KERN_ERR "%s device_create_file fail dev_attr_brightness\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_brightness.attr.name); } if (device_create_file(touchkey_update_device.this_device, &dev_attr_enable_disable) < 0) { printk(KERN_ERR "%s device_create_file fail dev_attr_touch_update\n",__FUNCTION__); pr_err("Failed to create device file(%s)!\n", dev_attr_enable_disable.attr.name); } init_hw(); get_touchkey_data(version_info, 3); printk(TCHKEY_KERN_DEBUG "%s F/W version: 0x%x, Module version:0x%x\n",__FUNCTION__, version_info[1], version_info[2]); //------------------- Auto Firmware Update Routine Start -------------------// if(HWREV>=8) { if(version_info[1]==0xff) //unknown firmware state { if(!mcsdl_download_binary_data(MCS5000_CHIP)) //try MCS-5000 download mcsdl_download_binary_data(MCS5080_CHIP); // if first try is fail, MCS-5080 download updated = 1; } else { if(version_info[2]>=MCS5000_CHIP) //MCS-5000 { if(version_info[1]!=MCS5000_last_ver) //not latest version { mcsdl_download_binary_data(MCS5000_CHIP); updated = 1; } } else if(version_info[2]==MCS5080_CHIP)//MCS-5080 { if(version_info[1]!=MCS5080_last_ver) //not latest version { mcsdl_download_binary_data(MCS5080_CHIP); updated = 1; } } else printk("Touchkey IC module is old, can't update!"); } if(updated) { get_touchkey_data(version_info, 3); printk(TCHKEY_KERN_DEBUG "Updated F/W version: 0x%x, Module version:0x%x\n", version_info[1], version_info[2]); } } //------------------- Auto Firmware Update Routine End -------------------// ret = i2c_add_driver(&touchkey_i2c_driver); if(ret||(touchkey_driver==NULL)) { touchkey_dead = 1; printk("ret = %d, touch_driver= %p:", ret, touchkey_driver); printk(KERN_ERR "melfas touch keypad registration failed, module not inserted.ret= %d\n", ret); } return ret; }
void mcs6000_firmware_info(unsigned char* fw_ver, unsigned char* hw_ver) { #ifdef LGE_MELFAS_UPDATE_ENABLE extern const unsigned char TS_FW_VER; extern const unsigned char TS_HW_REV; #endif unsigned char data; struct mcs6000_ts_device *dev = NULL; int try_cnt = 0; dev = &mcs6000_ts_dev; msleep(200); data = i2c_smbus_read_byte_data(dev->client, MCS6000_TS_FW_VERSION); printk(KERN_INFO "MCS6000 F/W Version [0x%x]\n", data); *fw_ver = dev->input_dev->id.version = data; data = i2c_smbus_read_byte_data(dev->client, MCS6000_TS_HW_REVISION); printk(KERN_INFO "MCS6000 H/W Revision [0x%x]\n", data); *hw_ver = dev->input_dev->id.product= data ; #ifdef LGE_MELFAS_UPDATE_ENABLE if(dev->input_dev->id.version == 0xfa && dev->input_dev->id.product == 0xfa) { display_update_msg(3); msleep(5000); // invalid firmware re-download start~ //return; } if(dev->input_dev->id.version >= TS_FW_VER && dev->input_dev->id.product == TS_HW_REV) { *fw_ver = dev->input_dev->id.version; *hw_ver = dev->input_dev->id.product; return; } msleep(2000); display_update_msg(0); msleep(2000); if(mcsdl_download_binary_data()) { display_update_msg(1); msleep(2000); lge_melfas_vdd(0); msleep(3000); lge_melfas_vdd(1); msleep(1000); } else { display_update_msg(2); msleep(5000); } do { data = i2c_smbus_read_byte_data(dev->client, MCS6000_TS_FW_VERSION); msleep(10); try_cnt ++; } while (data > TS_FW_VER && try_cnt < 10); printk(KERN_INFO "MCS6000 F/W Version [0x%x]\n", data); dev->input_dev->id.version = data; *fw_ver = data; try_cnt = 0; do { data = i2c_smbus_read_byte_data(dev->client, MCS6000_TS_HW_REVISION); msleep(10); try_cnt ++; } while (data > TS_HW_REV && try_cnt < 10); printk(KERN_INFO "MCS6000 H/W Revision [0x%x]\n", data); dev->input_dev->id.product= data ; *hw_ver = data; #endif }