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: Jonathan Cameron <jic23@cam.ac.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Jonathan Cameron 2011-05-18 14:42:13 +01:00 committed by Greg Kroah-Hartman
parent 41c775240a
commit d91a0ab06c
1 changed files with 19 additions and 12 deletions

View File

@ -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;
}