本文整理汇总了C++中GTP_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ GTP_ERROR函数的具体用法?C++ GTP_ERROR怎么用?C++ GTP_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GTP_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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]]);
}
示例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;
}
示例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;
//.........这里部分代码省略.........
示例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;
}
示例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
//.........这里部分代码省略.........