提交 abe6c3b0 编写于 作者: E Emiliano Ingrassia 提交者: Guenter Roeck

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: NEmiliano Ingrassia <ingrassia@epigenesys.com>
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
上级 b0076406
...@@ -732,6 +732,13 @@ static int sht3x_probe(struct i2c_client *client, ...@@ -732,6 +732,13 @@ static int sht3x_probe(struct i2c_client *client,
mutex_init(&data->i2c_lock); mutex_init(&data->i2c_lock);
mutex_init(&data->data_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); ret = limits_update(data);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册