Commit 15b08012 authored by Julien Stephan's avatar Julien Stephan Committed by Jonathan Cameron

iio: adc: ad7380: add oversampling support

ad7380x(-4) parts are able to do oversampling to increase accuracy.

This chips supports a normal oversampling mode and a rolling mode and
also allows enabling and disabling extra resolution bits when
oversampling is enabled.

We have intentionally left out the rolling mode for now as there is not
a compelling use case for it. User can process a captured data buffer
to get the same effect.

We are also currently not supporting changing the oversampling mode
independently of the resolution bits. The resolution boost feature
can only be enabled when oversampling is enabled and oversampling is
not as useful without the resolution boost. So for now we consider the
features tightly coupled. When oversampling is enabled, the resolution
boost is enabled and when oversampling is disabled, the resolution
boost is disabled.

Since the resolution boost feature causes 16-bit chips to now have
18-bit data which means the storagebits has to change from 16 to 32
bits, we use the new ext_scan_type feature to allow changing the
scan_type at runtime based on if the resolution boost is enabled or
not.

SPI message optimization has to be moved since now some of the xfer
parameters change based on the resolution boost mode.

A few neighboring comments are also fixed up while we are touching this
code.
Signed-off-by: default avatarJulien Stephan <jstephan@baylibre.com>
Co-developed-by: default avatarDavid Lechner <dlechner@baylibre.com>
Signed-off-by: default avatarDavid Lechner <dlechner@baylibre.com>
Reviewed-by: default avatarNuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240530-iio-add-support-for-multiple-scan-types-v3-5-cbc4acea2cfa@baylibre.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 99d46eec
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment