On Thu, Apr 21, 2016 at 09:19:56AM +0000, Davidoaia, Bogdan M wrote:
This is a proposal to add an API for reading, writing and updating
internal registers of I2C devices. This API would offer a simpler way of
communicating with I2C devices that have internal registers.
With the current I2C API, if you want to read the value of an internal
device register, you have to do an i2c_transfer call with two messages
(a write of the register address, followed by a read of the register
Just looking at the sensor subsystem, all drivers define their own
register read/write functions which are more or less identical. This is
a case of code duplication that can be avoided if we add an API for
Always in favour of removing code duplication! :)
I have written a patch that adds the I2C register access functions and
uploaded it to Gerrit . All the new functions are implemented using
the existing I2C driver API.
What are your thoughts on this addition to the I2C API? If you think
this is a good idea, I can start updating the drivers to use the
register access function.