return ret;\r
}\r
\r
+static int goodix_config_ok(struct rk_ts_data *ts)\r
+{\r
+ int ret = 0;\r
+ unsigned int w,h, n;\r
+ uint8_t rd_cfg_buf[7] = {0x66,};\r
+ \r
+ ret = goodix_i2c_read_bytes(ts->client, rd_cfg_buf, 7);\r
+\r
+ w = (rd_cfg_buf[1]<<8) + rd_cfg_buf[2];\r
+ h = (rd_cfg_buf[3]<<8) + rd_cfg_buf[4];\r
+ n = rd_cfg_buf[5];\r
+\r
+#ifdef CONFIG_ARCH_RK29\r
+ if((ret < 0) || (w != TS_MAX_X) || (h != TS_MAX_Y) || (n != 10))\r
+#else\r
+ if((ret < 0) || (w != TS_MAX_X) || (h != TS_MAX_Y) || (n != 170))\r
+#endif\r
+ return -1;\r
+\r
+ ts->abs_x_max = w;\r
+ ts->abs_y_max = h;\r
+ ts->max_touch_num = n;\r
+ \r
+ printk("goodix_ts_init: X_MAX = %d,Y_MAX = %d,MAX_TOUCH_NUM = %d\n",ts->abs_x_max,ts->abs_y_max,ts->max_touch_num);\r
+\r
+ return 0;\r
+}\r
/*******************************************************\r
Description:\r
Goodix touchscreen initialize function.\r
*******************************************************/\r
static int goodix_init_panel(struct rk_ts_data *ts)\r
{\r
- int ret=-1;\r
+ int ret=-1, retry = 10;\r
uint8_t rd_cfg_buf[7] = {0x66,};\r
\r
#if (TS_MAX_X == 1024)&&(TS_MAX_Y == 768) //for malata 10.1\r
};\r
\r
#elif (TS_MAX_X == 1280)&&(TS_MAX_Y == 800) \r
+#ifdef CONFIG_ARCH_RK29\r
uint8_t config_info[] = {\r
0x65,0x02,0x05,0x00,0x03,0x20,0x0A,0x22,0x1E,0xE7,0x32,0x05,0x08,0x10,0x4C,\r
0x41,0x41,0x20,0x07,0x00,0xA0,0xA0,0x46,0x64,0x0E,0x0D,0x0C,0x0B,0x0A,0x09,\r
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00\r
};\r
+#else\r
+ uint8_t config_info[] = {\r
+ 0x65,0xA2,0x05,0x00,0x03,0x20,0xAA,0x22,0x1E,0xE7,0x32,0x05,0x08,0x10,0x4C,\r
+ 0x42,0x42,0x20,0x00,0x09,0x80,0x80,0x32,0x46,0x0E,0x0D,0x0C,0x0B,0x0A,0x09,\r
+ 0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00,0x1D,0x1C,0x1B,0x1A,0x19,0x18,\r
+ 0x17,0x16,0x15,0x14,0x13,0x12,0x11,0x10,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\r
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00\r
+ };\r
+#endif\r
#else\r
uint8_t config_info[] = {\r
0x65,0x02,0x05,0x00,0x03,0x20,0x0A,0x22,0x1E,0xE7,0x32,0x05,0x08,0x10,0x4C,\r
0x00,0x00,0x00,0x00\r
};\r
#endif\r
- ret=goodix_i2c_write_bytes(ts->client,config_info, (sizeof(config_info)/sizeof(config_info[0])));\r
- if (ret < 0) {\r
- printk("goodix write cfg info err");\r
- return ret;\r
- }\r
- ret=goodix_i2c_read_bytes(ts->client, rd_cfg_buf, 7);\r
- if(ret != 2)\r
- {\r
- dev_info(&ts->client->dev, "Read resolution & max_touch_num failed, use default value!\n");\r
- ts->max_touch_num = MAX_FINGER_NUM;\r
- //ts->int_trigger_type = INT_TRIGGER;\r
- return 0;\r
- }\r
- ts->abs_x_max = (rd_cfg_buf[1]<<8) + rd_cfg_buf[2];\r
- ts->abs_y_max = (rd_cfg_buf[3]<<8) + rd_cfg_buf[4];\r
- ts->max_touch_num = rd_cfg_buf[5];\r
- //ts->int_trigger_type = rd_cfg_buf[6]&0x03;\r
- if((!ts->abs_x_max)||(!ts->abs_y_max)||(!ts->max_touch_num))\r
- {\r
- printk(KERN_INFO "Read invalid resolution & max_touch_num, use default value!\n");\r
- ts->max_touch_num = MAX_FINGER_NUM;\r
- }\r
\r
- printk(KERN_INFO "X_MAX = %d,Y_MAX = %d,MAX_TOUCH_NUM = %d\n",ts->abs_x_max,ts->abs_y_max,ts->max_touch_num);\r
+ while(--retry && (goodix_config_ok(ts) < 0)){\r
+ ret=goodix_i2c_write_bytes(ts->client,config_info, (sizeof(config_info)/sizeof(config_info[0])));\r
+ if (ret < 0) {\r
+ printk("goodix write cfg info err");\r
+ return ret;\r
+ }\r
+ msleep(100);\r
+ }\r
+\r
+ if(retry <= 0){\r
+ printk("goodix write cfg info err\n");\r
+ return -1;\r
+ }\r
+\r
\r
rd_cfg_buf[0] = 0x6e;\r
rd_cfg_buf[1] = 0x00;\r
}\r
\r
\r
- \r
-\r
/*******************************************************\r
Description:\r
Timer interrupt service routine.\r
hrtimer_start(&ts->timer, ktime_set(0, (POLL_TIME+6)*1000000), HRTIMER_MODE_REL);\r
return HRTIMER_NORESTART;\r
}\r
-\r
/*******************************************************\r
Description:\r
External interrupt service routine.\r
\r
static int goodix_ts_init(struct rk_ts_data *ts)\r
{\r
- char retry;\r
char ret ;\r
- char test_data = 1;\r
char *version_info = NULL;\r
+#if 0\r
+ char test_data = 1;\r
+ char retry;\r
for(retry=0;retry < 30; retry++) //test goodix\r
{\r
ret =goodix_i2c_write_bytes(ts->client, &test_data, 1);\r
printk(KERN_INFO "I2C communication ERROR!Goodix touchscreen driver become invalid\n");\r
return -1;\r
} \r
- \r
+#endif \r
\r
ret=goodix_init_panel(ts);\r
if(ret != 0) {\r
printk("goodix panel init fail\n");\r
return -1;\r
}\r
- else\r
- {\r
- printk(KERN_INFO "%s>>>>>>>max_point %d\n",__func__,ts->max_touch_num);\r
- }\r
ret = goodix_read_version(ts, &version_info);\r
if(ret <= 0)\r
{\r
}\r
else\r
{\r
- printk(KERN_INFO"Goodix TouchScreen Version:%s>>>max_point:%d\n", (version_info+1),ts->max_touch_num);\r
+ printk("goodix_ts_init: version %s\n", (version_info+1));\r
}\r
vfree(version_info);\r
#ifdef CONFIG_TOUCHSCREEN_GOODIX_IAP\r
}\r
else\r
{\r
- printk("Create proc entry success!\n");\r
+ printk("goodix_ts_init: create proc entry success!\n");\r
goodix_proc_entry->write_proc = goodix_update_write;\r
goodix_proc_entry->read_proc = goodix_update_read;\r
//goodix_proc_entry->owner = THIS_MODULE;\r
goto err_input_register_device_failed;\r
}\r
}\r
- printk("Goodix TS probe successfully!\n");\r
+ printk("goodix_ts_init: probe successfully!\n");\r
return 0;\r
\r
\r