public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Jacopo Mondi <jacopo+renesas@jmondi.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	linux-iio@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: adc: max9611: Fix too short conversion time delay
Date: Sat, 7 Dec 2019 10:33:48 +0000	[thread overview]
Message-ID: <20191207103348.58df9cd5@archlinux> (raw)
In-Reply-To: <20191202092328.GE1266@kunai>

On Mon, 2 Dec 2019 10:23:29 +0100
Wolfram Sang <wsa@the-dreams.de> wrote:

> On Mon, Dec 02, 2019 at 09:55:46AM +0100, Geert Uytterhoeven wrote:
> > As of commit b9ddd5091160793e ("iio: adc: max9611: Fix temperature
> > reading in probe"), max9611 initialization sometimes fails on the
> > Salvator-X(S) development board with:
> > 
> >     max9611 4-007f: Invalid value received from ADC 0x8000: aborting
> >     max9611: probe of 4-007f failed with error -5
> > 
> > The max9611 driver tests communications with the chip by reading the die
> > temperature during the probe function, which returns an invalid value.
> > 
> > According to the datasheet, the typical ADC conversion time is 2 ms, but
> > no minimum or maximum values are provided.  Maxim Technical Support
> > confirmed this was tested with temperature Ta=25 degreeC, and promised
> > to inform me if a maximum/minimum value is available (they didn't get
> > back to me, so I assume it is not).
> > 
> > However, the driver assumes a 1 ms conversion time.  Usually the
> > usleep_range() call returns after more than 1.8 ms, hence it succeeds.
> > When it returns earlier, the data register may be read too early, and
> > the previous measurement value will be returned.  After boot, this is
> > the temperature POR (power-on reset) value, causing the failure above.
> > 
> > Fix this by increasing the delay from 1000-2000 µs to 3000-3300 µs.
> > 
> > Note that this issue has always been present, but it was exposed by the
> > aformentioned commit.
> > 
> > Fixes: 69780a3bbc0b1e7e ("iio: adc: Add Maxim max9611 ADC driver")
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>  
> 
> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> One minor nit, though:
> 
> >  	/*
> >  	 * need a delay here to make register configuration
> > -	 * stabilize. 1 msec at least, from empirical testing.
> > +	 * stabilize.  
> 
> This could be a one line comment now?
> 

Applied to the fixes-togreg branch of iio.git and tidied up.

Thanks,

Jonathan

      reply	other threads:[~2019-12-07 10:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-02  8:55 [PATCH v2] iio: adc: max9611: Fix too short conversion time delay Geert Uytterhoeven
2019-12-02  9:23 ` Wolfram Sang
2019-12-07 10:33   ` Jonathan Cameron [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=20191207103348.58df9cd5@archlinux \
    --to=jic23@kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=jacopo+renesas@jmondi.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=wsa@the-dreams.de \
    /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