From: Hans de Goede <hdegoede@redhat.com>
To: Linus Walleij <linus.walleij@linaro.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Kent Gibson <warthog618@gmail.com>
Cc: Marc Zyngier <maz@kernel.org>,
linux-gpio@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, Bartosz Golaszewski <brgl@bgdev.pl>,
Jonathan Corbet <corbet@lwn.net>
Subject: Re: [PATCH v1 2/3] Documentation: gpio: Add a section on what to return in ->get() callback
Date: Sat, 3 Dec 2022 13:09:44 +0100 [thread overview]
Message-ID: <8246b761-d83d-de59-fa30-a82d6bbc9533@redhat.com> (raw)
In-Reply-To: <CACRpkdaQWZE6=BNEh5hSH9=jBK=TcLoD1uUb=JyNYmHFvaSAfg@mail.gmail.com>
Hi Linus,
On 12/3/22 10:38, Linus Walleij wrote:
> On Wed, Nov 30, 2022 at 4:55 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
>
>> +The below table gathered the most used cases.
>> +
>> +========== ========== =============== =======================
>> + Input Output State What value to return?
>> +========== ========== =============== =======================
>> + Disabled Disabled Hi-Z input buffer
>> + Disabled OS/OD/etc Single ended [cached] output buffer
>> + x Push-Pull Out [cached] output buffer
>> + Enabled Disabled In input buffer
>> + Enabled OS/OD/etc Bidirectional input buffer
>> +========== ========== =============== =======================
>
> This looks about right to me, but we need more input, Kent?
As I already mentioned in earlier replies to me this
seems to make things needlessly complicated for GPIO chips
where there are separate registers for reading the input-buffer vs
setting the output-buffer.
To implement the above drivers for these would need to check if
the pin is in push/pull mode and then read the register setting
the output-buffer in get() while reading the register reading
from the input-buffer in other cases in get().
I fail to see any downsides to just always reading
the register reading the input-buffer on GPIO chips like this,
when the pin in in push/pull output mode that should simply
give us the right value and when it does not this could
help detect short-circuits to Gnd/Vdd.
Where as I fear that implementing 2 different strategies in
get() for these kinda GPIO chips, will most likely be a
source of bug. Esp. since testing all the permutations
from the above table is going to be tricky in many cases.
If we go this route and demand that drivers for GPIO chips
with a separate (read-only) register for the input-buffer
sometimes read the register for the output-buffer on get()
can we then add a helper to the core which returns which
of the 2 registers should be used so that drivers don't
have to duplicate the logic for checking this ?
Regards,
Hans
next prev parent reply other threads:[~2022-12-03 12:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 15:55 [PATCH v1 1/3] Documentation: gpio: Input mode is not true Hi-Z Andy Shevchenko
2022-11-30 15:55 ` [PATCH v1 2/3] Documentation: gpio: Add a section on what to return in ->get() callback Andy Shevchenko
2022-11-30 16:12 ` Hans de Goede
2022-11-30 16:14 ` Hans de Goede
2022-11-30 16:22 ` Andy Shevchenko
2022-11-30 16:20 ` Andy Shevchenko
2022-12-01 11:18 ` Hans de Goede
2022-12-03 9:38 ` Linus Walleij
2022-12-03 12:09 ` Hans de Goede [this message]
2022-12-05 1:43 ` Kent Gibson
2022-12-05 12:08 ` Andy Shevchenko
2022-12-05 15:35 ` Kent Gibson
2022-12-07 0:06 ` Linus Walleij
2022-12-07 9:55 ` Andy Shevchenko
2022-12-07 10:11 ` Kent Gibson
2022-12-07 13:49 ` Linus Walleij
2022-11-30 15:55 ` [PATCH v1 3/3] Documentation: gpio: Replace leading TABs by spaces in the code blocks Andy Shevchenko
2022-12-03 9:35 ` Linus Walleij
2022-12-03 9:33 ` [PATCH v1 1/3] Documentation: gpio: Input mode is not true Hi-Z Linus Walleij
2023-03-10 17:25 ` Andy Shevchenko
2023-03-15 10:07 ` Bartosz Golaszewski
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=8246b761-d83d-de59-fa30-a82d6bbc9533@redhat.com \
--to=hdegoede@redhat.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@bgdev.pl \
--cc=corbet@lwn.net \
--cc=linus.walleij@linaro.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=warthog618@gmail.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).