[PATCH v2 0/3] Enhancements for TI INA219/220 current/voltage monitors

From: Stefan BrÃns
Date: Tue May 23 2017 - 20:10:08 EST


The ina2xx adc driver does not handle differences between INA219/220 and
INA226/230/231 completely:

- The 219 uses a 4 bit register field for for the bus/shunt voltage adc
integration times each, whereas the 226 uses two 3 bit fields for the
integration times and an additional 3 bit averaging field.

The second patch corrects setting integration times in the config register.

- The conversion ready flag differs between the two families.

Handling for this flag is corrected in the third patch. Without the patch,
the kernel will go in a busy loop (setting read register 6 is ACKed by the
INA219, and the following read returns 0).

- The 219 also has an adjustable PGA. The default setting allows the
maximum range, but also reduces accuracy.

(Postponed, needs more thought)

Changes v2:
- split attribute flags change from [Patch 1] iio: adc: Fix integration time/
averaging from INA219/220
- changed Patch v1 1/2 (now 2/3, feedback by Jonathan Cameron):
* Use correct flags for all channels/chips
* Improve readability of chip/channel handling in if statement
- dropped Patch v1 2/2 for now
- added Patch v2 3/3

Stefan BrÃns (3):
iio: adc: ina2xx: Make use of attribute flags consistent on all
channels
iio: adc: Fix integration time/averaging for INA219/220
iio: adc: Fix polling of INA219 conversion ready flag

drivers/iio/adc/ina2xx-adc.c | 242 +++++++++++++++++++++++++++++++++++++------
1 file changed, 213 insertions(+), 29 deletions(-)

--
2.12.2