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

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

From: Leela Krishna Amudala <hidden>
Date: 2012-08-03 08:47:24

Hello,

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