<Query> How to read arguments from a gpio handle
Stephen Warren
swarren at wwwdotorg.org
Fri Aug 3 15:28:48 EST 2012
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.
More information about the devicetree-discuss
mailing list