Commit d91a0ab0 authored by Jonathan Cameron's avatar Jonathan Cameron Committed by Greg Kroah-Hartman

staging:iio:adc:ad7150 fix event codes.

I won't guarantee I got these right, but they are certainly closer than
the abuse of buffer event codes that was perviously in here.
Signed-off-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 41c77524
......@@ -642,11 +642,6 @@ static const struct attribute_group ad7150_attribute_group = {
* threshold events
*/
#define IIO_EVENT_CODE_CH1_HIGH IIO_BUFFER_EVENT_CODE(0)
#define IIO_EVENT_CODE_CH1_LOW IIO_BUFFER_EVENT_CODE(1)
#define IIO_EVENT_CODE_CH2_HIGH IIO_BUFFER_EVENT_CODE(2)
#define IIO_EVENT_CODE_CH2_LOW IIO_BUFFER_EVENT_CODE(3)
static irqreturn_t ad7150_event_handler(int irq, void *private)
{
struct iio_dev *indio_dev = private;
......@@ -658,21 +653,33 @@ static irqreturn_t ad7150_event_handler(int irq, void *private)
if ((int_status & AD7150_STATUS_OUT1) && !(chip->old_state & AD7150_STATUS_OUT1))
iio_push_event(indio_dev, 0,
IIO_EVENT_CODE_CH1_HIGH,
IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN,
0,
IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING),
timestamp);
else if ((!(int_status & AD7150_STATUS_OUT1)) && (chip->old_state & AD7150_STATUS_OUT1))
iio_push_event(indio_dev, 0,
IIO_EVENT_CODE_CH1_LOW,
timestamp);
IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN,
0,
IIO_EV_TYPE_THRESH,
IIO_EV_DIR_FALLING),
timestamp);
if ((int_status & AD7150_STATUS_OUT2) && !(chip->old_state & AD7150_STATUS_OUT2))
iio_push_event(indio_dev, 0,
IIO_EVENT_CODE_CH2_HIGH,
timestamp);
IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN,
1,
IIO_EV_TYPE_THRESH,
IIO_EV_DIR_RISING),
timestamp);
else if ((!(int_status & AD7150_STATUS_OUT2)) && (chip->old_state & AD7150_STATUS_OUT2))
iio_push_event(indio_dev, 0,
IIO_EVENT_CODE_CH2_LOW,
timestamp);
IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN,
1,
IIO_EV_TYPE_THRESH,
IIO_EV_DIR_FALLING),
timestamp);
return IRQ_HANDLED;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment