Hello,
I have been working with a ina260 (digital current and power monitor via
ADC) sensor module (I2C interface). I created a device driver based on
the ina226 device. I have found some errors in the ina226 (and ina219)
drivers, and intend to feed back the changes (once I work out how to
generate a pull request), but had some questions on how these drivers
operate.
The ina226 device driver performs I2C write cycles to the ina226 device
configuration register during device 'initialization' and 'open'
routines, which call the driver ina226_write16 routine which in turn
calls the ina226_access routine. The ina226_access routine is not
correct for I2C register writes. I have produced a modified version for
the ina260 which correctly performs i2c register writes.
If I want to change device configuration within user routines (I want to
start and stop the ADC conversions to time them to other events) I only
have access via the driver ina260_write routine (based on the
ina226_write routine)?
I have modified the ina260_write driver routine (the ina226_write driver
just returned -ENOSYS) to perform writes to the ina260 configuration
register but had some general questions on how device driver write and
read operations work. For the ina226 device the driver ina226_read
routine perform specific operations (read the device shunt, bus, and
power registers) rather than generic device register reads. Is this
typical? In turn my ina260_write driver routine writes to the device
configuration register, rather than performing a generic device register
write. I appreciate any changes to the ina226/ina260 device driver write
or read operations could break existing user code, so I wouldn't be able
to include my modified version of the ina219_write, ina226_write (or
ina260_write) driver routine in any pull request?
Kind regards
Stewart Charnell