i2c: Add i2c block transaction support
The previous code always uses SMBus block read/write.
On some PSU (e.g. FP5280G2's PSU) the I2C block read/write is
required, so add that support.
Specifically, add a Mode enum class and add the parameter for block
read/write to indicate whether SMBus or I2C block read/write is to be
called.
Tested: Verify the code works on FP5280G2 with I2C block write.
Note: Currently there is no case for I2C block read, so that function is
not tested.
Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I5f77ffe6900d14f3703dae7241799a7b37c5a726
diff --git a/tools/power-utils/test/test_updater.cpp b/tools/power-utils/test/test_updater.cpp
index e1b6a2e..c51c233 100644
--- a/tools/power-utils/test/test_updater.cpp
+++ b/tools/power-utils/test/test_updater.cpp
@@ -97,7 +97,7 @@
updater->createI2CDevice();
auto& i2c = getMockedI2c();
- EXPECT_CALL(i2c, write(0xf0, 12, _));
+ EXPECT_CALL(i2c, write(0xf0, 12, _, I2CInterface::Mode::SMBUS));
EXPECT_CALL(i2c, write(0xf1, An<uint8_t>()));
EXPECT_CALL(i2c, read(0xf1, An<uint8_t&>()));
updater->doUpdate();