1
0
Fork 0
alistair23-linux/drivers/iio
Geert Uytterhoeven 8db2bb9681 iio: adc: max9611: Fix too short conversion time delay
[ Upstream commit 9fd229c478 ]

As of commit b9ddd50911 ("iio: adc: max9611: Fix temperature
reading in probe"), max9611 initialization sometimes fails on the
Salvator-X(S) development board with:

    max9611 4-007f: Invalid value received from ADC 0x8000: aborting
    max9611: probe of 4-007f failed with error -5

The max9611 driver tests communications with the chip by reading the die
temperature during the probe function, which returns an invalid value.

According to the datasheet, the typical ADC conversion time is 2 ms, but
no minimum or maximum values are provided.  Maxim Technical Support
confirmed this was tested with temperature Ta=25 degreeC, and promised
to inform me if a maximum/minimum value is available (they didn't get
back to me, so I assume it is not).

However, the driver assumes a 1 ms conversion time.  Usually the
usleep_range() call returns after more than 1.8 ms, hence it succeeds.
When it returns earlier, the data register may be read too early, and
the previous measurement value will be returned.  After boot, this is
the temperature POR (power-on reset) value, causing the failure above.

Fix this by increasing the delay from 1000-2000 µs to 3000-3300 µs.

Note that this issue has always been present, but it was exposed by the
aformentioned commit.

Fixes: 69780a3bbc ("iio: adc: Add Maxim max9611 ADC driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-09 10:19:43 +01:00
..
accel iio: st_accel: Fix unused variable warning 2020-01-09 10:19:43 +01:00
adc iio: adc: max9611: Fix too short conversion time delay 2020-01-09 10:19:43 +01:00
afe treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
amplifiers Second set of IIO device support, features, cleanups and minor fixes for 5.3. 2019-07-01 10:58:13 +02:00
buffer treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
chemical treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
common chrome platform changes for v5.4 2019-09-19 14:14:28 -07:00
dac iio: dac: ad5446: Add support for new AD5600 DAC 2019-12-31 16:45:19 +01:00
dummy spi: docs: convert to ReST and add it to the kABI bookset 2019-07-31 14:13:13 -06:00
frequency iio: frequency: adf4371: Fix output frequency setting 2019-08-05 17:38:33 +01:00
gyro iio:st_sensors: remove buffer allocation at each buffer enable 2019-08-11 09:26:04 +01:00
health treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
humidity iio: humidity: hdc100x: fix IIO_HUMIDITYRELATIVE channel reporting 2019-12-17 19:55:42 +01:00
imu iio: imu: inv_mpu6050: fix temperature reporting using bad unit 2019-12-17 19:55:42 +01:00
light iio: light: bh1750: Resolve compiler warning and make code more readable 2019-12-31 16:42:48 +01:00
magnetometer iio:st_sensors: remove buffer allocation at each buffer enable 2019-08-11 09:26:04 +01:00
multiplexer treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
orientation treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 309 2019-06-05 17:37:04 +02:00
potentiometer iio: potentiometer: add a driver for Maxim 5432-5435 2019-08-05 14:25:08 +01:00
potentiostat treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
pressure iio: cros_ec_baro: set info_mask_shared_by_all_available field 2019-12-31 16:45:15 +01:00
proximity iio: srf04: fix wrong limitation in distance measuring 2019-10-12 14:31:09 +01:00
resolver treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
temperature iio: max31856: add missing of_node and parent references to iio_dev 2019-12-31 16:42:46 +01:00
trigger IIO: stm32: Remove quadrature related functions from trigger driver 2019-07-27 20:11:18 +01:00
Kconfig Second set of IIO device support, features, cleanups and minor fixes for 5.3. 2019-07-01 10:58:13 +02:00
Makefile counter: stm32-lptimer: add counter device 2019-04-25 21:33:41 +02:00
iio_core.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
iio_core_trigger.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-buffer.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-configfs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-core.c Staging / IIO driver update for 5.3-rc1 2019-07-11 15:36:02 -07:00
industrialio-event.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-sw-device.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-sw-trigger.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-trigger.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
industrialio-triggered-event.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
inkern.c Driver Core and debugfs changes for 5.3-rc1 2019-07-12 12:24:03 -07:00