linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laxman Dewangan <ldewangan@nvidia.com>
To: Thierry Reding <thierry.reding@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>,
	Suresh Mangipudi <smangipudi@nvidia.com>,
	Alexandre Courbot <gnurou@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-tegra@vger.kernel.org" <linux-tegra@vger.kernel.org>
Subject: Re: [PATCH] gpio: tegra186: Add support for T186 GPIO
Date: Thu, 24 Nov 2016 12:06:16 +0530	[thread overview]
Message-ID: <58368A60.2010702@nvidia.com> (raw)
In-Reply-To: <20161123194036.GA25876@ulmo.ba.sec>


On Thursday 24 November 2016 01:10 AM, Thierry Reding wrote:
> * PGP Signed by an unknown key
>
> On Wed, Nov 23, 2016 at 02:25:51PM +0100, Linus Walleij wrote:
>>
>> This is already possible and several drivers are doing this.
>>
>> Everything, all kernel users and all character device users, end up
>> calling gpiod_request().
> It looks like I stumbled across the only case where this isn't true.
> What I was seeing, and which ultimately led me to implement the compact
> numberspace is that gpiochip_add_data() calls ->get_direction() directly
> without first going through ->request(). We'd have to guard that one
> case as well in order for this to work.
>
In T186, we have 8 pins per PORT and for some of ports, all pins are not 
available. Like Port A has 7 pins valid (0 to 6) and port E have 8 pins 
(0 to 7). The great part is that each port has valid pins start from 0.

So just having the number of valid pins for each port as part of SOC 
data will help to find out whether GPIO exist or not.

        int port = GPIO_PORT(offset);
         int pin = GPIO_PIN(offset);

       if (pin >= tgi->soc->port[port].valid_pins)
                 return false;

Similar logic can be used for APIs which can get called without 
gpio_request().

  reply	other threads:[~2016-11-24  6:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02 10:48 [PATCH] gpio: tegra186: Add support for T186 GPIO Suresh Mangipudi
2016-11-07  7:53 ` Linus Walleij
2016-11-07 13:21   ` Thierry Reding
2016-11-08  1:42     ` Olof Johansson
2016-11-08 15:55       ` Thierry Reding
2016-11-08 16:49         ` Stephen Warren
2016-11-08 17:58           ` Thierry Reding
2016-11-08 19:07 ` Stephen Warren
2016-11-22 17:30   ` Thierry Reding
2016-11-22 17:55     ` [PATCH] gpio: Add Tegra186 support Thierry Reding
2016-11-23 13:30       ` Linus Walleij
2016-11-23 19:44         ` Thierry Reding
2016-11-24 15:40           ` Linus Walleij
2016-11-24  6:53       ` Laxman Dewangan
2016-11-24 14:44         ` Thierry Reding
2016-11-24 14:44           ` Laxman Dewangan
2016-11-24 15:08             ` Thierry Reding
2016-11-25 12:10               ` Laxman Dewangan
2016-11-23 13:25     ` [PATCH] gpio: tegra186: Add support for T186 GPIO Linus Walleij
2016-11-23 19:40       ` Thierry Reding
2016-11-24  6:36         ` Laxman Dewangan [this message]
2016-11-24 15:01           ` Thierry Reding
2016-11-24 15:08         ` Linus Walleij
2016-11-24 16:32           ` Thierry Reding
2016-11-24 23:24             ` Linus Walleij

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=58368A60.2010702@nvidia.com \
    --to=ldewangan@nvidia.com \
    --cc=gnurou@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=smangipudi@nvidia.com \
    --cc=swarren@wwwdotorg.org \
    --cc=thierry.reding@gmail.com \
    /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).