本文整理汇总了C++中GTP_DEBUG_FUNC函数的典型用法代码示例。如果您正苦于以下问题:C++ GTP_DEBUG_FUNC函数的具体用法?C++ GTP_DEBUG_FUNC怎么用?C++ GTP_DEBUG_FUNC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTP_DEBUG_FUNC函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: gtp_i2c_write
/*******************************************************
Function:
Write data to the i2c slave device.
Input:
client: i2c device.
buf[0~1]: write start address.
buf[2~len-1]: data buffer
len: GTP_ADDR_LENGTH + write bytes count
Output:
numbers of i2c_msgs to transfer:
1: succeed, otherwise: failed
*********************************************************/
s32 gtp_i2c_write(struct i2c_client *client,u8 *buf,s32 len)
{
struct i2c_msg msg;
s32 ret = -1;
s32 retries = 0;
GTP_DEBUG_FUNC();
msg.flags = !I2C_M_RD;
msg.addr = client->addr;
msg.len = len;
msg.buf = buf;
msg.scl_rate = 300 * 1000; // for Rockchip
while(retries < 5)
{
ret = i2c_transfer(client->adapter, &msg, 1);
if (ret == 1)break;
retries++;
}
if((retries >= 5))
{
#if GTP_SLIDE_WAKEUP
if (DOZE_ENABLED == doze_status)
{
return ret;
}
#endif
GTP_DEBUG("I2C communication timeout, resetting chip...");
gtp_reset_guitar(client, 10);
}
return ret;
}
开发者ID:saydulk,项目名称:rk3188-kernel,代码行数:45,代码来源:gt9xx.c
示例2: gtp_irq_enable
void gtp_irq_enable(struct goodix_ts_data *ts)
{
unsigned long irqflags;
GTP_DEBUG_FUNC();
spin_lock_irqsave(&ts->irq_lock, irqflags);
if (ts->irq_is_disable) {
enable_irq(ts->client->irq);
ts->irq_is_disable = 0;
}
spin_unlock_irqrestore(&ts->irq_lock, irqflags);
}
开发者ID:GalaxyTab4,项目名称:maxicm_kernel_samsung_degaswifi,代码行数:13,代码来源:gt9xx_touch.c
示例3: gt1x_gesture_data_write
static ssize_t gt1x_gesture_data_write(struct file *filp, const char __user * buff, size_t len, loff_t * off)
{
s32 ret = 0;
GTP_DEBUG_FUNC();
ret = copy_from_user(&gesture_enabled, buff, 1);
if (ret) {
GTP_ERROR("copy_from_user failed.");
return -EPERM;
}
GTP_DEBUG("gesture enabled:%x, ret:%d", gesture_enabled, ret);
return len;
}
开发者ID:AudioGod,项目名称:MediaTek-HelioX10-Kernel,代码行数:16,代码来源:gt1x_extents.c
示例4: gesture_enter_doze
int gesture_enter_doze(void)
{
int retry = 0;
GTP_DEBUG_FUNC();
GTP_DEBUG("entering doze mode...");
while (retry++ < 5) {
if (!gt1x_send_cmd(0x08, 0)) {
gesture_doze_status = DOZE_ENABLED;
GTP_DEBUG("GTP has been working in doze mode!");
return 0;
}
msleep(10);
}
GTP_ERROR("GTP send doze cmd failed.");
return -1;
}
开发者ID:AudioGod,项目名称:MediaTek-HelioX10-Kernel,代码行数:17,代码来源:gt1x_extents.c
示例5: gtp_i2c_write
/*******************************************************
Function:
write data to the i2c slave device.
Input:
client: i2c device.
buf[0]:operate address.
buf[1]~buf[len]:write data buffer.
len:operate length.
Output:
numbers of i2c_msgs to transfer.
*********************************************************/
s32 gtp_i2c_write(struct i2c_client *client,u8 *buf,s32 len)
{
struct i2c_msg msg;
s32 ret=-1;
s32 retries = 0;
GTP_DEBUG_FUNC();
msg.flags = !I2C_M_RD;
msg.addr = client->addr;
msg.len = len;
msg.buf = buf;
while(retries < 5)
{
ret = i2c_transfer(client->adapter, &msg, 1);
if (ret == 1)break;
retries++;
}
return ret;
}
开发者ID:S-trace,项目名称:Amlogic_common_meson6,代码行数:34,代码来源:gt818x.c
示例6: gtp_i2c_read
/*******************************************************
Function:
Read data from the i2c slave device.
Input:
client: i2c device.
buf[0~1]: read start address.
buf[2~len-1]: read data buffer.
len: GTP_ADDR_LENGTH + read bytes count
Output:
numbers of i2c_msgs to transfer:
2: succeed, otherwise: failed
*********************************************************/
s32 gtp_i2c_read(struct i2c_client *client, u8 *buf, s32 len)
{
struct i2c_msg msgs[2];
s32 ret=-1;
s32 retries = 0;
GTP_DEBUG_FUNC();
msgs[0].flags = !I2C_M_RD;
msgs[0].addr = client->addr;
msgs[0].len = GTP_ADDR_LENGTH;
msgs[0].buf = &buf[0];
msgs[0].scl_rate = 300 * 1000; // for Rockchip
msgs[1].flags = I2C_M_RD;
msgs[1].addr = client->addr;
msgs[1].len = len - GTP_ADDR_LENGTH;
msgs[1].buf = &buf[GTP_ADDR_LENGTH];
msgs[1].scl_rate = 300 * 1000;
while(retries < 5)
{
ret = i2c_transfer(client->adapter, msgs, 2);
if(ret == 2)break;
retries++;
}
if((retries >= 5))
{
#if GTP_SLIDE_WAKEUP
// reset chip would quit doze mode
if (DOZE_ENABLED == doze_status)
{
return ret;
}
#endif
GTP_DEBUG("I2C communication timeout, resetting chip...");
gtp_reset_guitar(client, 10);
}
return ret;
}
开发者ID:saydulk,项目名称:rk3188-kernel,代码行数:52,代码来源:gt9xx.c
示例7: goodix_tool_read
/*******************************************************
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)
{
GTP_DEBUG_FUNC();
if (cmd_head.wr % 2)
{
return FAIL;
}
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 FAIL;
}
}
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 -= DATA_LENGTH;
if (tool_i2c_read(cmd_head.data, len) <= 0)
{
GTP_ERROR("[READ]Read data failed!");
return FAIL;
}
memcpy(&page[loc], &cmd_head.data[GTP_ADDR_LENGTH], len);
loc += len;
GTP_DEBUG_ARRAY(&cmd_head.data[GTP_ADDR_LENGTH], len);
GTP_DEBUG_ARRAY(page, len);
}
}
else if (2 == cmd_head.wr)
{
// memcpy(page, "gt8", cmd_head.data_len);
// memcpy(page, "GT818", 5);
// page[5] = 0;
GTP_DEBUG("Return ic type:%s len:%d.", page, (s32)cmd_head.data_len);
return cmd_head.data_len;
//return sizeof(IC_TYPE_NAME);
}
else if (4 == cmd_head.wr)
{
page[0] = show_len >> 8;
page[1] = show_len & 0xff;
page[2] = total_len >> 8;
page[3] = total_len & 0xff;
return cmd_head.data_len;
}
开发者ID:mradermaxlol,项目名称:HWY600-kernel,代码行数:92,代码来源:goodix_tool.c
示例8: goodix_tool_write
/*******************************************************
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)
{
u64 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.");
}
GTP_DEBUG("wr :0x%02x.", cmd_head.wr);
GTP_DEBUG("flag:0x%02x.", cmd_head.flag);
GTP_DEBUG("flag addr:0x%02x%02x.", cmd_head.flag_addr[0], cmd_head.flag_addr[1]);
GTP_DEBUG("flag val:0x%02x.", cmd_head.flag_val);
GTP_DEBUG("flag rel:0x%02x.", cmd_head.flag_relation);
GTP_DEBUG("circle :%d.", (s32)cmd_head.circle);
GTP_DEBUG("times :%d.", (s32)cmd_head.times);
GTP_DEBUG("retry :%d.", (s32)cmd_head.retry);
GTP_DEBUG("delay :%d.", (s32)cmd_head.delay);
GTP_DEBUG("data len:%d.", (s32)cmd_head.data_len);
GTP_DEBUG("addr len:%d.", (s32)cmd_head.addr_len);
GTP_DEBUG("addr:0x%02x%02x.", cmd_head.addr[0], cmd_head.addr[1]);
GTP_DEBUG("len:%d.", (s32)len);
GTP_DEBUG("buf[20]:0x%02x.", buff[CMD_HEAD_LENGTH]);
if (1 == cmd_head.wr)
{
// copy_from_user(&cmd_head.data[cmd_head.addr_len], &buff[CMD_HEAD_LENGTH], cmd_head.data_len);
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.");
}
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 FAIL;
}
}
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 FAIL;
}
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);
}
return cmd_head.data_len + CMD_HEAD_LENGTH;
}
else if (3 == cmd_head.wr) //Write ic type
{
memcpy(IC_TYPE, cmd_head.data, cmd_head.data_len);
register_i2c_func();
return cmd_head.data_len + CMD_HEAD_LENGTH;
}
else if (5 == cmd_head.wr)
{
//memcpy(IC_TYPE, cmd_head.data, cmd_head.data_len);
return cmd_head.data_len + CMD_HEAD_LENGTH;
}
else if (7 == cmd_head.wr)//disable irq!
{
// gtp_irq_disable(i2c_get_clientdata(gt_client));
return CMD_HEAD_LENGTH;
}
else if (9 == cmd_head.wr) //enable irq!
//.........这里部分代码省略.........
开发者ID:mradermaxlol,项目名称:HWY600-kernel,代码行数:101,代码来源:goodix_tool.c
示例9: goodix_tool_read
/*******************************************************
Function:
Goodix tool read function.
Input:
standard proc read function param.
Output:
Return read length.
********************************************************/
static ssize_t goodix_tool_read(struct file *flie, char __user *page, size_t size, loff_t *ppos)
{
s32 ret;
GTP_DEBUG_FUNC();
if(gtp_resetting == 1)
return FAIL;
if (*ppos) {
*ppos = 0;
return 0;
}
if (cmd_head.wr % 2)
{
GTP_ERROR("[READ] invaild operator fail!");
return FAIL;
}
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 FAIL;
}
}
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 FAIL;
}
//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;
//.........这里部分代码省略.........
开发者ID:rock12,项目名称:ALPS.L1.MP6.V2.19_CENON6580_WE_1_L_KERNEL,代码行数:101,代码来源:goodix_tool.c
示例10: goodix_tool_write
/*******************************************************
Function:
Goodix tool write function.
Input:
standard proc write function param.
Output:
Return write length.
********************************************************/
static 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);
if(gtp_resetting == 1)
{
//GTP_ERROR("[Write]tpd_halt =1 fail!");
return FAIL;
}
ret = copy_from_user(&cmd_head, buff, CMD_HEAD_LENGTH);
if (ret)
{
GTP_ERROR("copy_from_user failed.");
}
GTP_DEBUG("wr :0x%02x.", cmd_head.wr);
if (1 == cmd_head.wr)
{
// copy_from_user(&cmd_head.data[cmd_head.addr_len], &buff[CMD_HEAD_LENGTH], cmd_head.data_len);
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.");
}
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 FAIL;
}
}
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 FAIL;
}
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);
}
return cmd_head.data_len + CMD_HEAD_LENGTH;
}
else if (3 == cmd_head.wr) //Write ic type
{
memcpy(IC_TYPE, cmd_head.data, cmd_head.data_len);
register_i2c_func();
return cmd_head.data_len + CMD_HEAD_LENGTH;
}
else if (5 == cmd_head.wr)
{
//memcpy(IC_TYPE, cmd_head.data, cmd_head.data_len);
return cmd_head.data_len + CMD_HEAD_LENGTH;
}
else if (7 == cmd_head.wr)//disable irq!
{
mt_eint_mask(CUST_EINT_TOUCH_PANEL_NUM);
#if GTP_ESD_PROTECT
gtp_esd_switch(i2c_client_point, SWITCH_OFF);
#endif
return CMD_HEAD_LENGTH;
}
else if (9 == cmd_head.wr) //enable irq!
{
mt_eint_unmask(CUST_EINT_TOUCH_PANEL_NUM);
#if GTP_ESD_PROTECT
gtp_esd_switch(i2c_client_point, SWITCH_ON);
#endif
//.........这里部分代码省略.........
开发者ID:rock12,项目名称:ALPS.L1.MP6.V2.19_CENON6580_WE_1_L_KERNEL,代码行数:101,代码来源:goodix_tool.c
示例11: goodix_tool_write
/*******************************************************
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)
{
u64 ret = 0;
GTP_DEBUG_FUNC();
GTP_DEBUG_ARRAY((u8 *) buff, len);
if(len < CMD_HEAD_LENGTH){
GTP_ERROR("copy_from_user out of range, failed.");
return -1;
}
ret = copy_from_user(&cmd_head, buff, CMD_HEAD_LENGTH);
if (ret) {
GTP_ERROR("copy_from_user failed.");
}
GTP_DEBUG("wr :0x%02x.", cmd_head.wr);
GTP_DEBUG("flag:0x%02x.", cmd_head.flag);
GTP_DEBUG("flag addr:0x%02x%02x.", cmd_head.flag_addr[0], cmd_head.flag_addr[1]);
GTP_DEBUG("flag val:0x%02x.", cmd_head.flag_val);
GTP_DEBUG("flag rel:0x%02x.", cmd_head.flag_relation);
GTP_DEBUG("circle :%d.", (s32) cmd_head.circle);
GTP_DEBUG("times :%d.", (s32) cmd_head.times);
GTP_DEBUG("retry :%d.", (s32) cmd_head.retry);
GTP_DEBUG("delay :%d.", (s32) cmd_head.delay);
GTP_DEBUG("data len:%d.", (s32) cmd_head.data_len);
GTP_DEBUG("addr len:%d.", (s32) cmd_head.addr_len);
GTP_DEBUG("addr:0x%02x%02x.", cmd_head.addr[0], cmd_head.addr[1]);
GTP_DEBUG("len:%d.", (s32) len);
GTP_DEBUG("buf[20]:0x%02x.", buff[CMD_HEAD_LENGTH]);
if (1 == cmd_head.wr) {
if((cmd_head.data == NULL)
|| (cmd_head.data_len > (DATA_LENGTH - GTP_ADDR_LENGTH))
|| (cmd_head.data_len > (len - CMD_HEAD_LENGTH)) )
{
GTP_ERROR("copy_from_user data out of range.");
return -1;
}
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.");
}
if((cmd_head.addr_len > sizeof(cmd_head.addr)))
{
GTP_ERROR("copy_from_user data out of range.");
return -1;
}
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 FAIL;
}
} 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 FAIL;
}
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);
}
return cmd_head.data_len + CMD_HEAD_LENGTH;
} else if (3 == cmd_head.wr) /* Write ic type */
{
if((cmd_head.data == NULL)
|| (cmd_head.data_len > sizeof(IC_TYPE[16]))
|| (cmd_head.data_len > (len - CMD_HEAD_LENGTH)) )
{
GTP_ERROR("copy_from_user data out of range.");
return -1;
}
memcpy(IC_TYPE, cmd_head.data, cmd_head.data_len);
//.........这里部分代码省略.........
开发者ID:Swapnil133609,项目名称:Zeus_exp,代码行数:101,代码来源:goodix_tool.c
示例12: goodix_tool_write
//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)
{
//.........这里部分代码省略.........
开发者ID:sndnvaps,项目名称:G718c_kernel,代码行数:101,代码来源:goodix_tool.c
示例13: goodix_ts_work_func
static void goodix_ts_work_func(struct work_struct *work)
{
struct goodix_ts_data *ts = NULL;
static u16 pre_touch;
static u8 pre_key;
u8 end_cmd[3] = {
GTP_READ_COOR_ADDR >> 8,
GTP_READ_COOR_ADDR & 0xFF,
0
};
u8 point_data[2 + 1 + 8 * GTP_MAX_TOUCH + 1] = {
GTP_READ_COOR_ADDR >> 8,
GTP_READ_COOR_ADDR & 0xFF
};
u8 touch_num = 0;
u8 finger = 0;
u8 key_value = 0;
u8 *coor_data = NULL;
s32 input_x = 0;
s32 input_y = 0;
s32 input_w = 0;
s32 id = 0;
s32 i, ret;
GTP_DEBUG_FUNC();
ts = container_of(work, struct goodix_ts_data, work);
if (ts->enter_update)
return;
ret = gtp_i2c_read(ts->client, point_data, 12);
if (ret < 0) {
GTP_ERROR("I2C transfer error. errno:%d\n ", ret);
goto exit_work_func;
}
finger = point_data[GTP_ADDR_LENGTH];
if ((finger & 0x80) == 0)
goto exit_work_func;
touch_num = finger & 0x0f;
if (touch_num > GTP_MAX_TOUCH)
goto exit_work_func;
if (touch_num > 1) {
u8 buf[8 * GTP_MAX_TOUCH] = {
(GTP_READ_COOR_ADDR + 10) >> 8,
(GTP_READ_COOR_ADDR + 10) & 0xff
};
ret = gtp_i2c_read(ts->client, buf, 2 + 8 * (touch_num - 1));
memcpy(&point_data[12], &buf[2], 8 * (touch_num - 1));
}
#if GTP_HAVE_TOUCH_KEY
key_value = point_data[3 + 8 * touch_num];
if (key_value || pre_key) {
for (i = 0; i < GTP_MAX_KEY_NUM; i++)
input_report_key(ts->input_dev, touch_key_array[i],
key_value & (0x01 << i));
touch_num = 0;
pre_touch = 0;
}
#endif
pre_key = key_value;
GTP_DEBUG("pre_touch:%02x, finger:%02x.", pre_touch, finger);
#if GTP_ICS_SLOT_REPORT
if (pre_touch || touch_num) {
s32 pos = 0;
u16 touch_index = 0;
coor_data = &point_data[3];
if (touch_num) {
id = coor_data[pos] & 0x0F;
touch_index |= (0x01 << id);
}
GTP_DEBUG("id=%d, touch_index=0x%x, pre_touch=0x%x\n",\
id, touch_index, pre_touch);
for (i = 0; i < GTP_MAX_TOUCH; i++) {
if (touch_index & (0x01<<i)) {
input_x = coor_data[pos + 1]
| coor_data[pos + 2] << 8;
input_y = coor_data[pos + 3]
| coor_data[pos + 4] << 8;
input_w = coor_data[pos + 5]
| coor_data[pos + 6] << 8;
gtp_touch_down(ts, id, input_x, input_y,
input_w);
pre_touch |= 0x01 << i;
pos += 8;
id = coor_data[pos] & 0x0F;
touch_index |= (0x01<<id);
} else {
gtp_touch_up(ts, i);
pre_touch &= ~(0x01 << i);
}
}
//.........这里部分代码省略.........
开发者ID:GalaxyTab4,项目名称:maxicm_kernel_samsung_degaswifi,代码行数:101,代码来源:gt9xx_touch.c
示例14: goodix_tool_read
static s32 goodix_tool_read(char *page, char **start, off_t off,
int count, int *eof, void *data)
{
GTP_DEBUG_FUNC();
if (cmd_head.wr % 2)
return FAIL;
else if (!cmd_head.wr) {
u16 len = 0;
s16 data_len = 0;
u16 loc = 0;
if (1 == cmd_head.flag) {
if (FAIL == goodix_confirm()) {
GTP_ERROR("[READ]goodix_confirm fail!");
return FAIL;
}
} else if (2 == cmd_head.flag)
GTP_DEBUG("[READ]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 -= DATA_LENGTH;
if (tool_i2c_read(cmd_head.data, len) <= 0) {
GTP_ERROR("[READ]Read data failed!");
return FAIL;
}
memcpy(&page[loc], &cmd_head.data[GTP_ADDR_LENGTH],
len);
loc += len;
GTP_DEBUG_ARRAY(&cmd_head.data[GTP_ADDR_LENGTH], len);
GTP_DEBUG_ARRAY(page, len);
}
} else if (2 == cmd_head.wr) {
GTP_DEBUG("Return ic type:%s len:%d.", \
page, (s32)cmd_head.data_len);
return cmd_head.data_len;
} else if (4 == cmd_head.wr) {
page[0] = show_len >> 8;
page[1] = show_len & 0xff;
page[2] = total_len >> 8;
page[3] = total_len & 0xff;
return cmd_head.data_len;
} else if (6 == cmd_head.wr)
开发者ID:C457,项目名称:android_kernel_samsung_t110,代码行数:61,代码来源:goodix_tool.c
示例15: gt1x_tool_write
/*******************************************************
Function:
Goodix tool write function.
Input:
standard proc write function param.
Output:
Return write length.
********************************************************/
static s32 gt1x_tool_write(struct file *filp, const char __user * buff, size_t len, loff_t * data)
{
u64 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.");
}
GTP_DEBUG("wr :0x%02x.", cmd_head.wr);
/*
GTP_DEBUG("flag:0x%02x.", cmd_head.flag);
GTP_DEBUG("flag addr:0x%02x%02x.", cmd_head.flag_addr[0], cmd_head.flag_addr[1]);
GTP_DEBUG("flag val:0x%02x.", cmd_head.flag_val);
GTP_DEBUG("flag rel:0x%02x.", cmd_head.flag_relation);
GTP_DEBUG("circle :%d.", (s32)cmd_head.circle);
GTP_DEBUG("times :%d.", (s32)cmd_head.times);
GTP_DEBUG("retry :%d.", (s32)cmd_head.retry);
GTP_DEBUG("delay :%d.", (s32)cmd_head.delay);
GTP_DEBUG("data len:%d.", (s32)cmd_head.data_len);
GTP_DEBUG("addr len:%d.", (s32)cmd_head.addr_len);
GTP_DEBUG("addr:0x%02x%02x.", cmd_head.addr[0], cmd_head.addr[1]);
GTP_DEBUG("len:%d.", (s32)len);
GTP_DEBUG("buf[20]:0x%02x.", buff[CMD_HEAD_LENGTH]);
*/
if (1 == cmd_head.wr) {
u16 addr, data_len, pos;
if (1 == cmd_head.flag) {
if (comfirm()) {
GTP_ERROR("[WRITE]Comfirm fail!");
return -1;
}
} else if (2 == cmd_head.flag) {
//Need interrupt!
}
addr = (cmd_head.addr[0] << 8) + cmd_head.addr[1];
data_len = cmd_head.data_len;
pos = 0;
while (data_len > 0) {
len = data_len > DATA_LENGTH ? DATA_LENGTH : data_len;
ret = copy_from_user(&cmd_head.data[GTP_ADDR_LENGTH], &buff[CMD_HEAD_LENGTH + pos], len);
if (ret) {
GTP_ERROR("[WRITE]copy_from_user failed.");
return -1;
}
cmd_head.data[0] = ((addr >> 8) & 0xFF);
cmd_head.data[1] = (addr & 0xFF);
GTP_DEBUG_ARRAY(cmd_head.data, len + GTP_ADDR_LENGTH);
if (tool_i2c_write(cmd_head.data, len + GTP_ADDR_LENGTH) <= 0) {
GTP_ERROR("[WRITE]Write data failed!");
return -1;
}
addr += len;
pos += len;
data_len -= len;
}
if (cmd_head.delay) {
msleep(cmd_head.delay);
}
return cmd_head.data_len + CMD_HEAD_LENGTH;
} else if (3 == cmd_head.wr) { //gt1x unused
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:78,代码来源:gt1x_tools.c
示例16: goodix_tool_write
static int goodix_tool_write(struct file *filp,
const char __user *buff, unsigned long len, void *data)
{
int 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.");
GTP_DEBUG("wr :0x%02x.", cmd_head.wr);
GTP_DEBUG("flag:0x%02x.", cmd_head.flag);
GTP_DEBUG("flag addr:0x%02x%02x.",
cmd_head.flag_addr[0], cmd_head.flag_addr[1]);
GTP_DEBUG("flag val:0x%02x.", cmd_head.flag_val);
GTP_DEBUG("flag rel:0x%02x.", cmd_head.flag_relation);
GTP_DEBUG("circle :%d.", (int)cmd_head.circle);
GTP_DEBUG("times :%d.", (int)cmd_head.times);
GTP_DEBUG("retry :%d.", (int)cmd_head.retry);
GTP_DEBUG("delay :%d.", (int)cmd_head.delay);
GTP_DEBUG("data len:%d.", (int)cmd_head.data_len);
GTP_DEBUG("addr len:%d.", (int)cmd_head.addr_len);
GTP_DEBUG("addr:0x%02x%02x.", cmd_head.addr[0], cmd_head.addr[1]);
GTP_DEBUG("len:%d.", (int)len);
GTP_DEBUG("buf[20]:0x%02x.", buff[CMD_HEAD_LENGTH]);
if (1 == cmd_head.wr) {
/* copy_from_user(&cmd_head.data[cmd_head.addr_len],
&buff[CMD_HEAD_LENGTH], cmd_head.data_len);
*/
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.");
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 (comfirm() < 0) {
GTP_ERROR("[WRITE]Comfirm fail!");
return -1;
}
} 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 -1;
}
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);
return cmd_head.data_len + CMD_HEAD_LENGTH;
} 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.");
memcpy(IC_TYPE, cmd_head.data, cmd_head.data_len);
register_i2c_func();
return cmd_head.data_len + CMD_HEAD_LENGTH;
} else if (5 == cmd_head.wr) {
/* memcpy(IC_TYPE, cmd_head.data, cmd_head.data_len); */
return cmd_head.data_len + CMD_HEAD_LENGTH;
} 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
return CMD_HEAD_LENGTH;
} 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
return CMD_HEAD_LENGTH;
} 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);
//.........这里部分代码省略.........
开发者ID:Druboo666,项目名称:android_kernel_asus_moorefield,代码行数:101,代码来源:goodix_tool.c
注:本文中的GTP_DEBUG_FUNC函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论