]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - include/linux/iio/trigger_consumer.h
treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500
[mirror_ubuntu-hirsute-kernel.git] / include / linux / iio / trigger_consumer.h
CommitLineData
d2912cb1 1/* SPDX-License-Identifier: GPL-2.0-only */
3f72395e
JC
2/* The industrial I/O core, trigger consumer functions
3 *
4 * Copyright (c) 2008-2011 Jonathan Cameron
3f72395e
JC
5 */
6
08d6005c
LPC
7#ifndef __LINUX_IIO_TRIGGER_CONSUMER_H__
8#define __LINUX_IIO_TRIGGER_CONSUMER_H__
9
161e7f6d
LPC
10#include <linux/interrupt.h>
11#include <linux/types.h>
12
13struct iio_dev;
14struct iio_trigger;
15
3f72395e
JC
16/**
17 * struct iio_poll_func - poll function pair
18 *
19 * @indio_dev: data specific to device (passed into poll func)
20 * @h: the function that is actually run on trigger
21 * @thread: threaded interrupt part
22 * @type: the type of interrupt (basically if oneshot)
23 * @name: name used to identify the trigger consumer.
24 * @irq: the corresponding irq as allocated from the
25 * trigger pool
26 * @timestamp: some devices need a timestamp grabbed as soon
27 * as possible after the trigger - hence handler
28 * passes it via here.
29 **/
30struct iio_poll_func {
31 struct iio_dev *indio_dev;
32 irqreturn_t (*h)(int irq, void *p);
33 irqreturn_t (*thread)(int irq, void *p);
34 int type;
35 char *name;
36 int irq;
37 s64 timestamp;
38};
39
40
41struct iio_poll_func
42*iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
43 irqreturn_t (*thread)(int irq, void *p),
44 int type,
45 struct iio_dev *indio_dev,
46 const char *fmt,
47 ...);
48void iio_dealloc_pollfunc(struct iio_poll_func *pf);
49irqreturn_t iio_pollfunc_store_time(int irq, void *p);
50
51void iio_trigger_notify_done(struct iio_trigger *trig);
52
53/*
54 * Two functions for common case where all that happens is a pollfunc
55 * is attached and detached from a trigger
56 */
3b99fb76
JC
57int iio_triggered_buffer_postenable(struct iio_dev *indio_dev);
58int iio_triggered_buffer_predisable(struct iio_dev *indio_dev);
08d6005c
LPC
59
60#endif