diff options
author | Jonathan Cameron <jic23@cam.ac.uk> | 2011-09-02 16:14:45 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-09-06 23:02:03 (GMT) |
commit | ade7ef7ba3bf888b90269f8ca864841b2cd9803f (patch) | |
tree | 1713b66c05abbbb1ee023a72e4e1f5e591bb9762 /drivers/staging/iio/adc/ad7280a.c | |
parent | 8ce7375be7036d6e536b6341ec83e5db849cda6e (diff) | |
download | linux-fsl-qoriq-ade7ef7ba3bf888b90269f8ca864841b2cd9803f.tar.xz |
staging:iio: Differential channel handling - use explicit flag rather than types.
Straight forward change in the core, but required some drivers to not use
the IIO_CHAN macro as that doesn't allow setting this bit (and is
going away anyway). Hence the churn.
Tested on max1363 with a couple of supported parts.
V2: differential bit in code got 7 bits and direction 1. Reversed that.
Issue spotted by Michael - thanks!
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Michael Hennerich <Michael.Hennerich@analog.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/iio/adc/ad7280a.c')
-rw-r--r-- | drivers/staging/iio/adc/ad7280a.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c index bdc325d..2d8d650 100644 --- a/drivers/staging/iio/adc/ad7280a.c +++ b/drivers/staging/iio/adc/ad7280a.c @@ -495,7 +495,8 @@ static int ad7280_channel_init(struct ad7280_state *st) for (ch = AD7280A_CELL_VOLTAGE_1; ch <= AD7280A_AUX_ADC_6; ch++, cnt++) { if (ch < AD7280A_AUX_ADC_1) { - st->channels[cnt].type = IIO_IN_DIFF; + st->channels[cnt].type = IIO_VOLTAGE; + st->channels[cnt].differential = 1; st->channels[cnt].channel = (dev * 6) + ch; st->channels[cnt].channel2 = st->channels[cnt].channel + 1; @@ -515,7 +516,8 @@ static int ad7280_channel_init(struct ad7280_state *st) st->channels[cnt].scan_type.shift = 0; } - st->channels[cnt].type = IIO_IN_DIFF; + st->channels[cnt].type = IIO_VOLTAGE; + st->channels[cnt].differential = 1; st->channels[cnt].channel = 0; st->channels[cnt].channel2 = dev * 6; st->channels[cnt].address = AD7280A_ALL_CELLS; @@ -692,18 +694,22 @@ static irqreturn_t ad7280_event_handler(int irq, void *private) if (((channels[i] >> 11) & 0xFFF) >= st->cell_threshhigh) iio_push_event(dev_info, - IIO_UNMOD_EVENT_CODE(IIO_IN_DIFF, - 0, - IIO_EV_TYPE_THRESH, - IIO_EV_DIR_RISING), + IIO_EVENT_CODE(IIO_VOLTAGE, + 1, + 0, + IIO_EV_DIR_RISING, + IIO_EV_TYPE_THRESH, + 0, 0, 0), iio_get_time_ns()); else if (((channels[i] >> 11) & 0xFFF) <= st->cell_threshlow) iio_push_event(dev_info, - IIO_UNMOD_EVENT_CODE(IIO_IN_DIFF, - 0, - IIO_EV_TYPE_THRESH, - IIO_EV_DIR_FALLING), + IIO_EVENT_CODE(IIO_VOLTAGE, + 1, + 0, + IIO_EV_DIR_FALLING, + IIO_EV_TYPE_THRESH, + 0, 0, 0), iio_get_time_ns()); } else { if (((channels[i] >> 11) & 0xFFF) >= st->aux_threshhigh) |