diff options
Diffstat (limited to 'include/linux/iio/buffer_impl.h')
| -rw-r--r-- | include/linux/iio/buffer_impl.h | 33 | 
1 files changed, 33 insertions, 0 deletions
| diff --git a/include/linux/iio/buffer_impl.h b/include/linux/iio/buffer_impl.h index 89c3fd7c29ca..e72552e026f3 100644 --- a/include/linux/iio/buffer_impl.h +++ b/include/linux/iio/buffer_impl.h @@ -9,8 +9,12 @@  #include <uapi/linux/iio/buffer.h>  #include <linux/iio/buffer.h> +struct dma_buf_attachment; +struct dma_fence;  struct iio_dev; +struct iio_dma_buffer_block;  struct iio_buffer; +struct sg_table;  /**   * INDIO_BUFFER_FLAG_FIXED_WATERMARK - Watermark level of the buffer can not be @@ -39,6 +43,16 @@ struct iio_buffer;   *                      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. + * @attach_dmabuf:	called from userspace via ioctl to attach one external + *			DMABUF. + * @detach_dmabuf:	called from userspace via ioctl to detach one previously + *			attached DMABUF. + * @enqueue_dmabuf:	called from userspace via ioctl to queue this DMABUF + *			object to this buffer. Requires a valid DMABUF fd, that + *			was previouly attached to this buffer. + * @lock_queue:		called when the core needs to lock the buffer queue; + *                      it is used when enqueueing DMABUF objects. + * @unlock_queue:       used to unlock a previously locked buffer queue   * @modes:		Supported operating modes by this buffer type   * @flags:		A bitmask combination of INDIO_BUFFER_FLAG_*   * @@ -68,6 +82,17 @@ struct iio_buffer_access_funcs {  	void (*release)(struct iio_buffer *buffer); +	struct iio_dma_buffer_block * (*attach_dmabuf)(struct iio_buffer *buffer, +						       struct dma_buf_attachment *attach); +	void (*detach_dmabuf)(struct iio_buffer *buffer, +			      struct iio_dma_buffer_block *block); +	int (*enqueue_dmabuf)(struct iio_buffer *buffer, +			      struct iio_dma_buffer_block *block, +			      struct dma_fence *fence, struct sg_table *sgt, +			      size_t size, bool cyclic); +	void (*lock_queue)(struct iio_buffer *buffer); +	void (*unlock_queue)(struct iio_buffer *buffer); +  	unsigned int modes;  	unsigned int flags;  }; @@ -136,6 +161,12 @@ struct iio_buffer {  	/* @ref: Reference count of the buffer. */  	struct kref ref; + +	/* @dmabufs: List of DMABUF attachments */ +	struct list_head dmabufs; /* P: dmabufs_mutex */ + +	/* @dmabufs_mutex: Protects dmabufs */ +	struct mutex dmabufs_mutex;  };  /** @@ -159,6 +190,8 @@ void iio_buffer_init(struct iio_buffer *buffer);  struct iio_buffer *iio_buffer_get(struct iio_buffer *buffer);  void iio_buffer_put(struct iio_buffer *buffer); +void iio_buffer_signal_dmabuf_done(struct dma_fence *fence, int ret); +  #else /* CONFIG_IIO_BUFFER */  static inline void iio_buffer_get(struct iio_buffer *buffer) {} |