@@ -189,6 +189,7 @@ struct omap_i2c_dev {
u8 *buf;
u8 *regs;
size_t buf_len;
+ u16 actual;
struct i2c_adapter adapter;
u8 threshold;
u8 fifo_size; /* use as flag and value
@@ -601,6 +602,7 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
omap_i2c_init(dev);
return -ETIMEDOUT;
}
+ msg->actual = dev->actual;
if (likely(!dev->cmd_err))
return 0;
@@ -828,6 +830,7 @@ static void omap_i2c_receive_data(struct omap_i2c_dev *dev, u8 num_bytes,
w = omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG);
*dev->buf++ = w;
dev->buf_len--;
+ dev->actual++;
/*
* Data reg in 2430, omap3 and
@@ -848,6 +851,7 @@ static int omap_i2c_transmit_data(struct omap_i2c_dev *dev, u8 num_bytes,
while (num_bytes--) {
w = *dev->buf++;
dev->buf_len--;
+ dev->actual++;
/*
* Data reg in 2430, omap3 and
@@ -908,6 +912,7 @@ omap_i2c_isr(int this_irq, void *dev_id)
if (stat & OMAP_I2C_STAT_NACK) {
err |= OMAP_I2C_STAT_NACK;
+ dev->actual--;
omap_i2c_ack_stat(dev, OMAP_I2C_STAT_NACK);
goto out;
}