From: Kent Gibson <warthog618@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
linux-doc@vger.kernel.org, brgl@bgdev.pl,
linus.walleij@linaro.org, andy@kernel.org, corbet@lwn.net
Subject: Re: [PATCH] Documentation: gpio: describe uAPI behaviour when hardware doesn't support requested config
Date: Wed, 24 Jan 2024 08:18:45 +0800 [thread overview]
Message-ID: <20240124001845.GA4578@rigel> (raw)
In-Reply-To: <CAHp75Vd1dipGkCgQBENN3rLeUO+eQfOz9uKzz86eK755smqGag@mail.gmail.com>
On Tue, Jan 23, 2024 at 05:44:52PM +0200, Andy Shevchenko wrote:
> On Tue, Jan 23, 2024 at 3:39 PM Kent Gibson <warthog618@gmail.com> wrote:
> >
> > The existing uAPI documentation does not adequately describe how the kernel
> > handles the case where the underlying hardware or driver does not support
> > the requested configuration.
> >
> > Add a Configuration Support section describing that behaviour to both the
> > v1 and v2 documentation, and better document the errors returned where the
> > requested configuration cannot be supported.
>
> ...
>
> > +Bias best effort
>
This documents the behaviour of the uAPI as it stands, so is your
problem with the documentation or the uAPI?
> So, best effort means that in some cases it won't fail. It reminds me
> of the baud rate setting in serial (TermIOS). The question here is how
> does user space know that it fell in one of such cases? (In termios
> the IOCTL updates the respective fields and then user space can get
> settings to see what has actually been applied.)
>
Best effort means it will try, but if it fails it will continue
regardless. So the configuration is advisory, not strictly required.
As stated in the docs, userspace cannot currently tell, at least not via
the uAPI.
> Floating line is not good in some cases and user space really wants to
> know that and treat it as an error (if needed). Hence the above Q. I
> believe this needs to be explained in the documentation.
>
Indeed, and I think it is explained in the documentation - worst case it
will float. And you wont know. That is the way it is.
This originally came about as setting bias is entangled with
setting direction in gpiod_direction_input(), and it is best effort
there. The reasoning stated in the doc is what I recall from
conversations at the time.
Adding bias support was the first bit of kernel code I wrote so I wasn't
about to go refactoring the guts of gpiolib - though if I were to do it
now I probably would.
If you consider the current behaviour to be a bug then we can change
that behaviour, e.g. clearing the bias setting in the line info (bascially
the desc flags) if setting fails.
But if it is baked into the ABI then we need to extend the uAPI,
e.g. with a flag requesting that the bias config be mandatory.
Cheers,
Kent.
next prev parent reply other threads:[~2024-01-24 0:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-23 13:38 [PATCH] Documentation: gpio: describe uAPI behaviour when hardware doesn't support requested config Kent Gibson
2024-01-23 15:44 ` Andy Shevchenko
2024-01-24 0:18 ` Kent Gibson [this message]
2024-01-25 8:43 ` 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=20240124001845.GA4578@rigel \
--to=warthog618@gmail.com \
--cc=andy.shevchenko@gmail.com \
--cc=andy@kernel.org \
--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 \
/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).