iio: imu: fxos8700: fix ACCEL measurement range selection
authorCarlos Song <carlos.song@nxp.com>
Thu, 8 Dec 2022 07:19:09 +0000 (15:19 +0800)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 28 Dec 2022 17:20:04 +0000 (17:20 +0000)
commit9d61c1820598a5ea474576ed55318a6dadee37ed
treedf7996331545f33b3567daca62b26bc6b1754edc
parenta53f945879c0cb9de3a4c05a665f5157884b5208
iio: imu: fxos8700: fix ACCEL measurement range selection

When device is in active mode, it fails to set an ACCEL full-scale
range(2g/4g/8g) in FXOS8700_XYZ_DATA_CFG. This is not align with the
datasheet, but it is a fxos8700 chip behavior.

Keep the device in standby mode before setting ACCEL full-scale range
into FXOS8700_XYZ_DATA_CFG in chip initialization phase and setting
scale phase.

Fixes: 84e5ddd5c46e ("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-6-carlos.song@nxp.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/fxos8700_core.c