summaryrefslogtreecommitdiff
path: root/include/linux/iio/buffer.h
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-10-13 18:10:27 +0200
committerJonathan Cameron <jic23@kernel.org>2015-10-25 13:52:31 +0000
commite18a2ad45caeb11226e49c25068d0f2efe2adf6c (patch)
tree114be0686488813e493c28cdac988ad36de055ec /include/linux/iio/buffer.h
parentb440655b896b2d5a2fb5f918801fb0e281a537cd (diff)
iio: Add buffer enable/disable callbacks
This patch adds a enable and disable callback that is called when the buffer is enabled/disabled. This can be used by buffer implementations that need to do some setup or teardown work. E.g. a DMA based buffer can use this to start/stop the DMA transfer. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'include/linux/iio/buffer.h')
-rw-r--r--include/linux/iio/buffer.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index 4d99a53d1fe7..2ec3ad58e8a0 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -33,6 +33,11 @@ struct iio_buffer;
* storage.
* @set_bytes_per_datum:set number of bytes per datum
* @set_length: set number of datums in buffer
+ * @enable: called if the buffer is attached to a device and the
+ * device starts sampling. Calls are balanced with
+ * @disable.
+ * @disable: called if the buffer is attached to a device and the
+ * device stops sampling. Calles are balanced with @enable.
* @release: called when the last reference to the buffer is dropped,
* should free all resources allocated by the buffer.
* @modes: Supported operating modes by this buffer type
@@ -58,6 +63,9 @@ struct iio_buffer_access_funcs {
int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd);
int (*set_length)(struct iio_buffer *buffer, int length);
+ int (*enable)(struct iio_buffer *buffer, struct iio_dev *indio_dev);
+ int (*disable)(struct iio_buffer *buffer, struct iio_dev *indio_dev);
+
void (*release)(struct iio_buffer *buffer);
unsigned int modes;