]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: accel: adxl367: fix DEVID read after reset
authorCosmin Tanislav <demonsingur@gmail.com>
Wed, 7 Feb 2024 03:36:50 +0000 (05:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:11:40 +0000 (15:11 +0200)
commitf59551d708236d932533ac6b976acab5b72bfbc9
treef3b0282abeff392eb660d72bc9e10ce2d2133791
parentd738d5b5e2957905a5c5a61ee0385adb2ab5a097
iio: accel: adxl367: fix DEVID read after reset

commit 1b926914bbe4e30cb32f268893ef7d82a85275b8 upstream.

regmap_read_poll_timeout() will not sleep before reading,
causing the first read to return -ENXIO on I2C, since the
chip does not respond to it while it is being reset.

The datasheet specifies that a soft reset operation has a
latency of 7.5ms.

Add a 15ms sleep between reset and reading the DEVID register,
and switch to a simple regmap_read() call.

Fixes: cbab791c5e2a ("iio: accel: add ADXL367 driver")
Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240207033657.206171-1-demonsingur@gmail.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/accel/adxl367.c