/* @client: i2c device. @reg: the register to read from. @buf: raw write data buffer. @len: length of the buffer to write  */
static int goodix_i2c_read(struct i2c_client *client, u16 reg, u8 *buf, int len)
/* @client: i2c device. @reg: the register to read from. @buf: raw write data buffer. @len: length of the buffer to write  */
static int goodix_i2c_read(struct i2c_client *client, u16 reg, u8 *buf, int len)
{
	struct i2c_msg msgs[2];
	u16 wbuf = cpu_to_be16(reg);
	int ret;
	msgs[0].flags = 0;
	msgs[0].addr  = client->addr;
	msgs[0].len   = 2;
	msgs[0].buf   = (u8 *)&wbuf;
	msgs[1].flags = I2C_M_RD;
	msgs[1].addr  = client->addr;
	msgs[1].len   = len;
	msgs[1].buf   = buf;
	ret = i2c_transfer(client->adapter, msgs, 2);
	return ret < 0 ? ret : (ret != ARRAY_SIZE(msgs) ? -EIO : 0);
}