diff options
author | Vladimir Barinov <vladimir.barinov@cogentembedded.com> | 2015-08-20 21:37:39 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-08-27 21:47:09 +0200 |
commit | 735ad074ffa72ccc4fdba8e54eb024df95545e7d (patch) | |
tree | 5cc52d06761fba79d2a70ce0d665b1c583bf386c /drivers/iio/industrialio-trigger.c | |
parent | iio: mlx90614: Implement filter configuration (diff) | |
download | linux-735ad074ffa72ccc4fdba8e54eb024df95545e7d.tar.xz linux-735ad074ffa72ccc4fdba8e54eb024df95545e7d.zip |
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>
Diffstat (limited to 'drivers/iio/industrialio-trigger.c')
-rw-r--r-- | drivers/iio/industrialio-trigger.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c index 570606c2adbd..ae2806aafb72 100644 --- a/drivers/iio/industrialio-trigger.c +++ b/drivers/iio/industrialio-trigger.c @@ -366,10 +366,18 @@ static ssize_t iio_trigger_write_current(struct device *dev, indio_dev->trig = trig; - if (oldtrig) + if (oldtrig) { + if (indio_dev->modes & INDIO_EVENT_TRIGGERED) + iio_trigger_detach_poll_func(oldtrig, + indio_dev->pollfunc_event); iio_trigger_put(oldtrig); - if (indio_dev->trig) + } + if (indio_dev->trig) { iio_trigger_get(indio_dev->trig); + if (indio_dev->modes & INDIO_EVENT_TRIGGERED) + iio_trigger_attach_poll_func(indio_dev->trig, + indio_dev->pollfunc_event); + } return len; } |