diff options
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/atmel_mxt_ts.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index a68b2279e8df..dd2577b796a4 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
@@ -431,17 +431,24 @@ static int mxt_read_reg(struct i2c_client *client, u16 reg, u8 *val) | |||
431 | return __mxt_read_reg(client, reg, 1, val); | 431 | return __mxt_read_reg(client, reg, 1, val); |
432 | } | 432 | } |
433 | 433 | ||
434 | static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val) | 434 | static int __mxt_write_reg(struct i2c_client *client, u16 reg, u16 len, |
435 | const void *val) | ||
435 | { | 436 | { |
436 | u8 buf[3]; | 437 | u8 *buf; |
438 | size_t count; | ||
437 | int ret; | 439 | int ret; |
438 | 440 | ||
441 | count = len + 2; | ||
442 | buf = kmalloc(count, GFP_KERNEL); | ||
443 | if (!buf) | ||
444 | return -ENOMEM; | ||
445 | |||
439 | buf[0] = reg & 0xff; | 446 | buf[0] = reg & 0xff; |
440 | buf[1] = (reg >> 8) & 0xff; | 447 | buf[1] = (reg >> 8) & 0xff; |
441 | buf[2] = val; | 448 | memcpy(&buf[2], val, len); |
442 | 449 | ||
443 | ret = i2c_master_send(client, buf, 3); | 450 | ret = i2c_master_send(client, buf, count); |
444 | if (ret == 3) { | 451 | if (ret == count) { |
445 | ret = 0; | 452 | ret = 0; |
446 | } else { | 453 | } else { |
447 | if (ret >= 0) | 454 | if (ret >= 0) |
@@ -450,9 +457,15 @@ static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val) | |||
450 | __func__, ret); | 457 | __func__, ret); |
451 | } | 458 | } |
452 | 459 | ||
460 | kfree(buf); | ||
453 | return ret; | 461 | return ret; |
454 | } | 462 | } |
455 | 463 | ||
464 | static int mxt_write_reg(struct i2c_client *client, u16 reg, u8 val) | ||
465 | { | ||
466 | return __mxt_write_reg(client, reg, 1, &val); | ||
467 | } | ||
468 | |||
456 | static int mxt_read_object_table(struct i2c_client *client, | 469 | static int mxt_read_object_table(struct i2c_client *client, |
457 | u16 reg, u8 *object_buf) | 470 | u16 reg, u8 *object_buf) |
458 | { | 471 | { |