diff options
author | Lorenzo Bianconi <lorenzo@kernel.org> | 2019-10-08 14:05:02 +0200 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2019-10-15 21:11:06 +0100 |
commit | 960506ed2c69a87a2004556624c8f702391b2e43 (patch) | |
tree | d11a4b560716dff41a97fcc8536e33fc0ff859fe /drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | |
parent | 9d8e91d9169c53301afe861cdd15e3b98155e82f (diff) | |
download | linux-960506ed2c69a87a2004556624c8f702391b2e43.tar.gz linux-960506ed2c69a87a2004556624c8f702391b2e43.tar.bz2 linux-960506ed2c69a87a2004556624c8f702391b2e43.zip |
iio: imu: st_lsm6dsx: enable drdy-mask if available
Enable drdy mask if available in order to mark invalid samples during
sensor bootstrap phase
Tested-by: Mario Tesi <mario.tesi@st.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c')
-rw-r--r-- | drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c index cabd4bfeab17..1f6873441aa0 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c @@ -450,13 +450,19 @@ int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) return read_len; } +#define ST_LSM6DSX_INVALID_SAMPLE 0x7ffd static int st_lsm6dsx_push_tagged_data(struct st_lsm6dsx_hw *hw, u8 tag, u8 *data, s64 ts) { + s16 val = le16_to_cpu(*(__le16 *)data); struct st_lsm6dsx_sensor *sensor; struct iio_dev *iio_dev; + /* invalid sample during bootstrap phase */ + if (val >= ST_LSM6DSX_INVALID_SAMPLE) + return -EINVAL; + /* * EXT_TAG are managed in FIFO fashion so ST_LSM6DSX_EXT0_TAG * corresponds to the first enabled channel, ST_LSM6DSX_EXT1_TAG |