Skip to content

Commit

Permalink
iio:bma180: Prepare for accelerometer channels with different resolut…
Browse files Browse the repository at this point in the history
…ions

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>
  • Loading branch information
Peter Meerwald authored and Jonathan Cameron committed Sep 14, 2014
1 parent c1949ec commit 6377aa4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/iio/accel/bma180.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
{ },
};

#define BMA180_ACC_CHANNEL(_axis) { \
#define BMA180_ACC_CHANNEL(_axis, _bits) { \
.type = IIO_ACCEL, \
.modified = 1, \
.channel2 = IIO_MOD_##_axis, \
Expand All @@ -486,9 +486,9 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
.scan_index = AXIS_##_axis, \
.scan_type = { \
.sign = 's', \
.realbits = 14, \
.realbits = _bits, \
.storagebits = 16, \
.shift = 2, \
.shift = 16 - _bits, \
}, \
.ext_info = bma180_ext_info, \
}
Expand All @@ -506,9 +506,9 @@ static const struct iio_chan_spec_ext_info bma180_ext_info[] = {
}

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),
};
Expand Down

0 comments on commit 6377aa4

Please sign in to comment.