linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Stein <alexander.stein@systec-electronic.com>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Rob Herring <robh@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	Mark Rutland <mark.rutland@arm.com>,
	kernel@pengutronix.de, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] gpio: document how to order GPIO controllers
Date: Wed, 06 Jul 2016 09:54:03 +0200	[thread overview]
Message-ID: <7356797.MVQep4sf2D@ws-stein> (raw)
In-Reply-To: <20160705180447.GP16643@pengutronix.de>

On Tuesday 05 July 2016 20:04:47, Uwe Kleine-König wrote:
> That is we have:
> 
> 	Hardware name | software gpiochip
> 	    GPIO4     |      gpiochip0
> 	    GPIO3     |      gpiochip1
> 	    GPIO1     |      gpiochip2
> 	    GPIO2     |	     gpiochip3
> 
> I bet that's the probe order because when sorted by address (and so
> by order in the device tree) we have exactly this ordering. (Compare
> with $(grep gpio@ arch/arm/boot/dts/imx25.dtsi).)

This is rather straight forward and rather simple for controller internal GPIO 
controllers but when using GPIO expanders both on SPI and I2C thing will get 
much more volatile especially on SMP systems. What would be the correct 
"order" here? Unless they are cascaded they are independent and there is no 
such thing as an order. Probe order _is_ unpredictable so they will vary on 
different boots. Having 4 internal GPIO controllers which creates 4 gpiochips 
with more or less fixed names is rather a special case. Dunno if they might 
change on a SMP system. Can a driver probe be called multiple times 
simultaneously? Well, when drivers are used as modules I think things are even 
more unpredictable.

> For a new interface this is OK, still I predict users will complain if
> the numbers used don't match naturally the hardware names. And IMHO they
> are right.

Given the fact that hardware names and gpiochip number relation is not fixed 
IMHO the simplest way to identify them is using the DT label. You need them 
anyway to identify them in DT itself at other places why not using this on 
Linux userspace too? So gpiochip[0-9]* should still be created but using udev 
you can create appropriate symlinks with more recognizable names.

Best regards,
Alexander

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-07-06  7:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-01  6:42 [PATCH] gpio: document how to order GPIO controllers Uwe Kleine-König
2016-07-05 14:05 ` Rob Herring
2016-07-05 18:04   ` Uwe Kleine-König
2016-07-06  7:24     ` Lothar Waßmann
2016-07-06  7:54     ` Alexander Stein [this message]
2016-07-06  9:34     ` Linus Walleij
2016-07-06 10:27       ` Johan Hovold
2016-07-06 12:34         ` Linus Walleij
2016-07-06 14:12           ` Permissions for GPIOs [Was: [PATCH] gpio: document how to order GPIO controllers] Jan Lübbe
     [not found]             ` <1467814334.2472.154.camel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2016-07-08 11:25               ` Linus Walleij
2016-07-13 13:14           ` [PATCH] gpio: document how to order GPIO controllers Johan Hovold
2016-07-22 14:34             ` Linus Walleij
2016-07-17 22:03       ` Rob Herring

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=7356797.MVQep4sf2D@ws-stein \
    --to=alexander.stein@systec-electronic.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gnurou@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh@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).