本文整理汇总了C++中GTP_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ GTP_ERROR函数的具体用法?C++ GTP_ERROR怎么用?C++ GTP_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTP_ERROR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: tpd_enable_ps
static s32 tpd_enable_ps(s32 enable)
{
u8 state;
s32 ret = -1;
if (enable)
{
state = 1;
tpd_proximity_flag = 1;
GTP_INFO("TPD proximity function to be on.");
}
else
{
state = 0;
tpd_proximity_flag = 0;
GTP_INFO("TPD proximity function to be off.");
}
ret = i2c_write_bytes(i2c_client_point, TPD_PROXIMITY_ENABLE_REG, &state, 1);
if (ret < 0)
{
GTP_ERROR("TPD %s proximity cmd failed.", state ? "enable" : "disable");
return ret;
}
GTP_INFO("TPD proximity function %s success.", state ? "enable" : "disable");
return 0;
}
开发者ID:johnnyslt,项目名称:fxos-for-v967s,代码行数:29,代码来源:gt928_driver.c
示例2: hotknot_block_rw
static s32 hotknot_block_rw(u8 rqst_hotknot_state, s32 wait_hotknot_timeout)
{
s32 ret = 0;
wait_hotknot_state |= rqst_hotknot_state;
GTP_DEBUG("Goodix tool received wait polling state:0x%x,timeout:%d, all wait state:0x%x", rqst_hotknot_state,
wait_hotknot_timeout, wait_hotknot_state);
got_hotknot_state &= (~rqst_hotknot_state);
set_current_state(TASK_INTERRUPTIBLE);
if (wait_hotknot_timeout <= 0) {
wait_event_interruptible(bp_waiter, force_wake_flag
|| rqst_hotknot_state == (got_hotknot_state & rqst_hotknot_state));
} else {
wait_event_interruptible_timeout(bp_waiter, force_wake_flag
|| rqst_hotknot_state == (got_hotknot_state & rqst_hotknot_state),
wait_hotknot_timeout);
}
wait_hotknot_state &= (~rqst_hotknot_state);
if (rqst_hotknot_state != (got_hotknot_state & rqst_hotknot_state)) {
GTP_ERROR("Wait 0x%x block polling waiter failed.", rqst_hotknot_state);
ret = -1;
}
force_wake_flag = 0;
return ret;
}
开发者ID:P-D-A,项目名称:android_kernel_lge_mt6753,代码行数:29,代码来源:gt1x_extents.c
示例3: show_tpd_vendor_version
static ssize_t show_tpd_vendor_version(struct device *dev,struct device_attribute *attr, char *buf)
{
if(true){
return 0;
}else{
#define GTP_REG_FW_VERSION 0x8144
u8 rd_buf[4] = {GTP_REG_FW_VERSION>>8, GTP_REG_FW_VERSION&0xff};
int ret;
ret = gtp_i2c_read(i2c_client_point, rd_buf, sizeof(rd_buf));
if (ret < 0)
{
GTP_ERROR("[FW] error\n");
return 0;
}
GTP_DEBUG("[FW] FM version = 0x%x\n", rd_buf[3]<<8 | rd_buf[2]&0xff);
return sprintf(buf, "%x", rd_buf[3]<<8 | rd_buf[2]&0xff);
}
}
static DEVICE_ATTR(tpd_vendor_version, S_IRUGO, show_tpd_vendor_version, NULL);
static struct device_attribute *gt9xx_attrs[] =
{
&dev_attr_tpd_refresh_rate,
&dev_attr_tpd_read_reg,
&dev_attr_tpd_device_name,
&dev_attr_tpd_vendor_name,
&dev_attr_tpd_vendor_version,
};
//=============================================================
static int tpd_i2c_detect(struct i2c_client *client, struct i2c_board_info *info)
{
strcpy(info->type, "mtk-tpd");
return 0;
}
开发者ID:mradermaxlol,项目名称:HWY600-kernel,代码行数:35,代码来源:gt9xx2_driver.c
示例4: io_iic_read
static s32 io_iic_read(u8 *data, void __user *arg)
{
s32 err = ERROR;
s32 data_length = 0;
u16 addr = 0;
err = copy_from_user(data, arg, CMD_HEAD_LENGTH);
if (err) {
GTP_DEBUG("Can't access the memory.");
return ERROR_MEM;
}
addr = data[0] << 8 | data[1];
data_length = data[2] << 8 | data[3];
err = gt1x_i2c_read(addr, &data[CMD_HEAD_LENGTH], data_length);
if (!err) {
err = copy_to_user(&((u8 __user *) arg)[CMD_HEAD_LENGTH], &data[CMD_HEAD_LENGTH], data_length);
if (err) {
GTP_ERROR("ERROR when copy to user.[addr: %04x], [read length:%d]", addr, data_length);
return ERROR_MEM;
}
err = CMD_HEAD_LENGTH + data_length;
}
GTP_DEBUG("IIC_READ.addr:0x%4x, length:%d, ret:%d", addr, data_length, err);
GTP_DEBUG_ARRAY((&data[CMD_HEAD_LENGTH]), data_length);
return err;
}
开发者ID:P-D-A,项目名称:android_kernel_lge_mt6753,代码行数:29,代码来源:gt1x_extents.c
示例5: init_wr_node
int init_wr_node(struct i2c_client *client)
{
int 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 -1;
}
cmd_head.addr_len = 2;
cmd_head.retry = 5;
register_i2c_func();
tool_set_proc_name(procname);
fops.read = NULL;
fops.write = NULL;
goodix_proc_entry =
proc_create_data(procname, 0666, NULL, &fops, NULL);
if (goodix_proc_entry == NULL) {
GTP_ERROR("Couldn't create proc entry!");
return -1;
}
/* else {
GTP_INFO("Create proc entry success!");
goodix_proc_entry->write_proc = goodix_tool_write;
goodix_proc_entry->read_proc = goodix_tool_read;
}
*/
return 0;
}
开发者ID:Druboo666,项目名称:android_kernel_asus_moorefield,代码行数:46,代码来源:goodix_tool.c
示例6: init_wr_node
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();
goodix_proc_entry = create_proc_entry(GOODIX_ENTRY_NAME, 0666, NULL);
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;
}
开发者ID:C457,项目名称:android_kernel_samsung_t110,代码行数:40,代码来源:goodix_tool.c
示例7: gt1x_init_tool_node
int gt1x_init_tool_node(void)
{
memset(&cmd_head, 0, sizeof(cmd_head));
cmd_head.wr = 1; //if the first operation is read, will return fail.
cmd_head.data = kzalloc(DATA_LENGTH_UINT, GFP_KERNEL);
if (NULL == cmd_head.data) {
GTP_ERROR("Apply for memory failed.");
return -1;
}
GTP_INFO("Applied memory size:%d.", DATA_LENGTH_UINT);
DATA_LENGTH = DATA_LENGTH_UINT - GTP_ADDR_LENGTH;
set_tool_node_name(procname);
gt1x_tool_proc_entry = proc_create(procname, 0666, NULL, >1x_tool_fops);
if (gt1x_tool_proc_entry == NULL) {
GTP_ERROR("Couldn't create proc entry!");
return -1;
} else {
GTP_INFO("Create proc entry success!");
}
return 0;
}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:23,代码来源:gt1x_tools.c
示例8: 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
示例9: 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
示例10: gtp_init_panel
/*******************************************************
Function:
GTP initialize function.
Input:
ts: i2c client private struct.
Output:
Executive outcomes.0---succeed.
*******************************************************/
s32 gtp_init_panel(struct goodix_ts_data *ts)
{
s32 ret = -1;
dprintk(DEBUG_INIT, "*****%s start!\n******\n", __func__);
dprintk(DEBUG_INIT, " cfg_index :%d\n", cfg_index);
memcpy(config, gt811_cfg_grp[cfg_index].config_info, gt811_cfg_grp[cfg_index].size);
#if GTP_CUSTOM_CFG
config[57] &= 0xf7;
if(GTP_INT_TRIGGER&0x01)
{
config[57] += 0x08;
}
config[59] = GTP_REFRESH;
config[60] = GTP_MAX_TOUCH>5 ? 5 : GTP_MAX_TOUCH;
config[61] = (u8)SCREEN_MAX_WIDTH;
config[62] = (u8)(SCREEN_MAX_WIDTH >> 8);
config[63] = (u8)SCREEN_MAX_X;
config[64] = (u8)(SCREEN_MAX_Y >> 8);
#endif
ts->abs_x_max = (config[62]<<8) + config[61];
ts->abs_y_max = (config[64]<<8) + config[63];
ts->max_touch_num = config[60];
ts->int_trigger_type = ((config[57]>>3)&0x01);
if ((!ts->abs_x_max)||(!ts->abs_y_max)||(!ts->max_touch_num))
{
GTP_ERROR("GTP resolution & max_touch_num invalid, use default value!");
ts->abs_x_max = SCREEN_MAX_X;
ts->abs_y_max = SCREEN_MAX_Y;
ts->max_touch_num = GTP_MAX_TOUCH;
}
ret = gtp_send_cfg(ts->client);
if (ret)
{
printk("Send config error.");
}
msleep(10);
return 0;
}
开发者ID:tempbottle,项目名称:InDashNet.Open.UN2000,代码行数:52,代码来源:gt811.c
示例11: show_tpd_vendor_name
static ssize_t show_tpd_vendor_name(struct device *dev,struct device_attribute *attr, char *buf)
{
u8 rd_vendor_buf[16];
s32 ret = -1;
rd_vendor_buf[0] = GTP_REG_SENSOR_ID >> 8;
rd_vendor_buf[1] = GTP_REG_SENSOR_ID & 0xff;
ret = gtp_i2c_read(i2c_client_point, rd_vendor_buf, 3);
if (ret < 0)
{
GTP_ERROR("gt9xx Read SENSOR ID failed");
rd_vendor_buf[GTP_ADDR_LENGTH] = 3;
return sprintf(buf, "%s", tpd_manufacturer_name[rd_vendor_buf[GTP_ADDR_LENGTH]]);
}
GTP_INFO("gt9xx vendor ID:%d", rd_vendor_buf[GTP_ADDR_LENGTH]);
rd_vendor_buf[GTP_ADDR_LENGTH] &= 0x03;
return sprintf(buf, "%s", tpd_manufacturer_name[rd_vendor_buf[GTP_ADDR_LENGTH]]);
}
开发者ID:Lesozav25,项目名称:mtk_6572,代码行数:20,代码来源:gt9xx_driver.c
示例12: hotknot_load_authentication_subsystem
static s32 hotknot_load_authentication_subsystem(void)
{
s32 ret = 0;
u8 buffer[5] = { 0 };
ret = gt1x_hold_ss51_dsp_no_reset();
if (ret < 0) {
GTP_ERROR("Hold ss51 fail!");
return ERROR;
}
if (gt1x_chip_type == CHIP_TYPE_GT1X) {
GTP_INFO("hotknot load jump code.");
ret = gt1x_load_patch(gt1x_patch_jump_fw, 4096, 0, 1024 * 8);
if (ret < 0) {
GTP_ERROR("Load jump code fail!");
return ret;
}
GTP_INFO("hotknot load auth code.");
ret = gt1x_load_patch(hotknot_auth_fw, 4096, 4096, 1024 * 8);
if (ret < 0) {
GTP_ERROR("Load auth system fail!");
return ret;
}
} else {
GTP_INFO("hotknot load auth code.");
ret = gt1x_load_patch(hotknot_auth_fw, 4096, 0, 1024 * 6);
if (ret < 0) {
GTP_ERROR("load auth system fail!");
return ret;
}
}
ret = gt1x_startup_patch();
if (ret < 0) {
GTP_ERROR("Startup auth system fail!");
return ret;
}
ret = gt1x_i2c_read(GTP_REG_VERSION, buffer, 4);
if (ret < 0) {
GTP_ERROR("i2c read error!");
return ERROR_IIC;
}
buffer[4] = 0;
GTP_INFO("Current System version: %s", buffer);
return 0;
}
开发者ID:P-D-A,项目名称:android_kernel_lge_mt6753,代码行数:47,代码来源:gt1x_extents.c
示例13: 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
示例14: init_wr_node
s32 init_wr_node(struct i2c_client *client)
{
s32 i;
gt_client = i2c_client_point;
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;
memset(&cmd_head2, 0, sizeof(cmd_head2));
cmd_head2.data = NULL;
i = 5;
while ((!cmd_head2.data) && i)
{
cmd_head2.data = kzalloc(i * DATA_LENGTH_UINT, GFP_KERNEL);
if (NULL != cmd_head2.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_head2.addr_len = 2;
cmd_head2.retry = 5;
register_i2c_func();
tool_set_proc_name(procname);
goodix_proc_entry = proc_create(procname, 0660, NULL, &tool_ops);
if (misc_register(&hotknot_misc_device))
{
printk("mtk_tpd: hotknot_device register failed\n");
return FAIL;
}
if (goodix_proc_entry == NULL)
{
GTP_ERROR("Couldn't create proc entry!");
return FAIL;
}
else
{
GTP_INFO("Create proc entry success!");
}
return SUCCESS;
}
开发者ID:rock12,项目名称:ALPS.L1.MP6.V2.19_CENON6580_WE_1_L_KERNEL,代码行数:91,代码来源:goodix_tool.c
示例15: 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
示例16: 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
示例17: 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
示例18: gt91xx_config_write_proc
static int gt91xx_config_write_proc(struct file *file, const char *buffer, unsigned long count, void *data)
{
s32 ret = 0;
char temp[16] = {0}; // for store special format cmd
char mode_str[8] = {0};
unsigned int mode;
u8 buf[1];
GTP_DEBUG("write count %ld", count);
if (count > GTP_CONFIG_MAX_LENGTH)
{
GTP_ERROR("size not match [%d:%ld]", GTP_CONFIG_MAX_LENGTH, count);
return -EFAULT;
}
/**********************************************/
/* for store special format cmd */
if (copy_from_user(temp, buffer, sizeof(temp)))
{
GTP_ERROR("copy from user fail 2");
return -EFAULT;
}
sscanf(temp, "%s %d", (char *)&mode_str, &mode);
if(strcmp(mode_str, "switch") == 0)
{
if(mode == 0)// turn off
tpd_off();
else if(mode == 1)//turn on
tpd_on();
else
GTP_ERROR("error mode :%d", mode);
return count;
}
//force clear config
if(strcmp(mode_str, "clear_config") == 0)
{
GTP_INFO("Force clear config");
buf[0] = 0x10;
ret = i2c_write_bytes(i2c_client_point, GTP_REG_SLEEP, buf, 1);
return count;
}
if (copy_from_user(&config[2], buffer, count))
{
GTP_ERROR("copy from user fail");
return -EFAULT;
}
/***********clk operate reseved****************/
/**********************************************/
ret = gtp_send_cfg(i2c_client_point);
abs_x_max = (config[RESOLUTION_LOC + 1] << 8) + config[RESOLUTION_LOC];
abs_y_max = (config[RESOLUTION_LOC + 3] << 8) + config[RESOLUTION_LOC + 2];
int_type = (config[TRIGGER_LOC]) & 0x03;
if (ret < 0)
{
GTP_ERROR("send config failed.");
}
return count;
}
开发者ID:huyparody,项目名称:OT_7047D,代码行数:64,代码来源:gt9xx_driver.c
示例19: gt1x_ioctl
//.........这里部分代码省略.........
break;
case GESTURE_ENABLE_PARTLY:
SETBIT(gestures_flag, (u8) value);
gesture_enabled = 1;
GTP_DEBUG("ENABLE_GESTURE_PARTLY, gesture = 0x%02X, gesture_enabled = %d", value, gesture_enabled);
break;
case GESTURE_DISABLE_PARTLY:
ret = QUERYBIT(gestures_flag, (u8) value);
if (!ret) {
break;
}
CLEARBIT(gestures_flag, (u8) value);
if (is_all_dead(gestures_flag, sizeof(gestures_flag))) {
gesture_enabled = 0;
}
GTP_DEBUG("DISABLE_GESTURE_PARTLY, gesture = 0x%02X, gesture_enabled = %d", value, gesture_enabled);
break;
case GESTURE_DATA_OBTAIN:
GTP_DEBUG("OBTAIN_GESTURE_DATA");
mutex_lock(&gesture_data_mutex);
if (gesture_data.data[1] > GESTURE_MAX_POINT_COUNT) {
gesture_data.data[1] = GESTURE_MAX_POINT_COUNT;
}
if (gesture_data.data[3] > 80) {
gesture_data.data[3] = 80;
}
ret = copy_to_user(((u8 __user *) arg), &gesture_data.data, 4 + gesture_data.data[1] * 4 + gesture_data.data[3]);
mutex_unlock(&gesture_data_mutex);
if (ret) {
GTP_ERROR("ERROR when copy gesture data to user.");
ret = ERROR_MEM;
} else {
ret = 4 + gesture_data.data[1] * 4 + gesture_data.data[3];
}
break;
case GESTURE_DATA_ERASE:
GTP_DEBUG("ERASE_GESTURE_DATA");
gesture_clear_wakeup_data();
break;
#endif // GTP_GESTURE_WAKEUP
#if GTP_HOTKNOT
case HOTKNOT_LOAD_HOTKNOT:
ret = hotknot_load_hotknot_subsystem();
break;
case HOTKNOT_LOAD_AUTHENTICATION:
#if GTP_ESD_PROTECT
gt1x_esd_switch(SWITCH_ON);
#endif
ret = hotknot_load_authentication_subsystem();
break;
case HOTKNOT_RECOVERY_MAIN:
ret = hotknot_recovery_main_system();
break;
#if HOTKNOT_BLOCK_RW
case HOTKNOT_DEVICES_PAIRED:
hotknot_paired_flag = 0;
force_wake_flag = 0;
block_enable = 1;
开发者ID:AudioGod,项目名称:MediaTek-HelioX10-Kernel,代码行数:67,代码来源:gt1x_extents.c
示例20: 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
注:本文中的GTP_ERROR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论