summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc
diff options
context:
space:
mode:
authorPeter Meerwald <pmeerw@pmeerw.net>2014-12-06 05:54:00 +0000
committerJonathan Cameron <jic23@kernel.org>2014-07-13 21:58:59 +0100
commit1d15330a399217500d496f8cd1852e11225000a1 (patch)
treec2cea263a55e3d24ccb123caee2ba326229c34de /drivers/iio/adc
parent8235841b95f5c2b88b2fd012b419c2f4adaeb898 (diff)
downloadop-kernel-dev-1d15330a399217500d496f8cd1852e11225000a1.zip
op-kernel-dev-1d15330a399217500d496f8cd1852e11225000a1.tar.gz
iio:adc:ad799x: Return more meaningful event enabled state
only report an event as enabled if it actually is enabled Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r--drivers/iio/adc/ad799x.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index abc36c8..08bcada3 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -364,7 +364,15 @@ static int ad799x_read_event_config(struct iio_dev *indio_dev,
enum iio_event_type type,
enum iio_event_direction dir)
{
- return 1;
+ struct ad799x_state *st = iio_priv(indio_dev);
+
+ if (!(st->config & AD7998_ALERT_EN))
+ return 0;
+
+ if ((st->config >> AD799X_CHANNEL_SHIFT) & BIT(chan->scan_index))
+ return 1;
+
+ return 0;
}
static unsigned int ad799x_threshold_reg(const struct iio_chan_spec *chan,
OpenPOWER on IntegriCloud