1 /* The industrial I/O core, trigger consumer functions
3 * Copyright (c) 2008-2011 Jonathan Cameron
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.
10 #ifndef __LINUX_IIO_TRIGGER_CONSUMER_H__
11 #define __LINUX_IIO_TRIGGER_CONSUMER_H__
13 #include <linux/interrupt.h>
14 #include <linux/types.h>
20 * struct iio_poll_func - poll function pair
22 * @indio_dev: data specific to device (passed into poll func)
23 * @h: the function that is actually run on trigger
24 * @thread: threaded interrupt part
25 * @type: the type of interrupt (basically if oneshot)
26 * @name: name used to identify the trigger consumer.
27 * @irq: the corresponding irq as allocated from the
29 * @timestamp: some devices need a timestamp grabbed as soon
30 * as possible after the trigger - hence handler
33 struct iio_poll_func {
34 struct iio_dev *indio_dev;
35 irqreturn_t (*h)(int irq, void *p);
36 irqreturn_t (*thread)(int irq, void *p);
45 *iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
46 irqreturn_t (*thread)(int irq, void *p),
48 struct iio_dev *indio_dev,
51 void iio_dealloc_pollfunc(struct iio_poll_func *pf);
52 irqreturn_t iio_pollfunc_store_time(int irq, void *p);
54 void iio_trigger_notify_done(struct iio_trigger *trig);
57 * Two functions for common case where all that happens is a pollfunc
58 * is attached and detached from a trigger
60 int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
61 int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);