diff options
Diffstat (limited to 'src/device')
-rw-r--r-- | src/device/i2c.c | 2 | ||||
-rw-r--r-- | src/device/software_i2c.c | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/device/i2c.c b/src/device/i2c.c index d4670a013c..67470d4921 100644 --- a/src/device/i2c.c +++ b/src/device/i2c.c @@ -49,7 +49,7 @@ int i2c_dev_find_bus(struct device *dev) return ops->dev_to_bus(pbus->dev); } -int i2c_dev_transfer(struct device *dev, struct i2c_seg *segments, int count) +int i2c_dev_transfer(struct device *dev, struct i2c_msg *segments, int count) { int bus = i2c_dev_find_bus(dev); if (bus < 0) diff --git a/src/device/software_i2c.c b/src/device/software_i2c.c index be7aebecd0..368d145b3e 100644 --- a/src/device/software_i2c.c +++ b/src/device/software_i2c.c @@ -238,19 +238,20 @@ static int in_byte(unsigned bus, int ack) return byte; } -int software_i2c_transfer(unsigned bus, struct i2c_seg *segments, int count) +int software_i2c_transfer(unsigned bus, struct i2c_msg *segments, int count) { int i; - struct i2c_seg *seg; + struct i2c_msg *seg; for (seg = segments; seg - segments < count; seg++) { if (start_cond(bus) < 0) return -1; - if (out_byte(bus, seg->chip << 1 | !!seg->read) < 0) + const u8 addr_dir = seg->slave << 1 | !!(seg->flags & I2C_M_RD); + if (out_byte(bus, addr_dir) < 0) return -1; for (i = 0; i < seg->len; i++) { int ret; - if (seg->read) { + if (seg->flags & I2C_M_RD) { ret = in_byte(bus, i < seg->len - 1); seg->buf[i] = (u8)ret; } else { |