From: "andriy.shevchenko@linux.intel.com" <andriy.shevchenko@linux.intel.com>
To: "Stanimir, Vasile-Laurentiu" <Vasile-Laurentiu.Stanimir@windriver.com>
Cc: "linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linus.walleij@linaro.org" <linus.walleij@linaro.org>,
"mika.westerberg@linux.intel.com"
<mika.westerberg@linux.intel.com>
Subject: Re: [PATCH] gpiolib-acpi: Set gpiod flags for ACPI GPIO resources based on pullup and polarity
Date: Thu, 5 Dec 2019 19:49:59 +0200 [thread overview]
Message-ID: <20191205174959.GW32742@smile.fi.intel.com> (raw)
In-Reply-To: <20191204140834.GP32742@smile.fi.intel.com>
On Wed, Dec 04, 2019 at 04:08:34PM +0200, andriy.shevchenko@linux.intel.com wrote:
> On Tue, Dec 03, 2019 at 03:24:57PM +0000, Stanimir, Vasile-Laurentiu wrote:
> > On Mon, Dec 02, 2019 at 01:44:04PM +0000, Stanimir, Vasile-Laurentiu wrote:
> > > On Mon, Dec 02, 2019 at 12:36:47PM +0000, Stanimir, Vasile-Laurentiu wrote:
> > The pin itself is a reset pin that must (as defined by rfc2119) be asserted during Linux boot (it controls
> > the reset logic of a soc external device), the polarity is active low, which is why it's configured with a PullDown.
>
> And here is the issue AFAICS. The Active low should be configured with PullUp
> and set to whatever BIOS wants.
I stand corrected:
whatever -> active state
So, basically BIOS settings in ACPI and in hardware should be in align.
Otherwise it's badly created / configured BIOS.
> Correct me if I'm wrong, but code does the following in
> the properly configured DSDT:
>
> 0/ (not OS) firmware prepares ACPI DSDT with parameters (see 2/) and sets pin
> to active state - electrical low;
> 1/ we request GPIO via gpiod_get(..., GPIOD_ASIS);
> 2/ ACPI provides: IoOutput + Active Low + PullUp;
> 3/ above is translated to GPIO flags = GPIOD_OUT_HIGH and look up flags =
> GPIO_PULL_UP | GPIO_ACTIVE_LOW;
> 4/ ...which calls gpiod_direction_output() with value = 1 and being inverted
> to 0 due to Active Low in the descriptor flags;
> 5/ 0, i.e. electrically low signal, comes out from the SoC (compare
> with 0/ above).
>
> If it's not, we need to fix a root cause of it.
>
> > Also we discussed here about using IoRestrictionNone/IoRestrictionNonePreserve as a potential solution to
> > this problem, but this is a pure output pin, so that didn't seem right to us either.
> >
> > In the end the main question, no matter the use case, is how an active low pin, that's being
> > asserted from BIOS, should be configured in the DSDT to be correctly represented by the code.
> > The patch was the result of not finding any solution to the problem above. Speaking strictly of the
> > patch it should solve the problem of this case of active-low pins.
> P.S. Before we are going further we need to see the dmesg when
> CONFIG_DEBUG_GPIO is set along with GpioIo() macro and corresponding
> _DSD() excerpts from DSDT.
You can send it privately if something is not okay to share (though I don't see
such in this case).
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2019-12-05 17:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-02 12:36 [PATCH] gpiolib-acpi: Set gpiod flags for ACPI GPIO resources based on pullup and polarity Stanimir, Vasile-Laurentiu
2019-12-02 13:05 ` andriy.shevchenko
2019-12-02 13:44 ` Stanimir, Vasile-Laurentiu
2019-12-02 14:08 ` andriy.shevchenko
2019-12-03 15:24 ` Stanimir, Vasile-Laurentiu
2019-12-04 14:08 ` andriy.shevchenko
2019-12-05 17:49 ` andriy.shevchenko [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=20191205174959.GW32742@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=Vasile-Laurentiu.Stanimir@windriver.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/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;
as well as URLs for NNTP newsgroup(s).