summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorEmiliano Ingrassia <ingrassia@epigenesys.com>2018-01-12 21:42:28 +0100
committerGuenter Roeck <linux@roeck-us.net>2018-01-12 23:18:39 +0100
commitabe6c3b06fa80777e321add05345c799a74e624a (patch)
tree8d52e3b9df9910862401d0bd3b725e7b968c4bd1 /drivers/hwmon
parenthwmon: (pmbus/ibm-cffps) Add dependency on LEDS_CLASS (diff)
downloadlinux-abe6c3b06fa80777e321add05345c799a74e624a.tar.xz
linux-abe6c3b06fa80777e321add05345c799a74e624a.zip
hwmon: (sht3x) wait predefined limits loading complete before access
An sht3x sensor include limits register which contains temperature and humidity limit values. After a reset, pre-defined values are loaded into that register. During the probe function, the driver reads the limits register. However, if the reads are made too early, and the bus is clocked at high frequencies (e.g. 100 kHz or more), the loading could be not completed and the sensor returns a NACK which causes the probe to fail. A delay of at least 500 us before the first read solves this issue. Signed-off-by: Emiliano Ingrassia <ingrassia@epigenesys.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/sht3x.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c
index 6ea99cd6ae79..370b57dafab7 100644
--- a/drivers/hwmon/sht3x.c
+++ b/drivers/hwmon/sht3x.c
@@ -732,6 +732,13 @@ static int sht3x_probe(struct i2c_client *client,
mutex_init(&data->i2c_lock);
mutex_init(&data->data_lock);
+ /*
+ * An attempt to read limits register too early
+ * causes a NACK response from the chip.
+ * Waiting for an empirical delay of 500 us solves the issue.
+ */
+ usleep_range(500, 600);
+
ret = limits_update(data);
if (ret)
return ret;