From: Marek Vasut <marex@denx.de>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "Bartosz Golaszewski" <brgl@bgdev.pl>,
"Ahmad Fatoum" <a.fatoum@pengutronix.de>,
"Kent Gibson" <warthog618@gmail.com>,
"Jan Lübbe" <jlu@pengutronix.de>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>
Subject: Re: Replacing global GPIO numbers in sysfs with hardware offsets
Date: Wed, 26 Feb 2025 13:36:44 +0100 [thread overview]
Message-ID: <d29f36d1-53e0-42d3-beed-cc228553f658@denx.de> (raw)
In-Reply-To: <CACRpkdaGeV3v80QuWwus5rg9GfKkT_gzhvRgfOobnDMUO2cPEQ@mail.gmail.com>
On 2/25/25 8:54 PM, Linus Walleij wrote:
> On Fri, Feb 21, 2025 at 8:41 PM Marek Vasut <marex@denx.de> wrote:
>
>> I would very much like to avoid having to enable debugfs on production
>> systems to access GPIOs in early userspace (e.g. initramfs).
>
> I didn't understand that. It was because Bartosz used the word "play":
Uh oh ... in short, the entire discussion between me and Bartosz at
FOSDEM could be summarized to (please correct me if I'm wrong and I'm
stuffing words into someone's mouth):
- Bartosz does not like fixed static GPIO number assignment, we agree
- Bartosz wants to write more userspace tools to operate GPIO chardev
API, we do not agree, Marek already has all the tools built into shell
(printf, echo, cat)
=> Some sysfs API "v2" which does not suffer from the defects of the
current one would be great. The benefit would be:
- Can be operated without extra tools, simple printf/echo/cat into
sysfs attributes would suffice
- Would work even in the simplest of userspaces (initramfs, remote
access VMs, etc.), which is practical for board bring up and well,
other limited deployments
That's really all this is about, get rid of the defects of the old sysfs
API, but keep the tooling requirements to minimum.
Also note that API "v2" attribute layout could differ from API "v1" ,
that is not a problem.
>>> The gist of it is: some people need to play with GPIOs very early, for
>>> example in an initramfs
>
> So I took that word literal: explore, play around. Not develop
> products.
>
>> This was so
>> far possible via the sysfs API without tools, currently it is becoming
>> not easily possible. A sysfs API "v2" which makes that possible would be
>> very much appreciated.
>
> I understand, I'm fine with sysfs if it needs to be a "support forever"
> ABI, as long as it's:
>
> - Using the per-chip HW numberspace
This is no issue for me.
> - Doesn't need any echo NN > export to see the lines in
> sysfs.
Can we really make do without export/unexport ?
Consider this scenario:
- User open()s and write()s /sys/bus/gpio/gpiochip0/gpio0/value
- User keeps FD to /sys/bus/gpio/gpiochip0/gpio0/value open
- Kernel module gets loaded, binds to DT node which references the same GPIO
- User write()s /sys/bus/gpio/gpiochip0/gpio0/value open again
I wonder if this could pose a problem ?
I suspect the kernel module loading should fail , right ?
next prev parent reply other threads:[~2025-02-26 12:43 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-02 12:45 Replacing global GPIO numbers in sysfs with hardware offsets Bartosz Golaszewski
2025-02-03 14:23 ` Geert Uytterhoeven
2025-02-07 20:18 ` Bartosz Golaszewski
2025-02-09 9:40 ` Geert Uytterhoeven
2025-02-25 18:25 ` Ayush Singh
2025-02-25 20:20 ` Linus Walleij
2025-02-26 6:25 ` Ayush Singh
2025-02-14 9:14 ` Linus Walleij
2025-02-21 18:01 ` Marek Vasut
2025-02-25 19:54 ` Linus Walleij
2025-02-26 12:36 ` Marek Vasut [this message]
2025-02-26 19:07 ` Bartosz Golaszewski
2025-02-28 7:49 ` Linus Walleij
2025-02-28 8:49 ` Geert Uytterhoeven
2025-02-28 8:55 ` Linus Walleij
2025-02-28 9:53 ` Geert Uytterhoeven
2025-03-05 8:22 ` Linus Walleij
2025-03-05 8:41 ` Kent Gibson
2025-03-11 10:28 ` Bartosz Golaszewski
2025-03-11 10:52 ` Geert Uytterhoeven
2025-03-11 11:53 ` Bartosz Golaszewski
2025-03-11 15:26 ` Geert Uytterhoeven
2025-02-21 19:56 ` Ahmad Fatoum
2025-02-25 19:56 ` Linus Walleij
2025-02-24 1:49 ` Kent Gibson
2025-02-24 8:28 ` Geert Uytterhoeven
2025-02-26 9:23 ` Bartosz Golaszewski
2025-02-26 10:58 ` Kent Gibson
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=d29f36d1-53e0-42d3-beed-cc228553f658@denx.de \
--to=marex@denx.de \
--cc=a.fatoum@pengutronix.de \
--cc=brgl@bgdev.pl \
--cc=geert+renesas@glider.be \
--cc=jlu@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.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).