Re: [PATCH] gpio: tegra186: Add support for T186 GPIO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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().

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux