diff options
author | Hartley Sweeten <hartleys@visionengravers.com> | 2011-01-27 11:29:29 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-01-27 12:07:52 -0500 |
commit | 5d046af0eb94bdf67f048ba4056e85fa080b4b07 (patch) | |
tree | 66ea320bbbf172895d9b32b52937e09be73b2dac /arch/arm/mach-ep93xx | |
parent | 6fb1b304255efc5c4c93874ac8c066272e257e28 (diff) |
ARM: 6641/1: ep93xx: implement gpiolib set_debounce for built-in GPIOs
GPIO Ports A, B, and F on the ep93xx provide interrupt capability. It
is possible to debounce the input signal on these ports when interrupts
are enabled.
Support for this debounce capability was provided with an ep93xx internal
function. Now that gpiolib knows about gpio debounce, use the gpiolib
method and do not export the internal function.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Ryan Mallon <ryan@bluewatersys.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-ep93xx')
-rw-r--r-- | arch/arm/mach-ep93xx/gpio.c | 33 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/include/mach/gpio.h | 2 |
2 files changed, 29 insertions, 6 deletions
diff --git a/arch/arm/mach-ep93xx/gpio.c b/arch/arm/mach-ep93xx/gpio.c index bec34b834958..a889fa7c3ba1 100644 --- a/arch/arm/mach-ep93xx/gpio.c +++ b/arch/arm/mach-ep93xx/gpio.c | |||
@@ -61,7 +61,7 @@ static inline void ep93xx_gpio_int_mask(unsigned line) | |||
61 | gpio_int_unmasked[line >> 3] &= ~(1 << (line & 7)); | 61 | gpio_int_unmasked[line >> 3] &= ~(1 << (line & 7)); |
62 | } | 62 | } |
63 | 63 | ||
64 | void ep93xx_gpio_int_debounce(unsigned int irq, int enable) | 64 | static void ep93xx_gpio_int_debounce(unsigned int irq, bool enable) |
65 | { | 65 | { |
66 | int line = irq_to_gpio(irq); | 66 | int line = irq_to_gpio(irq); |
67 | int port = line >> 3; | 67 | int port = line >> 3; |
@@ -75,7 +75,6 @@ void ep93xx_gpio_int_debounce(unsigned int irq, int enable) | |||
75 | __raw_writeb(gpio_int_debounce[port], | 75 | __raw_writeb(gpio_int_debounce[port], |
76 | EP93XX_GPIO_REG(int_debounce_register_offset[port])); | 76 | EP93XX_GPIO_REG(int_debounce_register_offset[port])); |
77 | } | 77 | } |
78 | EXPORT_SYMBOL(ep93xx_gpio_int_debounce); | ||
79 | 78 | ||
80 | static void ep93xx_gpio_ab_irq_handler(unsigned int irq, struct irq_desc *desc) | 79 | static void ep93xx_gpio_ab_irq_handler(unsigned int irq, struct irq_desc *desc) |
81 | { | 80 | { |
@@ -335,6 +334,20 @@ static void ep93xx_gpio_set(struct gpio_chip *chip, unsigned offset, int val) | |||
335 | local_irq_restore(flags); | 334 | local_irq_restore(flags); |
336 | } | 335 | } |
337 | 336 | ||
337 | static int ep93xx_gpio_set_debounce(struct gpio_chip *chip, | ||
338 | unsigned offset, unsigned debounce) | ||
339 | { | ||
340 | int gpio = chip->base + offset; | ||
341 | int irq = gpio_to_irq(gpio); | ||
342 | |||
343 | if (irq < 0) | ||
344 | return -EINVAL; | ||
345 | |||
346 | ep93xx_gpio_int_debounce(irq, debounce ? true : false); | ||
347 | |||
348 | return 0; | ||
349 | } | ||
350 | |||
338 | static void ep93xx_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) | 351 | static void ep93xx_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) |
339 | { | 352 | { |
340 | struct ep93xx_gpio_chip *ep93xx_chip = to_ep93xx_gpio_chip(chip); | 353 | struct ep93xx_gpio_chip *ep93xx_chip = to_ep93xx_gpio_chip(chip); |
@@ -434,6 +447,18 @@ void __init ep93xx_gpio_init(void) | |||
434 | EP93XX_SYSCON_DEVCFG_GONIDE | | 447 | EP93XX_SYSCON_DEVCFG_GONIDE | |
435 | EP93XX_SYSCON_DEVCFG_HONIDE); | 448 | EP93XX_SYSCON_DEVCFG_HONIDE); |
436 | 449 | ||
437 | for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) | 450 | for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) { |
438 | gpiochip_add(&ep93xx_gpio_banks[i].chip); | 451 | struct gpio_chip *chip = &ep93xx_gpio_banks[i].chip; |
452 | |||
453 | /* | ||
454 | * Ports A, B, and F support input debouncing when | ||
455 | * used as interrupts. | ||
456 | */ | ||
457 | if (!strcmp(chip->label, "A") || | ||
458 | !strcmp(chip->label, "B") || | ||
459 | !strcmp(chip->label, "F")) | ||
460 | chip->set_debounce = ep93xx_gpio_set_debounce; | ||
461 | |||
462 | gpiochip_add(chip); | ||
463 | } | ||
439 | } | 464 | } |
diff --git a/arch/arm/mach-ep93xx/include/mach/gpio.h b/arch/arm/mach-ep93xx/include/mach/gpio.h index c991b149bdf2..c57152c231f1 100644 --- a/arch/arm/mach-ep93xx/include/mach/gpio.h +++ b/arch/arm/mach-ep93xx/include/mach/gpio.h | |||
@@ -99,8 +99,6 @@ | |||
99 | /* maximum value for irq capable line identifiers */ | 99 | /* maximum value for irq capable line identifiers */ |
100 | #define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7) | 100 | #define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7) |
101 | 101 | ||
102 | extern void ep93xx_gpio_int_debounce(unsigned int irq, int enable); | ||
103 | |||
104 | /* new generic GPIO API - see Documentation/gpio.txt */ | 102 | /* new generic GPIO API - see Documentation/gpio.txt */ |
105 | 103 | ||
106 | #include <asm-generic/gpio.h> | 104 | #include <asm-generic/gpio.h> |