]> git.baikalelectronics.ru Git - kernel.git/commit
iio: imu: fxos8700: fix IMU data bits returned to user space
authorCarlos Song <carlos.song@nxp.com>
Thu, 8 Dec 2022 07:19:08 +0000 (15:19 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:18 +0000 (11:28 +0100)
commit5cb5ce2fd3ab69a7c439da36d7e6da515907b805
tree6f46437b687cdb685547074b4f4c85a97ec98b8e
parent9302e0b99920712547b5cb57e98ad9be4bdf758f
iio: imu: fxos8700: fix IMU data bits returned to user space

commit a53f945879c0cb9de3a4c05a665f5157884b5208 upstream.

ACCEL output data registers contain the X-axis, Y-axis, and Z-axis
14-bit left-justified sample data and MAGN output data registers
contain the X-axis, Y-axis, and Z-axis 16-bit sample data. The ACCEL
raw register output data should be divided by 4 before sent to
userspace.

Apply a 2 bits signed right shift to the raw data from ACCEL output
data register but keep that from MAGN sensor as the origin.

Fixes: 2c7e7594a2fd ("iio: imu: Add support for the FXOS8700 IMU")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Link: https://lore.kernel.org/r/20221208071911.2405922-5-carlos.song@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/imu/fxos8700_core.c