[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58368A60.2010702@nvidia.com>
Date: Thu, 24 Nov 2016 12:06:16 +0530
From: Laxman Dewangan <ldewangan@...dia.com>
To: Thierry Reding <thierry.reding@...il.com>,
Linus Walleij <linus.walleij@...aro.org>
CC: Stephen Warren <swarren@...dotorg.org>,
Suresh Mangipudi <smangipudi@...dia.com>,
Alexandre Courbot <gnurou@...il.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>
Subject: Re: [PATCH] gpio: tegra186: Add support for T186 GPIO
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().
Powered by blists - more mailing lists