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>
This commit is contained in:
parent
b440655b89
commit
e18a2ad45c
2 changed files with 43 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue