]> git.karo-electronics.de Git - karo-tx-linux.git/blob - drivers/staging/iio/trigger_consumer.h
merged selected files from staging-next
[karo-tx-linux.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 //      void *pf_private;
33 };
34
35
36 struct iio_poll_func
37 *iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
38                     irqreturn_t (*thread)(int irq, void *p),
39                     int type,
40                     struct iio_dev *indio_dev,
41 //              void *private_data,
42                     const char *fmt,
43                     ...);
44 void iio_dealloc_pollfunc(struct iio_poll_func *pf);
45 irqreturn_t iio_pollfunc_store_time(int irq, void *p);
46
47 void iio_trigger_notify_done(struct iio_trigger *trig);
48
49 /*
50  * Two functions for common case where all that happens is a pollfunc
51  * is attached and detached from a trigger
52  */
53 int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
54 int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);