aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorPeter Meerwald <pmeerw@pmeerw.net>2014-08-19 18:43:00 -0400
committerJonathan Cameron <jic23@kernel.org>2014-09-14 15:26:08 -0400
commit6377aa496a0bc40af4f66574c813bb9a807a7e3a (patch)
tree252856251cc5c6368e4a221a30e0ec890a2c2b0b /drivers/iio
parentc1949ec18e50e1e23f3045a7c3836c289f553bb8 (diff)
iio:bma180: Prepare for accelerometer channels with different resolutions
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>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/accel/bma180.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index 933645547f82..f4d280456dd7 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -476,7 +476,7 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
476 { }, 476 { },
477}; 477};
478 478
479#define BMA180_ACC_CHANNEL(_axis) { \ 479#define BMA180_ACC_CHANNEL(_axis, _bits) { \
480 .type = IIO_ACCEL, \ 480 .type = IIO_ACCEL, \
481 .modified = 1, \ 481 .modified = 1, \
482 .channel2 = IIO_MOD_##_axis, \ 482 .channel2 = IIO_MOD_##_axis, \
@@ -486,9 +486,9 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
486 .scan_index = AXIS_##_axis, \ 486 .scan_index = AXIS_##_axis, \
487 .scan_type = { \ 487 .scan_type = { \
488 .sign = 's', \ 488 .sign = 's', \
489 .realbits = 14, \ 489 .realbits = _bits, \
490 .storagebits = 16, \ 490 .storagebits = 16, \
491 .shift = 2, \ 491 .shift = 16 - _bits, \
492 }, \ 492 }, \
493 .ext_info = bma180_ext_info, \ 493 .ext_info = bma180_ext_info, \
494} 494}
@@ -506,9 +506,9 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
506} 506}
507 507
508static const struct iio_chan_spec bma180_channels[] = { 508static const struct iio_chan_spec bma180_channels[] = {
509 BMA180_ACC_CHANNEL(X), 509 BMA180_ACC_CHANNEL(X, 14),
510 BMA180_ACC_CHANNEL(Y), 510 BMA180_ACC_CHANNEL(Y, 14),
511 BMA180_ACC_CHANNEL(Z), 511 BMA180_ACC_CHANNEL(Z, 14),
512 BMA180_TEMP_CHANNEL, 512 BMA180_TEMP_CHANNEL,
513 IIO_CHAN_SOFT_TIMESTAMP(4), 513 IIO_CHAN_SOFT_TIMESTAMP(4),
514}; 514};