OpenCloudOS-Kernel/drivers/iio/common
Gwendal Grignou 3d02d7082e iio: cros_ec: Fix the maths for gyro scale calculation
Calculation did not use IIO_DEGREE_TO_RAD and implemented a variant to
avoid precision loss as we aim a nano value. The offset added to avoid
rounding error, though, doesn't give us a close result to the expected
value. E.g.

For 1000dps, the result should be:

    (1000 * pi ) / 180 >> 15 ~= 0.000532632218

But with current calculation we get

    $ cat scale
    0.000547890

Fix the calculation by just doing the maths involved for a nano value

   val * pi * 10e12 / (180 * 2^15)

so we get a closer result.

    $ cat scale
    0.000532632

Fixes: c14dca07a3 ("iio: cros_ec_sensors: add ChromeOS EC Contiguous Sensors driver")
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-03-16 16:08:55 +00:00
..
cros_ec_sensors iio: cros_ec: Fix the maths for gyro scale calculation 2019-03-16 16:08:55 +00:00
hid-sensors iio: hid-sensor-hub: clean up indentation, remove extraneous tab 2018-11-25 14:03:59 +00:00
ms_sensors iio: common: ms_sensors: Remove unnecessary cast on void pointer 2017-04-02 09:47:57 +01:00
ssp_sensors iio: ssp_sensors: don't manually free devm managed resources 2018-10-07 20:04:30 +01:00
st_sensors iio: st_sensors: miscellaneous cleanup 2018-10-21 15:33:36 +01:00
Kconfig iio: cros_ec_sensors_core: Add common functions for the ChromeOS EC Sensor Hub. 2016-10-25 18:20:05 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00