android: gt911 tp support
Signed-off-by: August <mingxin.android@gmail.com>
This commit is contained in:
parent
0a0b11e0d7
commit
5f59113f20
18 changed files with 29090 additions and 4 deletions
1
lichee/linux-4.9/drivers/input/touchscreen/Kconfig
Normal file → Executable file
1
lichee/linux-4.9/drivers/input/touchscreen/Kconfig
Normal file → Executable file
|
@ -1115,4 +1115,5 @@ config TOUCHSCREEN_GT82X
|
|||
|
||||
source "drivers/input/touchscreen/gslx680new/Kconfig"
|
||||
source "drivers/input/touchscreen/ftxxxx/Kconfig"
|
||||
source "drivers/input/touchscreen/gt9xx/Kconfig"
|
||||
endif
|
||||
|
|
2
lichee/linux-4.9/drivers/input/touchscreen/Makefile
Normal file → Executable file
2
lichee/linux-4.9/drivers/input/touchscreen/Makefile
Normal file → Executable file
|
@ -94,4 +94,4 @@ obj-$(CONFIG_TOUCHSCREEN_ROHM_BU21023) += rohm_bu21023.o
|
|||
obj-$(CONFIG_TOUCHSCREEN_GT82X) += gt82x.o
|
||||
obj-$(CONFIG_TOUCHSCREEN_GSLX680NEW) += gslx680new/
|
||||
obj-$(CONFIG_TOUCHSCREEN_FT5X16_TS) += ftxxxx/
|
||||
|
||||
obj-$(CONFIG_TOUCHSCREEN_GT9XX) += gt9xx/
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,31 @@
|
|||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD>IC<EFBFBD>ͺ<EFBFBD><EFBFBD>뱾Ŀ¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ, <20>뽫<EFBFBD><EBBDAB>Ӧ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>µ<EFBFBD>gt9xx_firmware.h<>滻<EFBFBD><E6BBBB><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>е<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ļ<EFBFBD>,
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>gt9xx.h<>н<EFBFBD>GTP_COMPATIBLE_MODE<44><45>1, <20><>û<EFBFBD><C3BB>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>Ĭ<EFBFBD><C4AC>gt9xx_firmware.h.
|
||||
|
||||
<EFBFBD>̼<EFBFBD><EFBFBD>б<EFBFBD>:
|
||||
GT910_1020
|
||||
GT950_1020
|
||||
GT960F_1020
|
||||
GT968F_1020
|
||||
GT963_1010
|
||||
GT9150_1010
|
||||
|
||||
== <20><>л<EFBFBD><D0BB>ʹ<EFBFBD><CAB9>Goodix<69><78>Ʒ ==
|
||||
|
||||
If the chip type you use is the same with any sub-directory's name, please replace the default gt9xx_firmware.h with
|
||||
|
||||
gt9xx_firmware.h in the specified sub-directory. Meanwhile, you are required to enable GTP_COMPATIBLE_MODE in gt9xx.h.
|
||||
|
||||
If no such sub-directory, you may use the default gt9xx_firmware.h.
|
||||
|
||||
firmware list:
|
||||
GT910_1010
|
||||
GT912_1010
|
||||
GT950_1020
|
||||
GT960F_1020
|
||||
GT968F_1020
|
||||
GT963_1010
|
||||
GT9150_1010
|
||||
|
||||
== Thanks for your using Goodix Products ==
|
10
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/Kconfig
Executable file
10
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/Kconfig
Executable file
|
@ -0,0 +1,10 @@
|
|||
#
|
||||
# Touchscreen driver configuration
|
||||
#
|
||||
config TOUCHSCREEN_GT9XX
|
||||
tristate "gt9xxnew touchscreen driver"
|
||||
depends on INPUT && I2C
|
||||
default m
|
||||
help
|
||||
gt9xx touchscreen driver
|
||||
|
11
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/Makefile
Executable file
11
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/Makefile
Executable file
|
@ -0,0 +1,11 @@
|
|||
#
|
||||
# Makefile for the touchscreen drivers.
|
||||
#
|
||||
|
||||
# Each configuration option enables a list of files.
|
||||
|
||||
EXTRA_CFLAGS +=-Wno-error=date-time
|
||||
|
||||
obj-$(CONFIG_TOUCHSCREEN_GT9XX) += gt9xxnew_ts.o
|
||||
gt9xxnew_ts-objs := goodix_tool.o gt9xx_update.o gt9xx.o
|
||||
|
627
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/goodix_tool.c
Executable file
627
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/goodix_tool.c
Executable file
|
@ -0,0 +1,627 @@
|
|||
/* drivers/input/touchscreen/goodix_tool.c
|
||||
*
|
||||
* 2010 - 2012 Goodix Technology.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be a reference
|
||||
* to you, when you are integrating the GOODiX's CTP IC into your system,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* Version:2.2
|
||||
* V1.0:2012/05/01,create file.
|
||||
* V1.2:2012/06/08,modify some warning.
|
||||
* V1.4:2012/08/28,modified to support GT9XX
|
||||
* V1.6:new proc name
|
||||
* V2.2: compatible with Linux 3.10, 2014/01/14
|
||||
*/
|
||||
|
||||
#include "gt9xx.h"
|
||||
|
||||
#define DATA_LENGTH_UINT 512
|
||||
#define CMD_HEAD_LENGTH (sizeof(st_cmd_head) - sizeof(u8*))
|
||||
static char procname[20] = {0};
|
||||
|
||||
#define UPDATE_FUNCTIONS
|
||||
|
||||
#ifdef UPDATE_FUNCTIONS
|
||||
extern s32 gup_enter_update_mode(struct i2c_client *client);
|
||||
extern void gup_leave_update_mode(void);
|
||||
extern s32 gup_update_proc(void *dir);
|
||||
#endif
|
||||
|
||||
extern void gtp_irq_disable(struct goodix_ts_data *);
|
||||
extern void gtp_irq_enable(struct goodix_ts_data *);
|
||||
|
||||
#pragma pack(1)
|
||||
typedef struct{
|
||||
u8 wr; //write read flag<61><67>0:R 1:W 2:PID 3:
|
||||
u8 flag; //0:no need flag/int 1: need flag 2:need int
|
||||
u8 flag_addr[2]; //flag address
|
||||
u8 flag_val; //flag val
|
||||
u8 flag_relation; //flag_val:flag 0:not equal 1:equal 2:> 3:<
|
||||
u16 circle; //polling cycle
|
||||
u8 times; //plling times
|
||||
u8 retry; //I2C retry times
|
||||
u16 delay; //delay befor read or after write
|
||||
u16 data_len; //data length
|
||||
u8 addr_len; //address length
|
||||
u8 addr[2]; //address
|
||||
u8 res[3]; //reserved
|
||||
u8* data; //data pointer
|
||||
}st_cmd_head;
|
||||
#pragma pack()
|
||||
st_cmd_head cmd_head;
|
||||
|
||||
static struct i2c_client *gt_client = NULL;
|
||||
|
||||
static struct proc_dir_entry *goodix_proc_entry;
|
||||
|
||||
static ssize_t goodix_tool_read(struct file *, char __user *, size_t, loff_t *);
|
||||
static ssize_t goodix_tool_write(struct file *, const char __user *, size_t, loff_t *);
|
||||
static const struct file_operations tool_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.read = goodix_tool_read,
|
||||
.write = goodix_tool_write,
|
||||
};
|
||||
|
||||
//static s32 goodix_tool_write(struct file *filp, const char __user *buff, unsigned long len, void *data);
|
||||
//static s32 goodix_tool_read( char *page, char **start, off_t off, int count, int *eof, void *data );
|
||||
static s32 (*tool_i2c_read)(u8 *, u16);
|
||||
static s32 (*tool_i2c_write)(u8 *, u16);
|
||||
|
||||
#if GTP_ESD_PROTECT
|
||||
extern void gtp_esd_switch(struct i2c_client *, s32);
|
||||
#endif
|
||||
s32 DATA_LENGTH = 0;
|
||||
s8 IC_TYPE[16] = "GT9XX";
|
||||
|
||||
static void tool_set_proc_name(char * procname)
|
||||
{
|
||||
char *months[12] = {"Jan", "Feb", "Mar", "Apr", "May",
|
||||
"Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
|
||||
char date[20] = {0};
|
||||
char month[4] = {0};
|
||||
int i = 0, n_month = 1, n_day = 0, n_year = 0;
|
||||
|
||||
sprintf(date, "%s", __DATE__);
|
||||
|
||||
//GTP_DEBUG("compile date: %s", date);
|
||||
|
||||
sscanf(date, "%3s %02d %04d", month, &n_day, &n_year);
|
||||
|
||||
for (i = 0; i < 12; ++i)
|
||||
{
|
||||
if (!memcmp(months[i], month, 3))
|
||||
{
|
||||
n_month = i+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sprintf(procname, "gmnode%04d%02d%02d", n_year, n_month, n_day);
|
||||
//sprintf(procname, "goodix_tool");
|
||||
//GTP_DEBUG("procname = %s", procname);
|
||||
}
|
||||
|
||||
|
||||
static s32 tool_i2c_read_no_extra(u8* buf, u16 len)
|
||||
{
|
||||
s32 ret = -1;
|
||||
s32 i = 0;
|
||||
struct i2c_msg msgs[2];
|
||||
|
||||
msgs[0].flags = !I2C_M_RD;
|
||||
msgs[0].addr = gt_client->addr;
|
||||
msgs[0].len = cmd_head.addr_len;
|
||||
msgs[0].buf = &buf[0];
|
||||
|
||||
msgs[1].flags = I2C_M_RD;
|
||||
msgs[1].addr = gt_client->addr;
|
||||
msgs[1].len = len;
|
||||
msgs[1].buf = &buf[GTP_ADDR_LENGTH];
|
||||
|
||||
for (i = 0; i < cmd_head.retry; i++)
|
||||
{
|
||||
ret=i2c_transfer(gt_client->adapter, msgs, 2);
|
||||
if (ret > 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static s32 tool_i2c_write_no_extra(u8* buf, u16 len)
|
||||
{
|
||||
s32 ret = -1;
|
||||
s32 i = 0;
|
||||
struct i2c_msg msg;
|
||||
|
||||
msg.flags = !I2C_M_RD;
|
||||
msg.addr = gt_client->addr;
|
||||
msg.len = len;
|
||||
msg.buf = buf;
|
||||
|
||||
for (i = 0; i < cmd_head.retry; i++)
|
||||
{
|
||||
ret=i2c_transfer(gt_client->adapter, &msg, 1);
|
||||
if (ret > 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static s32 tool_i2c_read_with_extra(u8* buf, u16 len)
|
||||
{
|
||||
s32 ret = -1;
|
||||
u8 pre[2] = {0x0f, 0xff};
|
||||
u8 end[2] = {0x80, 0x00};
|
||||
|
||||
tool_i2c_write_no_extra(pre, 2);
|
||||
ret = tool_i2c_read_no_extra(buf, len);
|
||||
tool_i2c_write_no_extra(end, 2);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static s32 tool_i2c_write_with_extra(u8* buf, u16 len)
|
||||
{
|
||||
s32 ret = -1;
|
||||
u8 pre[2] = {0x0f, 0xff};
|
||||
u8 end[2] = {0x80, 0x00};
|
||||
|
||||
tool_i2c_write_no_extra(pre, 2);
|
||||
ret = tool_i2c_write_no_extra(buf, len);
|
||||
tool_i2c_write_no_extra(end, 2);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void register_i2c_func(void)
|
||||
{
|
||||
// if (!strncmp(IC_TYPE, "GT818", 5) || !strncmp(IC_TYPE, "GT816", 5)
|
||||
// || !strncmp(IC_TYPE, "GT811", 5) || !strncmp(IC_TYPE, "GT818F", 6)
|
||||
// || !strncmp(IC_TYPE, "GT827", 5) || !strncmp(IC_TYPE,"GT828", 5)
|
||||
// || !strncmp(IC_TYPE, "GT813", 5))
|
||||
if (strncmp(IC_TYPE, "GT8110", 6) && strncmp(IC_TYPE, "GT8105", 6)
|
||||
&& strncmp(IC_TYPE, "GT801", 5) && strncmp(IC_TYPE, "GT800", 5)
|
||||
&& strncmp(IC_TYPE, "GT801PLUS", 9) && strncmp(IC_TYPE, "GT811", 5)
|
||||
&& strncmp(IC_TYPE, "GTxxx", 5) && strncmp(IC_TYPE, "GT9XX", 5))
|
||||
{
|
||||
tool_i2c_read = tool_i2c_read_with_extra;
|
||||
tool_i2c_write = tool_i2c_write_with_extra;
|
||||
GTP_DEBUG("I2C function: with pre and end cmd!");
|
||||
}
|
||||
else
|
||||
{
|
||||
tool_i2c_read = tool_i2c_read_no_extra;
|
||||
tool_i2c_write = tool_i2c_write_no_extra;
|
||||
GTP_INFO("I2C function: without pre and end cmd!");
|
||||
}
|
||||
}
|
||||
|
||||
static void unregister_i2c_func(void)
|
||||
{
|
||||
tool_i2c_read = NULL;
|
||||
tool_i2c_write = NULL;
|
||||
GTP_INFO("I2C function: unregister i2c transfer function!");
|
||||
}
|
||||
|
||||
s32 init_wr_node(struct i2c_client *client)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
gt_client = client;
|
||||
memset(&cmd_head, 0, sizeof(cmd_head));
|
||||
cmd_head.data = NULL;
|
||||
|
||||
i = 5;
|
||||
while ((!cmd_head.data) && i)
|
||||
{
|
||||
cmd_head.data = kzalloc(i * DATA_LENGTH_UINT, GFP_KERNEL);
|
||||
if (NULL != cmd_head.data)
|
||||
{
|
||||
break;
|
||||
}
|
||||
i--;
|
||||
}
|
||||
if (i)
|
||||
{
|
||||
DATA_LENGTH = i * DATA_LENGTH_UINT + GTP_ADDR_LENGTH;
|
||||
GTP_INFO("Applied memory size:%d.", DATA_LENGTH);
|
||||
}
|
||||
else
|
||||
{
|
||||
GTP_ERROR("Apply for memory failed.");
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
cmd_head.addr_len = 2;
|
||||
cmd_head.retry = 5;
|
||||
|
||||
register_i2c_func();
|
||||
|
||||
tool_set_proc_name(procname);
|
||||
//goodix_proc_entry = create_proc_entry(procname, 0666, NULL);
|
||||
goodix_proc_entry = proc_create(procname, 0666, NULL, &tool_ops);
|
||||
if (goodix_proc_entry == NULL)
|
||||
{
|
||||
GTP_ERROR("Couldn't create proc entry!");
|
||||
return FAIL;
|
||||
}
|
||||
else
|
||||
{
|
||||
GTP_INFO("Create proc entry success!");
|
||||
//goodix_proc_entry->write_proc = goodix_tool_write;
|
||||
//goodix_proc_entry->read_proc = goodix_tool_read;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void uninit_wr_node(void)
|
||||
{
|
||||
kfree(cmd_head.data);
|
||||
cmd_head.data = NULL;
|
||||
unregister_i2c_func();
|
||||
remove_proc_entry(procname, NULL);
|
||||
}
|
||||
|
||||
static u8 relation(u8 src, u8 dst, u8 rlt)
|
||||
{
|
||||
u8 ret = 0;
|
||||
|
||||
switch (rlt)
|
||||
{
|
||||
case 0:
|
||||
ret = (src != dst) ? true : false;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ret = (src == dst) ? true : false;
|
||||
GTP_DEBUG("equal:src:0x%02x dst:0x%02x ret:%d.", src, dst, (s32)ret);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ret = (src > dst) ? true : false;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ret = (src < dst) ? true : false;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ret = (src & dst) ? true : false;
|
||||
break;
|
||||
|
||||
case 5:
|
||||
ret = (!(src | dst)) ? true : false;
|
||||
break;
|
||||
|
||||
default:
|
||||
ret = false;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*******************************************************
|
||||
Function:
|
||||
Comfirm function.
|
||||
Input:
|
||||
None.
|
||||
Output:
|
||||
Return write length.
|
||||
********************************************************/
|
||||
static u8 comfirm(void)
|
||||
{
|
||||
s32 i = 0;
|
||||
u8 buf[32];
|
||||
|
||||
// memcpy(&buf[GTP_ADDR_LENGTH - cmd_head.addr_len], &cmd_head.flag_addr, cmd_head.addr_len);
|
||||
// memcpy(buf, &cmd_head.flag_addr, cmd_head.addr_len);//Modified by Scott, 2012-02-17
|
||||
memcpy(buf, cmd_head.flag_addr, cmd_head.addr_len);
|
||||
|
||||
for (i = 0; i < cmd_head.times; i++)
|
||||
{
|
||||
if (tool_i2c_read(buf, 1) <= 0)
|
||||
{
|
||||
GTP_ERROR("Read flag data failed!");
|
||||
return FAIL;
|
||||
}
|
||||
if (true == relation(buf[GTP_ADDR_LENGTH], cmd_head.flag_val, cmd_head.flag_relation))
|
||||
{
|
||||
GTP_DEBUG("value at flag addr:0x%02x.", buf[GTP_ADDR_LENGTH]);
|
||||
GTP_DEBUG("flag value:0x%02x.", cmd_head.flag_val);
|
||||
break;
|
||||
}
|
||||
|
||||
msleep(cmd_head.circle);
|
||||
}
|
||||
|
||||
if (i >= cmd_head.times)
|
||||
{
|
||||
GTP_ERROR("Didn't get the flag to continue!");
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
/*******************************************************
|
||||
Function:
|
||||
Goodix tool write function.
|
||||
Input:
|
||||
standard proc write function param.
|
||||
Output:
|
||||
Return write length.
|
||||
********************************************************/
|
||||
//static s32 goodix_tool_write(struct file *filp, const char __user *buff, unsigned long len, void *data)
|
||||
ssize_t goodix_tool_write(struct file *filp, const char __user *buff, size_t len, loff_t *off)
|
||||
{
|
||||
s32 ret = 0;
|
||||
|
||||
GTP_DEBUG_FUNC();
|
||||
GTP_DEBUG_ARRAY((u8*)buff, len);
|
||||
|
||||
ret = copy_from_user(&cmd_head, buff, CMD_HEAD_LENGTH);
|
||||
if(ret)
|
||||
{
|
||||
GTP_ERROR("copy_from_user failed.");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
|
||||
GTP_DEBUG("[Operation]wr: %02X", cmd_head.wr);
|
||||
GTP_DEBUG("[Flag]flag: %02X, addr: %02X%02X, value: %02X, relation: %02X", cmd_head.flag, cmd_head.flag_addr[0],
|
||||
cmd_head.flag_addr[1], cmd_head.flag_val, cmd_head.flag_relation);
|
||||
GTP_DEBUG("[Retry]circle: %d, times: %d, retry: %d, delay: %d", (s32)cmd_head.circle, (s32)cmd_head.times,
|
||||
(s32)cmd_head.retry, (s32)cmd_head.delay);
|
||||
GTP_DEBUG("[Data]data len: %d, addr len: %d, addr: %02X%02X, buffer len: %d, data[0]: %02X", (s32)cmd_head.data_len,
|
||||
(s32)cmd_head.addr_len, cmd_head.addr[0], cmd_head.addr[1], (s32)len, buff[CMD_HEAD_LENGTH]);
|
||||
|
||||
if (1 == cmd_head.wr)
|
||||
{
|
||||
ret = copy_from_user(&cmd_head.data[GTP_ADDR_LENGTH], &buff[CMD_HEAD_LENGTH], cmd_head.data_len);
|
||||
if(ret)
|
||||
{
|
||||
GTP_ERROR("copy_from_user failed.");
|
||||
return -EPERM;
|
||||
}
|
||||
memcpy(&cmd_head.data[GTP_ADDR_LENGTH - cmd_head.addr_len], cmd_head.addr, cmd_head.addr_len);
|
||||
|
||||
GTP_DEBUG_ARRAY(cmd_head.data, cmd_head.data_len + cmd_head.addr_len);
|
||||
GTP_DEBUG_ARRAY((u8*)&buff[CMD_HEAD_LENGTH], cmd_head.data_len);
|
||||
|
||||
if (1 == cmd_head.flag)
|
||||
{
|
||||
if (FAIL == comfirm())
|
||||
{
|
||||
GTP_ERROR("[WRITE]Comfirm fail!");
|
||||
return -EPERM;
|
||||
}
|
||||
}
|
||||
else if (2 == cmd_head.flag)
|
||||
{
|
||||
//Need interrupt!
|
||||
}
|
||||
if (tool_i2c_write(&cmd_head.data[GTP_ADDR_LENGTH - cmd_head.addr_len],
|
||||
cmd_head.data_len + cmd_head.addr_len) <= 0)
|
||||
{
|
||||
GTP_ERROR("[WRITE]Write data failed!");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
GTP_DEBUG_ARRAY(&cmd_head.data[GTP_ADDR_LENGTH - cmd_head.addr_len],cmd_head.data_len + cmd_head.addr_len);
|
||||
if (cmd_head.delay)
|
||||
{
|
||||
msleep(cmd_head.delay);
|
||||
}
|
||||
}
|
||||
else if (3 == cmd_head.wr) //Write ic type
|
||||
{
|
||||
ret = copy_from_user(&cmd_head.data[0], &buff[CMD_HEAD_LENGTH], cmd_head.data_len);
|
||||
if(ret)
|
||||
{
|
||||
GTP_ERROR("copy_from_user failed.");
|
||||
return -EPERM;
|
||||
}
|
||||
memcpy(IC_TYPE, cmd_head.data, cmd_head.data_len);
|
||||
|
||||
register_i2c_func();
|
||||
}
|
||||
else if (5 == cmd_head.wr)
|
||||
{
|
||||
//memcpy(IC_TYPE, cmd_head.data, cmd_head.data_len);
|
||||
}
|
||||
else if (7 == cmd_head.wr)//disable irq!
|
||||
{
|
||||
gtp_irq_disable(i2c_get_clientdata(gt_client));
|
||||
|
||||
#if GTP_ESD_PROTECT
|
||||
gtp_esd_switch(gt_client, SWITCH_OFF);
|
||||
#endif
|
||||
}
|
||||
else if (9 == cmd_head.wr) //enable irq!
|
||||
{
|
||||
gtp_irq_enable(i2c_get_clientdata(gt_client));
|
||||
|
||||
#if GTP_ESD_PROTECT
|
||||
gtp_esd_switch(gt_client, SWITCH_ON);
|
||||
#endif
|
||||
}
|
||||
else if(17 == cmd_head.wr)
|
||||
{
|
||||
struct goodix_ts_data *ts = i2c_get_clientdata(gt_client);
|
||||
ret = copy_from_user(&cmd_head.data[GTP_ADDR_LENGTH], &buff[CMD_HEAD_LENGTH], cmd_head.data_len);
|
||||
if(ret)
|
||||
{
|
||||
GTP_DEBUG("copy_from_user failed.");
|
||||
return -EPERM;
|
||||
}
|
||||
if(cmd_head.data[GTP_ADDR_LENGTH])
|
||||
{
|
||||
GTP_INFO("gtp enter rawdiff.");
|
||||
ts->gtp_rawdiff_mode = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ts->gtp_rawdiff_mode = false;
|
||||
GTP_INFO("gtp leave rawdiff.");
|
||||
}
|
||||
}
|
||||
#ifdef UPDATE_FUNCTIONS
|
||||
else if (11 == cmd_head.wr)//Enter update mode!
|
||||
{
|
||||
if (FAIL == gup_enter_update_mode(gt_client))
|
||||
{
|
||||
return -EPERM;
|
||||
}
|
||||
}
|
||||
else if (13 == cmd_head.wr)//Leave update mode!
|
||||
{
|
||||
gup_leave_update_mode();
|
||||
}
|
||||
else if (15 == cmd_head.wr) //Update firmware!
|
||||
{
|
||||
show_len = 0;
|
||||
total_len = 0;
|
||||
memset(cmd_head.data, 0, cmd_head.data_len + 1);
|
||||
memcpy(cmd_head.data, &buff[CMD_HEAD_LENGTH], cmd_head.data_len);
|
||||
|
||||
if (FAIL == gup_update_proc((void*)cmd_head.data))
|
||||
{
|
||||
return -EPERM;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/*******************************************************
|
||||
Function:
|
||||
Goodix tool read function.
|
||||
Input:
|
||||
standard proc read function param.
|
||||
Output:
|
||||
Return read length.
|
||||
********************************************************/
|
||||
//static s32 goodix_tool_read( char *page, char **start, off_t off, int count, int *eof, void *data )
|
||||
ssize_t goodix_tool_read(struct file *file, char __user *page, size_t size, loff_t *ppos)
|
||||
{
|
||||
s32 ret = 0;
|
||||
|
||||
GTP_DEBUG_FUNC();
|
||||
|
||||
if (*ppos) // ADB call again
|
||||
{
|
||||
//GTP_DEBUG("[HEAD]wr: %d", cmd_head.wr);
|
||||
//GTP_DEBUG("[PARAM]size: %d, *ppos: %d", size, (int)*ppos);
|
||||
//GTP_DEBUG("[TOOL_READ]ADB call again, return it.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cmd_head.wr % 2)
|
||||
{
|
||||
return -EPERM;
|
||||
}
|
||||
else if (!cmd_head.wr)
|
||||
{
|
||||
u16 len = 0;
|
||||
s16 data_len = 0;
|
||||
u16 loc = 0;
|
||||
|
||||
if (1 == cmd_head.flag)
|
||||
{
|
||||
if (FAIL == comfirm())
|
||||
{
|
||||
GTP_ERROR("[READ]Comfirm fail!");
|
||||
return -EPERM;
|
||||
}
|
||||
}
|
||||
else if (2 == cmd_head.flag)
|
||||
{
|
||||
//Need interrupt!
|
||||
}
|
||||
|
||||
memcpy(cmd_head.data, cmd_head.addr, cmd_head.addr_len);
|
||||
|
||||
GTP_DEBUG("[CMD HEAD DATA] ADDR:0x%02x%02x.", cmd_head.data[0], cmd_head.data[1]);
|
||||
GTP_DEBUG("[CMD HEAD ADDR] ADDR:0x%02x%02x.", cmd_head.addr[0], cmd_head.addr[1]);
|
||||
|
||||
if (cmd_head.delay)
|
||||
{
|
||||
msleep(cmd_head.delay);
|
||||
}
|
||||
|
||||
data_len = cmd_head.data_len;
|
||||
|
||||
while(data_len > 0)
|
||||
{
|
||||
if (data_len > DATA_LENGTH)
|
||||
{
|
||||
len = DATA_LENGTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
len = data_len;
|
||||
}
|
||||
data_len -= len;
|
||||
|
||||
if (tool_i2c_read(cmd_head.data, len) <= 0)
|
||||
{
|
||||
GTP_ERROR("[READ]Read data failed!");
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
//memcpy(&page[loc], &cmd_head.data[GTP_ADDR_LENGTH], len);
|
||||
ret = simple_read_from_buffer(&page[loc], size, ppos, &cmd_head.data[GTP_ADDR_LENGTH], len);
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
loc += len;
|
||||
|
||||
GTP_DEBUG_ARRAY(&cmd_head.data[GTP_ADDR_LENGTH], len);
|
||||
GTP_DEBUG_ARRAY(page, len);
|
||||
}
|
||||
return cmd_head.data_len;
|
||||
}
|
||||
else if (2 == cmd_head.wr)
|
||||
{
|
||||
ret = simple_read_from_buffer(page, size, ppos, IC_TYPE, sizeof(IC_TYPE));
|
||||
return ret;
|
||||
}
|
||||
else if (4 == cmd_head.wr)
|
||||
{
|
||||
u8 progress_buf[4];
|
||||
progress_buf[0] = show_len >> 8;
|
||||
progress_buf[1] = show_len & 0xff;
|
||||
progress_buf[2] = total_len >> 8;
|
||||
progress_buf[3] = total_len & 0xff;
|
||||
|
||||
ret = simple_read_from_buffer(page, size, ppos, progress_buf, 4);
|
||||
return ret;
|
||||
}
|
||||
else if (6 == cmd_head.wr)
|
||||
{
|
||||
//Read error code!
|
||||
}
|
||||
else if (8 == cmd_head.wr) //Read driver version
|
||||
{
|
||||
ret = simple_read_from_buffer(page, size, ppos, GTP_DRIVER_VERSION, strlen(GTP_DRIVER_VERSION));
|
||||
return ret;
|
||||
}
|
||||
return -EPERM;
|
||||
}
|
3459
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/gt9xx.c
Executable file
3459
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/gt9xx.c
Executable file
File diff suppressed because it is too large
Load diff
454
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/gt9xx.h
Executable file
454
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/gt9xx.h
Executable file
|
@ -0,0 +1,454 @@
|
|||
/* drivers/input/touchscreen/gt9xx.h
|
||||
*
|
||||
* 2010 - 2013 Goodix Technology.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be a reference
|
||||
* to you, when you are integrating the GOODiX's CTP IC into your system,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _GOODIX_GT9XX_H_
|
||||
#define _GOODIX_GT9XX_H_
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/input.h>
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#include <linux/pm.h>
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/async.h>
|
||||
#include <linux/hrtimer.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <asm/irq.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/notifier.h>
|
||||
#include "../../init-input.h"
|
||||
|
||||
|
||||
//***************************PART1:ON/OFF define*******************************
|
||||
#define GTP_CUSTOM_CFG 0
|
||||
#define GTP_CHANGE_X2Y 0
|
||||
#define GTP_DRIVER_SEND_CFG 1
|
||||
#define GTP_HAVE_TOUCH_KEY 1
|
||||
#define GTP_ICS_SLOT_REPORT 0
|
||||
|
||||
#define GTP_AUTO_UPDATE 0 // auto update fw by .bin file as default
|
||||
#define GTP_HEADER_FW_UPDATE 0 // auto update fw by gtp_default_FW in gt9xx_firmware.h, function together with GTP_AUTO_UPDATE
|
||||
#define GTP_AUTO_UPDATE_CFG 0 // auto update config by .cfg file, function together with GTP_AUTO_UPDATE
|
||||
|
||||
#define GTP_COMPATIBLE_MODE 0 // compatible with GT9XXF
|
||||
|
||||
#define GTP_CREATE_WR_NODE 1
|
||||
#define GTP_ESD_PROTECT 0 // esd protection with a cycle of 2 seconds
|
||||
|
||||
#define GTP_WITH_PEN 0
|
||||
#define GTP_PEN_HAVE_BUTTON 0 // active pen has buttons, function together with GTP_WITH_PEN
|
||||
|
||||
//#define GTP_GESTURE_WAKEUP 0 // gesture wakeup
|
||||
|
||||
//#if (!GTP_GESTURE_WAKEUP)
|
||||
//#define GTP_POWER_CTRL_SLEEP 1
|
||||
//#endif
|
||||
|
||||
#define GTP_DEBUG_ON 0
|
||||
#define GTP_DEBUG_ARRAY_ON 0
|
||||
#define GTP_DEBUG_FUNC_ON 0
|
||||
|
||||
#if GTP_COMPATIBLE_MODE
|
||||
typedef enum
|
||||
{
|
||||
CHIP_TYPE_GT9 = 0,
|
||||
CHIP_TYPE_GT9F = 1,
|
||||
} CHIP_TYPE_T;
|
||||
#endif
|
||||
|
||||
struct goodix_ts_data {
|
||||
spinlock_t irq_lock;
|
||||
struct i2c_client *client;
|
||||
struct input_dev *input_dev;
|
||||
struct hrtimer timer;
|
||||
struct work_struct work;
|
||||
s32 irq_is_disable;
|
||||
s32 use_irq;
|
||||
u16 abs_x_max;
|
||||
u16 abs_y_max;
|
||||
u8 max_touch_num;
|
||||
u8 int_trigger_type;
|
||||
u8 green_wake_mode;
|
||||
u8 enter_update;
|
||||
u8 gtp_is_suspend;
|
||||
bool is_suspended;
|
||||
bool is_runtime_suspend;
|
||||
bool try_to_runtime_suspend;
|
||||
bool try_to_runtime_resume;
|
||||
u8 gtp_rawdiff_mode;
|
||||
u8 gtp_cfg_len;
|
||||
u8 fixed_cfg;
|
||||
u8 fw_error;
|
||||
u8 pnl_init_error;
|
||||
|
||||
#if GTP_WITH_PEN
|
||||
struct input_dev *pen_dev;
|
||||
#endif
|
||||
|
||||
#if GTP_ESD_PROTECT
|
||||
spinlock_t esd_lock;
|
||||
u8 esd_running;
|
||||
s32 clk_tick_cnt;
|
||||
#endif
|
||||
|
||||
#if GTP_COMPATIBLE_MODE
|
||||
u16 bak_ref_len;
|
||||
s32 ref_chk_fs_times;
|
||||
s32 clk_chk_fs_times;
|
||||
CHIP_TYPE_T chip_type;
|
||||
u8 rqst_processing;
|
||||
u8 is_950;
|
||||
#endif
|
||||
|
||||
struct notifier_block fb_notif;
|
||||
|
||||
};
|
||||
|
||||
extern u16 show_len;
|
||||
extern u16 total_len;
|
||||
|
||||
extern struct ctp_config_info config_info;
|
||||
extern void gtp_set_int_value(int status);
|
||||
extern void gtp_set_io_int(void);
|
||||
#define GTP_INT_PORT (config_info.irq_gpio.gpio)
|
||||
#define GTP_RST_PORT (config_info.wakeup_gpio.gpio)
|
||||
#define GTP_INT_IRQ (gpio_to_irq(GTP_INT_PORT))
|
||||
|
||||
/*******************************************************************************
|
||||
|
||||
//#define GTP_GPIO_AS_INPUT(pin) do{\
|
||||
// long unsigned int config; \
|
||||
// char pin_name[8]; \
|
||||
// sunxi_gpio_to_name(pin,pin_name); \
|
||||
// config = SUNXI_PINCFG_PACK(SUNXI_PINCFG_TYPE_FUNC,0xFFFF); \
|
||||
// pin_config_get(SUNXI_PINCTRL,pin_name,&config); \
|
||||
// if (1 != SUNXI_PINCFG_UNPACK_VALUE(config)){ \
|
||||
// config = SUNXI_PINCFG_PACK(SUNXI_PINCFG_TYPE_FUNC,1); \
|
||||
// pin_config_set(SUNXI_PINCTRL,pin_name,config); \
|
||||
// } \
|
||||
// }while(0)
|
||||
//#define GTP_GPIO_AS_INT(pin) do{\
|
||||
// long unsigned int config; \
|
||||
// char pin_name[8]; \
|
||||
// sunxi_gpio_to_name(pin,pin_name); \
|
||||
// config = SUNXI_PINCFG_PACK(SUNXI_PINCFG_TYPE_FUNC,0xFFFF); \
|
||||
// pin_config_get(SUNXI_PINCTRL,pin_name,&config); \
|
||||
if (4 != SUNXI_PINCFG_UNPACK_VALUE(config)){ \
|
||||
config = SUNXI_PINCFG_PACK(SUNXI_PINCFG_TYPE_FUNC,4); \
|
||||
pin_config_set(SUNXI_PINCTRL,pin_name,config); \
|
||||
} \
|
||||
}while(0)
|
||||
#define GTP_GPIO_GET_VALUE(pin) gpio_get_value(pin)
|
||||
#define GTP_GPIO_OUTPUT(pin,level) gpio_direction_output(pin,level)
|
||||
#define GTP_GPIO_REQUEST(pin, label) gpio_request(pin, label)
|
||||
#define GTP_GPIO_FREE(pin) gpio_free(pin)
|
||||
#define GTP_IRQ_TAB {IRQ_TYPE_EDGE_RISING, IRQ_TYPE_EDGE_FALLING, IRQ_TYPE_LEVEL_LOW, IRQ_TYPE_LEVEL_HIGH}
|
||||
|
||||
********************************************************************************/
|
||||
|
||||
//*************************** PART2:TODO define **********************************
|
||||
// STEP_1(REQUIRED): Define Configuration Information Group(s)
|
||||
// Sensor_ID Map:
|
||||
/* sensor_opt1 sensor_opt2 Sensor_ID
|
||||
GND GND 0
|
||||
VDDIO GND 1
|
||||
NC GND 2
|
||||
GND NC/300K 3
|
||||
VDDIO NC/300K 4
|
||||
NC NC/300K 5
|
||||
*/
|
||||
// TODO: define your own default or for Sensor_ID == 0 config here.
|
||||
// The predefined one is just a sample config, which is not suitable for your tp in most cases.
|
||||
// suozhi,1536*2048,gt9271,COF
|
||||
|
||||
#define CTP_CFG_GROUP1 {\
|
||||
0x46,0x80,0x07,0xB0,0x04,0x0A,0x3D,0x00,0x01,0x0A,\
|
||||
0x1E,0x0F,0x50,0x3C,0x03,0x04,0x01,0x01,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x1A,0x1C,0x1E,0x14,0x90,0x30,0xAA,\
|
||||
0x32,0x30,0x03,0x15,0x00,0x00,0x02,0x03,0x03,0x1D,\
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x00,\
|
||||
0x00,0x27,0x3B,0x94,0xC5,0x02,0x08,0x00,0x00,0x04,\
|
||||
0x8C,0x28,0x00,0x85,0x2C,0x00,0x80,0x30,0x00,0x7B,\
|
||||
0x34,0x00,0x77,0x38,0x00,0x77,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,0x19,0x18,0x17,0x16,0x15,0x14,0x11,0x10,\
|
||||
0x0F,0x0E,0x0D,0x0C,0x09,0x08,0x07,0x06,0x05,0x04,\
|
||||
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x02,0x04,0x06,0x07,0x08,0x0A,0x0C,\
|
||||
0x0D,0x0E,0x0F,0x10,0x11,0x12,0x13,0x14,0x2A,0x29,\
|
||||
0x28,0x27,0x26,0x25,0x24,0x23,0x22,0x21,0x20,0x1F,\
|
||||
0x1E,0x1C,0x1B,0x19,0x00,0x00,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x00,0x61,0x01}
|
||||
|
||||
|
||||
// TODO: define your config for Sensor_ID == 1 here, if needed
|
||||
// for yuxin gt9110,COB
|
||||
#define CTP_CFG_GROUP2 {\
|
||||
0x41,0x00,0x06,0x00,0x08,0x0A,0xC5,0x00,0x01,0x08,\
|
||||
0x28,0x05,0x50,0x32,0x03,0x05,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x95,0x35,0xFF,\
|
||||
0x1E,0x20,0x31,0x0D,0x00,0x00,0x00,0x1A,0x03,0x2D,\
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x0F,0x4B,0x94,0xC5,0x02,0x08,0x00,0x00,0x04,\
|
||||
0xD0,0x11,0x00,0x9A,0x18,0x00,0x76,0x21,0x00,0x5C,\
|
||||
0x2E,0x00,0x4A,0x40,0x00,0x4A,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,0x1D,0x1C,0x1B,0x1A,0x19,0x18,0x17,0x16,\
|
||||
0x15,0x14,0x13,0x12,0x11,0x10,0x0F,0x0E,0x0D,0x0C,\
|
||||
0x0B,0x0A,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,\
|
||||
0x01,0x00,0x14,0x13,0x12,0x11,0x10,0x0F,0x0E,0x0D,\
|
||||
0x0C,0x0B,0x0A,0x09,0x08,0x07,0x06,0x05,0x04,0x03,\
|
||||
0x02,0x01,0x00,0x15,0x16,0x17,0x18,0x19,0x1B,0x1C,\
|
||||
0x1D,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,\
|
||||
0x27,0x28,0x29,0x2A,0x2A,0x01}
|
||||
|
||||
|
||||
// TODO: define your config for Sensor_ID == 2 here, if needed
|
||||
//for yuxin gt9271,COF
|
||||
#define CTP_CFG_GROUP3 {\
|
||||
0x41,0x00,0x06,0x00,0x08,0x0A,0x05,0x00,0x01,0x0F,\
|
||||
0x28,0x0F,0x50,0x32,0x03,0x05,0x00,0x00,0xFB,0x03,\
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x90,0x30,0xAA,\
|
||||
0x1F,0x1C,0xD6,0x09,0x00,0x00,0x00,0x9A,0x33,0x25,\
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
|
||||
0x02,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,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x19,\
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x01,0x04,0x05,0x06,0x07,0x08,0x09,\
|
||||
0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x14,0x15,0x16,0x17,\
|
||||
0x18,0x19,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x14,0x13,0x12,0x11,0x10,0x0F,0x0E,0x0D,\
|
||||
0x0C,0x0A,0x08,0x07,0x06,0x04,0x02,0x00,0x19,0x1B,\
|
||||
0x1C,0x1E,0x1F,0x20,0x21,0x22,0x23,0x24,0x25,0x26,\
|
||||
0x27,0x28,0x29,0x2A,0x00,0x00,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x00,0x63,0x01}
|
||||
|
||||
// TODO: define your config for Sensor_ID == 3 here, if needed
|
||||
//for dushulang gt9110,COF
|
||||
#define CTP_CFG_GROUP4 {\
|
||||
0x41,0x56,0x05,0x00,0x03,0x0A,0x3D,0x00,0x01,0x08,\
|
||||
0x28,0x08,0x50,0x32,0x03,0x07,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x19,0x1A,0x1E,0x14,0x95,0x35,0xFF,\
|
||||
0x2A,0x2C,0x39,0x13,0x00,0x00,0x00,0x9A,0x03,0x2D,\
|
||||
0x00,0x00,0x00,0x80,0x83,0x04,0x6E,0x64,0x14,0x00,\
|
||||
0x00,0x1E,0x3C,0x94,0xC5,0x02,0x07,0x00,0x00,0x04,\
|
||||
0x96,0x20,0x00,0x89,0x25,0x00,0x7F,0x2A,0x00,0x77,\
|
||||
0x30,0x00,0x6F,0x38,0x00,0x6F,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,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,\
|
||||
0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,\
|
||||
0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,\
|
||||
0x1C,0x1D,0x2A,0x29,0x28,0x27,0x26,0x25,0x24,0x23,\
|
||||
0x22,0x21,0x20,0x1F,0x1E,0x1D,0x1C,0x1B,0x19,0x18,\
|
||||
0x17,0x16,0x15,0x14,0x13,0x12,0x11,0x10,0x0F,0x0E,\
|
||||
0x0D,0x0C,0x0B,0x0A,0x09,0x08,0x07,0x06,0x05,0x04,\
|
||||
0x03,0x02,0x01,0x00,0x24,0x01}
|
||||
|
||||
// TODO: define your config for Sensor_ID == 4 here, if needed
|
||||
/* bpi, gt9147 TP LCD5" */
|
||||
#define CTP_CFG_GROUP5 {\
|
||||
0x5B,0x23,0x03,0x0A,0x05,0x05,0x34,0xC1,0x01,0x09,\
|
||||
0x28,0x08,0x48,0x35,0x03,0x05,0x00,0x00,0xFF,0x7F,\
|
||||
0x00,0x00,0x85,0x14,0x18,0x1B,0x12,0x92,0x00,0x0A,\
|
||||
0x31,0x2F,0xB5,0x06,0x03,0x00,0x01,0xBB,0x33,0x1D,\
|
||||
0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x09,0x10,0x00,\
|
||||
0x2A,0x1E,0x50,0x94,0xC5,0x02,0x00,0x0E,0x00,0x04,\
|
||||
0xAB,0x21,0x00,0x8D,0x28,0x00,0x7A,0x31,0x00,0x6B,\
|
||||
0x3B,0x00,0x59,0x48,0x00,0x5C,0x10,0x30,0x48,0x00,\
|
||||
0xF0,0x4A,0x3A,0xFF,0xEF,0x27,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x01,0x1C,0x19,0x17,0x0F,0x01,0x00,0x01,0x0F,\
|
||||
0x0F,0x03,0x04,0x10,0x42,0x8F,0x0F,0x19,0x00,0x00,\
|
||||
0x46,0x37,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,0x16,\
|
||||
0x18,0x1A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x08,0x20,0x0A,0x1F,0x0C,0x1E,0x0E,0x1D,\
|
||||
0x22,0x05,0x24,0x04,0x28,0x00,0x29,0x02,0x2A,0x06,\
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
|
||||
0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xAF,\
|
||||
0xFF,0xFF,0xFF,0xFF,0xC8,0x01}
|
||||
|
||||
// TODO: define your config for Sensor_ID == 5 here, if needed
|
||||
/* bpi, gt911 TP LCD7" */
|
||||
#define CTP_CFG_GROUP6 {\
|
||||
0x50,0x20,0x03,0xE0,0x01,0x05,0x0D,0x00,0x01,0x08,\
|
||||
0x28,0x05,0x50,0x32,0x03,0x05,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x8C,0x28,0x0C,\
|
||||
0x3B,0x3D,0x0C,0x08,0x00,0x00,0x01,0x02,0x03,0x1D,\
|
||||
0x00,0x01,0x00,0x00,0x00,0x03,0x64,0x32,0x00,0x00,\
|
||||
0x00,0x1E,0x50,0x94,0xD5,0x02,0x07,0x00,0x00,0x04,\
|
||||
0x9B,0x21,0x00,0x72,0x28,0x00,0x57,0x31,0x00,0x42,\
|
||||
0x3B,0x00,0x35,0x48,0x00,0x35,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,0x06,0x08,0x0A,0x0C,0x0E,0x10,0x12,0x14,\
|
||||
0x16,0x18,0x1A,0x1C,0xFF,0xFF,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x02,0x04,0x06,0x08,0x0A,0x0C,0x0F,\
|
||||
0x10,0x12,0x13,0x14,0x16,0x18,0x1C,0x1D,0x1E,0x1F,\
|
||||
0x20,0x21,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
|
||||
0x00,0x00,0x00,0x00,0xB5,0x01}
|
||||
|
||||
#if GTP_CUSTOM_CFG
|
||||
#define GTP_MAX_HEIGHT 800
|
||||
#define GTP_MAX_WIDTH 480
|
||||
#define GTP_INT_TRIGGER 0 // 0: Rising 1: Falling
|
||||
#else
|
||||
#define GTP_MAX_HEIGHT 4096
|
||||
#define GTP_MAX_WIDTH 4096
|
||||
#define GTP_INT_TRIGGER 1
|
||||
#endif
|
||||
#define GTP_MAX_TOUCH 10
|
||||
|
||||
// STEP_4(optional): If keys are available and reported as keys, config your key info here
|
||||
#if GTP_HAVE_TOUCH_KEY
|
||||
#define GTP_KEY_TAB {KEY_MENU, KEY_HOME, KEY_BACK}
|
||||
#endif
|
||||
|
||||
//***************************PART3:OTHER define*********************************
|
||||
#define GTP_DRIVER_VERSION "V2.2<2014/01/14>"
|
||||
#define GTP_I2C_NAME "Goodix-TS"
|
||||
#define GT91XX_CONFIG_PROC_FILE "gt9xx_config"
|
||||
#define GTP_POLL_TIME 10
|
||||
#define GTP_ADDR_LENGTH 2
|
||||
#define GTP_CONFIG_MIN_LENGTH 186
|
||||
#define GTP_CONFIG_MAX_LENGTH 240
|
||||
#define FAIL 0
|
||||
#define SUCCESS 1
|
||||
#define SWITCH_OFF 0
|
||||
#define SWITCH_ON 1
|
||||
|
||||
//******************** For GT9XXF Start **********************//
|
||||
#define GTP_REG_BAK_REF 0x99D0
|
||||
#define GTP_REG_MAIN_CLK 0x8020
|
||||
#define GTP_REG_CHIP_TYPE 0x8000
|
||||
#define GTP_REG_HAVE_KEY 0x804E
|
||||
#define GTP_REG_MATRIX_DRVNUM 0x8069
|
||||
#define GTP_REG_MATRIX_SENNUM 0x806A
|
||||
|
||||
#define GTP_FL_FW_BURN 0x00
|
||||
#define GTP_FL_ESD_RECOVERY 0x01
|
||||
#define GTP_FL_READ_REPAIR 0x02
|
||||
|
||||
#define GTP_BAK_REF_SEND 0
|
||||
#define GTP_BAK_REF_STORE 1
|
||||
#define CFG_LOC_DRVA_NUM 29
|
||||
#define CFG_LOC_DRVB_NUM 30
|
||||
#define CFG_LOC_SENS_NUM 31
|
||||
|
||||
#define GTP_CHK_FW_MAX 40
|
||||
#define GTP_CHK_FS_MNT_MAX 300
|
||||
#define GTP_BAK_REF_PATH "/data/gtp_ref.bin"
|
||||
#define GTP_MAIN_CLK_PATH "/data/gtp_clk.bin"
|
||||
#define GTP_RQST_CONFIG 0x01
|
||||
#define GTP_RQST_BAK_REF 0x02
|
||||
#define GTP_RQST_RESET 0x03
|
||||
#define GTP_RQST_MAIN_CLOCK 0x04
|
||||
#define GTP_RQST_RESPONDED 0x00
|
||||
#define GTP_RQST_IDLE 0xFF
|
||||
|
||||
//******************** For GT9XXF End **********************//
|
||||
// Registers define
|
||||
#define GTP_READ_COOR_ADDR 0x814E
|
||||
#define GTP_REG_SLEEP 0x8040
|
||||
#define GTP_REG_SENSOR_ID 0x814A
|
||||
#define GTP_REG_CONFIG_DATA 0x8047
|
||||
#define GTP_REG_VERSION 0x8140
|
||||
|
||||
#define RESOLUTION_LOC 3
|
||||
#define TRIGGER_LOC 8
|
||||
|
||||
#define CFG_GROUP_LEN(p_cfg_grp) (sizeof(p_cfg_grp) / sizeof(p_cfg_grp[0]))
|
||||
// Log define
|
||||
/***********************Add by zhongjian for sunxi tp************************
|
||||
extern u32 debug_mask;
|
||||
|
||||
enum{
|
||||
DEBUG_INIT = 1U << 0,
|
||||
DEBUG_SUSPEND = 1U << 1,
|
||||
DEBUG_INT_INFO = 1U << 2,
|
||||
DEBUG_X_Y_INFO = 1U << 3,
|
||||
DEBUG_KEY_INFO = 1U << 4,
|
||||
DEBUG_WAKEUP_INFO = 1U << 5,
|
||||
DEBUG_OTHERS_INFO = 1U << 6,
|
||||
};
|
||||
|
||||
#define dprintk(level_mask,fmt,arg...) if(unlikely(debug_mask & level_mask)) \
|
||||
printk("***CTP***"fmt, ## arg)
|
||||
***************************************************************************/
|
||||
|
||||
#define GTP_INFO(fmt,arg...) printk("<<-GTP-INFO->> "fmt"\n",##arg)
|
||||
#define GTP_ERROR(fmt,arg...) printk("<<-GTP-ERROR->> "fmt"\n",##arg)
|
||||
#define GTP_DEBUG(fmt,arg...) do{\
|
||||
if(GTP_DEBUG_ON)\
|
||||
printk("<<-GTP-DEBUG->> [%d]"fmt"\n",__LINE__, ##arg);\
|
||||
}while(0)
|
||||
#define GTP_DEBUG_ARRAY(array, num) do{\
|
||||
s32 i;\
|
||||
u8* a = array;\
|
||||
if(GTP_DEBUG_ARRAY_ON)\
|
||||
{\
|
||||
printk("<<-GTP-DEBUG-ARRAY->>\n");\
|
||||
for (i = 0; i < (num); i++)\
|
||||
{\
|
||||
printk("%02x ", (a)[i]);\
|
||||
if ((i + 1 ) %10 == 0)\
|
||||
{\
|
||||
printk("\n");\
|
||||
}\
|
||||
}\
|
||||
printk("\n");\
|
||||
}\
|
||||
}while(0)
|
||||
#define GTP_DEBUG_FUNC() do{\
|
||||
if(GTP_DEBUG_FUNC_ON)\
|
||||
printk("<<-GTP-FUNC->> Func:%s@Line:%d\n",__func__,__LINE__);\
|
||||
}while(0)
|
||||
#define GTP_SWAP(x, y) do{\
|
||||
typeof(x) z = x;\
|
||||
x = y;\
|
||||
y = z;\
|
||||
}while (0)
|
||||
|
||||
//*****************************End of Part III********************************
|
||||
|
||||
#endif /* _GOODIX_GT9XX_H_ */
|
6845
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/gt9xx_firmware.h
Executable file
6845
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/gt9xx_firmware.h
Executable file
File diff suppressed because it is too large
Load diff
3613
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/gt9xx_update.c
Executable file
3613
lichee/linux-4.9/drivers/input/touchscreen/gt9xx/gt9xx_update.c
Executable file
File diff suppressed because it is too large
Load diff
|
@ -392,9 +392,9 @@ rtp_exchange_x_y_flag = 0
|
|||
[ctp]
|
||||
compatible = "allwinner,sun50i-ctp-para"
|
||||
ctp_used = 1
|
||||
ctp_name = "ft5x_ts"
|
||||
ctp_name = "bpi_lcd7"
|
||||
ctp_twi_id = 0
|
||||
ctp_twi_addr = 0x38
|
||||
ctp_twi_addr = 0x5d
|
||||
ctp_screen_max_x = 800
|
||||
ctp_screen_max_y = 480
|
||||
ctp_revert_x_flag = 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue