[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51066F1B.9010102@antcom.de>
Date: Mon, 28 Jan 2013 13:29:15 +0100
From: Roland Stigge <stigge@...com.de>
To: Stijn Devriendt <highguy@...il.com>
CC: gregkh@...uxfoundation.org, grant.likely@...retlab.ca,
linus.walleij@...aro.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, w.sang@...gutronix.de,
jbe@...gutronix.de, plagnioj@...osoft.com,
broonie@...nsource.wolfsonmicro.com, daniel-gl@....net,
rmallon@...il.com, sr@...x.de, wg@...ndegger.com,
mark.rutland@....com, nicolas.ferre@...el.com
Subject: Re: [PATCH 5/6 v14] gpio: Add device tree support to block GPIO API
On 01/28/2013 12:39 PM, Stijn Devriendt wrote:
>>> In the device-tree this is specified as:
>>>
>>> powr@...0 {
>>> // 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@...0 {
>> // ...
>>
>> 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.
>
> Given the pick-up of device-tree in ARM and MIPS, I think this stands
> a good chance
> of becoming a common pattern. Do mind the "gpios" name; it's already used by the
> normal GPIO request functions...
Right, when providing the respective convenience function, I'll better
use sth. like "gpioblock" as property name.
Specifying a traditional list of GPIOs instead is easy, actually. The
respective driver just needs to allocate a gpio block explicitly
(insteady of implicitly via phandle as above). Unfortunately, gpio
blocks that should be exported and available to userspace can't be
specified this way. Therefore the strategy as above.
Roland
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists