Skip to content

Commit 0e4190d

Browse files
dmosbergergroeck
authored andcommitted
hwmon: (sht4x) Fix EREMOTEIO errors
Per datasheet, SHT4x may need up to 8.2ms for a "high repeatability" measurement to complete. Attempting to read the result too early triggers a NAK which then causes an EREMOTEIO error. This behavior has been confirmed with a logic analyzer while running the I2C bus at only 40kHz. The low frequency precludes any signal-integrity issues, which was also confirmed by the absence of any CRC8 errors. In this configuration, a NAK occurred on any read that followed the measurement command within less than 8.2ms. Signed-off-by: David Mosberger-Tang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 214f525 commit 0e4190d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/hwmon/sht4x.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
/*
2424
* I2C command delays (in microseconds)
2525
*/
26-
#define SHT4X_MEAS_DELAY 1000
26+
#define SHT4X_MEAS_DELAY_HPM 8200 /* see t_MEAS,h in datasheet */
2727
#define SHT4X_DELAY_EXTRA 10000
2828

2929
/*
@@ -90,7 +90,7 @@ static int sht4x_read_values(struct sht4x_data *data)
9090
if (ret < 0)
9191
goto unlock;
9292

93-
usleep_range(SHT4X_MEAS_DELAY, SHT4X_MEAS_DELAY + SHT4X_DELAY_EXTRA);
93+
usleep_range(SHT4X_MEAS_DELAY_HPM, SHT4X_MEAS_DELAY_HPM + SHT4X_DELAY_EXTRA);
9494

9595
ret = i2c_master_recv(client, raw_data, SHT4X_RESPONSE_LENGTH);
9696
if (ret != SHT4X_RESPONSE_LENGTH) {

0 commit comments

Comments
 (0)