遇到点小插曲,由于厂家那边给GT911固化错了配置(把800*480分辨率搞成了1024*600),所以找厂家要了一份正确配置,需要ctp驱动中开启自动更新配置。
另外,tina linux驱动文件夹gt9xxnew中,分析gtp_init_panel初始化函数。因为手头这个屏幕与文件的都不同,并且看到源文件注释掉了从屏幕读取id。所以可确定sensor_id恒为0,那么就很简单了,自己的配置直接写到gt9xx.h的GOURP1即可。
#if GTP_COMPATIBLE_MODE
msleep(50);
#endif
// ret = gtp_i2c_read_dbl_check(ts->client, GTP_REG_SENSOR_ID, &sensor_id, 1);
dprintk(DEBUG_INIT, "CTP name : %s\n", config_info.name);
if (!strcmp(config_info.name, "gt9271_mb976a9")) {
sensor_id = 0;
dprintk(DEBUG_INIT, "gt9xx:sensor_id = %d\n", sensor_id);
} else if (!strcmp(config_info.name, "gt9110_wt097")) {
sensor_id = 1;
dprintk(DEBUG_INIT, "gt9xx:sensor_id = %d\n", sensor_id);
} else if (!strcmp(config_info.name, "gt9271_wt097")) {
sensor_id = 2;
dprintk(DEBUG_INIT, "gt9xx:sensor_id = %d\n", sensor_id);
} else if (!strcmp(config_info.name, "gt9110_g200")) {
sensor_id = 3;
dprintk(DEBUG_INIT, "gt9xx:sensor_id = %d\n", sensor_id);
} else if (!strcmp(config_info.name, "gt9271_noah")) {
sensor_id = 4;
dprintk(DEBUG_INIT, "gt9xx:sensor_id = %d\n", sensor_id);
} else if (!strcmp(config_info.name, "gt9271_p2")) {
sensor_id = 5;
dprintk(DEBUG_INIT, "gt9xx:sensor_id = %d\n", sensor_id);
} else if (!strcmp(config_info.name, "gt911_1060")) {
sensor_id = 6;
dprintk(DEBUG_INIT, "gt9xx:sensor_id = %d\n", sensor_id);
} else if (!strcmp(config_info.name, "gt911_784")) {
sensor_id = 7;
dprintk(DEBUG_INIT, "gt9xx:sensor_id = %d\n", sensor_id);
} else {
sensor_id = 0;
dprintk(DEBUG_INIT, "gt9xx:sensor_id = %d\n", sensor_id);
}
ret = SUCCESS;
if (SUCCESS == ret) {
if (sensor_id >= 0x08) {
printk("Invalid sensor_id(0x%02X), No Config Sent!\n", sensor_id);
ts->pnl_init_error = 1;
return -1;
}
} else {
printk("Failed to get sensor_id, No config sent!\n");
ts->pnl_init_error = 1;
return -1;
}
}
ts->gtp_cfg_len = cfg_info_len[sensor_id];
GTP_INFO( "CTP_CONFIG_GROUP%d used, config length: %d\n", sensor_id + 1, ts->gtp_cfg_len);
gt9xx.h中需增加配置:
#define CTP_CFG_GROUP1 {\
0x42,0x20,0x03,0xE0,0x01,0x0A,0x3D,0x00,0x01,0x08,0x28,0x08,\
0x5A,0x46,0x03,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,\
0x1A,0x1E,0x14,0x89,0x2A,0x09,0x57,0x5C,0xB5,0x06,0x00,0x00,\
0x00,0x02,0x01,0x1D,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x46,0x82,0x94,0xC5,0x02,0x07,0x00,0x00,0x04,\
0x96,0x4A,0x00,0x85,0x54,0x00,0x77,0x5F,0x00,0x6A,0x6C,0x00,\
0x5F,0x7A,0x00,0x5F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x10,0x12,\
0x14,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,\
0x04,0x06,0x08,0x0A,0x0F,0x10,0x12,0x16,0x18,0x1C,0x1D,0x1E,\
0x1F,0x20,0x21,0x22,0x24,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,\
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
0x00,0x00,0x00,0x00,0x4B,0x01}
效果:
TODO:以后再尝试把group配置放到dts中,会不会更优雅些?
歪朵拉开源硬件: https://widora.cn
淘宝: https://widora.taobao.com/
离线