mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: "Jonathan Cameron" <Jonathan.Cameron@Huawei.com>,
	"Nuno Sá" <noname.nuno@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	"Tanislav, Cosmin" <Cosmin.Tanislav@analog.com>,
	Rob Herring <robh+dt@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/5] iio: addac: ad74413r: add support for reset-gpio
Date: Tue, 15 Nov 2022 20:10:53 +0100	[thread overview]
Message-ID: <6d76cc6d-9db7-5b18-e4f1-dc220b3929a3@rasmusvillemoes.dk> (raw)
In-Reply-To: <20221115161052.00002633@Huawei.com>

On 15/11/2022 17.10, Jonathan Cameron wrote:
> On Tue, 15 Nov 2022 15:49:46 +0100
> Nuno Sá <noname.nuno@gmail.com> wrote:
> 
>> On Mon, 2022-11-14 at 19:44 +0000, Jonathan Cameron wrote:
>>> On Mon, 14 Nov 2022 13:52:26 +0000
>>> "Tanislav, Cosmin" <Cosmin.Tanislav@analog.com> wrote:
>>>   
>>>>>
>>>>> I'm a little confused on polarity here.  The pin is a !reset so
>>>>> we need to drive it low briefly to trigger a reset.
>>>>> I'm guessing for your board the pin is set to active low? (an
>>>>> example
>>>>> in the dt would have made that clearer) Hence the pulse
>>>>> in here to 1 is actually briefly driving it low before restoring
>>>>> to high?
>>>>>
>>>>> For a pin documented as !reset that seems backwards though you
>>>>> have
>>>>> called it reset so that is fine, but this description doesn't
>>>>> make that
>>>>> celar.    
>>>>
>>>> My opinion is that the driver shouldn't exactly know the polarity
>>>> of the reset,
>>>> and just assume that setting the reset GPIO to 1 means putting it
>>>> in reset,
>>>> and setting it to 0 means bringing out of reset.  
>>>
>>> Agreed. I'd just like a comment + example in the dt-binding to make
>>> the point
>>> that the pin is !reset.
>>>
>>> Preferably with an example in the dt binding of the common case of it
>>> being wired
>>> up to an active low pin.
>>>
>>> The main oddity here is the need to pulse it rather than request it
>>> directly as
>>> in the reset state and then just set that to off.
>>>
>>>   
>>
>> Agreed... In theory we should be able to request the gpio with
>> GPIOD_OUT_HIGH and then just bring the device out of reset
> 
> If I recall correctly the datasheet specifically calls out that a pulse
> should be used.  No idea if that's actually true, or if it was meant
> to be there just to say it needs to be set for X nsecs.

So the data sheet says

  The hardware reset is initiated by pulsing the RESET pin low. The
RESET pulse width must comply with the specifications in Table 11.

and table 11 says that the pulse must be min 50us, max 1ms. We don't
really have any way whatsoever to ensure that we're not rescheduled
right before pulling the gpio high again (deasserting the reset), so the
pulse could effectively be much more than 1ms. But I have a hard time
believing that that actually matters (i.e., what state would the chip be
in if we happen to make a pulse 1234us wide?). But what might be
relevant, and maybe where that 1ms figure really comes from, can perhaps
be read in table 10, which lists a "device reset time" of 1ms, with the
description

  Time taken for device reset and calibration memory upload to complete
hardware or software reset events after the device is powered up

so perhaps we should ensure a 1ms delay after the reset (whether we used
the software or gpio method). But that would be a separate fix IMO (and
I'm not sure we actually need it).

I don't mind requesting the gpio with GPIOD_OUT_HIGH, but I'd still keep
the gpiod_set_value(, 1) in the reset function, otherwise it's a bit too
magic for my taste.

Rasmus


  reply	other threads:[~2022-11-15 19:11 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-11 14:39 [PATCH 0/5] iio: addac: ad74413r: various fixups Rasmus Villemoes
2022-11-11 14:39 ` [PATCH 1/5] iio: addac: ad74413r: add spi_device_id table Rasmus Villemoes
2022-11-12 16:50   ` Jonathan Cameron
2022-11-14  8:02     ` Rasmus Villemoes
2022-11-14 19:39       ` Jonathan Cameron
2022-11-11 14:39 ` [PATCH 2/5] dt-bindings: iio: ad74413r: make refin-supply optional Rasmus Villemoes
2022-11-12 16:54   ` Jonathan Cameron
2022-11-14  8:10     ` Rasmus Villemoes
2022-11-11 14:39 ` [PATCH 3/5] iio: addac: ad74413r: implement support for optional refin-supply Rasmus Villemoes
2022-11-12 16:56   ` Jonathan Cameron
2022-11-11 14:39 ` [PATCH 4/5] dt-bindings: iio: ad74413r: add optional reset-gpios Rasmus Villemoes
2022-11-12 17:00   ` Jonathan Cameron
2022-11-11 14:39 ` [PATCH 5/5] iio: addac: ad74413r: add support for reset-gpio Rasmus Villemoes
2022-11-12 17:07   ` Jonathan Cameron
2022-11-14  8:37     ` Rasmus Villemoes
2022-11-14 19:41       ` Jonathan Cameron
2022-11-14 13:52     ` Tanislav, Cosmin
2022-11-14 19:44       ` Jonathan Cameron
2022-11-15 14:49         ` Nuno Sá
2022-11-15 16:10           ` Jonathan Cameron
2022-11-15 19:10             ` Rasmus Villemoes [this message]
2022-11-16 10:22               ` Jonathan Cameron
2022-11-16 12:06                 ` Nuno Sá
2022-11-18 11:21                 ` Rasmus Villemoes
2022-11-15 14:53   ` Nuno Sá
2022-11-15  9:55 ` [PATCH v2 0/3] iio: addac: ad74413r: add spi device id table, support reset gpio Rasmus Villemoes
2022-11-15  9:55   ` [PATCH v2 1/3] iio: addac: ad74413r: add spi_device_id table Rasmus Villemoes
2022-11-15  9:55   ` [PATCH v2 2/3] dt-bindings: iio: ad74413r: add optional reset-gpios Rasmus Villemoes
2022-11-15 10:12     ` Krzysztof Kozlowski
2022-11-15  9:55   ` [PATCH v2 3/3] iio: addac: ad74413r: add support for reset-gpio Rasmus Villemoes
2022-11-23 20:55   ` [PATCH v2 0/3] iio: addac: ad74413r: add spi device id table, support reset gpio Jonathan Cameron

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=6d76cc6d-9db7-5b18-e4f1-dc220b3929a3@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=Cosmin.Tanislav@analog.com \
    --cc=Jonathan.Cameron@Huawei.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noname.nuno@gmail.com \
    --cc=robh+dt@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

all inboxes | Powered by JetHome®