iio: imu: st_lsm6dsx: Scaling factor type set to IIO_VAL_INT_PLUS_NANO
authorMario Tesi <mario.tesi@st.com>
Thu, 17 Sep 2020 16:47:16 +0000 (18:47 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 21 Sep 2020 19:01:45 +0000 (20:01 +0100)
commit44a76de8ca4d13b157c49a16d0ef47ccff91a2e3
treeb6878e13c8d783c75da1753300b3133c39d3396b
parente8173161746d1d8a8b9dfd8968cf695efaa90d09
iio: imu: st_lsm6dsx: Scaling factor type set to IIO_VAL_INT_PLUS_NANO

Scaling factor values for Acc lead to an unacceptable rounding of the
full scale (FS) calculated by some SensorHAL on Android devices. For examples
setting FS to 4g the in_accel_x_scale, in_accel_y_scale and in_accel_z_scale
are 0.001196 on 6 decimal digits and the FS is
0.001196 × ((2^15) − 1) ~= 39.1893 m/s^2.

Android CTS R10 SensorParameterRangeTest test expects a value greater than
39.20 m/s^2 so this test fails (ACCELEROMETER_MAX_RANGE = 4 * 9.80).

Using 9 decimal digits the new scale factor is 0.001196411 and the FS now
is 0.001196411 × ((2^15)−1) ~= 39.2028 m/s^2.

This patch extends to IIO_VAL_INT_PLUS_NANO type the scaling factor to all
IMU devices where SensorParameterRangeTest CTS test fails.

Signed-off-by: Mario Tesi <mario.tesi@st.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/1600361236-2285-1-git-send-email-martepisa@gmail.com
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c