Skip to content

Commit 84edec8

Browse files
ChrisLesiakjic23
authored andcommitted
iio: humidity: hdc100x: Add margin to the conversion time
The datasheets have the following note for the conversion time specification: "This parameter is specified by design and/or characterization and it is not tested in production." Parts have been seen that require more time to do 14-bit conversions for the relative humidity channel. The result is ENXIO due to the address phase of a transfer not getting an ACK. Delay an additional 1 ms per conversion to allow for additional margin. Fixes: 4839367 ("iio: humidity: add HDC100x support") Signed-off-by: Chris Lesiak <[email protected]> Acked-by: Matt Ranostay <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 14a3023 commit 84edec8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/iio/humidity/hdc100x.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
#include <linux/iio/trigger_consumer.h>
2626
#include <linux/iio/triggered_buffer.h>
2727

28+
#include <linux/time.h>
29+
2830
#define HDC100X_REG_TEMP 0x00
2931
#define HDC100X_REG_HUMIDITY 0x01
3032

@@ -166,7 +168,7 @@ static int hdc100x_get_measurement(struct hdc100x_data *data,
166168
struct iio_chan_spec const *chan)
167169
{
168170
struct i2c_client *client = data->client;
169-
int delay = data->adc_int_us[chan->address];
171+
int delay = data->adc_int_us[chan->address] + 1*USEC_PER_MSEC;
170172
int ret;
171173
__be16 val;
172174

@@ -316,7 +318,7 @@ static irqreturn_t hdc100x_trigger_handler(int irq, void *p)
316318
struct iio_dev *indio_dev = pf->indio_dev;
317319
struct hdc100x_data *data = iio_priv(indio_dev);
318320
struct i2c_client *client = data->client;
319-
int delay = data->adc_int_us[0] + data->adc_int_us[1];
321+
int delay = data->adc_int_us[0] + data->adc_int_us[1] + 2*USEC_PER_MSEC;
320322
int ret;
321323

322324
/* dual read starts at temp register */

0 commit comments

Comments
 (0)