lkml.org 
[lkml]   [2016]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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().

\
 
 \ /
  Last update: 2016-11-24 07:53    [W:0.099 / U:0.976 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site