From: Linus Walleij <linus.walleij@linaro.org>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Robert Schwebel <r.schwebel@pengutronix.de>,
bartosz.golaszewski@linaro.org,
Bartosz Golaszewski <brgl@bgdev.pl>,
Marco Felsch <m.felsch@pengutronix.de>,
christophe.leroy@csgroup.eu, linux-gpio@vger.kernel.org,
kernel@pengutronix.de, shawnguo@kernel.org,
Sascha Hauer <sha@pengutronix.de>
Subject: Re: GPIO static allocation warning with v6.2-rcX
Date: Tue, 31 Jan 2023 00:26:30 +0100 [thread overview]
Message-ID: <CACRpkdZsKAHx9KVTAF0-VBSd5QOSzP+Li_dyWETPY+_FpC_Cmw@mail.gmail.com> (raw)
In-Reply-To: <20230130164835.eteteji2vy7pbwtz@pengutronix.de>
On Mon, Jan 30, 2023 at 5:48 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> On Mon, Jan 30, 2023 at 11:19:11AM +0100, Linus Walleij wrote:
> > On Sun, Jan 29, 2023 at 7:33 PM Robert Schwebel
> > <r.schwebel@pengutronix.de> wrote:
> >
> > > While this could also be done with a daemon offering a dbus api, this
> > > would be significantly more complex. In a critical environment, one
> > > needs to make sure that the daemon process never fails, otherwhise the
> > > power of the DuT would maybe be in a random state. Then of course one
> > > can add a watchdog, but with the current sysfs interface it's really
> > > simple. Of course that would also work if the new interface would offer
> > > a "keep this line as it is" feature, but adding a dbus daemon just for
> > > keeping the state of a pin sounds overcomplex when the kernel could also
> > > provide that functionality.
> >
> > One issue we face as developers is scaleability. Things that
> > seem straight forward on a single board computer in a lab get
> > really complex in a big system with man GPIO chips.
>
> This is the point where the discussion took a wrong turn.
>
> Yes, there is awareness that the sysfs API has a downside (here: on some
> platforms the number allocation is not stable).
>
> But the problem here is that the alternative (i.e. using the newer
> devctrl API) also has a downside that makes it unsuitable (or overly
> complex) to use for some workflows.
That should make it possible to use my suggested debugfs facility
that provide the same, but does not use the global numberspace.
People who don't care about the complexity involved with the character
device certainly will not care about the downsides of using debugfs in
production either. (Such as interfering with any chardev users...)
> Just an idea: Wouldn't a nice solution be to make it possible to opt-out
> of the reset to the safe state after use?
As Bartosz says there is no reset to any safe state, whatever that
would be. The state is kept in hardware just like with sysfs.
You can even set up the state from sysfs and then read it back
from the character device or vice versa, after freeing each
hogs resources.
It's really just the .get_direction() and .get() callbacks on the
gpio_chip that read the state, .set_direction_input|output()
and .set() sets it, like they always did.
Consider the example too tools/gpio/gpio-hammer.c
that I wrote. It reads the initial line values of the GPIO lines
(from hardware) and then start to invert them. It doesn't start
from any specific state?
Yours,
Linus Walleij
next prev parent reply other threads:[~2023-01-30 23:26 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 10:46 GPIO static allocation warning with v6.2-rcX Marco Felsch
2023-01-23 14:55 ` Bartosz Golaszewski
2023-01-23 14:56 ` Bartosz Golaszewski
2023-01-25 9:35 ` Sascha Hauer
2023-01-25 13:56 ` Bartosz Golaszewski
2023-01-26 10:27 ` Sascha Hauer
2023-01-26 1:57 ` Kent Gibson
2023-01-26 10:14 ` Sascha Hauer
2023-01-26 10:26 ` Kent Gibson
2023-01-26 9:35 ` Linus Walleij
2023-01-26 10:49 ` Sascha Hauer
2023-01-29 18:33 ` Robert Schwebel
2023-01-30 10:19 ` Linus Walleij
2023-01-30 11:02 ` Marco Felsch
2023-01-30 15:01 ` Linus Walleij
2023-01-30 15:45 ` Rob Herring
2023-01-31 7:21 ` Alexander Stein
2023-01-30 17:26 ` Andy Shevchenko
2023-01-30 16:48 ` Uwe Kleine-König
2023-01-30 17:21 ` Bartosz Golaszewski
2023-01-30 23:26 ` Linus Walleij [this message]
2023-03-02 2:19 ` Kent Gibson
2023-03-02 15:40 ` Andy Shevchenko
2023-01-26 9:42 ` Linus Walleij
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=CACRpkdZsKAHx9KVTAF0-VBSd5QOSzP+Li_dyWETPY+_FpC_Cmw@mail.gmail.com \
--to=linus.walleij@linaro.org \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=christophe.leroy@csgroup.eu \
--cc=kernel@pengutronix.de \
--cc=linux-gpio@vger.kernel.org \
--cc=m.felsch@pengutronix.de \
--cc=r.schwebel@pengutronix.de \
--cc=sha@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
/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).