OSDN Git Service

iio: adc: at91-sama5d2_adc: add support for oversampling resolution
authorEugen Hristev <eugen.hristev@microchip.com>
Thu, 21 Jun 2018 07:56:21 +0000 (10:56 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 25 Jun 2018 20:05:22 +0000 (21:05 +0100)
commit6794e23fa3fed82b1e71f730359618b40cbf7d66
tree6c2f96dc62d271e2e801c2903b95fc0cc865aea4
parent45e7f5d2889a35b6e1b0eecdcc2e0a1ebac071bf
iio: adc: at91-sama5d2_adc: add support for oversampling resolution

This implements oversampling support for the SAMA5d2 ADC device.
Enabling oversampling : OSR can improve resolution from 12 bits to
13 or 14 bits.
Changing the channel specification to have 14 bits, and we shift the value
1 bit to the left if we have oversampling for just one extra bit, and two
bits to the left if we have no oversampling (old support).
From this commit on, the converted values for all the voltage channels
change to 14 bits real data, with most insignificant two bits always zero
if oversampling is not enabled.
sysfs object oversampling_ratio has been enabled and
oversampling_ratio_available will list possible values (1 or 4 or 16) having
1 as default (no oversampling, 1 sample for each conversion).
Special care was required for the triggered buffer scenario (+ DMA), to
adjust the values accordingly.
Touchscreen measurements supported by this driver are not affected by
oversampling, they are still on 12 bits (scale handing is already included
in the driver).

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/at91-sama5d2_adc.c