aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/i2c/algos/i2c-algo-bit.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
index 28b7e25ca79..fcef6ff3d28 100644
--- a/drivers/i2c/algos/i2c-algo-bit.c
+++ b/drivers/i2c/algos/i2c-algo-bit.c
@@ -391,6 +391,21 @@ static int readbytes(struct i2c_adapter *i2c_adap, struct i2c_msg *msg)
391 }; 391 };
392 scllo(adap); 392 scllo(adap);
393 sdahi(adap); 393 sdahi(adap);
394
395 /* Some SMBus transactions require that we receive the
396 transaction length as the first read byte. */
397 if (rdcount == 1 && (msg->flags & I2C_M_RECV_LEN)) {
398 if (inval <= 0 || inval > I2C_SMBUS_BLOCK_MAX) {
399 printk(KERN_ERR "i2c-algo-bit: readbytes: "
400 "invalid block length (%d)\n", inval);
401 return -EREMOTEIO;
402 }
403 /* The original count value accounts for the extra
404 bytes, that is, either 1 for a regular transaction,
405 or 2 for a PEC transaction. */
406 count += inval;
407 msg->len += inval;
408 }
394 } 409 }
395 return rdcount; 410 return rdcount;
396} 411}
@@ -509,6 +524,8 @@ bailout:
509static u32 bit_func(struct i2c_adapter *adap) 524static u32 bit_func(struct i2c_adapter *adap)
510{ 525{
511 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | 526 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL |
527 I2C_FUNC_SMBUS_READ_BLOCK_DATA |
528 I2C_FUNC_SMBUS_BLOCK_PROC_CALL |
512 I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING; 529 I2C_FUNC_10BIT_ADDR | I2C_FUNC_PROTOCOL_MANGLING;
513} 530}
514 531