aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-tegra.c
diff options
context:
space:
mode:
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 747eb40e8af..6b65207c810 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -27,6 +27,7 @@
27 27
28#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
29 29
30#include <mach/gpio-tegra.h>
30#include <mach/iomap.h> 31#include <mach/iomap.h>
31#include <mach/suspend.h> 32#include <mach/suspend.h>
32 33
@@ -134,7 +135,10 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
134 return 0; 135 return 0;
135} 136}
136 137
137 138static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
139{
140 return TEGRA_GPIO_TO_IRQ(offset);
141}
138 142
139static struct gpio_chip tegra_gpio_chip = { 143static struct gpio_chip tegra_gpio_chip = {
140 .label = "tegra-gpio", 144 .label = "tegra-gpio",
@@ -142,6 +146,7 @@ static struct gpio_chip tegra_gpio_chip = {
142 .get = tegra_gpio_get, 146 .get = tegra_gpio_get,
143 .direction_output = tegra_gpio_direction_output, 147 .direction_output = tegra_gpio_direction_output,
144 .set = tegra_gpio_set, 148 .set = tegra_gpio_set,
149 .to_irq = tegra_gpio_to_irq,
145 .base = 0, 150 .base = 0,
146 .ngpio = TEGRA_NR_GPIOS, 151 .ngpio = TEGRA_NR_GPIOS,
147}; 152};
@@ -331,6 +336,7 @@ static struct lock_class_key gpio_lock_class;
331static int __init tegra_gpio_init(void) 336static int __init tegra_gpio_init(void)
332{ 337{
333 struct tegra_gpio_bank *bank; 338 struct tegra_gpio_bank *bank;
339 int gpio;
334 int i; 340 int i;
335 int j; 341 int j;
336 342
@@ -352,14 +358,17 @@ static int __init tegra_gpio_init(void)
352 358
353 gpiochip_add(&tegra_gpio_chip); 359 gpiochip_add(&tegra_gpio_chip);
354 360
355 for (i = INT_GPIO_BASE; i < (INT_GPIO_BASE + TEGRA_NR_GPIOS); i++) { 361 for (gpio = 0; gpio < TEGRA_NR_GPIOS; gpio++) {
356 bank = &tegra_gpio_banks[GPIO_BANK(irq_to_gpio(i))]; 362 int irq = TEGRA_GPIO_TO_IRQ(gpio);
363 /* No validity check; all Tegra GPIOs are valid IRQs */
364
365 bank = &tegra_gpio_banks[GPIO_BANK(gpio)];
357 366
358 irq_set_lockdep_class(i, &gpio_lock_class); 367 irq_set_lockdep_class(irq, &gpio_lock_class);
359 irq_set_chip_data(i, bank); 368 irq_set_chip_data(irq, bank);
360 irq_set_chip_and_handler(i, &tegra_gpio_irq_chip, 369 irq_set_chip_and_handler(irq, &tegra_gpio_irq_chip,
361 handle_simple_irq); 370 handle_simple_irq);
362 set_irq_flags(i, IRQF_VALID); 371 set_irq_flags(irq, IRQF_VALID);
363 } 372 }
364 373
365 for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) { 374 for (i = 0; i < ARRAY_SIZE(tegra_gpio_banks); i++) {