diff options
-rw-r--r-- | drivers/i2c/i2c-core.c | 16 | ||||
-rw-r--r-- | include/linux/i2c.h | 3 |
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index a58f89a6418..64f8e56d300 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1298,6 +1298,22 @@ s32 i2c_smbus_write_word_data(struct i2c_client *client, u8 command, u16 value) | |||
1298 | } | 1298 | } |
1299 | EXPORT_SYMBOL(i2c_smbus_write_word_data); | 1299 | EXPORT_SYMBOL(i2c_smbus_write_word_data); |
1300 | 1300 | ||
1301 | /* Returns the number of read bytes */ | ||
1302 | s32 i2c_smbus_read_block_data(struct i2c_client *client, u8 command, | ||
1303 | u8 *values) | ||
1304 | { | ||
1305 | union i2c_smbus_data data; | ||
1306 | |||
1307 | if (i2c_smbus_xfer(client->adapter, client->addr, client->flags, | ||
1308 | I2C_SMBUS_READ, command, | ||
1309 | I2C_SMBUS_BLOCK_DATA, &data)) | ||
1310 | return -1; | ||
1311 | |||
1312 | memcpy(values, &data.block[1], data.block[0]); | ||
1313 | return data.block[0]; | ||
1314 | } | ||
1315 | EXPORT_SYMBOL(i2c_smbus_read_block_data); | ||
1316 | |||
1301 | s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, | 1317 | s32 i2c_smbus_write_block_data(struct i2c_client *client, u8 command, |
1302 | u8 length, const u8 *values) | 1318 | u8 length, const u8 *values) |
1303 | { | 1319 | { |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 3fe2ad37da3..cae7d618030 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -82,6 +82,9 @@ extern s32 i2c_smbus_write_byte_data(struct i2c_client * client, | |||
82 | extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); | 82 | extern s32 i2c_smbus_read_word_data(struct i2c_client * client, u8 command); |
83 | extern s32 i2c_smbus_write_word_data(struct i2c_client * client, | 83 | extern s32 i2c_smbus_write_word_data(struct i2c_client * client, |
84 | u8 command, u16 value); | 84 | u8 command, u16 value); |
85 | /* Returns the number of read bytes */ | ||
86 | extern s32 i2c_smbus_read_block_data(struct i2c_client *client, | ||
87 | u8 command, u8 *values); | ||
85 | extern s32 i2c_smbus_write_block_data(struct i2c_client * client, | 88 | extern s32 i2c_smbus_write_block_data(struct i2c_client * client, |
86 | u8 command, u8 length, | 89 | u8 command, u8 length, |
87 | const u8 *values); | 90 | const u8 *values); |