diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2019-03-13 12:40:02 +0100 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2019-03-16 16:08:55 +0000 |
commit | 3d02d7082e5823598090530c3988a35f69689943 (patch) | |
tree | 1ffcb16eb7ce2e3a5badc8dfa6e703ed980fc385 /block | |
parent | 2e4b88f73966adead360e47621df0183586fac32 (diff) | |
download | linux-3d02d7082e5823598090530c3988a35f69689943.tar.bz2 |
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: c14dca07a31d ("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>
Diffstat (limited to 'block')
0 files changed, 0 insertions, 0 deletions