servod: Use the Linux i2c-pseudo driver to implement Servo/DUT I2C adapter.
This uses non-blocking I/O with the epoll(7) interface for interfacing with
the i2c-pseudo controller device. All I/O, both with the controller and
with the I2C bus, is peformed in a single thread dedicated to the pseudo
controller.
Things that can and should be improved in followup changes:
- There should be a dut-control command to expose the Servo/DUT
I2C adapter number. The adapter number is already tracked internally.
- There is a circular reference between BaseI2CBus and the new
I2cPseudoAdapter class. An actual circular dependency is avoided using
weakref, however it's still ugly. A cleaner way should be found to
integrate I2cPseudoAdapter with the rest of servod. (Could have
BaseI2CBus inherit from I2cPseudoAdapter, but that doesn't feel
quite right either.)
BRANCH=none
BUG=b:79684405,b:124388894
CQ-DEPEND=CL:1274778
TEST=Issued I2C xfer requests via i2c-tools -> i2c-dev. Used CL:1301154
to reflash ITE EC on bip and ampton.
Change-Id: Ic206095e8fe37dc1261ab68542e70ab8b5302895
Signed-off-by: Matthew Blecker <matthewb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1282275
Reviewed-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
5 files changed