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