This source file includes following definitions.
- iio_triggered_event_setup
- iio_triggered_event_cleanup
1
2
3
4
5
6 #include <linux/kernel.h>
7 #include <linux/export.h>
8 #include <linux/module.h>
9 #include <linux/iio/iio.h>
10 #include <linux/iio/triggered_event.h>
11 #include <linux/iio/trigger_consumer.h>
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 int iio_triggered_event_setup(struct iio_dev *indio_dev,
31 irqreturn_t (*h)(int irq, void *p),
32 irqreturn_t (*thread)(int irq, void *p))
33 {
34 indio_dev->pollfunc_event = iio_alloc_pollfunc(h,
35 thread,
36 IRQF_ONESHOT,
37 indio_dev,
38 "%s_consumer%d",
39 indio_dev->name,
40 indio_dev->id);
41 if (indio_dev->pollfunc_event == NULL)
42 return -ENOMEM;
43
44
45 indio_dev->modes |= INDIO_EVENT_TRIGGERED;
46
47 return 0;
48 }
49 EXPORT_SYMBOL(iio_triggered_event_setup);
50
51
52
53
54
55 void iio_triggered_event_cleanup(struct iio_dev *indio_dev)
56 {
57 indio_dev->modes &= ~INDIO_EVENT_TRIGGERED;
58 iio_dealloc_pollfunc(indio_dev->pollfunc_event);
59 }
60 EXPORT_SYMBOL(iio_triggered_event_cleanup);
61
62 MODULE_AUTHOR("Vladimir Barinov");
63 MODULE_DESCRIPTION("IIO helper functions for setting up triggered events");
64 MODULE_LICENSE("GPL");