allow to specify channels resolution and compute shift assuming
16-bit registers and MSB allocation
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Oleksandr Kravchenko <o.v.kravchenko@globallogic.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-#define BMA180_ACC_CHANNEL(_axis) { \
+#define BMA180_ACC_CHANNEL(_axis, _bits) { \
.type = IIO_ACCEL, \
.modified = 1, \
.channel2 = IIO_MOD_##_axis, \
.type = IIO_ACCEL, \
.modified = 1, \
.channel2 = IIO_MOD_##_axis, \
.scan_index = AXIS_##_axis, \
.scan_type = { \
.sign = 's', \
.scan_index = AXIS_##_axis, \
.scan_type = { \
.sign = 's', \
}, \
.ext_info = bma180_ext_info, \
}
}, \
.ext_info = bma180_ext_info, \
}
}
static const struct iio_chan_spec bma180_channels[] = {
}
static const struct iio_chan_spec bma180_channels[] = {
- BMA180_ACC_CHANNEL(X),
- BMA180_ACC_CHANNEL(Y),
- BMA180_ACC_CHANNEL(Z),
+ BMA180_ACC_CHANNEL(X, 14),
+ BMA180_ACC_CHANNEL(Y, 14),
+ BMA180_ACC_CHANNEL(Z, 14),
BMA180_TEMP_CHANNEL,
IIO_CHAN_SOFT_TIMESTAMP(4),
};
BMA180_TEMP_CHANNEL,
IIO_CHAN_SOFT_TIMESTAMP(4),
};