Loading drivers/input/touchscreen/gt9xx/goodix_tool.c +33 −20 Original line number Diff line number Diff line Loading @@ -93,18 +93,21 @@ static void tool_set_proc_name(char *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]; u8 i = 0; struct i2c_msg msgs[2] = { { .flags = !I2C_M_RD, .addr = gt_client->addr, .len = cmd_head.addr_len, .buf = &buf[0], }, { .flags = I2C_M_RD, .addr = gt_client->addr, .len = len, .buf = &buf[GTP_ADDR_LENGTH], }, }; for (i = 0; i < cmd_head.retry; i++) { ret = i2c_transfer(gt_client->adapter, msgs, 2); Loading @@ -112,19 +115,24 @@ static s32 tool_i2c_read_no_extra(u8 *buf, u16 len) break; } if (i == cmd_head.retry) { dev_err(&client->dev, "I2C read retry limit over.\n"); ret = -EIO; } 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; u8 i = 0; struct i2c_msg msg = { .flags = !I2C_M_RD, .addr = gt_client->addr, .len = len, .buf = buf, }; for (i = 0; i < cmd_head.retry; i++) { ret = i2c_transfer(gt_client->adapter, &msg, 1); Loading @@ -132,6 +140,11 @@ static s32 tool_i2c_write_no_extra(u8 *buf, u16 len) break; } if (i == cmd_head.retry) { dev_err(&client->dev, "I2C write retry limit over.\n"); ret = -EIO; } return ret; } Loading drivers/input/touchscreen/gt9xx/gt9xx_update.c +40 −30 Original line number Diff line number Diff line Loading @@ -109,24 +109,25 @@ Output: *********************************************************/ s32 gup_i2c_read(struct i2c_client *client, u8 *buf, s32 len) { struct i2c_msg msgs[2]; s32 ret = -1; s32 retries = 0; u8 retries = 0; struct i2c_msg msgs[2] = { { .flags = !I2C_M_RD, .addr = client->addr, .len = GTP_ADDR_LENGTH, .buf = &buf[0], }, { .flags = I2C_M_RD, .addr = client->addr, .len = len - GTP_ADDR_LENGTH, .buf = &buf[GTP_ADDR_LENGTH], }, }; 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) Loading @@ -134,6 +135,11 @@ s32 gup_i2c_read(struct i2c_client *client, u8 *buf, s32 len) retries++; } if (retries == 5) { dev_err(&client->dev, "I2C read retry limit over.\n"); ret = -EIO; } return ret; } Loading @@ -151,18 +157,17 @@ Output: *********************************************************/ s32 gup_i2c_write(struct i2c_client *client, u8 *buf, s32 len) { struct i2c_msg msg; s32 ret = -1; s32 retries = 0; u8 retries = 0; struct i2c_msg msg = { .flags = !I2C_M_RD, .addr = client->addr, .len = len, .buf = buf, }; 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) Loading @@ -170,6 +175,11 @@ s32 gup_i2c_write(struct i2c_client *client, u8 *buf, s32 len) retries++; } if (retries == 5) { dev_err(&client->dev, "I2C write retry limit over.\n"); ret = -EIO; } return ret; } Loading Loading @@ -286,7 +296,7 @@ static s32 gup_init_panel(struct goodix_ts_data *ts) static u8 gup_get_ic_msg(struct i2c_client *client, u16 addr, u8 *msg, s32 len) { s32 i = 0; u8 i = 0; msg[0] = (addr >> 8) & 0xff; msg[1] = addr & 0xff; Loading @@ -305,12 +315,12 @@ static u8 gup_get_ic_msg(struct i2c_client *client, u16 addr, u8 *msg, s32 len) static u8 gup_set_ic_msg(struct i2c_client *client, u16 addr, u8 val) { s32 i = 0; u8 msg[3]; msg[0] = (addr >> 8) & 0xff; msg[1] = addr & 0xff; msg[2] = val; u8 i = 0; u8 msg[3] = { (addr >> 8) & 0xff, addr & 0xff, val, }; for (i = 0; i < 5; i++) if (gup_i2c_write(client, msg, GTP_ADDR_LENGTH + 1) > 0) Loading Loading @@ -408,7 +418,7 @@ static u8 gup_get_ic_fw_msg(struct i2c_client *client) s32 gup_enter_update_mode(struct i2c_client *client) { s32 ret = -1; s32 retry = 0; u8 retry = 0; u8 rd_buf[3]; /* step1:RST output low last at least 2ms */ Loading Loading
drivers/input/touchscreen/gt9xx/goodix_tool.c +33 −20 Original line number Diff line number Diff line Loading @@ -93,18 +93,21 @@ static void tool_set_proc_name(char *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]; u8 i = 0; struct i2c_msg msgs[2] = { { .flags = !I2C_M_RD, .addr = gt_client->addr, .len = cmd_head.addr_len, .buf = &buf[0], }, { .flags = I2C_M_RD, .addr = gt_client->addr, .len = len, .buf = &buf[GTP_ADDR_LENGTH], }, }; for (i = 0; i < cmd_head.retry; i++) { ret = i2c_transfer(gt_client->adapter, msgs, 2); Loading @@ -112,19 +115,24 @@ static s32 tool_i2c_read_no_extra(u8 *buf, u16 len) break; } if (i == cmd_head.retry) { dev_err(&client->dev, "I2C read retry limit over.\n"); ret = -EIO; } 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; u8 i = 0; struct i2c_msg msg = { .flags = !I2C_M_RD, .addr = gt_client->addr, .len = len, .buf = buf, }; for (i = 0; i < cmd_head.retry; i++) { ret = i2c_transfer(gt_client->adapter, &msg, 1); Loading @@ -132,6 +140,11 @@ static s32 tool_i2c_write_no_extra(u8 *buf, u16 len) break; } if (i == cmd_head.retry) { dev_err(&client->dev, "I2C write retry limit over.\n"); ret = -EIO; } return ret; } Loading
drivers/input/touchscreen/gt9xx/gt9xx_update.c +40 −30 Original line number Diff line number Diff line Loading @@ -109,24 +109,25 @@ Output: *********************************************************/ s32 gup_i2c_read(struct i2c_client *client, u8 *buf, s32 len) { struct i2c_msg msgs[2]; s32 ret = -1; s32 retries = 0; u8 retries = 0; struct i2c_msg msgs[2] = { { .flags = !I2C_M_RD, .addr = client->addr, .len = GTP_ADDR_LENGTH, .buf = &buf[0], }, { .flags = I2C_M_RD, .addr = client->addr, .len = len - GTP_ADDR_LENGTH, .buf = &buf[GTP_ADDR_LENGTH], }, }; 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) Loading @@ -134,6 +135,11 @@ s32 gup_i2c_read(struct i2c_client *client, u8 *buf, s32 len) retries++; } if (retries == 5) { dev_err(&client->dev, "I2C read retry limit over.\n"); ret = -EIO; } return ret; } Loading @@ -151,18 +157,17 @@ Output: *********************************************************/ s32 gup_i2c_write(struct i2c_client *client, u8 *buf, s32 len) { struct i2c_msg msg; s32 ret = -1; s32 retries = 0; u8 retries = 0; struct i2c_msg msg = { .flags = !I2C_M_RD, .addr = client->addr, .len = len, .buf = buf, }; 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) Loading @@ -170,6 +175,11 @@ s32 gup_i2c_write(struct i2c_client *client, u8 *buf, s32 len) retries++; } if (retries == 5) { dev_err(&client->dev, "I2C write retry limit over.\n"); ret = -EIO; } return ret; } Loading Loading @@ -286,7 +296,7 @@ static s32 gup_init_panel(struct goodix_ts_data *ts) static u8 gup_get_ic_msg(struct i2c_client *client, u16 addr, u8 *msg, s32 len) { s32 i = 0; u8 i = 0; msg[0] = (addr >> 8) & 0xff; msg[1] = addr & 0xff; Loading @@ -305,12 +315,12 @@ static u8 gup_get_ic_msg(struct i2c_client *client, u16 addr, u8 *msg, s32 len) static u8 gup_set_ic_msg(struct i2c_client *client, u16 addr, u8 val) { s32 i = 0; u8 msg[3]; msg[0] = (addr >> 8) & 0xff; msg[1] = addr & 0xff; msg[2] = val; u8 i = 0; u8 msg[3] = { (addr >> 8) & 0xff, addr & 0xff, val, }; for (i = 0; i < 5; i++) if (gup_i2c_write(client, msg, GTP_ADDR_LENGTH + 1) > 0) Loading Loading @@ -408,7 +418,7 @@ static u8 gup_get_ic_fw_msg(struct i2c_client *client) s32 gup_enter_update_mode(struct i2c_client *client) { s32 ret = -1; s32 retry = 0; u8 retry = 0; u8 rd_buf[3]; /* step1:RST output low last at least 2ms */ Loading