iio: adc: ti-ads1015: fix scale information for ADS1115
authorAkinobu Mita <akinobu.mita@gmail.com>
Thu, 20 Jul 2017 15:24:18 +0000 (00:24 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 9 Sep 2017 15:39:20 +0000 (17:39 +0200)
commitdac6ce351a109b5a3f8edfd55af069aaa4a8ae52
tree193f3deb1beba91af5007c974baf0c04ae092919
parentcc06f5a9be34ef8c72759d4cb575600872ec8c7b
iio: adc: ti-ads1015: fix scale information for ADS1115

commit 8d0e8e795623bd6229cf48bb7777a1c456c370ed upstream.

The ti-ads1015 driver supports ADS1015 and ADS1115 devices.  The same
scale information is used for both devices in this driver, however they
have actually different values and the ADS1115's one is not correct.

These devices have the same full-scale input voltage range for each PGA
selection.  So instead of adding another hardcoded scale information,
compute a correct scale on demand from each device's resolution.

Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/adc/ti-ads1015.c