All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Sa, Nuno" <Nuno.Sa@analog.com>
To: Alexandru Ardelean <ardeleanalex@gmail.com>
Cc: linux-iio <linux-iio@vger.kernel.org>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Drew Fustini <drew@pdp7.com>
Subject: RE: [PATCH 1/2] iio: ltc2983: add support for optional reset gpio
Date: Fri, 20 Aug 2021 09:29:16 +0000	[thread overview]
Message-ID: <SJ0PR03MB6359B7B5B7BF6975590879EC99C19@SJ0PR03MB6359.namprd03.prod.outlook.com> (raw)
In-Reply-To: <CA+U=Dso61XreVxxz8a3cSO+LJrdQAJAi--3Nuv5nRG=buuVCcQ@mail.gmail.com>



> -----Original Message-----
> From: Alexandru Ardelean <ardeleanalex@gmail.com>
> Sent: Friday, August 20, 2021 10:21 AM
> To: Sa, Nuno <Nuno.Sa@analog.com>
> Cc: linux-iio <linux-iio@vger.kernel.org>; Jonathan Cameron
> <jic23@kernel.org>; Lars-Peter Clausen <lars@metafoo.de>; Drew
> Fustini <drew@pdp7.com>
> Subject: Re: [PATCH 1/2] iio: ltc2983: add support for optional reset
> gpio
> 
> [External]
> 
> On Fri, Aug 20, 2021 at 9:53 AM Nuno Sá <nuno.sa@analog.com>
> wrote:
> >
> > Check if an optional reset gpio is present and if so, make sure to
> reset
> > the device.
> >
> 
> Just one note/question inline.
> 
> > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> > ---
> >  drivers/iio/temperature/ltc2983.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> >
> > diff --git a/drivers/iio/temperature/ltc2983.c
> b/drivers/iio/temperature/ltc2983.c
> > index 3b4a0e60e605..37903e9fb90f 100644
> > --- a/drivers/iio/temperature/ltc2983.c
> > +++ b/drivers/iio/temperature/ltc2983.c
> > @@ -1470,6 +1470,7 @@ static int ltc2983_probe(struct spi_device
> *spi)
> >  {
> >         struct ltc2983_data *st;
> >         struct iio_dev *indio_dev;
> > +       struct gpio_desc *gpio;
> >         const char *name = spi_get_device_id(spi)->name;
> >         int ret;
> >
> > @@ -1494,6 +1495,16 @@ static int ltc2983_probe(struct spi_device
> *spi)
> >         if (ret)
> >                 return ret;
> >
> > +       gpio = devm_gpiod_get_optional(&st->spi->dev, "reset",
> GPIOD_OUT_HIGH);
> > +       if (IS_ERR(gpio))
> > +               return PTR_ERR(gpio);
> > +
> > +       if (gpio) {
> > +               /* bring device out of reset */
> > +               usleep_range(1000, 1005);
> > +               gpiod_set_value_cansleep(gpio, 0);
> 
> Datasheet mentions that it takes up to 100 ms for the device to fully
> start-up.
> It also mentions that the (command) status register will be
> unavailable to the user before this point.
> Page 16, Conversion State Details section, second paragraph.
> 
> I think there should probably be a sleep here of 100 ms.
> 
> Other than that change looks good.
> 

In the setup function we do a polled read on the status register until
we get the indication we are up. This was actually a fix sent recently
[1].

[1]: https://patchwork.kernel.org/project/linux-iio/patch/20210811133220.190264-2-nuno.sa@analog.com/
- Nuno Sá

> > +       }
> > +
> >         ret = ltc2983_setup(st, true);
> >         if (ret)
> >                 return ret;
> > --
> > 2.33.0
> >

  reply	other threads:[~2021-08-20  9:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20  6:55 [PATCH 1/2] iio: ltc2983: add support for optional reset gpio Nuno Sá
2021-08-20  6:55 ` [PATCH 2/2] iio: ltc2983: fail probe if no channels are given Nuno Sá
2021-08-20  8:22   ` Alexandru Ardelean
2021-08-20  8:21 ` [PATCH 1/2] iio: ltc2983: add support for optional reset gpio Alexandru Ardelean
2021-08-20  9:29   ` Sa, Nuno [this message]
2021-08-20 18:58     ` Alexandru Ardelean
2021-08-23  7:04       ` Sa, Nuno
2021-08-25  8:24         ` Sa, Nuno
2021-08-23 11:14 ` Andy Shevchenko
2021-08-23 12:51   ` Nuno Sá
2021-08-23 14:27     ` Andy Shevchenko
2021-08-23 14:51       ` Nuno Sá

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=SJ0PR03MB6359B7B5B7BF6975590879EC99C19@SJ0PR03MB6359.namprd03.prod.outlook.com \
    --to=nuno.sa@analog.com \
    --cc=ardeleanalex@gmail.com \
    --cc=drew@pdp7.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.