From: Roland Stigge <stigge@antcom.de>
To: Stijn Devriendt <highguy@gmail.com>
Cc: gregkh@linuxfoundation.org, grant.likely@secretlab.ca,
linus.walleij@linaro.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, w.sang@pengutronix.de,
jbe@pengutronix.de, plagnioj@jcrosoft.com,
broonie@opensource.wolfsonmicro.com, daniel-gl@gmx.net,
rmallon@gmail.com, sr@denx.de, wg@grandegger.com,
mark.rutland@arm.com, nicolas.ferre@atmel.com
Subject: Re: [PATCH 5/6 v14] gpio: Add device tree support to block GPIO API
Date: Sun, 27 Jan 2013 15:29:25 +0100 [thread overview]
Message-ID: <510539C5.8000208@antcom.de> (raw)
In-Reply-To: <CAOY=C6E-+uKQGbRDjNh5ZP9Wrmd+PNbt7djkBTzwe29=qA1_PA@mail.gmail.com>
On 27/01/13 14:07, Stijn Devriendt wrote:
>> +Example:
>> +
>> + blockgpio {
>> + compatible = "linux,gpio-block";
>> +
>> + block0 {
>> + gpios = <&gpio 3 0 0>,
>> + <&gpio 3 1 0>;
>> + };
>> + block1 {
>> + gpios = <&gpio 4 1 0>,
>> + <&gpio 4 3 0>,
>> + <&gpio 4 2 0>,
>> + <&gpio 4 4 0>,
>> + <&gpio 4 5 0>,
>> + <&gpio 4 6 0>,
>> + <&gpio 4 7 0>,
>> + <&gpio 4 8 0>,
>> + <&gpio 4 9 0>,
>> + <&gpio 4 10 0>,
>> + <&gpio 4 19 0>;
>> + };
>> + };
>
> How do you see bindings for other kinds of drivers?
>
> In my patchset, it's possible for other drivers to use gpio-blocks.
> One example we have is a power sequencer with 2 pins attached
> to GPIO pins. These 2 pins form a 2bit word to select power margining.
> These 2 pins need to be set synchronously (as otherwise when going
> from profile 0 to profile 3 you pass either profile 1 or profile 2 which
> could be bad for hardware)
>
> In the device-tree this is specified as:
>
> powr@0x20 {
> // other properties
>
> gpios = <&gpio 4 0
> &gpio 5 0>;
> };
>
> Is this kind of integration also possible?
You can reference the gpio block via a phandle, e.g.:
blockgpio {
compatible = "linux,gpio-block";
selector1 {
gpios = <&gpio 4 0>,
<&gpio 5 0>;
};
};
powr@0x20 {
// ...
gpios = <&selector1>;
};
In the driver, you can get the gpio block like this:
block = gpio_block_find_by_name(of_parse_phandle(powr, "gpios", 0)->name);
(Simplified by removed error/NULL handling!)
If this turns out to be a common pattern, I can add a convenience "get"
function for this.
Roland
next prev parent reply other threads:[~2013-01-27 14:32 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-22 12:06 [PATCH 0/6 v14] gpio: Add block GPIO Roland Stigge
2013-01-22 12:06 ` [PATCH 1/6 v14] gpio: Add a block GPIO API to gpiolib Roland Stigge
2013-01-27 13:19 ` Stijn Devriendt
2013-01-27 13:58 ` Roland Stigge
2013-01-28 11:30 ` Stijn Devriendt
2013-01-31 20:56 ` Linus Walleij
2013-01-22 12:06 ` [PATCH 2/6 v14] gpio: Add sysfs support to block GPIO API Roland Stigge
2013-01-22 12:06 ` [PATCH 3/6 v14] gpio: Add userland device interface to block GPIO Roland Stigge
2013-01-23 1:03 ` Jonathan Corbet
2013-01-23 18:47 ` Roland Stigge
2013-01-24 9:13 ` Alexander Stein
2013-01-22 12:06 ` [PATCH 4/6 v14] gpiolib: Fix default attributes for class Roland Stigge
2013-01-22 12:06 ` [PATCH 5/6 v14] gpio: Add device tree support to block GPIO API Roland Stigge
2013-01-27 13:07 ` Stijn Devriendt
2013-01-27 14:29 ` Roland Stigge [this message]
2013-01-28 11:39 ` Stijn Devriendt
2013-01-28 12:29 ` Roland Stigge
2013-01-22 12:06 ` [PATCH 6/6 v14] gpio: Add block gpio to several gpio drivers Roland Stigge
2013-01-24 12:02 ` Stijn Devriendt
2013-01-24 12:17 ` Mark Brown
2013-01-24 12:19 ` Roland Stigge
2013-01-27 12:18 ` Stijn Devriendt
2013-01-27 13:48 ` Roland Stigge
2013-01-28 11:27 ` Stijn Devriendt
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=510539C5.8000208@antcom.de \
--to=stigge@antcom.de \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=daniel-gl@gmx.net \
--cc=grant.likely@secretlab.ca \
--cc=gregkh@linuxfoundation.org \
--cc=highguy@gmail.com \
--cc=jbe@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=nicolas.ferre@atmel.com \
--cc=plagnioj@jcrosoft.com \
--cc=rmallon@gmail.com \
--cc=sr@denx.de \
--cc=w.sang@pengutronix.de \
--cc=wg@grandegger.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).