1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright 2014-2015 Analog Devices Inc.
4  *  Author: Lars-Peter Clausen <lars@metafoo.de>
5  */
6 
7 #ifndef __IIO_DMAENGINE_H__
8 #define __IIO_DMAENGINE_H__
9 
10 #include <linux/iio/buffer.h>
11 
12 struct iio_dev;
13 struct device;
14 
15 void iio_dmaengine_buffer_free(struct iio_buffer *buffer);
16 struct iio_buffer *iio_dmaengine_buffer_setup_ext(struct device *dev,
17 						  struct iio_dev *indio_dev,
18 						  const char *channel,
19 						  enum iio_buffer_direction dir);
20 
21 #define iio_dmaengine_buffer_setup(dev, indio_dev, channel)	\
22 	iio_dmaengine_buffer_setup_ext(dev, indio_dev, channel,	\
23 				       IIO_BUFFER_DIRECTION_IN)
24 
25 int devm_iio_dmaengine_buffer_setup_ext(struct device *dev,
26 					struct iio_dev *indio_dev,
27 					const char *channel,
28 					enum iio_buffer_direction dir);
29 
30 #define devm_iio_dmaengine_buffer_setup(dev, indio_dev, channel)	\
31 	devm_iio_dmaengine_buffer_setup_ext(dev, indio_dev, channel,	\
32 					    IIO_BUFFER_DIRECTION_IN)
33 
34 #endif
35