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:23:32 -0400 |
commit | 45240340568a799fa140645af2a45600dfe68694 (patch) | |
tree | 08de2dd6fcaf87d6eb7c60a2b2352e22326af065 /drivers/staging | |
parent | d5304b771203b62430776f3fca4823670282cbe4 (diff) |
staging:iio: Fix adis16220 channel offsets and scales
Most of the channel offsets and scales in the adis16220 are incorrect:
* Temperature scale is off by a factor of 1000
* Voltage scale is off by a factor of 1000
* Acceleration seems to have a typo "187042" since it should be instead of
"1887042"
* 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/staging')
-rw-r--r-- | drivers/staging/iio/accel/adis16220_core.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c index c755089c7117..eaadd9df3f78 100644 --- a/drivers/staging/iio/accel/adis16220_core.c +++ b/drivers/staging/iio/accel/adis16220_core.c | |||
@@ -486,7 +486,7 @@ static int adis16220_read_raw(struct iio_dev *indio_dev, | |||
486 | break; | 486 | break; |
487 | case IIO_CHAN_INFO_OFFSET: | 487 | case IIO_CHAN_INFO_OFFSET: |
488 | if (chan->type == IIO_TEMP) { | 488 | if (chan->type == IIO_TEMP) { |
489 | *val = 25; | 489 | *val = 25000 / -470 - 1278; /* 25 C = 1278 */ |
490 | return IIO_VAL_INT; | 490 | return IIO_VAL_INT; |
491 | } | 491 | } |
492 | addrind = 1; | 492 | addrind = 1; |
@@ -495,19 +495,22 @@ static int adis16220_read_raw(struct iio_dev *indio_dev, | |||
495 | addrind = 2; | 495 | addrind = 2; |
496 | break; | 496 | break; |
497 | case IIO_CHAN_INFO_SCALE: | 497 | case IIO_CHAN_INFO_SCALE: |
498 | *val = 0; | ||
499 | switch (chan->type) { | 498 | switch (chan->type) { |
500 | case IIO_TEMP: | 499 | case IIO_TEMP: |
501 | *val2 = -470000; | 500 | *val = -470; /* -0.47 C */ |
501 | *val2 = 0; | ||
502 | return IIO_VAL_INT_PLUS_MICRO; | 502 | return IIO_VAL_INT_PLUS_MICRO; |
503 | case IIO_ACCEL: | 503 | case IIO_ACCEL: |
504 | *val2 = 1887042; | 504 | *val2 = IIO_G_TO_M_S_2(19073); /* 19.073 g */ |
505 | return IIO_VAL_INT_PLUS_MICRO; | 505 | return IIO_VAL_INT_PLUS_MICRO; |
506 | case IIO_VOLTAGE: | 506 | case IIO_VOLTAGE: |
507 | if (chan->channel == 0) | 507 | if (chan->channel == 0) { |
508 | *val2 = 0012221; | 508 | *val = 1; |
509 | else /* Should really be dependent on VDD */ | 509 | *val2 = 220700; /* 1.2207 mV */ |
510 | *val2 = 305; | 510 | } else { |
511 | /* Should really be dependent on VDD */ | ||
512 | *val2 = 305180; /* 305.18 uV */ | ||
513 | } | ||
511 | return IIO_VAL_INT_PLUS_MICRO; | 514 | return IIO_VAL_INT_PLUS_MICRO; |
512 | default: | 515 | default: |
513 | return -EINVAL; | 516 | return -EINVAL; |