summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsravanM <Sravan@mindtribe.com>2016-02-03 16:54:31 -0800
committerEvan Wilson <evan@oliodevices.com>2016-03-18 13:34:54 -0700
commitade1424d40048f5c0d21020445e9726c42d482e1 (patch)
tree2cc2211cb595d25516bfaee6971dcd3e877bee85
parent8eb584a45bee9ed6d984ea966c33622ef8307c39 (diff)
downloadolio-linux-3.10-ade1424d40048f5c0d21020445e9726c42d482e1.tar.xz
olio-linux-3.10-ade1424d40048f5c0d21020445e9726c42d482e1.zip
Fixing the timestamp for fake events passed through the buffer. If the 6D event is pushed with a timestamp that is the current timestamp then any data previous to that(All of the fifo) will be ignored when pushed to the buffer.
Change-Id: I677b524faee88ca5b01475e4f336ecad235bfac5 Signed-off-by: Evan Wilson <evan@oliodevices.com>
-rw-r--r--drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_buffer.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_buffer.c b/drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_buffer.c
index b89141689a1..c555927769d 100644
--- a/drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_buffer.c
+++ b/drivers/iio/imu/st_lsm6ds3/st_lsm6ds3_buffer.c
@@ -29,6 +29,8 @@
#define ST_LSM6DS3_FIFO_DATA_OUT_L 0x3e
#define ST_LSM6DS3_FIFO_DATA_OVR_2REGS 0x4000
+static int64_t last_timestamp = 0;
+
static void st_lsm6ds3_push_data_with_timestamp(struct lsm6ds3_data *cdata,
u8 index, u8 *data, int64_t timestamp)
{
@@ -154,7 +156,7 @@ void st_lsm6ds3_push_tap_to_fifo(struct lsm6ds3_data *cdata)
st_lsm6ds3_push_data_with_timestamp(
cdata, ST_INDIO_DEV_ACCEL,
fake_tap,
- cdata->accel_timestamp -1);
+ last_timestamp);
}
@@ -165,7 +167,7 @@ void st_lsm6ds3_push_d6d_to_fifo(struct lsm6ds3_data *cdata)
st_lsm6ds3_push_data_with_timestamp(
cdata, ST_INDIO_DEV_ACCEL,
d6d_signature,
- cdata->accel_timestamp -1);
+ last_timestamp);
}
@@ -221,6 +223,7 @@ void st_lsm6ds3_read_fifo(struct lsm6ds3_data *cdata, bool check_fifo_len, bool
}
}
+ last_timestamp = cdata->timestamp + 1;
read_len *= ST_LSM6DS3_BYTE_FOR_CHANNEL;
#ifdef CONFIG_ST_LSM6DS3_IIO_MASTER_SUPPORT