Commit 47c15308 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'iio-fixes-for-3.7a' of...

Merge tag 'iio-fixes-for-3.7a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

First round of fixes for IIO in 3.7 cycle, applies to 3.7-rc1.

Mostly a round of fixes for Analog Devices MEMs devices where some
offset values were either completely incorrect, or in the wrong units.

Also removal of an accidental duplicate entry in a Kconfig file.
parents ddffeb8c 98f9c3c1
...@@ -62,7 +62,6 @@ source "drivers/iio/frequency/Kconfig" ...@@ -62,7 +62,6 @@ source "drivers/iio/frequency/Kconfig"
source "drivers/iio/dac/Kconfig" source "drivers/iio/dac/Kconfig"
source "drivers/iio/common/Kconfig" source "drivers/iio/common/Kconfig"
source "drivers/iio/gyro/Kconfig" source "drivers/iio/gyro/Kconfig"
source "drivers/iio/light/Kconfig"
source "drivers/iio/magnetometer/Kconfig" source "drivers/iio/magnetometer/Kconfig"
endif # IIO endif # IIO
...@@ -18,5 +18,4 @@ obj-y += frequency/ ...@@ -18,5 +18,4 @@ obj-y += frequency/
obj-y += dac/ obj-y += dac/
obj-y += common/ obj-y += common/
obj-y += gyro/ obj-y += gyro/
obj-y += light/
obj-y += magnetometer/ obj-y += magnetometer/
...@@ -310,30 +310,32 @@ static int adis16201_read_raw(struct iio_dev *indio_dev, ...@@ -310,30 +310,32 @@ static int adis16201_read_raw(struct iio_dev *indio_dev,
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
switch (chan->type) { switch (chan->type) {
case IIO_VOLTAGE: case IIO_VOLTAGE:
*val = 0; if (chan->channel == 0) {
if (chan->channel == 0) *val = 1;
*val2 = 1220; *val2 = 220000; /* 1.22 mV */
else } else {
*val2 = 610; *val = 0;
*val2 = 610000; /* 0.610 mV */
}
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_TEMP: case IIO_TEMP:
*val = 0; *val = -470; /* 0.47 C */
*val2 = -470000; *val2 = 0;
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_ACCEL: case IIO_ACCEL:
*val = 0; *val = 0;
*val2 = 462500; *val2 = IIO_G_TO_M_S_2(462400); /* 0.4624 mg */
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_NANO;
case IIO_INCLI: case IIO_INCLI:
*val = 0; *val = 0;
*val2 = 100000; *val2 = 100000; /* 0.1 degree */
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
default: default:
return -EINVAL; return -EINVAL;
} }
break; break;
case IIO_CHAN_INFO_OFFSET: case IIO_CHAN_INFO_OFFSET:
*val = 25; *val = 25000 / -470 - 1278; /* 25 C = 1278 */
return IIO_VAL_INT; return IIO_VAL_INT;
case IIO_CHAN_INFO_CALIBBIAS: case IIO_CHAN_INFO_CALIBBIAS:
switch (chan->type) { switch (chan->type) {
......
...@@ -316,25 +316,27 @@ static int adis16203_read_raw(struct iio_dev *indio_dev, ...@@ -316,25 +316,27 @@ static int adis16203_read_raw(struct iio_dev *indio_dev,
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
switch (chan->type) { switch (chan->type) {
case IIO_VOLTAGE: case IIO_VOLTAGE:
*val = 0; if (chan->channel == 0) {
if (chan->channel == 0) *val = 1;
*val2 = 1220; *val2 = 220000; /* 1.22 mV */
else } else {
*val2 = 610; *val = 0;
*val2 = 610000; /* 0.61 mV */
}
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_TEMP: case IIO_TEMP:
*val = 0; *val = -470; /* -0.47 C */
*val2 = -470000; *val2 = 0;
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_INCLI: case IIO_INCLI:
*val = 0; *val = 0;
*val2 = 25000; *val2 = 25000; /* 0.025 degree */
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
default: default:
return -EINVAL; return -EINVAL;
} }
case IIO_CHAN_INFO_OFFSET: case IIO_CHAN_INFO_OFFSET:
*val = 25; *val = 25000 / -470 - 1278; /* 25 C = 1278 */
return IIO_VAL_INT; return IIO_VAL_INT;
case IIO_CHAN_INFO_CALIBBIAS: case IIO_CHAN_INFO_CALIBBIAS:
bits = 14; bits = 14;
......
...@@ -317,26 +317,28 @@ static int adis16204_read_raw(struct iio_dev *indio_dev, ...@@ -317,26 +317,28 @@ static int adis16204_read_raw(struct iio_dev *indio_dev,
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
switch (chan->type) { switch (chan->type) {
case IIO_VOLTAGE: case IIO_VOLTAGE:
*val = 0; if (chan->channel == 0) {
if (chan->channel == 0) *val = 1;
*val2 = 1220; *val2 = 220000; /* 1.22 mV */
else } else {
*val2 = 610; *val = 0;
*val2 = 610000; /* 0.61 mV */
}
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_TEMP: case IIO_TEMP:
*val = 0; *val = -470; /* 0.47 C */
*val2 = -470000; *val2 = 0;
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_ACCEL: case IIO_ACCEL:
*val = 0; *val = 0;
switch (chan->channel2) { switch (chan->channel2) {
case IIO_MOD_X: case IIO_MOD_X:
case IIO_MOD_ROOT_SUM_SQUARED_X_Y: case IIO_MOD_ROOT_SUM_SQUARED_X_Y:
*val2 = 17125; *val2 = IIO_G_TO_M_S_2(17125); /* 17.125 mg */
break; break;
case IIO_MOD_Y: case IIO_MOD_Y:
case IIO_MOD_Z: case IIO_MOD_Z:
*val2 = 8407; *val2 = IIO_G_TO_M_S_2(8407); /* 8.407 mg */
break; break;
} }
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
...@@ -345,7 +347,7 @@ static int adis16204_read_raw(struct iio_dev *indio_dev, ...@@ -345,7 +347,7 @@ static int adis16204_read_raw(struct iio_dev *indio_dev,
} }
break; break;
case IIO_CHAN_INFO_OFFSET: case IIO_CHAN_INFO_OFFSET:
*val = 25; *val = 25000 / -470 - 1278; /* 25 C = 1278 */
return IIO_VAL_INT; return IIO_VAL_INT;
case IIO_CHAN_INFO_CALIBBIAS: case IIO_CHAN_INFO_CALIBBIAS:
case IIO_CHAN_INFO_PEAK: case IIO_CHAN_INFO_PEAK:
......
...@@ -343,28 +343,29 @@ static int adis16209_read_raw(struct iio_dev *indio_dev, ...@@ -343,28 +343,29 @@ static int adis16209_read_raw(struct iio_dev *indio_dev,
case IIO_VOLTAGE: case IIO_VOLTAGE:
*val = 0; *val = 0;
if (chan->channel == 0) if (chan->channel == 0)
*val2 = 305180; *val2 = 305180; /* 0.30518 mV */
else else
*val2 = 610500; *val2 = 610500; /* 0.6105 mV */
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_TEMP: case IIO_TEMP:
*val = 0; *val = -470; /* -0.47 C */
*val2 = -470000; *val2 = 0;
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_ACCEL: case IIO_ACCEL:
*val = 0; *val = 0;
*val2 = 2394; *val2 = IIO_G_TO_M_S_2(244140); /* 0.244140 mg */
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_NANO;
case IIO_INCLI: case IIO_INCLI:
case IIO_ROT:
*val = 0; *val = 0;
*val2 = 436; *val2 = 25000; /* 0.025 degree */
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
default: default:
return -EINVAL; return -EINVAL;
} }
break; break;
case IIO_CHAN_INFO_OFFSET: case IIO_CHAN_INFO_OFFSET:
*val = 25; *val = 25000 / -470 - 0x4FE; /* 25 C = 0x4FE */
return IIO_VAL_INT; return IIO_VAL_INT;
case IIO_CHAN_INFO_CALIBBIAS: case IIO_CHAN_INFO_CALIBBIAS:
switch (chan->type) { switch (chan->type) {
...@@ -491,6 +492,7 @@ static const struct iio_chan_spec adis16209_channels[] = { ...@@ -491,6 +492,7 @@ static const struct iio_chan_spec adis16209_channels[] = {
.modified = 1, .modified = 1,
.channel2 = IIO_MOD_X, .channel2 = IIO_MOD_X,
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT, .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT,
IIO_CHAN_INFO_SCALE_SHARED_BIT,
.address = rot, .address = rot,
.scan_index = ADIS16209_SCAN_ROT, .scan_index = ADIS16209_SCAN_ROT,
.scan_type = { .scan_type = {
......
...@@ -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;
......
...@@ -373,30 +373,31 @@ static int adis16240_read_raw(struct iio_dev *indio_dev, ...@@ -373,30 +373,31 @@ static int adis16240_read_raw(struct iio_dev *indio_dev,
case IIO_CHAN_INFO_SCALE: case IIO_CHAN_INFO_SCALE:
switch (chan->type) { switch (chan->type) {
case IIO_VOLTAGE: case IIO_VOLTAGE:
*val = 0; if (chan->channel == 0) {
if (chan->channel == 0) *val = 4;
*val2 = 4880; *val2 = 880000; /* 4.88 mV */
else return IIO_VAL_INT_PLUS_MICRO;
} else {
return -EINVAL; return -EINVAL;
return IIO_VAL_INT_PLUS_MICRO; }
case IIO_TEMP: case IIO_TEMP:
*val = 0; *val = 244; /* 0.244 C */
*val2 = 244000; *val2 = 0;
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_ACCEL: case IIO_ACCEL:
*val = 0; *val = 0;
*val2 = 504062; *val2 = IIO_G_TO_M_S_2(51400); /* 51.4 mg */
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
default: default:
return -EINVAL; return -EINVAL;
} }
break; break;
case IIO_CHAN_INFO_PEAK_SCALE: case IIO_CHAN_INFO_PEAK_SCALE:
*val = 6; *val = 0;
*val2 = 629295; *val2 = IIO_G_TO_M_S_2(51400); /* 51.4 mg */
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_CHAN_INFO_OFFSET: case IIO_CHAN_INFO_OFFSET:
*val = 25; *val = 25000 / 244 - 0x133; /* 25 C = 0x133 */
return IIO_VAL_INT; return IIO_VAL_INT;
case IIO_CHAN_INFO_CALIBBIAS: case IIO_CHAN_INFO_CALIBBIAS:
bits = 10; bits = 10;
......
...@@ -498,28 +498,33 @@ static int adis16260_read_raw(struct iio_dev *indio_dev, ...@@ -498,28 +498,33 @@ static int adis16260_read_raw(struct iio_dev *indio_dev,
switch (chan->type) { switch (chan->type) {
case IIO_ANGL_VEL: case IIO_ANGL_VEL:
*val = 0; *val = 0;
if (spi_get_device_id(st->us)->driver_data) if (spi_get_device_id(st->us)->driver_data) {
*val2 = 320; /* 0.01832 degree / sec */
else *val2 = IIO_DEGREE_TO_RAD(18320);
*val2 = 1278; } else {
/* 0.07326 degree / sec */
*val2 = IIO_DEGREE_TO_RAD(73260);
}
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_VOLTAGE: case IIO_VOLTAGE:
*val = 0; if (chan->channel == 0) {
if (chan->channel == 0) *val = 1;
*val2 = 18315; *val2 = 831500; /* 1.8315 mV */
else } else {
*val2 = 610500; *val = 0;
*val2 = 610500; /* 610.5 uV */
}
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_TEMP: case IIO_TEMP:
*val = 0; *val = 145;
*val2 = 145300; *val2 = 300000; /* 0.1453 C */
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
default: default:
return -EINVAL; return -EINVAL;
} }
break; break;
case IIO_CHAN_INFO_OFFSET: case IIO_CHAN_INFO_OFFSET:
*val = 25; *val = 250000 / 1453; /* 25 C = 0x00 */
return IIO_VAL_INT; return IIO_VAL_INT;
case IIO_CHAN_INFO_CALIBBIAS: case IIO_CHAN_INFO_CALIBBIAS:
switch (chan->type) { switch (chan->type) {
......
...@@ -139,6 +139,8 @@ struct adis16400_chip_info { ...@@ -139,6 +139,8 @@ struct adis16400_chip_info {
const long flags; const long flags;
unsigned int gyro_scale_micro; unsigned int gyro_scale_micro;
unsigned int accel_scale_micro; unsigned int accel_scale_micro;
int temp_scale_nano;
int temp_offset;
unsigned long default_scan_mask; unsigned long default_scan_mask;
}; };
......
...@@ -553,10 +553,13 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, ...@@ -553,10 +553,13 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_VOLTAGE: case IIO_VOLTAGE:
*val = 0; *val = 0;
if (chan->channel == 0) if (chan->channel == 0) {
*val2 = 2418; *val = 2;
else *val2 = 418000; /* 2.418 mV */
*val2 = 806; } else {
*val = 0;
*val2 = 805800; /* 805.8 uV */
}
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_ACCEL: case IIO_ACCEL:
*val = 0; *val = 0;
...@@ -564,11 +567,11 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, ...@@ -564,11 +567,11 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_MAGN: case IIO_MAGN:
*val = 0; *val = 0;
*val2 = 500; *val2 = 500; /* 0.5 mgauss */
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
case IIO_TEMP: case IIO_TEMP:
*val = 0; *val = st->variant->temp_scale_nano / 1000000;
*val2 = 140000; *val2 = (st->variant->temp_scale_nano % 1000000);
return IIO_VAL_INT_PLUS_MICRO; return IIO_VAL_INT_PLUS_MICRO;
default: default:
return -EINVAL; return -EINVAL;
...@@ -586,9 +589,8 @@ static int adis16400_read_raw(struct iio_dev *indio_dev, ...@@ -586,9 +589,8 @@ static int adis16400_read_raw(struct iio_dev *indio_dev,
return IIO_VAL_INT; return IIO_VAL_INT;
case IIO_CHAN_INFO_OFFSET: case IIO_CHAN_INFO_OFFSET:
/* currently only temperature */ /* currently only temperature */
*val = 198; *val = st->variant->temp_offset;
*val2 = 160000; return IIO_VAL_INT;
return IIO_VAL_INT_PLUS_MICRO;
case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY: case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY:
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
/* Need both the number of taps and the sampling frequency */ /* Need both the number of taps and the sampling frequency */
...@@ -1035,7 +1037,7 @@ static const struct iio_chan_spec adis16334_channels[] = { ...@@ -1035,7 +1037,7 @@ static const struct iio_chan_spec adis16334_channels[] = {
.indexed = 1, .indexed = 1,
.channel = 0, .channel = 0,
.info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT | .info_mask = IIO_CHAN_INFO_RAW_SEPARATE_BIT |
IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT | IIO_CHAN_INFO_OFFSET_SEPARATE_BIT |
IIO_CHAN_INFO_SCALE_SHARED_BIT, IIO_CHAN_INFO_SCALE_SHARED_BIT,
.address = temp0, .address = temp0,
.scan_index = ADIS16400_SCAN_TEMP, .scan_index = ADIS16400_SCAN_TEMP,
...@@ -1058,8 +1060,10 @@ static struct adis16400_chip_info adis16400_chips[] = { ...@@ -1058,8 +1060,10 @@ static struct adis16400_chip_info adis16400_chips[] = {
[ADIS16300] = { [ADIS16300] = {
.channels = adis16300_channels, .channels = adis16300_channels,
.num_channels = ARRAY_SIZE(adis16300_channels), .num_channels = ARRAY_SIZE(adis16300_channels),
.gyro_scale_micro = 873, .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */
.accel_scale_micro = 5884, .accel_scale_micro = 5884,
.temp_scale_nano = 140000000, /* 0.14 C */
.temp_offset = 25000000 / 140000, /* 25 C = 0x00 */
.default_scan_mask = (1 << ADIS16400_SCAN_SUPPLY) | .default_scan_mask = (1 << ADIS16400_SCAN_SUPPLY) |
(1 << ADIS16400_SCAN_GYRO_X) | (1 << ADIS16400_SCAN_ACC_X) | (1 << ADIS16400_SCAN_GYRO_X) | (1 << ADIS16400_SCAN_ACC_X) |
(1 << ADIS16400_SCAN_ACC_Y) | (1 << ADIS16400_SCAN_ACC_Z) | (1 << ADIS16400_SCAN_ACC_Y) | (1 << ADIS16400_SCAN_ACC_Z) |
...@@ -1070,8 +1074,10 @@ static struct adis16400_chip_info adis16400_chips[] = { ...@@ -1070,8 +1074,10 @@ static struct adis16400_chip_info adis16400_chips[] = {
[ADIS16334] = { [ADIS16334] = {
.channels = adis16334_channels, .channels = adis16334_channels,
.num_channels = ARRAY_SIZE(adis16334_channels), .num_channels = ARRAY_SIZE(adis16334_channels),
.gyro_scale_micro = 873, .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */
.accel_scale_micro = 981, .accel_scale_micro = IIO_G_TO_M_S_2(1000), /* 1 mg */
.temp_scale_nano = 67850000, /* 0.06785 C */
.temp_offset = 25000000 / 67850, /* 25 C = 0x00 */
.default_scan_mask = (1 << ADIS16400_SCAN_GYRO_X) | .default_scan_mask = (1 << ADIS16400_SCAN_GYRO_X) |
(1 << ADIS16400_SCAN_GYRO_Y) | (1 << ADIS16400_SCAN_GYRO_Z) | (1 << ADIS16400_SCAN_GYRO_Y) | (1 << ADIS16400_SCAN_GYRO_Z) |
(1 << ADIS16400_SCAN_ACC_X) | (1 << ADIS16400_SCAN_ACC_Y) | (1 << ADIS16400_SCAN_ACC_X) | (1 << ADIS16400_SCAN_ACC_Y) |
...@@ -1080,8 +1086,10 @@ static struct adis16400_chip_info adis16400_chips[] = { ...@@ -1080,8 +1086,10 @@ static struct adis16400_chip_info adis16400_chips[] = {
[ADIS16350] = { [ADIS16350] = {
.channels = adis16350_channels, .channels = adis16350_channels,
.num_channels = ARRAY_SIZE(adis16350_channels), .num_channels = ARRAY_SIZE(adis16350_channels),
.gyro_scale_micro = 872664, .gyro_scale_micro = IIO_DEGREE_TO_RAD(73260), /* 0.07326 deg/s */
.accel_scale_micro = 24732, .accel_scale_micro = IIO_G_TO_M_S_2(2522), /* 0.002522 g */
.temp_scale_nano = 145300000, /* 0.1453 C */
.temp_offset = 25000000 / 145300, /* 25 C = 0x00 */
.default_scan_mask = 0x7FF, .default_scan_mask = 0x7FF,
.flags = ADIS16400_NO_BURST, .flags = ADIS16400_NO_BURST,
}, },
...@@ -1090,8 +1098,10 @@ static struct adis16400_chip_info adis16400_chips[] = { ...@@ -1090,8 +1098,10 @@ static struct adis16400_chip_info adis16400_chips[] = {
.num_channels = ARRAY_SIZE(adis16350_channels), .num_channels = ARRAY_SIZE(adis16350_channels),
.flags = ADIS16400_HAS_PROD_ID, .flags = ADIS16400_HAS_PROD_ID,
.product_id = 0x3FE8, .product_id = 0x3FE8,
.gyro_scale_micro = 1279, .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */
.accel_scale_micro = 24732, .accel_scale_micro = IIO_G_TO_M_S_2(3333), /* 3.333 mg */
.temp_scale_nano = 136000000, /* 0.136 C */
.temp_offset = 25000000 / 136000, /* 25 C = 0x00 */
.default_scan_mask = 0x7FF, .default_scan_mask = 0x7FF,
}, },
[ADIS16362] = { [ADIS16362] = {
...@@ -1099,8 +1109,10 @@ static struct adis16400_chip_info adis16400_chips[] = { ...@@ -1099,8 +1109,10 @@ static struct adis16400_chip_info adis16400_chips[] = {
.num_channels = ARRAY_SIZE(adis16350_channels), .num_channels = ARRAY_SIZE(adis16350_channels),
.flags = ADIS16400_HAS_PROD_ID, .flags = ADIS16400_HAS_PROD_ID,
.product_id = 0x3FEA, .product_id = 0x3FEA,
.gyro_scale_micro = 1279, .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */
.accel_scale_micro = 24732, .accel_scale_micro = IIO_G_TO_M_S_2(333), /* 0.333 mg */
.temp_scale_nano = 136000000, /* 0.136 C */
.temp_offset = 25000000 / 136000, /* 25 C = 0x00 */
.default_scan_mask = 0x7FF, .default_scan_mask = 0x7FF,
}, },
[ADIS16364] = { [ADIS16364] = {
...@@ -1108,8 +1120,10 @@ static struct adis16400_chip_info adis16400_chips[] = { ...@@ -1108,8 +1120,10 @@ static struct adis16400_chip_info adis16400_chips[] = {
.num_channels = ARRAY_SIZE(adis16350_channels), .num_channels = ARRAY_SIZE(adis16350_channels),
.flags = ADIS16400_HAS_PROD_ID, .flags = ADIS16400_HAS_PROD_ID,
.product_id = 0x3FEC, .product_id = 0x3FEC,
.gyro_scale_micro = 1279, .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */
.accel_scale_micro = 24732, .accel_scale_micro = IIO_G_TO_M_S_2(1000), /* 1 mg */
.temp_scale_nano = 136000000, /* 0.136 C */
.temp_offset = 25000000 / 136000, /* 25 C = 0x00 */
.default_scan_mask = 0x7FF, .default_scan_mask = 0x7FF,
}, },
[ADIS16365] = { [ADIS16365] = {
...@@ -1117,8 +1131,10 @@ static struct adis16400_chip_info adis16400_chips[] = { ...@@ -1117,8 +1131,10 @@ static struct adis16400_chip_info adis16400_chips[] = {
.num_channels = ARRAY_SIZE(adis16350_channels), .num_channels = ARRAY_SIZE(adis16350_channels),
.flags = ADIS16400_HAS_PROD_ID, .flags = ADIS16400_HAS_PROD_ID,
.product_id = 0x3FED, .product_id = 0x3FED,
.gyro_scale_micro = 1279, .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */
.accel_scale_micro = 24732, .accel_scale_micro = IIO_G_TO_M_S_2(1000), /* 1 mg */
.temp_scale_nano = 136000000, /* 0.136 C */
.temp_offset = 25000000 / 136000, /* 25 C = 0x00 */
.default_scan_mask = 0x7FF, .default_scan_mask = 0x7FF,
}, },
[ADIS16400] = { [ADIS16400] = {
...@@ -1126,9 +1142,11 @@ static struct adis16400_chip_info adis16400_chips[] = { ...@@ -1126,9 +1142,11 @@ static struct adis16400_chip_info adis16400_chips[] = {
.num_channels = ARRAY_SIZE(adis16400_channels), .num_channels = ARRAY_SIZE(adis16400_channels),
.flags = ADIS16400_HAS_PROD_ID, .flags = ADIS16400_HAS_PROD_ID,
.product_id = 0x4015, .product_id = 0x4015,
.gyro_scale_micro = 873, .gyro_scale_micro = IIO_DEGREE_TO_RAD(50000), /* 0.05 deg/s */
.accel_scale_micro = 32656, .accel_scale_micro = IIO_G_TO_M_S_2(3333), /* 3.333 mg */
.default_scan_mask = 0xFFF, .default_scan_mask = 0xFFF,
.temp_scale_nano = 140000000, /* 0.14 C */
.temp_offset = 25000000 / 140000, /* 25 C = 0x00 */
} }
}; };
......
...@@ -618,4 +618,20 @@ static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) ...@@ -618,4 +618,20 @@ static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
}; };
#endif #endif
/**
* IIO_DEGREE_TO_RAD() - Convert degree to rad
* @deg: A value in degree
*
* Returns the given value converted from degree to rad
*/
#define IIO_DEGREE_TO_RAD(deg) (((deg) * 314159ULL + 9000000ULL) / 18000000ULL)
/**
* IIO_G_TO_M_S_2() - Convert g to meter / second**2
* @g: A value in g
*
* Returns the given value converted from g to meter / second**2
*/
#define IIO_G_TO_M_S_2(g) ((g) * 980665ULL / 100000ULL)
#endif /* _INDUSTRIAL_IO_H_ */ #endif /* _INDUSTRIAL_IO_H_ */
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