Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 123724
b: refs/heads/master
c: a007b70
h: refs/heads/master
v: v3
  • Loading branch information
David Brownell authored and Tony Lindgren committed Dec 11, 2008
1 parent 2dab154 commit d74eb08
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 21c867f1dedc21fb6e5244b7b27cfcfd09b83188
refs/heads/master: a007b7096feea2d865ad3e7177eb8be34041bef9
9 changes: 9 additions & 0 deletions trunk/arch/arm/plat-omap/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,14 @@ static void gpio_set(struct gpio_chip *chip, unsigned offset, int value)
spin_unlock_irqrestore(&bank->lock, flags);
}

static int gpio_2irq(struct gpio_chip *chip, unsigned offset)
{
struct gpio_bank *bank;

bank = container_of(chip, struct gpio_bank, chip);
return bank->virtual_irq_start + offset;
}

/*---------------------------------------------------------------------*/

static int initialized;
Expand Down Expand Up @@ -1480,6 +1488,7 @@ static int __init _omap_gpio_init(void)
bank->chip.get = gpio_get;
bank->chip.direction_output = gpio_output;
bank->chip.set = gpio_set;
bank->chip.to_irq = gpio_2irq;
if (bank_is_mpuio(bank)) {
bank->chip.label = "mpuio";
#ifdef CONFIG_ARCH_OMAP16XX
Expand Down
16 changes: 12 additions & 4 deletions trunk/arch/arm/plat-omap/include/mach/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,24 @@ static inline int gpio_cansleep(unsigned gpio)

static inline int gpio_to_irq(unsigned gpio)
{
if (gpio < (OMAP_MAX_GPIO_LINES + 16))
return OMAP_GPIO_IRQ(gpio);
return -EINVAL;
return __gpio_to_irq(gpio);
}

static inline int irq_to_gpio(unsigned irq)
{
int tmp;

/* omap1 SOC mpuio */
if (cpu_class_is_omap1() && (irq < (IH_MPUIO_BASE + 16)))
return (irq - IH_MPUIO_BASE) + OMAP_MAX_GPIO_LINES;
return irq - IH_GPIO_BASE;

/* SOC gpio */
tmp = irq - IH_GPIO_BASE;
if (tmp < OMAP_MAX_GPIO_LINES)
return tmp;

/* we don't supply reverse mappings for non-SOC gpios */
return -EIO;
}

#endif

0 comments on commit d74eb08

Please sign in to comment.