drivers: gpio_pca95xx: use I2C burst write

Use I2C burst write to write 2 bytes to each pair of registers
instead of 2 separate transactions of writing 1 byte.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2019-11-03 19:21:05 -08:00 committed by Carles Cufí
commit 74e6795f6a

View file

@ -113,16 +113,12 @@ static int write_port_regs(struct device *dev, u8_t reg,
"0x%X", i2c_addr, reg, buf->byte[0], (reg + 1),
buf->byte[1]);
ret = i2c_reg_write_byte(i2c_master, i2c_addr, reg, buf->byte[0]);
ret = i2c_burst_write(i2c_master, i2c_addr, reg, buf->byte, 2);
if (ret) {
LOG_ERR("PCA95XX[0x%X]: error writing to register 0x%X "
"(%d)", i2c_addr, reg, ret);
}
ret = i2c_reg_write_byte(i2c_master, i2c_addr, reg+1, buf->byte[1]);
if (ret) {
LOG_ERR("PCA95XX[0x%X]: error writing to register 0x%X "
"(%d)", i2c_addr, reg, ret);
}
return ret;
}