linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Alexander Dahl <ada@thorsis.com>,
	Rob Herring <robh+dt@kernel.org>,
	Kent Gibson <warthog618@gmail.com>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>
Subject: Re: setting gpio-line-names in dts for sama5d2 SoC
Date: Sat, 20 Mar 2021 12:20:31 +0100	[thread overview]
Message-ID: <CACRpkdaHA2a2hOCHNNnbLgNV2QeB-UZFKgEw111Fmg-Lh_=bOQ@mail.gmail.com> (raw)
In-Reply-To: <CAHp75Vd-+rSgG08TV0P3ocCQjUdPkNypxGncJmT5K62SEuwXog@mail.gmail.com>

On Thu, Mar 18, 2021 at 4:00 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Thu, Mar 18, 2021 at 3:56 PM Alexander Dahl <ada@thorsis.com> wrote:

> > In other words: if I design a new board, there's no interface I would break, at least not from the userspace point of view just looking at the line names, or is there?
>
> I understand that  names are platform specific and I'm on your side as
> an IoT specialist, but on the Linux side we may not blindly do changes
> like this due to ABI concerns. You see the problem here: you can't fix
> all (legacy) DTSs in the world which do not have GPIO line names
> listed, and for those users we effectively break their tools and
> scripts which relies on the hard coded naming scheme.
>
> So, we may change if and only if the names of the lines are not an ABI!
>
> What we can do as a workaround is to reverse the partsing order, and
> if somebody complains, it will be their DTS issues, whoever not the
> best solution either.

The line names are not really supposed to be used as ABI since
they are not necessarily unique. This problem was pointed out
by Johan a few times. The real ABI is the HW line number (local
offset) when used with the GPIO character device.

This is logical since the gpio-line-names attribute is optional.

It must be possible to get a handle to a GPIO line without a
name. And using the offset number should be the preferred
way for userspace: use a number on a gpiochipN with the
character device.

(The topology of the gpiochip per se can be determined from sysfs.)

However this has not stopped userspace from using it as ABI,
and these names are used by the GPIO aggregator.

It's hard to do it right without resetting history and requireing that
all names in the device tree be unique as well, at the root of the
problem, but when introduced, these names were there for
the file /sys/kernel/debug/gpio, not for exposing to userspace.

However the character device does give the name away, as
a piece of information, it is not supposed to be used to look
up lines but merely as information, but well people use it
for looking up lines by name anyway so what can we do.

I don't think it's a big deal to change these names.

Yours,
Linus Walleij

      reply	other threads:[~2021-03-20 11:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 13:07 setting gpio-line-names in dts for sama5d2 SoC Alexander Dahl
     [not found] ` <CAHp75Vf05NN0dXUrMSOXBRuYRnQRHO_92itZ3ndOyX1oERWt=g@mail.gmail.com>
2021-03-17 12:33   ` Andy Shevchenko
2021-03-18  9:50     ` Alexander Dahl
2021-03-18 12:40       ` Andy Shevchenko
2021-03-18 13:56         ` Alexander Dahl
2021-03-18 14:59           ` Andy Shevchenko
2021-03-20 11:20             ` Linus Walleij [this message]

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='CACRpkdaHA2a2hOCHNNnbLgNV2QeB-UZFKgEw111Fmg-Lh_=bOQ@mail.gmail.com' \
    --to=linus.walleij@linaro.org \
    --cc=ada@thorsis.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=robh+dt@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).