|
39 | 39 | #define MXT_OBJECT_START 0x07
|
40 | 40 | #define MXT_OBJECT_SIZE 6
|
41 | 41 | #define MXT_INFO_CHECKSUM_SIZE 3
|
42 |
| -#define MXT_MAX_BLOCK_WRITE 256 |
| 42 | +#define MXT_MAX_BLOCK_WRITE 255 |
43 | 43 |
|
44 | 44 | /* Object types */
|
45 | 45 | #define MXT_DEBUG_DIAGNOSTIC_T37 37
|
@@ -575,6 +575,27 @@ static int __mxt_read_reg(struct i2c_client *client,
|
575 | 575 | return ret;
|
576 | 576 | }
|
577 | 577 |
|
| 578 | +static int mxt_read_blks(struct mxt_data *data, u16 start, u16 count, u8 *buf) |
| 579 | +{ |
| 580 | + u16 offset = 0; |
| 581 | + int error; |
| 582 | + u16 size; |
| 583 | + |
| 584 | + while (offset < count) { |
| 585 | + size = min(MXT_MAX_BLOCK_WRITE, count - offset); |
| 586 | + |
| 587 | + error = __mxt_read_reg(data->client, |
| 588 | + start + offset, |
| 589 | + size, buf + offset); |
| 590 | + if (error) |
| 591 | + return error; |
| 592 | + |
| 593 | + offset += size; |
| 594 | + } |
| 595 | + |
| 596 | + return 0; |
| 597 | +} |
| 598 | + |
578 | 599 | static int __mxt_write_reg(struct i2c_client *client, u16 reg, u16 len,
|
579 | 600 | const void *val)
|
580 | 601 | {
|
@@ -1704,7 +1725,7 @@ static int mxt_read_info_block(struct mxt_data *data)
|
1704 | 1725 | }
|
1705 | 1726 |
|
1706 | 1727 | /* Read rest of info block */
|
1707 |
| - error = __mxt_read_reg(client, MXT_OBJECT_START, |
| 1728 | + error = mxt_read_blks(data, MXT_OBJECT_START, |
1708 | 1729 | size - MXT_OBJECT_START,
|
1709 | 1730 | buf + MXT_OBJECT_START);
|
1710 | 1731 | if (error)
|
@@ -2243,7 +2264,7 @@ static ssize_t mxt_object_show(struct device *dev,
|
2243 | 2264 | u16 size = mxt_obj_size(object);
|
2244 | 2265 | u16 addr = object->start_address + j * size;
|
2245 | 2266 |
|
2246 |
| - error = __mxt_read_reg(data->client, addr, size, obuf); |
| 2267 | + error = mxt_read_blks(data, addr, size, obuf); |
2247 | 2268 | if (error)
|
2248 | 2269 | goto done;
|
2249 | 2270 |
|
|
0 commit comments