diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-10-15 05:35:00 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2012-10-19 11:13:06 -0400 |
commit | 8735cf94afc1a63526417762c288501fc239c12d (patch) | |
tree | d6e1f786eeab74334ccff703e7325bd87387c4d0 /drivers | |
parent | 9dbf8ccde1b810a59b684e1d1aec7f9d2d007162 (diff) |
staging:iio: Fix adis16201 channel offsets and scales
Most of the channel offsets and scales in the adis16201 are incorrect:
* Temperature scale is off by a factor of 1000
* Voltage scale is off by a factor of 1000
* Acceleration scale is in g instead of m/(s**2)
* Temperature offset is completely wrong
This patch fixes these issues.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/iio/accel/adis16201_core.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/drivers/staging/iio/accel/adis16201_core.c b/drivers/staging/iio/accel/adis16201_core.c index 8e37d6e04277..b12ca68cd9e4 100644 --- a/drivers/staging/iio/accel/adis16201_core.c +++ b/drivers/staging/iio/accel/adis16201_core.c | |||
@@ -310,30 +310,32 @@ static int adis16201_read_raw(struct iio_dev *indio_dev, | |||
310 | case IIO_CHAN_INFO_SCALE: | 310 | case IIO_CHAN_INFO_SCALE: |
311 | switch (chan->type) { | 311 | switch (chan->type) { |
312 | case IIO_VOLTAGE: | 312 | case IIO_VOLTAGE: |
313 | *val = 0; | 313 | if (chan->channel == 0) { |
314 | if (chan->channel == 0) | 314 | *val = 1; |
315 | *val2 = 1220; | 315 | *val2 = 220000; /* 1.22 mV */ |
316 | else | 316 | } else { |
317 | *val2 = 610; | 317 | *val = 0; |
318 | *val2 = 610000; /* 0.610 mV */ | ||
319 | } | ||
318 | return IIO_VAL_INT_PLUS_MICRO; | 320 | return IIO_VAL_INT_PLUS_MICRO; |
319 | case IIO_TEMP: | 321 | case IIO_TEMP: |
320 | *val = 0; | 322 | *val = -470; /* 0.47 C */ |
321 | *val2 = -470000; | 323 | *val2 = 0; |
322 | return IIO_VAL_INT_PLUS_MICRO; | 324 | return IIO_VAL_INT_PLUS_MICRO; |
323 | case IIO_ACCEL: | 325 | case IIO_ACCEL: |
324 | *val = 0; | 326 | *val = 0; |
325 | *val2 = 462500; | 327 | *val2 = IIO_G_TO_M_S_2(462400); /* 0.4624 mg */ |
326 | return IIO_VAL_INT_PLUS_MICRO; | 328 | return IIO_VAL_INT_PLUS_NANO; |
327 | case IIO_INCLI: | 329 | case IIO_INCLI: |
328 | *val = 0; | 330 | *val = 0; |
329 | *val2 = 100000; | 331 | *val2 = 100000; /* 0.1 degree */ |
330 | return IIO_VAL_INT_PLUS_MICRO; | 332 | return IIO_VAL_INT_PLUS_MICRO; |
331 | default: | 333 | default: |
332 | return -EINVAL; | 334 | return -EINVAL; |
333 | } | 335 | } |
334 | break; | 336 | break; |
335 | case IIO_CHAN_INFO_OFFSET: | 337 | case IIO_CHAN_INFO_OFFSET: |
336 | *val = 25; | 338 | *val = 25000 / -470 - 1278; /* 25 C = 1278 */ |
337 | return IIO_VAL_INT; | 339 | return IIO_VAL_INT; |
338 | case IIO_CHAN_INFO_CALIBBIAS: | 340 | case IIO_CHAN_INFO_CALIBBIAS: |
339 | switch (chan->type) { | 341 | switch (chan->type) { |