#define SCREEN_MAX_X 1024\r
#define SCREEN_MAX_Y 600\r
#define PRESS_MAX 255\r
-#define FT5X0X_NAME "ft5x0x_ts"//"synaptics_i2c_rmi"//"synaptics-rmi-ts"// \r
+#define FT5X0X_NAME "ft5x0x_ts"\r
#define TOUCH_MAJOR_MAX 200\r
#define WIDTH_MAJOR_MAX 200\r
//FT5X0X_REG_PMODE\r
#define PMODE_STANDBY 0x02\r
#define PMODE_HIBERNATE 0x03\r
\r
+/* zhengxing@rock-chips: avoid to firmwarm upgrade directly cause barrage when startup. */\r
+#define FT5X0X_FW_UPGRADE_ASYNC (1)\r
+#define FT5X0X_FW_UPGRADE_DIRECTLY (2)\r
+\r
+#ifdef CONFIG_MACH_RK3066B_M701\r
+#define FT5X0X_FW_UPGRADE_MODE FT5X0X_FW_UPGRADE_ASYNC\r
+#else\r
+#define FT5X0X_FW_UPGRADE_MODE FT5X0X_FW_UPGRADE_DIRECTLY\r
+#endif\r
\r
struct ts_event {\r
u16 x1;\r
#ifdef CONFIG_HAS_EARLYSUSPEND\r
struct early_suspend ft5306_early_suspend;\r
#endif\r
+#if (FT5X0X_FW_UPGRADE_MODE == FT5X0X_FW_UPGRADE_ASYNC)\r
+ struct work_struct fw_upgrade_work;\r
+ struct workqueue_struct *fw_workqueue;\r
+#endif\r
};\r
static struct i2c_client *this_client;\r
\r
return ret;\r
}\r
\r
+#if (FT5X0X_FW_UPGRADE_MODE == FT5X0X_FW_UPGRADE_ASYNC)\r
+static void ft5306_firmware_upgrade_work(struct work_struct *work)\r
+{\r
+ struct ft5x0x_ts_data *data = container_of(work, struct ft5x0x_ts_data, fw_upgrade_work);\r
+ int err = 0;\r
+ unsigned char reg_value;\r
+ unsigned char reg_version;\r
+\r
+ printk("<-- %s --> enter\n", __FUNCTION__);\r
+\r
+ fts_register_read(FT5X0X_REG_FIRMID, ®_version,1);\r
+ printk("cdy == [TSP] firmware version = 0x%2x\n", reg_version);\r
+\r
+ fts_register_read(FT5X0X_REG_FIRMID, ®_version,1);\r
+ FTprintk("[TSP] firmware version = 0x%2x\n", reg_version);\r
+ if (fts_ctpm_get_upg_ver() != reg_version) \r
+ {\r
+ FTprintk("[TSP] start upgrade new verison 0x%2x\n", fts_ctpm_get_upg_ver());\r
+ msleep(200);\r
+ err = fts_ctpm_fw_upgrade_with_i_file();\r
+ if (err == 0)\r
+ {\r
+ FTprintk("[TSP] ugrade successfuly.\n");\r
+ msleep(300);\r
+ fts_register_read(FT5X0X_REG_FIRMID, ®_value,1);\r
+ FTprintk("FTS_DBG from old version 0x%2x to new version = 0x%2x\n", reg_version, reg_value);\r
+ }\r
+ else\r
+ {\r
+ FTprintk("[TSP] ugrade fail err=%d, line = %d.\n",err, __LINE__);\r
+ }\r
+ msleep(4000);\r
+ }\r
+ cancel_work_sync(&data->fw_upgrade_work);\r
+ destroy_workqueue(data->fw_workqueue);\r
+}\r
+#endif\r
+\r
static void ft5306_queue_work(struct work_struct *work)\r
{\r
struct ft5x0x_ts_data *data = container_of(work, struct ft5x0x_ts_data, pen_event_work);\r
\r
/***wait CTP to bootup normally***/\r
msleep(200); \r
- \r
- fts_register_read(FT5X0X_REG_FIRMID, ®_version,1);\r
- printk("cdy == [TSP] firmware version = 0x%2x\n", reg_version);\r
- \r
-#if 1 //write firmware \r
+\r
+//write firmware \r
+#if (FT5X0X_FW_UPGRADE_MODE == FT5X0X_FW_UPGRADE_ASYNC)\r
+/* zhengxing: will upgrade firmware async */\r
+ printk("will create ft tp firmware upgrade workqueue...\n");\r
+ ft5x0x_ts->fw_workqueue = create_singlethread_workqueue("ft5x0x_fw");\r
+ if (!ft5x0x_ts->fw_workqueue) {\r
+ err = -ESRCH;\r
+ goto exit_create_singlethread;\r
+ }\r
+ INIT_WORK(&ft5x0x_ts->fw_upgrade_work, ft5306_firmware_upgrade_work); \r
+#else\r
+/* zhengxing: will upgrade firmware directly */\r
+ fts_register_read(FT5X0X_REG_FIRMID, ®_version,1);\r
+ printk("cdy == [TSP] firmware version = 0x%2x\n", reg_version);\r
+\r
fts_register_read(FT5X0X_REG_FIRMID, ®_version,1);\r
FTprintk("[TSP] firmware version = 0x%2x\n", reg_version);\r
if (fts_ctpm_get_upg_ver() != reg_version) \r
buf_r[0] = 0;\r
err = ft5306_read_regs(client,0x88,buf_r,1);\r
FTprintk("read buf[0x88] = %d\n", buf_r[0]);\r
+\r
+#if (FT5X0X_FW_UPGRADE_MODE == FT5X0X_FW_UPGRADE_ASYNC) \r
+ queue_work(ft5x0x_ts->fw_workqueue, &ft5x0x_ts->fw_upgrade_work);\r
+#endif\r
+\r
return 0;\r
\r
i2c_set_clientdata(client, NULL);\r