1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_IIO_TRIGGERED_BUFFER_H_
3 #define _LINUX_IIO_TRIGGERED_BUFFER_H_
4 
5 #include <linux/iio/buffer.h>
6 #include <linux/interrupt.h>
7 
8 struct attribute;
9 struct iio_dev;
10 struct iio_buffer_setup_ops;
11 
12 int iio_triggered_buffer_setup_ext(struct iio_dev *indio_dev,
13 	irqreturn_t (*h)(int irq, void *p),
14 	irqreturn_t (*thread)(int irq, void *p),
15 	enum iio_buffer_direction direction,
16 	const struct iio_buffer_setup_ops *setup_ops,
17 	const struct attribute **buffer_attrs);
18 void iio_triggered_buffer_cleanup(struct iio_dev *indio_dev);
19 
20 #define iio_triggered_buffer_setup(indio_dev, h, thread, setup_ops)		\
21 	iio_triggered_buffer_setup_ext((indio_dev), (h), (thread),		\
22 					IIO_BUFFER_DIRECTION_IN, (setup_ops),	\
23 					NULL)
24 
25 int devm_iio_triggered_buffer_setup_ext(struct device *dev,
26 					struct iio_dev *indio_dev,
27 					irqreturn_t (*h)(int irq, void *p),
28 					irqreturn_t (*thread)(int irq, void *p),
29 					enum iio_buffer_direction direction,
30 					const struct iio_buffer_setup_ops *ops,
31 					const struct attribute **buffer_attrs);
32 
33 #define devm_iio_triggered_buffer_setup(dev, indio_dev, h, thread, setup_ops)	\
34 	devm_iio_triggered_buffer_setup_ext((dev), (indio_dev), (h), (thread),	\
35 					    IIO_BUFFER_DIRECTION_IN,		\
36 					    (setup_ops), NULL)
37 
38 #endif
39