diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2011-05-18 09:42:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-05-19 19:15:00 -0400 |
commit | d91a0ab06ca27ec552233b5225e80661125fe1b2 (patch) | |
tree | 24a1a6a0cdff5116185087d6ce6dbdd48d200a19 /drivers | |
parent | 41c775240a78fac3e2bd7f024c3cf0d61547249e (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/iio/adc/ad7150.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/drivers/staging/iio/adc/ad7150.c b/drivers/staging/iio/adc/ad7150.c index cbd1f96188c3..e23bb9960019 100644 --- a/drivers/staging/iio/adc/ad7150.c +++ b/drivers/staging/iio/adc/ad7150.c | |||
@@ -642,11 +642,6 @@ static const struct attribute_group ad7150_attribute_group = { | |||
642 | * threshold events | 642 | * threshold events |
643 | */ | 643 | */ |
644 | 644 | ||
645 | #define IIO_EVENT_CODE_CH1_HIGH IIO_BUFFER_EVENT_CODE(0) | ||
646 | #define IIO_EVENT_CODE_CH1_LOW IIO_BUFFER_EVENT_CODE(1) | ||
647 | #define IIO_EVENT_CODE_CH2_HIGH IIO_BUFFER_EVENT_CODE(2) | ||
648 | #define IIO_EVENT_CODE_CH2_LOW IIO_BUFFER_EVENT_CODE(3) | ||
649 | |||
650 | static irqreturn_t ad7150_event_handler(int irq, void *private) | 645 | static irqreturn_t ad7150_event_handler(int irq, void *private) |
651 | { | 646 | { |
652 | struct iio_dev *indio_dev = private; | 647 | struct iio_dev *indio_dev = private; |
@@ -658,21 +653,33 @@ static irqreturn_t ad7150_event_handler(int irq, void *private) | |||
658 | 653 | ||
659 | if ((int_status & AD7150_STATUS_OUT1) && !(chip->old_state & AD7150_STATUS_OUT1)) | 654 | if ((int_status & AD7150_STATUS_OUT1) && !(chip->old_state & AD7150_STATUS_OUT1)) |
660 | iio_push_event(indio_dev, 0, | 655 | iio_push_event(indio_dev, 0, |
661 | IIO_EVENT_CODE_CH1_HIGH, | 656 | IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, |
657 | 0, | ||
658 | IIO_EV_TYPE_THRESH, | ||
659 | IIO_EV_DIR_RISING), | ||
662 | timestamp); | 660 | timestamp); |
663 | else if ((!(int_status & AD7150_STATUS_OUT1)) && (chip->old_state & AD7150_STATUS_OUT1)) | 661 | else if ((!(int_status & AD7150_STATUS_OUT1)) && (chip->old_state & AD7150_STATUS_OUT1)) |
664 | iio_push_event(indio_dev, 0, | 662 | iio_push_event(indio_dev, 0, |
665 | IIO_EVENT_CODE_CH1_LOW, | 663 | IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, |
666 | timestamp); | 664 | 0, |
665 | IIO_EV_TYPE_THRESH, | ||
666 | IIO_EV_DIR_FALLING), | ||
667 | timestamp); | ||
667 | 668 | ||
668 | if ((int_status & AD7150_STATUS_OUT2) && !(chip->old_state & AD7150_STATUS_OUT2)) | 669 | if ((int_status & AD7150_STATUS_OUT2) && !(chip->old_state & AD7150_STATUS_OUT2)) |
669 | iio_push_event(indio_dev, 0, | 670 | iio_push_event(indio_dev, 0, |
670 | IIO_EVENT_CODE_CH2_HIGH, | 671 | IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, |
671 | timestamp); | 672 | 1, |
673 | IIO_EV_TYPE_THRESH, | ||
674 | IIO_EV_DIR_RISING), | ||
675 | timestamp); | ||
672 | else if ((!(int_status & AD7150_STATUS_OUT2)) && (chip->old_state & AD7150_STATUS_OUT2)) | 676 | else if ((!(int_status & AD7150_STATUS_OUT2)) && (chip->old_state & AD7150_STATUS_OUT2)) |
673 | iio_push_event(indio_dev, 0, | 677 | iio_push_event(indio_dev, 0, |
674 | IIO_EVENT_CODE_CH2_LOW, | 678 | IIO_UNMOD_EVENT_CODE(IIO_EV_CLASS_IN, |
675 | timestamp); | 679 | 1, |
680 | IIO_EV_TYPE_THRESH, | ||
681 | IIO_EV_DIR_FALLING), | ||
682 | timestamp); | ||
676 | return IRQ_HANDLED; | 683 | return IRQ_HANDLED; |
677 | } | 684 | } |
678 | 685 | ||