@@ -620,8 +620,8 @@ static int mxt_send_bootloader_cmd(struct mxt_data *data, bool unlock)
return 0;
}
-static int __mxt_read_reg(struct i2c_client *client,
- u16 reg, u16 len, void *val)
+static int __mxt_read_chunk(struct i2c_client *client,
+ u16 reg, u16 len, void *val)
{
struct i2c_msg xfer[2];
u8 buf[2];
@@ -655,8 +655,33 @@ static int __mxt_read_reg(struct i2c_client *client,
return ret;
}
-static int __mxt_write_reg(struct i2c_client *client, u16 reg, u16 len,
- const void *val)
+static int __mxt_read_reg(struct i2c_client *client,
+ u16 reg, u16 len, void *buf)
+{
+ const struct i2c_adapter_quirks *quirks = client->adapter->quirks;
+ u16 size, offset = 0, max_read_len = len;
+ int ret;
+
+ if (quirks && quirks->max_read_len)
+ max_read_len = quirks->max_read_len;
+
+ while (offset < len) {
+ size = min_t(u16, max_read_len, len - offset);
+
+ ret = __mxt_read_chunk(client,
+ reg + offset,
+ size, buf + offset);
+ if (ret)
+ return ret;
+
+ offset += size;
+ }
+
+ return 0;
+}
+
+static int __mxt_write_chunk(struct i2c_client *client, u16 reg, u16 len,
+ const void *val)
{
u8 *buf;
size_t count;
@@ -685,9 +710,34 @@ static int __mxt_write_reg(struct i2c_client *client, u16 reg, u16 len,
return ret;
}
+static int __mxt_write_reg(struct i2c_client *client, u16 reg, u16 len,
+ const void *val)
+{
+ const struct i2c_adapter_quirks *quirks = client->adapter->quirks;
+ u16 size, offset = 0, max_write_len = len;
+ int ret;
+
+ if (quirks && quirks->max_write_len)
+ max_write_len = quirks->max_write_len;
+
+ while (offset < len) {
+ size = min_t(u16, max_write_len, len - offset);
+
+ ret = __mxt_write_chunk(client,
+ reg + offset,
+ size, val + offset);
+ if (ret)
+ return ret;
+
+ offset += size;
+ }
+
+ return 0;
+}
+
static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val)
{
- return __mxt_write_reg(client, reg, 1, &val);
+ return __mxt_write_chunk(client, reg, 1, &val);
}
static struct mxt_object *