• Eugen Hristev's avatar
    iio: adc: at91-sama5d2_adc: add support for oversampling resolution · 6794e23f
    Eugen Hristev authored
    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: default avatarEugen Hristev <eugen.hristev@microchip.com>
    Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
    6794e23f
at91-sama5d2_adc.c 54.6 KB