iio: adc: ina2xx: Allow setting Shunt Voltage PGA gain and Bus Voltage range
authorStefan Brüns <stefan.bruens@rwth-aachen.de>
Sat, 28 Oct 2017 21:12:48 +0000 (23:12 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 2 Dec 2017 10:40:20 +0000 (10:40 +0000)
commitca6a2d86acaebd7a7e871fbb361a75101cf9f4cb
tree1ddfa9ee32b3e04f6ab12044f7cbcbb3c5ab597b
parent2d8119d752d4fe794d768b0c42cdf6cf14b37bcc
iio: adc: ina2xx: Allow setting Shunt Voltage PGA gain and Bus Voltage range

Reducing shunt and bus voltage range improves the accuracy, so allow
altering the default settings.

Both settings are exposed as gain values. While for the shunt voltage
this is straightforward, the bus range settings of 32V (default) and 16V
are mapped to gain values of 1 resp. 2, to provide a uniform API to
userspace.

As the gain settings are incorporated into the raw values by the sensor
itself, adjusting of the scale attributes is not necessary.

Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ina2xx-adc.c