* <Query> How to read arguments from a gpio handle
@ 2012-08-03 3:39 Leela Krishna Amudala
[not found] ` <CAL1wa8fdYCmTNpO=7v5S7o-Oi3nRD_7uUgCCVpM5TEP9ZUXedw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Leela Krishna Amudala @ 2012-08-03 3:39 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
Hello,
Can some one please tell me how to read the args from the gpio handle
For example:
Consider lcd-reset-gpio = <&gpx0 1 2 3 4>; as my phandle.
The 4 args in the above handle denotes
<[phandle of the gpio controller node]
[pin number within the gpio controller]
[mux function]
[pull up/down]
[drive strength]>
My intention is to read the "mux function" and "pull up/down" values
from the above handle and do the corresponding operations on that
particular gpio.
I tried using of_get_named_gpio_flags(struct device_node *np, const
char *propname,
int index, enum of_gpio_flags *flags);
function and I always gets the flags value as '0' irrespective of the
values present in phandle of GPIO.
If somebody knows how to parse those values please throw some pointers on this.
Thanks in advance,
Leela krishna Amudala.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: <Query> How to read arguments from a gpio handle
[not found] ` <CAL1wa8fdYCmTNpO=7v5S7o-Oi3nRD_7uUgCCVpM5TEP9ZUXedw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-08-03 4:40 ` Daniel Mack
2012-08-03 5:28 ` Stephen Warren
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Mack @ 2012-08-03 4:40 UTC (permalink / raw)
To: Leela Krishna Amudala; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
Hi,
On 03.08.2012 05:39, Leela Krishna Amudala wrote:
> Can some one please tell me how to read the args from the gpio handle
>
> For example:
> Consider lcd-reset-gpio = <&gpx0 1 2 3 4>; as my phandle.
>
> The 4 args in the above handle denotes
>
> <[phandle of the gpio controller node]
> [pin number within the gpio controller]
> [mux function]
> [pull up/down]
> [drive strength]>
>
> My intention is to read the "mux function" and "pull up/down" values
> from the above handle and do the corresponding operations on that
> particular gpio.
>
> I tried using of_get_named_gpio_flags(struct device_node *np, const
> char *propname,
> int index, enum of_gpio_flags *flags);
> function and I always gets the flags value as '0' irrespective of the
> values present in phandle of GPIO.
>
> If somebody knows how to parse those values please throw some pointers on this.
The mux functions, pull-up/down and driver strength are not part of the
GPIO spec but belong the the pinctrl driver. The mux of the pin you are
using has to be configured to GPIO of course, but how that is done and
all other details is not something the GPIO chip driver is in charge for,
of_get_named_gpio_flags() is the right funtion to use, and the flags are
currently only used to denote whether a pin is considered inverted. See
of_gpio_flags in include/linux/of_gpio.h.
HTH,
Daniel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: <Query> How to read arguments from a gpio handle
[not found] ` <CAL1wa8fdYCmTNpO=7v5S7o-Oi3nRD_7uUgCCVpM5TEP9ZUXedw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-03 4:40 ` Daniel Mack
@ 2012-08-03 5:28 ` Stephen Warren
[not found] ` <501B6190.9060101-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
1 sibling, 1 reply; 5+ messages in thread
From: Stephen Warren @ 2012-08-03 5:28 UTC (permalink / raw)
To: Leela Krishna Amudala; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
On 08/02/2012 09:39 PM, Leela Krishna Amudala wrote:
> Hello,
>
> Can some one please tell me how to read the args from the gpio handle
>
> For example:
> Consider lcd-reset-gpio = <&gpx0 1 2 3 4>; as my phandle.
>
> The 4 args in the above handle denotes
>
> <[phandle of the gpio controller node]
> [pin number within the gpio controller]
> [mux function]
> [pull up/down]
> [drive strength]>
>
> My intention is to read the "mux function" and "pull up/down" values
> from the above handle and do the corresponding operations on that
> particular gpio.
>
> I tried using of_get_named_gpio_flags(struct device_node *np, const
> char *propname,
> int index, enum of_gpio_flags *flags);
> function and I always gets the flags value as '0' irrespective of the
> values present in phandle of GPIO.
Perhaps the GPIO controller referenced by &gpx0 has #gpio-cells=1?
Alternatively, the GPIO controller's xlate function may simply be
setting the flags value to 0, rather than deriving the value from the
extra cells in the GPIO specifier.
Either way, the mux function, pull, and driver strength should be
represented using the pinctrl bindings not as part of the GPIO
specifier. See Documentation/devicetree/bindings/pinctrl/pinctrl.txt for
the basics.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: <Query> How to read arguments from a gpio handle
[not found] ` <501B6190.9060101-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
@ 2012-08-03 8:47 ` Leela Krishna Amudala
[not found] ` <CAL1wa8cJpcnNZ_p6Ueu07GQ=m2zP6MpQHKqC4dKGDFVO7zRY2w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Leela Krishna Amudala @ 2012-08-03 8:47 UTC (permalink / raw)
To: Stephen Warren; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
Hello,
On Fri, Aug 3, 2012 at 10:58 AM, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
> On 08/02/2012 09:39 PM, Leela Krishna Amudala wrote:
>> Hello,
>>
>> Can some one please tell me how to read the args from the gpio handle
>>
>> For example:
>> Consider lcd-reset-gpio = <&gpx0 1 2 3 4>; as my phandle.
>>
>> The 4 args in the above handle denotes
>>
>> <[phandle of the gpio controller node]
>> [pin number within the gpio controller]
>> [mux function]
>> [pull up/down]
>> [drive strength]>
>>
>> My intention is to read the "mux function" and "pull up/down" values
>> from the above handle and do the corresponding operations on that
>> particular gpio.
>>
>> I tried using of_get_named_gpio_flags(struct device_node *np, const
>> char *propname,
>> int index, enum of_gpio_flags *flags);
>> function and I always gets the flags value as '0' irrespective of the
>> values present in phandle of GPIO.
>
> Perhaps the GPIO controller referenced by &gpx0 has #gpio-cells=1?
>
> Alternatively, the GPIO controller's xlate function may simply be
> setting the flags value to 0, rather than deriving the value from the
> extra cells in the GPIO specifier.
>
> Either way, the mux function, pull, and driver strength should be
> represented using the pinctrl bindings not as part of the GPIO
> specifier. See Documentation/devicetree/bindings/pinctrl/pinctrl.txt for
> the basics.
I got the required values using of_parse_phandle_with_args() function.
Thanks,
Leela Krishna Amudala
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: <Query> How to read arguments from a gpio handle
[not found] ` <CAL1wa8cJpcnNZ_p6Ueu07GQ=m2zP6MpQHKqC4dKGDFVO7zRY2w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-08-03 15:34 ` Stephen Warren
0 siblings, 0 replies; 5+ messages in thread
From: Stephen Warren @ 2012-08-03 15:34 UTC (permalink / raw)
To: Leela Krishna Amudala; +Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
On 08/03/2012 02:47 AM, Leela Krishna Amudala wrote:
> Hello,
>
> On Fri, Aug 3, 2012 at 10:58 AM, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
>> On 08/02/2012 09:39 PM, Leela Krishna Amudala wrote:
>>> Hello,
>>>
>>> Can some one please tell me how to read the args from the gpio handle
>>>
>>> For example:
>>> Consider lcd-reset-gpio = <&gpx0 1 2 3 4>; as my phandle.
>>>
>>> The 4 args in the above handle denotes
>>>
>>> <[phandle of the gpio controller node]
>>> [pin number within the gpio controller]
>>> [mux function]
>>> [pull up/down]
>>> [drive strength]>
>>>
>>> My intention is to read the "mux function" and "pull up/down" values
>>> from the above handle and do the corresponding operations on that
>>> particular gpio.
>>>
>>> I tried using of_get_named_gpio_flags(struct device_node *np, const
>>> char *propname,
>>> int index, enum of_gpio_flags *flags);
>>> function and I always gets the flags value as '0' irrespective of the
>>> values present in phandle of GPIO.
...
> I got the required values using of_parse_phandle_with_args() function.
OK, you can certainly do that, but I fully expect pushback on such code
if you try and upstream it. Also, it's most likely fragile if your DT
property needs to represent a list of GPIOs rather than just 1, given
that of_get_named_gpio_flags() doesn't do what you'd expect.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-08-03 15:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-03 3:39 <Query> How to read arguments from a gpio handle Leela Krishna Amudala
[not found] ` <CAL1wa8fdYCmTNpO=7v5S7o-Oi3nRD_7uUgCCVpM5TEP9ZUXedw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-03 4:40 ` Daniel Mack
2012-08-03 5:28 ` Stephen Warren
[not found] ` <501B6190.9060101-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-08-03 8:47 ` Leela Krishna Amudala
[not found] ` <CAL1wa8cJpcnNZ_p6Ueu07GQ=m2zP6MpQHKqC4dKGDFVO7zRY2w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-08-03 15:34 ` Stephen Warren
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).