diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-05-15 18:18:38 +0300 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-05-16 13:01:20 +0300 |
commit | d046ba268adb87c7780494ecf897cbafbf100d57 (patch) | |
tree | 5da67104077407d418a7d921b96c34767b8fb724 /drivers/iio/imu/adis16400_buffer.c | |
parent | 9df560350c90f3d3909fe653399b3584c9a17b61 (diff) | |
download | linux-d046ba268adb87c7780494ecf897cbafbf100d57.tar.xz |
iio: adis16400: Fix burst transfer for adis16448
The adis16448, unlike the other chips in this family, in addition to the
hardware channels also sends out the DIAG_STAT register in burst mode
before them. Handle that case by skipping over the first 2 bytes before we
pass the received data to the buffer.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Fixes: 76ada52f7f5d ("iio:adis16400: Add support for the adis16448")
Cc: <stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/imu/adis16400_buffer.c')
-rw-r--r-- | drivers/iio/imu/adis16400_buffer.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/iio/imu/adis16400_buffer.c b/drivers/iio/imu/adis16400_buffer.c index 629ae84d4e62..90c24a23c679 100644 --- a/drivers/iio/imu/adis16400_buffer.c +++ b/drivers/iio/imu/adis16400_buffer.c @@ -29,6 +29,8 @@ int adis16400_update_scan_mode(struct iio_dev *indio_dev, /* All but the timestamp channel */ burst_length = (indio_dev->num_channels - 1) * sizeof(u16); + if (st->variant->flags & ADIS16400_BURST_DIAG_STAT) + burst_length += sizeof(u16); adis->xfer = kcalloc(2, sizeof(*adis->xfer), GFP_KERNEL); if (!adis->xfer) @@ -63,6 +65,7 @@ irqreturn_t adis16400_trigger_handler(int irq, void *p) struct adis16400_state *st = iio_priv(indio_dev); struct adis *adis = &st->adis; u32 old_speed_hz = st->adis.spi->max_speed_hz; + void *buffer; int ret; if (!adis->buffer) @@ -83,7 +86,12 @@ irqreturn_t adis16400_trigger_handler(int irq, void *p) spi_setup(st->adis.spi); } - iio_push_to_buffers_with_timestamp(indio_dev, adis->buffer, + if (st->variant->flags & ADIS16400_BURST_DIAG_STAT) + buffer = adis->buffer + sizeof(u16); + else + buffer = adis->buffer; + + iio_push_to_buffers_with_timestamp(indio_dev, buffer, pf->timestamp); iio_trigger_notify_done(indio_dev->trig); |