Skip to content

Commit

Permalink
Input: atmel_mxt_ts - read ID information block in one i2c transaction
Browse files Browse the repository at this point in the history
Reading the whole info block in one i2c transaction speeds up driver
probe significantly, especially on slower i2c busses.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
  • Loading branch information
Daniel Kurtz authored and Henrik Rydberg committed Jun 29, 2012
1 parent cf94bc0 commit 23003a8
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions drivers/input/touchscreen/atmel_mxt_ts.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#define MXT_FW_NAME "maxtouch.fw"

/* Registers */
#define MXT_INFO 0x00
#define MXT_FAMILY_ID 0x00
#define MXT_VARIANT_ID 0x01
#define MXT_VERSION 0x02
Expand Down Expand Up @@ -760,32 +761,11 @@ static int mxt_get_info(struct mxt_data *data)
struct i2c_client *client = data->client;
struct mxt_info *info = &data->info;
int error;
u8 val;

error = mxt_read_reg(client, MXT_FAMILY_ID, &val);
if (error)
return error;
info->family_id = val;

error = mxt_read_reg(client, MXT_VARIANT_ID, &val);
if (error)
return error;
info->variant_id = val;

error = mxt_read_reg(client, MXT_VERSION, &val);
if (error)
return error;
info->version = val;

error = mxt_read_reg(client, MXT_BUILD, &val);
if (error)
return error;
info->build = val;

error = mxt_read_reg(client, MXT_OBJECT_NUM, &val);
/* Read 7-byte info block starting at address 0 */
error = __mxt_read_reg(client, MXT_INFO, sizeof(*info), info);
if (error)
return error;
info->object_num = val;

return 0;
}
Expand Down

0 comments on commit 23003a8

Please sign in to comment.