linux-uconsole/drivers/iio
Geert Uytterhoeven 346812c25f 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:18:55 +01:00
..
accel iio: fix center temperature of bmc150-accel-core 2019-11-06 13:05:40 +01:00
adc iio: adc: max9611: Fix too short conversion time delay 2020-01-09 10:18:55 +01:00
afe
amplifiers iio: amplifiers: ad8366: move channel init before iio_device_register() 2018-05-22 18:13:45 +01:00
buffer
chemical iio:chemical:bme680: Fix SPI read interface 2019-04-27 09:36:34 +02:00
common iio: common: ssp_sensors: Initialize calculated_time in ssp_common_process_data 2019-05-31 06:46:25 -07:00
counter iio: 104-quad-8: Provide defines for magic numbers 2018-06-10 11:52:30 +01:00
dac iio: dac: ad5446: Add support for new AD5600 DAC 2019-12-31 16:36:00 +01:00
dummy
frequency Merge branch 'fixes-togreg' into togreg 2018-08-01 18:56:17 +01:00
gyro iio/gyro/bmg160: Use millidegrees for temperature scale 2019-04-27 09:36:34 +02:00
health
humidity iio: humidity: hdc100x: fix IIO_HUMIDITYRELATIVE channel reporting 2019-12-17 20:34:37 +01:00
imu iio: imu: mpu6050: add missing available scan masks 2019-12-17 20:36:01 +01:00
light iio: light: bh1750: Resolve compiler warning and make code more readable 2019-12-31 16:34:48 +01:00
magnetometer iio: hmc5843: fix potential NULL pointer dereferences 2019-05-31 06:46:25 -07:00
multiplexer treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
orientation iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers 2018-12-05 19:32:13 +01:00
potentiometer
potentiostat
pressure iio/hid-sensors: Fix IIO_CHAN_INFO_RAW returning wrong values for signed numbers 2018-12-05 19:32:13 +01:00
proximity iio: srf04: fix wrong limitation in distance measuring 2019-11-12 19:20:40 +01:00
resolver staging: iio: ad2s1200: Move driver out of staging 2018-05-20 12:17:48 +01:00
temperature iio: temperature: mlx90632 Relax the compatibility check 2019-06-25 11:35:54 +08:00
trigger
iio_core.h
iio_core_trigger.h
industrialio-buffer.c iio: Fix scan mask selection 2019-04-27 09:36:35 +02:00
industrialio-configfs.c
industrialio-core.c iio: core: fix a possible circular locking dependency 2019-04-27 09:36:35 +02:00
industrialio-event.c
industrialio-sw-device.c
industrialio-sw-trigger.c
industrialio-trigger.c
industrialio-triggered-event.c
inkern.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
Kconfig staging: iio: ad2s1200: Move driver out of staging 2018-05-20 12:17:48 +01:00
Makefile staging: iio: ad2s1200: Move driver out of staging 2018-05-20 12:17:48 +01:00