* [PATCH] iio: ad7152: Fix differential channel return value and increase delay.
@ 2011-08-25 10:58 michael.hennerich
2011-08-25 13:45 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: michael.hennerich @ 2011-08-25 10:58 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, device-drivers-devel, drivers, Michael Hennerich
From: Michael Hennerich <michael.hennerich@analog.com>
In differential mode zero scale equals to 0x8000.
Increase readout delay by 1ms.
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
---
drivers/staging/iio/adc/ad7152.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/iio/adc/ad7152.c b/drivers/staging/iio/adc/ad7152.c
index 41c3102..42efc37 100644
--- a/drivers/staging/iio/adc/ad7152.c
+++ b/drivers/staging/iio/adc/ad7152.c
@@ -159,9 +159,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,
@@ -366,6 +366,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):
--
1.7.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: ad7152: Fix differential channel return value and increase delay.
2011-08-25 10:58 [PATCH] iio: ad7152: Fix differential channel return value and increase delay michael.hennerich
@ 2011-08-25 13:45 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2011-08-25 13:45 UTC (permalink / raw)
To: michael.hennerich; +Cc: linux-iio, device-drivers-devel, drivers
On 08/25/11 11:58, michael.hennerich@analog.com wrote:
> From: Michael Hennerich <michael.hennerich@analog.com>
>
> In differential mode zero scale equals to 0x8000.
> Increase readout delay by 1ms.
>
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
merged to iio-blue.git
> ---
> drivers/staging/iio/adc/ad7152.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/iio/adc/ad7152.c b/drivers/staging/iio/adc/ad7152.c
> index 41c3102..42efc37 100644
> --- a/drivers/staging/iio/adc/ad7152.c
> +++ b/drivers/staging/iio/adc/ad7152.c
> @@ -159,9 +159,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,
> @@ -366,6 +366,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):
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-08-25 13:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-25 10:58 [PATCH] iio: ad7152: Fix differential channel return value and increase delay michael.hennerich
2011-08-25 13:45 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).