staging:iio: treewide rename iio_triggered_ring_* to iio_triggered_buffer_*
[pandora-kernel.git] / drivers / staging / iio / trigger_consumer.h
1 /* The industrial I/O core, trigger consumer functions
2  *
3  * Copyright (c) 2008-2011 Jonathan Cameron
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 as published by
7  * the Free Software Foundation.
8  */
9
10 /**
11  * struct iio_poll_func - poll function pair
12  *
13  * @indio_dev:                  data specific to device (passed into poll func)
14  * @h:                          the function that is actually run on trigger
15  * @thread:                     threaded interrupt part
16  * @type:                       the type of interrupt (basically if oneshot)
17  * @name:                       name used to identify the trigger consumer.
18  * @irq:                        the corresponding irq as allocated from the
19  *                              trigger pool
20  * @timestamp:                  some devices need a timestamp grabbed as soon
21  *                              as possible after the trigger - hence handler
22  *                              passes it via here.
23  **/
24 struct iio_poll_func {
25         struct iio_dev *indio_dev;
26         irqreturn_t (*h)(int irq, void *p);
27         irqreturn_t (*thread)(int irq, void *p);
28         int type;
29         char *name;
30         int irq;
31         s64 timestamp;
32 };
33
34
35 struct iio_poll_func
36 *iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
37                     irqreturn_t (*thread)(int irq, void *p),
38                     int type,
39                     struct iio_dev *indio_dev,
40                     const char *fmt,
41                     ...);
42 void iio_dealloc_pollfunc(struct iio_poll_func *pf);
43 irqreturn_t iio_pollfunc_store_time(int irq, void *p);
44
45 void iio_trigger_notify_done(struct iio_trigger *trig);
46
47 /*
48  * Two functions for common case where all that happens is a pollfunc
49  * is attached and detached from a trigger
50  */
51 int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
52 int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);