devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Leela Krishna Amudala
	<leelakrishna.a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: Re: <Query> How to read arguments from a gpio handle
Date: Fri, 03 Aug 2012 06:40:03 +0200	[thread overview]
Message-ID: <501B5623.7050209@gmail.com> (raw)
In-Reply-To: <CAL1wa8fdYCmTNpO=7v5S7o-Oi3nRD_7uUgCCVpM5TEP9ZUXedw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

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

  parent reply	other threads:[~2012-08-03  4:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=501B5623.7050209@gmail.com \
    --to=zonque-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=leelakrishna.a-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).