iio: Support triggered events
Support triggered events. This is useful for chips that don't have their own interrupt sources. It allows to use generic/standalone iio triggers for those drivers. Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:

committed by
Jonathan Cameron

parent
764589b688
commit
735ad074ff
@@ -294,6 +294,7 @@ static inline s64 iio_get_time_ns(void)
|
||||
#define INDIO_BUFFER_TRIGGERED 0x02
|
||||
#define INDIO_BUFFER_SOFTWARE 0x04
|
||||
#define INDIO_BUFFER_HARDWARE 0x08
|
||||
#define INDIO_EVENT_TRIGGERED 0x10
|
||||
|
||||
#define INDIO_ALL_BUFFER_MODES \
|
||||
(INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE | INDIO_BUFFER_SOFTWARE)
|
||||
@@ -457,6 +458,7 @@ struct iio_buffer_setup_ops {
|
||||
* @scan_index_timestamp:[INTERN] cache of the index to the timestamp
|
||||
* @trig: [INTERN] current device trigger (buffer modes)
|
||||
* @pollfunc: [DRIVER] function run on trigger being received
|
||||
* @pollfunc_event: [DRIVER] function run on events trigger being received
|
||||
* @channels: [DRIVER] channel specification structure table
|
||||
* @num_channels: [DRIVER] number of channels specified in @channels.
|
||||
* @channel_attr_list: [INTERN] keep track of automatically created channel
|
||||
@@ -495,6 +497,7 @@ struct iio_dev {
|
||||
unsigned scan_index_timestamp;
|
||||
struct iio_trigger *trig;
|
||||
struct iio_poll_func *pollfunc;
|
||||
struct iio_poll_func *pollfunc_event;
|
||||
|
||||
struct iio_chan_spec const *channels;
|
||||
int num_channels;
|
||||
|
11
include/linux/iio/triggered_event.h
Normal file
11
include/linux/iio/triggered_event.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#ifndef _LINUX_IIO_TRIGGERED_EVENT_H_
|
||||
#define _LINUX_IIO_TRIGGERED_EVENT_H_
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
int iio_triggered_event_setup(struct iio_dev *indio_dev,
|
||||
irqreturn_t (*h)(int irq, void *p),
|
||||
irqreturn_t (*thread)(int irq, void *p));
|
||||
void iio_triggered_event_cleanup(struct iio_dev *indio_dev);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user