summaryrefslogtreecommitdiff
path: root/drivers/staging/iio/accel
diff options
context:
space:
mode:
authorJonathan Cameron <jic23@kernel.org>2016-10-08 19:39:04 +0300
committerJonathan Cameron <jic23@kernel.org>2016-10-23 21:33:58 +0300
commit271a25f6480d51225abc2616df6c96e5979a7ffa (patch)
treee93d2f2132b13649d202b89a152572879b69ff29 /drivers/staging/iio/accel
parentd1bf1a865fe6b391208efab532b1e6fc912e5bed (diff)
downloadlinux-271a25f6480d51225abc2616df6c96e5979a7ffa.tar.xz
staging:iio:accel:sca3000 Fix clearing of flag + setting of size of scan.
Not clearing the stuff_to_read flag can lead to a false flag being set on restarting the buffer if the data was not all read the previous time. The size of the scan is needed to ensure the function iio_buffer_read_first_n_outer actually tries to read the data. This stuff has been broken for some time so not stable material. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Diffstat (limited to 'drivers/staging/iio/accel')
-rw-r--r--drivers/staging/iio/accel/sca3000.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/staging/iio/accel/sca3000.c b/drivers/staging/iio/accel/sca3000.c
index 36a52d02ee0e..8af7d83e658d 100644
--- a/drivers/staging/iio/accel/sca3000.c
+++ b/drivers/staging/iio/accel/sca3000.c
@@ -1491,6 +1491,19 @@ error_ret:
**/
static int sca3000_hw_ring_preenable(struct iio_dev *indio_dev)
{
+ /*
+ * Set stuff to read to indicate no data present.
+ * Need for cases where the interrupt had fired at the
+ * end of a cycle, but the data was never read.
+ */
+ indio_dev->buffer->stufftoread = 0;
+ /*
+ * Needed to ensure the core will actually read data
+ * from the device rather than assuming no channels
+ * are enabled.
+ */
+ indio_dev->buffer->bytes_per_datum = 6;
+
return __sca3000_hw_ring_state_set(indio_dev, 1);
}