iio: imu: st_lsm6dsx: do not apply ODR configuration in write_raw handler
authorLorenzo Bianconi <lorenzo.bianconi83@gmail.com>
Sun, 2 Apr 2017 12:58:45 +0000 (14:58 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 2 Apr 2017 13:36:06 +0000 (14:36 +0100)
commit2ccc15036d812e75f334c0fb813104ef765a2c77
treeeeddc87b33d4447c623f481e11efd63a9273d54e
parentbe2d73208606bc5d52e60dea223da77f49d58340
iio: imu: st_lsm6dsx: do not apply ODR configuration in write_raw handler

This patch allows to avoid a transitory that occurs when a given sensor
has been already enabled (e.g. gyroscope) and the user is configuring
the sample frequency of the other one (e.g. accelerometer).
The transitory lasts until the accelerometer is enabled.
During that time slice the gyroscope ODR is incorrectly modified as well.
At the end of the transitory both sensors work at the right frequency.
Fix it introducing st_lsm6dsx_check_odr() routine to check ODR consistency
in write_raw handler in order to apply frequency configuration just
in st_lsm6dsx_set_odr()

Fixes: 290a6ce11d93 (iio: imu: add support to lsm6dsx driver)
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c