Commit 45240340 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Jonathan Cameron

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: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent d5304b77
...@@ -486,7 +486,7 @@ static int adis16220_read_raw(struct iio_dev *indio_dev, ...@@ -486,7 +486,7 @@ static int adis16220_read_raw(struct iio_dev *indio_dev,
break; break;
case IIO_CHAN_INFO_OFFSET: case IIO_CHAN_INFO_OFFSET:
if (chan->type == IIO_TEMP) { if (chan->type == IIO_TEMP) {
*val = 25; *val = 25000 / -470 - 1278; /* 25 C = 1278 */
return IIO_VAL_INT; return IIO_VAL_INT;
} }
addrind = 1; addrind = 1;
...@@ -495,19 +495,22 @@ static int adis16220_read_raw(struct iio_dev *indio_dev, ...@@ -495,19 +495,22 @@ static int adis16220_read_raw(struct iio_dev *indio_dev,
addrind = 2; addrind = 2;
break; break;
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
*val = 0;
switch (chan->type) { switch (chan->type) {
case IIO_TEMP: case IIO_TEMP:
*val2 = -470000; *val = -470; /* -0.47 C */
*val2 = 0;
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_ACCEL: case IIO_ACCEL:
*val2 = 1887042; *val2 = IIO_G_TO_M_S_2(19073); /* 19.073 g */
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_VOLTAGE: case IIO_VOLTAGE:
if (chan->channel == 0) if (chan->channel == 0) {
*val2 = 0012221; *val = 1;
else /* Should really be dependent on VDD */ *val2 = 220700; /* 1.2207 mV */
*val2 = 305; } else {
/* Should really be dependent on VDD */
*val2 = 305180; /* 305.18 uV */
}
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
default: default:
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment