Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /* The industrial I/O core, trigger consumer functions
0003  *
0004  * Copyright (c) 2008-2011 Jonathan Cameron
0005  */
0006 
0007 #ifndef __LINUX_IIO_TRIGGER_CONSUMER_H__
0008 #define __LINUX_IIO_TRIGGER_CONSUMER_H__
0009 
0010 #include <linux/interrupt.h>
0011 #include <linux/types.h>
0012 
0013 struct iio_dev;
0014 struct iio_trigger;
0015 
0016 /**
0017  * struct iio_poll_func - poll function pair
0018  *
0019  * @indio_dev:          data specific to device (passed into poll func)
0020  * @h:              the function that is actually run on trigger
0021  * @thread:         threaded interrupt part
0022  * @type:           the type of interrupt (basically if oneshot)
0023  * @name:           name used to identify the trigger consumer.
0024  * @irq:            the corresponding irq as allocated from the
0025  *              trigger pool
0026  * @timestamp:          some devices need a timestamp grabbed as soon
0027  *              as possible after the trigger - hence handler
0028  *              passes it via here.
0029  **/
0030 struct iio_poll_func {
0031     struct iio_dev *indio_dev;
0032     irqreturn_t (*h)(int irq, void *p);
0033     irqreturn_t (*thread)(int irq, void *p);
0034     int type;
0035     char *name;
0036     int irq;
0037     s64 timestamp;
0038 };
0039 
0040 
0041 __printf(5, 6) struct iio_poll_func
0042 *iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
0043             irqreturn_t (*thread)(int irq, void *p),
0044             int type,
0045             struct iio_dev *indio_dev,
0046             const char *fmt,
0047             ...);
0048 void iio_dealloc_pollfunc(struct iio_poll_func *pf);
0049 irqreturn_t iio_pollfunc_store_time(int irq, void *p);
0050 
0051 void iio_trigger_notify_done(struct iio_trigger *trig);
0052 
0053 #endif