[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdZ0W10E7UX7KDnej0SX_Jtuo8r1xSTJsGmXDrDYwArO7Q@mail.gmail.com>
Date: Wed, 11 Jun 2025 10:27:43 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Ahmad Fatoum <a.fatoum@...gutronix.de>, Kent Gibson <warthog618@...il.com>,
Jan Lübbe <jlu@...gutronix.de>, Marek Vasut <marex@...x.de>,
Geert Uytterhoeven <geert+renesas@...der.be>, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH RFC/RFT 07/15] gpio: sysfs: add a parallel class device
for each GPIO chip using device IDs
On Tue, Jun 10, 2025 at 4:38 PM Bartosz Golaszewski <brgl@...ev.pl> wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>
> In order to enable moving away from the global GPIO numberspace-based
> exporting of lines over sysfs: add a parallel, per-chip entry under
> /sys/class/gpio/ for every registered GPIO chip, denoted by device ID
> in the file name and not its base GPIO number.
>
> Compared to the existing chip group: it does not contain the "base"
> attribute as the goal of this change is to not refer to GPIOs by their
> global number from user-space anymore. It also contains its own,
> per-chip export/unexport attribute pair which allow to export lines by
> their hardware offset within the chip.
>
> Caveat #1: the new device cannot be a link to (or be linked to by) the
> existing "gpiochip<BASE>" entry as we cannot create links in
> /sys/class/xyz/.
>
> Caveat #2: the new entry cannot be named "gpiochipX" as it could
> conflict with devices whose base is statically defined to a low number.
> Let's go with "chipX" instead.
That's unfortunate but it's good to separate them, and
gpio/gpiochip is a bit tautological so this is a better sysfs name
anyway.
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> + /chipX ... for each gpiochip; #X is the gpio device ID
> + /export ... asks the kernel to export a GPIO at HW offset X to userspace
> + /unexport ... to return a GPIO at HW offset X to the kernel
> + /label ... (r/o) descriptive, not necessarily unique
Not necessarily *globally* unique, I think it's required to be unique
per-gpiochip right? Otherwise it will be hard to create these files.
> + /ngpio ... (r/o) number of GPIOs exposed by the chip
I like this approach, it's a good compromise between different
desires of the sysfs ABI.
Acked-by: Linus Walleij <linus.walleij@...aro.org>
Yours,
Linus Walleij
Powered by blists - more mailing lists