summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2011-09-02 16:25:31 (GMT)
committerGreg Kroah-Hartman <gregkh@suse.de>2011-09-06 23:03:31 (GMT)
commitfe55a170399a0f30d1268848d2cb99dcf8fa413b (patch)
treeff402e14eec41cbbb1ca72877ac154da0c610f64
parentc3b7915df6356cee6412f24fbdcbf4f7ec107a5a (diff)
downloadlinux-fe55a170399a0f30d1268848d2cb99dcf8fa413b.tar.xz
staging:iio:adc:ad7152: Fix differential channel return value and increase delay.
In differential mode zero scale equals to 0x8000. Increase readout delay by 1ms. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/iio/adc/ad7152.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/staging/iio/adc/ad7152.c b/drivers/staging/iio/adc/ad7152.c
index 122d56c..42996b9 100644
--- a/drivers/staging/iio/adc/ad7152.c
+++ b/drivers/staging/iio/adc/ad7152.c
@@ -160,9 +160,9 @@ static IIO_DEVICE_ATTR(in_capacitance0_calibscale_calibration,
static IIO_DEVICE_ATTR(in_capacitance1_calibscale_calibration,
S_IWUSR, NULL, ad7152_start_gain_calib, 1);
-/* Values are Update Rate (Hz), Conversion Time (ms) */
+/* Values are Update Rate (Hz), Conversion Time (ms) + 1*/
static const unsigned char ad7152_filter_rate_table[][2] = {
- {200, 5}, {50, 20}, {20, 50}, {17, 60},
+ {200, 5 + 1}, {50, 20 + 1}, {20, 50 + 1}, {17, 60 + 1},
};
static ssize_t ad7152_show_filter_rate_setup(struct device *dev,
@@ -367,6 +367,9 @@ static int ad7152_read_raw(struct iio_dev *indio_dev,
goto out;
*val = swab16(ret);
+ if (chan->differential)
+ *val -= 0x8000;
+
ret = IIO_VAL_INT;
break;
case (1 << IIO_CHAN_INFO_CALIBSCALE_SEPARATE):