Skip to content

Commit

Permalink
Input: ad7879 - use i2c_smbus_read_i2c_block_data() to lower overhead
Browse files Browse the repository at this point in the history
Avoid additional addressing overhead incurred by word_data transfers.

Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
  • Loading branch information
Michael Hennerich authored and Dmitry Torokhov committed Jul 3, 2010
1 parent 14fbbc3 commit 16ea10a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/input/touchscreen/ad7879-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ static int ad7879_i2c_read(struct device *dev, u8 reg)
static int ad7879_i2c_multi_read(struct device *dev,
u8 first_reg, u8 count, u16 *buf)
{
struct i2c_client *client = to_i2c_client(dev);
u8 idx;

i2c_smbus_read_i2c_block_data(client, first_reg, count * 2, (u8 *)buf);

for (idx = 0; idx < count; ++idx)
buf[idx] = ad7879_i2c_read(dev, first_reg + idx);
buf[idx] = swab16(buf[idx]);

return 0;
}
Expand Down

0 comments on commit 16ea10a

Please sign in to comment.