summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLadislav Michl <ladis@linux-mips.org>2017-08-25 07:39:16 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2017-09-03 18:10:31 +0100
commitfe895ac88b9fbdf2026f0bfd56c82747bb9d7c48 (patch)
treea79d63def40b36d421b6b8d7d44d0802802bee8f /drivers
parentd1c11dc27e3282e787406290ead5926bb7bb4579 (diff)
iio: adc: ti-ads1015: add 10% to conversion wait time
As user's guide "ADS1015EVM, ADS1115EVM, ADS1015EVM-PDK, ADS1115EVM-PDK User Guide (Rev. B)" (http://www.ti.com/lit/ug/sbau157b/sbau157b.pdf) states at page 16: "Note that both the ADS1115 and ADS1015 have internal clocks with a ±10% accuracy. If performing FFT tests, frequencies may appear to be incorrect as a result of this tolerance range.", add those 10% to converion wait time. Cc: Daniel Baluta <daniel.baluta@gmail.com> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Reviewed-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/iio/adc/ti-ads1015.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index 7503ea56b781..3e9719e8cf3b 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -368,6 +368,7 @@ int ads1015_get_adc_result(struct ads1015_data *data, int chan, int *val)
dr_old = (old & ADS1015_CFG_DR_MASK) >> ADS1015_CFG_DR_SHIFT;
conv_time = DIV_ROUND_UP(USEC_PER_SEC, data->data_rate[dr_old]);
conv_time += DIV_ROUND_UP(USEC_PER_SEC, data->data_rate[dr]);
+ conv_time += conv_time / 10; /* 10% internal clock inaccuracy */
usleep_range(conv_time, conv_time + 1);
data->conv_invalid = false;
}