Linux IIO development
 help / color / mirror / Atom feed
* [PATCH v3 0/5] iio: add support for multiple scan types
@ 2024-05-30 15:14 David Lechner
  2024-05-30 15:14 ` [PATCH v3 1/5] iio: introduce struct iio_scan_type David Lechner
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: David Lechner @ 2024-05-30 15:14 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: David Lechner, Michael Hennerich, Nuno Sá, Julien Stephan,
	Esteban Blanc, linux-iio, linux-kernel

Up to now, the IIO subsystem has only supported a single scan type per
channel. This scan type determines the binary format of the data in the
buffer when doing buffered reads.

For simple devices, there is only one scan type and all is well. But
for more complex devices, there may be multiple scan types. For example,
ADCs with a resolution boost feature that adds more bits to the raw
sample data. Traditionally, for slow devices, we've just always used the
highest resolution mode, but for high performance ADCs, this may not be
always practical. Manipulating data after every read can hurt performance
and in the case of hardware buffers, it may not be possible to change the
format of the data in the buffer at all. There are also ADCs where
enabling the higher resolution can only be done if oversampling is also
enabled which may not be desireable.

To allow for more flexibility, we would like to add support for multiple
scan types per channel.

To avoid having to touch every driver, we implemented this in a way that
preserves the existing scan_type field. See the "iio: add support for
multiple scan types per channel" the details. The first couple of patches
are just preparation for this.

[1]: https://lore.kernel.org/linux-iio/CAMknhBHOXaff__QyU-wFSNNENvs23vDX5n_ddH-Dw3s6-sQ9sg@mail.gmail.com/

---
Changes in v3:
* Changed return type of get_current_scan_type callback to int.
* Brought back updated ad7380 patches.
* Link to v2: https://lore.kernel.org/r/20240524-iio-add-support-for-multiple-scan-types-v2-0-a6c328fdfab7@baylibre.com

Changes in v2:
* Use union for scan_type and scan_type_ext.
* Dropped ad7380 patch - those changed will be squashed into the next
  revision of the series adding the driver for ad7380.
* Temporary updated ad7380 patch for reference: https://github.com/dlech/linux/commit/64be3de241e73b43c5a5daa44b6b97f35f0743bf
* Link to v1: https://lore.kernel.org/r/20240507-iio-add-support-for-multiple-scan-types-v1-0-95ac33ee51e9@baylibre.com

---
David Lechner (4):
      iio: introduce struct iio_scan_type
      iio: buffer: use struct iio_scan_type to simplify code
      iio: add support for multiple scan types per channel
      iio: adc: ad7380: use spi_optimize_message()

Julien Stephan (1):
      iio: adc: ad7380: add oversampling support

 drivers/iio/adc/ad7380.c          | 335 +++++++++++++++++++++++++++++++-------
 drivers/iio/industrialio-buffer.c | 129 +++++++++++----
 include/linux/iio/iio.h           |  94 ++++++++---
 3 files changed, 450 insertions(+), 108 deletions(-)
---
base-commit: b4bfc5f52090336f5f5b65bbdac394ac1001952d
change-id: 20240507-iio-add-support-for-multiple-scan-types-f4dbcf4c2cb8

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-06-03 19:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-30 15:14 [PATCH v3 0/5] iio: add support for multiple scan types David Lechner
2024-05-30 15:14 ` [PATCH v3 1/5] iio: introduce struct iio_scan_type David Lechner
2024-05-30 15:14 ` [PATCH v3 2/5] iio: buffer: use struct iio_scan_type to simplify code David Lechner
2024-05-30 15:14 ` [PATCH v3 3/5] iio: add support for multiple scan types per channel David Lechner
2024-05-30 15:14 ` [PATCH v3 4/5] iio: adc: ad7380: use spi_optimize_message() David Lechner
2024-05-30 15:14 ` [PATCH v3 5/5] iio: adc: ad7380: add oversampling support David Lechner
2024-06-02  9:25 ` [PATCH v3 0/5] iio: add support for multiple scan types Jonathan Cameron
2024-06-02  9:27   ` Jonathan Cameron
2024-06-02  9:37     ` Jonathan Cameron
2024-06-03 10:25   ` Nuno Sá
2024-06-03 19:55     ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox