Thread (1 message) 1 message, 1 author, 2012-08-03

Re: <Query> How to read arguments from a gpio handle

From: Stephen Warren <hidden>
Date: 2012-08-03 15:34:57

On 08/03/2012 02:47 AM, Leela Krishna Amudala wrote:
Hello,

On Fri, Aug 3, 2012 at 10:58 AM, Stephen Warren [off-list ref] wrote:
quoted
On 08/02/2012 09:39 PM, Leela Krishna Amudala wrote:
quoted
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help