public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Emiliano Ingrassia <ingrassia@epigenesys.com>
Cc: Jean Delvare <jdelvare@suse.com>, linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v3] hwmon: sht3x: wait predefined limits loading complete before access
Date: Fri, 12 Jan 2018 14:20:27 -0800	[thread overview]
Message-ID: <20180112222027.GA2804@roeck-us.net> (raw)
In-Reply-To: <20180112204228.GA1182@ingrassia.epigenesys.com>

On Fri, Jan 12, 2018 at 09:42:28PM +0100, Emiliano Ingrassia wrote:
> 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>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/sht3x.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> 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;
> -- 
> 2.15.1
> 

      reply	other threads:[~2018-01-12 22:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 20:42 [PATCH v3] hwmon: sht3x: wait predefined limits loading complete before access Emiliano Ingrassia
2018-01-12 22:20 ` Guenter Roeck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180112222027.GA2804@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=ingrassia@epigenesys.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox