Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1529405

Re: [PATCH] gpio: Add Tegra186 support

From Laxman Dewangan <ldewangan@nvidia.com>
Newsgroups linux.kernel
Subject Re: [PATCH] gpio: Add Tegra186 support
Date 2016-11-24 16:10 +0100
Message-ID <sH3OX-4pu-57@gated-at.bofh.it> (permalink)
References <sGnd0-1Py-41@gated-at.bofh.it> <sGnwl-1Wv-31@gated-at.bofh.it> <sGWu5-7Tk-1@gated-at.bofh.it> <sH3vA-43h-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thursday 24 November 2016 08:14 PM, Thierry Reding wrote:
> * PGP Signed by an unknown key
>
> On Thu, Nov 24, 2016 at 12:23:56PM +0530, Laxman Dewangan wrote:
>> On Tuesday 22 November 2016 11:25 PM, Thierry Reding wrote:
>>> +static inline struct tegra_gpio *to_tegra_gpio(struct gpio_chip *chip)
>>> +{
>>> +	return container_of(chip, struct tegra_gpio, gpio);
>>> +}
>> You dont need this as gpiochip_get_data(chip); can provide the required
>> driver specific data.
> It's common practice to embed the struct gpio_chip within a driver-
> specific structure, and it's equally common to use a container_of() to
> get at the embedding structure.

I am saying that you dont need this new APIs, GPIO framework already 
support this via the call gpiochip_get_data(chip); which you provided 
when adding gpiochip().



>
>>> +	gpio->gpio.parent = &pdev->dev;
>>> +
>>> +	gpio->gpio.get_direction = tegra186_gpio_get_direction;
>>> +	gpio->gpio.direction_input = tegra186_gpio_direction_input;
>>> +	gpio->gpio.direction_output = tegra186_gpio_direction_output;
>>> +	gpio->gpio.get = tegra186_gpio_get,
>>> +	gpio->gpio.set = tegra186_gpio_set;
>>> +	gpio->gpio.to_irq = tegra186_gpio_to_irq;
>>> +
>>> +	gpio->gpio.base = -1;
>>> +
>>> +	for (i = 0; i < gpio->soc->num_ports; i++)
>>> +		gpio->gpio.ngpio += gpio->soc->ports[i].pins;
>>> +
>> Our DT binding does not say this. We assume that we have 8 gpios per port.
>> so this will not work at all.
> This has nothing to do with the device tree binding. What the device
> tree binding defines is the indices to use to obtain a given GPIO within
> a given port. What numbering the driver uses internally is completely up
> to the driver implementation.
>
> Oh, and the above works just fine.


Nop, it will not work. The reason is:
include/dt-binding/gpio/tegra186-gpio.h


#define TEGRA_MAIN_GPIO(port, offset) \
         ((TEGRA_MAIN_GPIO_PORT_##port * 8) + offset)


so in your DTS file, if you use this macro for the gpio number then you 
will have pin per port as 8.
And so your total GPIO is 23 *8 (Port CC) but in source code ngpio is 
very less.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Thierry Reding <thierry.reding@gmail.com> - 2016-11-22 18:40 +0100
  [PATCH] gpio: Add Tegra186 support Thierry Reding <thierry.reding@gmail.com> - 2016-11-22 19:00 +0100
    Re: [PATCH] gpio: Add Tegra186 support Linus Walleij <linus.walleij@linaro.org> - 2016-11-23 14:40 +0100
      Re: [PATCH] gpio: Add Tegra186 support Thierry Reding <thierry.reding@gmail.com> - 2016-11-23 20:50 +0100
        Re: [PATCH] gpio: Add Tegra186 support Linus Walleij <linus.walleij@linaro.org> - 2016-11-24 16:50 +0100
    Re: [PATCH] gpio: Add Tegra186 support Laxman Dewangan <ldewangan@nvidia.com> - 2016-11-24 08:20 +0100
      Re: [PATCH] gpio: Add Tegra186 support Thierry Reding <thierry.reding@gmail.com> - 2016-11-24 15:50 +0100
        Re: [PATCH] gpio: Add Tegra186 support Laxman Dewangan <ldewangan@nvidia.com> - 2016-11-24 16:10 +0100
          Re: [PATCH] gpio: Add Tegra186 support Thierry Reding <thierry.reding@gmail.com> - 2016-11-24 16:10 +0100
  Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Linus Walleij <linus.walleij@linaro.org> - 2016-11-23 14:30 +0100
    Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Thierry Reding <thierry.reding@gmail.com> - 2016-11-23 21:00 +0100
      Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Laxman Dewangan <ldewangan@nvidia.com> - 2016-11-24 08:00 +0100
        Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Thierry Reding <thierry.reding@gmail.com> - 2016-11-24 16:10 +0100
      Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Linus Walleij <linus.walleij@linaro.org> - 2016-11-24 16:10 +0100
        Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Thierry Reding <thierry.reding@gmail.com> - 2016-11-24 17:40 +0100
          Re: [PATCH] gpio: tegra186: Add support for T186 GPIO Linus Walleij <linus.walleij@linaro.org> - 2016-11-25 00:30 +0100

csiph-web