[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=Meaif1zDeV5mQj3sdJB5et36a_6RctLoVLQc+EH8ig9LQ@mail.gmail.com>
Date: Mon, 23 Jun 2025 10:02:07 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Linus Walleij <linus.walleij@...aro.org>
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 Wed, Jun 11, 2025 at 10:27 AM Linus Walleij <linus.walleij@...aro.org> wrote:
>
> 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.
>
Yes, this must be updated as well, the labels are of course unique.
Bart
> > + /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