On Wed, Dec 04, 2019 at 04:08:34PM +0200, andriy.shevchenko@xxxxxxxxxxxxxxx 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