Skip to contentSkip to conversation

iio: humidity: hdc100x: Add margin to the conversion time

PATCH Applied Chris Lesiak 3 participants 5 messages Jun 14, 2021 – Jul 24, 2021 IIO

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 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 4839367d99e3 ("iio: humidity: add HDC100x support")
---
 drivers/iio/humidity/hdc100x.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/humidity/hdc100x.c +4 -2
index 2a957f19048e..9e0fce917ce4 100644
@@ -25,6 +25,8 @@
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/triggered_buffer.h>
 
+#include <linux/time.h>
+
 #define HDC100X_REG_TEMP			0x00
 #define HDC100X_REG_HUMIDITY			0x01
 
@@ -166,7 +168,7 @@ static int hdc100x_get_measurement(struct hdc100x_data *data,
 				   struct iio_chan_spec const *chan)
 {
 	struct i2c_client *client = data->client;
-	int delay = data->adc_int_us[chan->address];
+	int delay = data->adc_int_us[chan->address] + 1*USEC_PER_MSEC;
 	int ret;
 	__be16 val;
 
@@ -316,7 +318,7 @@ static irqreturn_t hdc100x_trigger_handler(int irq, void *p)
 	struct iio_dev *indio_dev = pf->indio_dev;
 	struct hdc100x_data *data = iio_priv(indio_dev);
 	struct i2c_client *client = data->client;
-	int delay = data->adc_int_us[0] + data->adc_int_us[1];
+	int delay = data->adc_int_us[0] + data->adc_int_us[1] + 2*USEC_PER_MSEC;
 	int ret;
 
 	/* dual read starts at temp register */
Signature · 1 line
2.26.2
maintainer
#1 lore raw
Quoted 4 lines · On Mon, 14 Jun 2021 09:18:20 -0500 Chris Lesiak <[email protected]> wrote:

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."

Quoted 8 lines

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 4839367d99e3 ("iio: humidity: add HDC100x support")

+CC Matt as this is one of his drivers.

Looks good to me.

Quoted 35 lines
---
 drivers/iio/humidity/hdc100x.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/humidity/hdc100x.c +4 -2
index 2a957f19048e..9e0fce917ce4 100644
@@ -25,6 +25,8 @@
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/triggered_buffer.h>
 
+#include <linux/time.h>
+
 #define HDC100X_REG_TEMP			0x00
 #define HDC100X_REG_HUMIDITY			0x01
 
@@ -166,7 +168,7 @@ static int hdc100x_get_measurement(struct hdc100x_data *data,
 				   struct iio_chan_spec const *chan)
 {
 	struct i2c_client *client = data->client;
-	int delay = data->adc_int_us[chan->address];
+	int delay = data->adc_int_us[chan->address] + 1*USEC_PER_MSEC;
 	int ret;
 	__be16 val;
 
@@ -316,7 +318,7 @@ static irqreturn_t hdc100x_trigger_handler(int irq, void *p)
 	struct iio_dev *indio_dev = pf->indio_dev;
 	struct hdc100x_data *data = iio_priv(indio_dev);
 	struct i2c_client *client = data->client;
-	int delay = data->adc_int_us[0] + data->adc_int_us[1];
+	int delay = data->adc_int_us[0] + data->adc_int_us[1] + 2*USEC_PER_MSEC;
 	int ret;
 
 	/* dual read starts at temp register */
maintainer
#2 lore raw
Quoted 11 lines · On Wed, 16 Jun 2021 13:43:35 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 8 lines · On Mon, 14 Jun 2021 09:18:20 -0500 Chris Lesiak <[email protected]> wrote:

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.

Quoted 6 lines
Quoted 4 lines

Delay an additional 1 ms per conversion to allow for additional margin.

Fixes 4839367d99e3 ("iio: humidity: add HDC100x support")

+CC Matt as this is one of his drivers.

@Matt. Ping.

Quoted 39 lines

Looks good to me.

Quoted 35 lines
---
 drivers/iio/humidity/hdc100x.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/humidity/hdc100x.c +4 -2
index 2a957f19048e..9e0fce917ce4 100644
@@ -25,6 +25,8 @@
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/triggered_buffer.h>
 
+#include <linux/time.h>
+
 #define HDC100X_REG_TEMP			0x00
 #define HDC100X_REG_HUMIDITY			0x01
 
@@ -166,7 +168,7 @@ static int hdc100x_get_measurement(struct hdc100x_data *data,
 				   struct iio_chan_spec const *chan)
 {
 	struct i2c_client *client = data->client;
-	int delay = data->adc_int_us[chan->address];
+	int delay = data->adc_int_us[chan->address] + 1*USEC_PER_MSEC;
 	int ret;
 	__be16 val;
 
@@ -316,7 +318,7 @@ static irqreturn_t hdc100x_trigger_handler(int irq, void *p)
 	struct iio_dev *indio_dev = pf->indio_dev;
 	struct hdc100x_data *data = iio_priv(indio_dev);
 	struct i2c_client *client = data->client;
-	int delay = data->adc_int_us[0] + data->adc_int_us[1];
+	int delay = data->adc_int_us[0] + data->adc_int_us[1] + 2*USEC_PER_MSEC;
 	int ret;
 
 	/* dual read starts at temp register */  
Acked-by
#3 lore raw
Quoted 15 lines · Jonathan Cameron
Quoted 11 lines · On Wed, 16 Jun 2021 13:43:35 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 8 lines · On Mon, 14 Jun 2021 09:18:20 -0500 Chris Lesiak <[email protected]> wrote:

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.

Quoted 11 lines
Quoted 6 lines
Quoted 4 lines

Delay an additional 1 ms per conversion to allow for additional margin.

Fixes 4839367d99e3 ("iio: humidity: add HDC100x support")

+CC Matt as this is one of his drivers.

@Matt. Ping.

Quoted 2 lines

Looks good to me.

Looks good to me as well.

Quoted 38 lines
Quoted 37 lines
Quoted 36 lines
---
 drivers/iio/humidity/hdc100x.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/humidity/hdc100x.c +4 -2
index 2a957f19048e..9e0fce917ce4 100644
@@ -25,6 +25,8 @@
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/triggered_buffer.h>
 
+#include <linux/time.h>
+
 #define HDC100X_REG_TEMP                   0x00
 #define HDC100X_REG_HUMIDITY                       0x01
 
@@ -166,7 +168,7 @@ static int hdc100x_get_measurement(struct hdc100x_data *data,
                               struct iio_chan_spec const *chan)
 {
    struct i2c_client *client = data->client;
-   int delay = data->adc_int_us[chan->address];
+   int delay = data->adc_int_us[chan->address] + 1*USEC_PER_MSEC;
    int ret;
    __be16 val;
 
@@ -316,7 +318,7 @@ static irqreturn_t hdc100x_trigger_handler(int irq, void *p)
    struct iio_dev *indio_dev = pf->indio_dev;
    struct hdc100x_data *data = iio_priv(indio_dev);
    struct i2c_client *client = data->client;
-   int delay = data->adc_int_us[0] + data->adc_int_us[1];
+   int delay = data->adc_int_us[0] + data->adc_int_us[1] + 2*USEC_PER_MSEC;
    int ret;
 
    /* dual read starts at temp register */
maintainer Applied
#4 lore raw
Quoted 23 lines · On Sun, 18 Jul 2021 14:31:28 -0700 Matt Ranostay <[email protected]>…
Quoted 22 lines · Jonathan Cameron
Quoted 17 lines · On Wed, 16 Jun 2021 13:43:35 +0100 Jonathan Cameron <[email protected]> wrote:
Quoted 4 lines · On Mon, 14 Jun 2021 09:18:20 -0500 Chris Lesiak <[email protected]> wrote:

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."

Quoted 8 lines

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 4839367d99e3 ("iio: humidity: add HDC100x support")

+CC Matt as this is one of his drivers.

Quoted 8 lines
Quoted 4 lines

@Matt. Ping.

Quoted 2 lines

Looks good to me.

Looks good to me as well.

Thanks.

Applied to the fixes-togreg branch of iio.git and marked for stable.

Jonathan

Quoted 39 lines
Quoted 39 lines
Quoted 38 lines
Quoted 37 lines
 
---
 drivers/iio/humidity/hdc100x.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iio/humidity/hdc100x.c +4 -2
index 2a957f19048e..9e0fce917ce4 100644
@@ -25,6 +25,8 @@
 #include <linux/iio/trigger_consumer.h>
 #include <linux/iio/triggered_buffer.h>
 
+#include <linux/time.h>
+
 #define HDC100X_REG_TEMP                   0x00
 #define HDC100X_REG_HUMIDITY                       0x01
 
@@ -166,7 +168,7 @@ static int hdc100x_get_measurement(struct hdc100x_data *data,
                               struct iio_chan_spec const *chan)
 {
    struct i2c_client *client = data->client;
-   int delay = data->adc_int_us[chan->address];
+   int delay = data->adc_int_us[chan->address] + 1*USEC_PER_MSEC;
    int ret;
    __be16 val;
 
@@ -316,7 +318,7 @@ static irqreturn_t hdc100x_trigger_handler(int irq, void *p)
    struct iio_dev *indio_dev = pf->indio_dev;
    struct hdc100x_data *data = iio_priv(indio_dev);
    struct i2c_client *client = data->client;
-   int delay = data->adc_int_us[0] + data->adc_int_us[1];
+   int delay = data->adc_int_us[0] + data->adc_int_us[1] + 2*USEC_PER_MSEC;
    int ret;
 
    /* dual read starts at temp register */