aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-tegra.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2011-10-31 18:46:42 -0400
committerArnd Bergmann <arnd@arndb.de>2011-10-31 18:46:42 -0400
commitefa62e1355f0495f37f1296754b8880947c8da72 (patch)
treec07af29f8baf2e6f4ed3bedbe46d405924edd530 /drivers/gpio/gpio-tegra.c
parent107532920226a37e595697959b2a6a823cfa2497 (diff)
parentf55be1bf52aad524dc1bf556ae26c90262c87825 (diff)
Merge branch 'depends/rmk/gpio' into next/devel
Conflicts: arch/arm/mach-mxs/include/mach/gpio.h arch/arm/plat-mxc/include/mach/gpio.h Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/gpio/gpio-tegra.c')
-rw-r--r--drivers/gpio/gpio-tegra.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 75cf91138b69..61044c889f7f 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -28,6 +28,7 @@
28 28
29#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
30 30
31#include <mach/gpio-tegra.h>
31#include <mach/iomap.h> 32#include <mach/iomap.h>
32#include <mach/suspend.h> 33#include <mach/suspend.h>
33 34
@@ -136,7 +137,10 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
136 return 0; 137 return 0;
137} 138}
138 139
139 140static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
141{
142 return TEGRA_GPIO_TO_IRQ(offset);
143}
140 144
141static struct gpio_chip tegra_gpio_chip = { 145static struct gpio_chip tegra_gpio_chip = {
142 .label = "tegra-gpio", 146 .label = "tegra-gpio",
@@ -144,6 +148,7 @@ static struct gpio_chip tegra_gpio_chip = {
144 .get = tegra_gpio_get, 148 .get = tegra_gpio_get,
145 .direction_output = tegra_gpio_direction_output, 149 .direction_output = tegra_gpio_direction_output,
146 .set = tegra_gpio_set, 150 .set = tegra_gpio_set,
151 .to_irq = tegra_gpio_to_irq,
147 .base = 0, 152 .base = 0,
148 .ngpio = TEGRA_NR_GPIOS, 153 .ngpio = TEGRA_NR_GPIOS,
149}; 154};
@@ -334,6 +339,7 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev)
334{ 339{
335 struct resource *res; 340 struct resource *res;
336 struct tegra_gpio_bank *bank; 341 struct tegra_gpio_bank *bank;
342 int gpio;
337 int i; 343 int i;
338 int j; 344 int j;
339 345
@@ -381,14 +387,17 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev)
381 387
382 gpiochip_add(&tegra_gpio_chip); 388 gpiochip_add(&tegra_gpio_chip);
383 389
384 for (i = INT_GPIO_BASE; i < (INT_GPIO_BASE + TEGRA_NR_GPIOS); i++) { 390 for (gpio = 0; gpio < TEGRA_NR_GPIOS; gpio++) {
385 bank = &tegra_gpio_banks[GPIO_BANK(irq_to_gpio(i))]; 391 int irq = TEGRA_GPIO_TO_IRQ(gpio);
392 /* No validity check; all Tegra GPIOs are valid IRQs */
393
394 bank = &tegra_gpio_banks[GPIO_BANK(gpio)];
386 395
387 irq_set_lockdep_class(i, &gpio_lock_class); 396 irq_set_lockdep_class(irq, &gpio_lock_class);
388 irq_set_chip_data(i, bank); 397 irq_set_chip_data(irq, bank);
389 irq_set_chip_and_handler(i, &tegra_gpio_irq_chip, 398 irq_set_chip_and_handler(irq, &tegra_gpio_irq_chip,
390 handle_simple_irq); 399 handle_simple_irq);
391 set_irq_flags(i, IRQF_VALID); 400 set_irq_flags(irq, IRQF_VALID);
392 } 401 }
393 402
394 for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) { 403 for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) {