From: Hans de Goede <hdegoede@redhat.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
linux-gpio@vger.kernel.org, Jamie McClymont <jamie@kwiius.com>
Subject: Re: [PATCH v1 1/3] gpiolib: acpi: Respect bias settings for GpioInt() resource
Date: Thu, 22 Oct 2020 11:05:01 +0200 [thread overview]
Message-ID: <b747a80e-27e1-be81-58dc-7d95c2cc567a@redhat.com> (raw)
In-Reply-To: <20201021163844.GX4077@smile.fi.intel.com>
Hi,
On 10/21/20 6:38 PM, Andy Shevchenko wrote:
> On Wed, Oct 21, 2020 at 12:58:54PM +0300, Mika Westerberg wrote:
>> On Wed, Oct 14, 2020 at 04:31:52PM +0300, Andy Shevchenko wrote:
>>> In some cases the GpioInt() resource is coming with bias settings
>>> which may affect system functioning. Respect bias settings for
>>> GpioInt() resource by calling acpi_gpio_update_gpiod_*flags() API
>>> in acpi_dev_gpio_irq_get().
>>>
>>> While at it, refactor to configure flags first and, only when succeeded,
>>> map the IRQ descriptor.
>
> ...
>
>>> - irq = gpiod_to_irq(desc);
>>> - if (irq < 0)
>>> - return irq;
>>> + acpi_gpio_update_gpiod_flags(&dflags, &info);
>>> + acpi_gpio_update_gpiod_lookup_flags(&lflags, &info);
>>>
>>> snprintf(label, sizeof(label), "GpioInt() %d", index);
>>> - ret = gpiod_configure_flags(desc, label, lflags, info.flags);
>>> + ret = gpiod_configure_flags(desc, label, lflags, dflags);
>>> if (ret < 0)
>>> return ret;
>>>
>>> + irq = gpiod_to_irq(desc);
>>> + if (irq < 0)
>>> + return irq;
>>
>> Should the above be undone if the conversion here fails?
>
> But wouldn't it be not good if we changed direction, for example, and then
> change it back? (IRQ requires input, which is safer, right?)
>
> This makes me think what gpiod_to_irq() may do for physical state of the pin.
> On the brief search it seems there is no side effect on the pin with that
> function, so, perhaps the original order has that in mind to not shuffle with
> line if mapping can't be established. But if setting flags fail, we may got
> into the state which is not equal to the initial one, right?
>
> So, in either case I see no good way to roll back the physical pin state
> changes. But I can return ordering of the calls in next version.
>
> What do you think?
I think it would be good to do a new version where you keep the original
ordering.
Also if you decide to keep the ordering change, that really should be
in a separate commit and not squashed into this one, so that e.g. a bisect
can determine the difference between the ordering change or the flags
changes causing any issues.
Regards,
Hans
next prev parent reply other threads:[~2020-10-22 9:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-14 13:31 [PATCH v1 1/3] gpiolib: acpi: Respect bias settings for GpioInt() resource Andy Shevchenko
2020-10-14 13:31 ` [PATCH v1 2/3] gpiolib: acpi: Use named item for enum gpiod_flags variable Andy Shevchenko
2020-10-21 9:59 ` Mika Westerberg
2020-10-14 13:31 ` [PATCH v1 3/3] gpiolib: of: " Andy Shevchenko
2020-10-21 9:58 ` [PATCH v1 1/3] gpiolib: acpi: Respect bias settings for GpioInt() resource Mika Westerberg
2020-10-21 16:38 ` Andy Shevchenko
2020-10-22 6:51 ` Mika Westerberg
2020-10-22 9:05 ` Hans de Goede [this message]
2020-10-22 10:43 ` Andy Shevchenko
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=b747a80e-27e1-be81-58dc-7d95c2cc567a@redhat.com \
--to=hdegoede@redhat.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bgolaszewski@baylibre.com \
--cc=jamie@kwiius.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).