]> www.infradead.org Git - users/jedix/linux-maple.git/commit
iio: adc: ad7380: add oversampling support
authorJulien Stephan <jstephan@baylibre.com>
Thu, 30 May 2024 15:14:12 +0000 (10:14 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 4 Jun 2024 18:53:08 +0000 (19:53 +0100)
commit15b08012852f40ce89c3237a557b68397916685e
tree97cea8cc8ba424d92b9aeafc267af46f7a726b59
parent99d46eecf98fe9af4573363fcb5c8d8d36ce875e
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: Julien Stephan <jstephan@baylibre.com>
Co-developed-by: David Lechner <dlechner@baylibre.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240530-iio-add-support-for-multiple-scan-types-v3-5-cbc4acea2cfa@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad7380.c