Skip to content

Commit

Permalink
ARM: 6641/1: ep93xx: implement gpiolib set_debounce for built-in GPIOs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hartley Sweeten authored and Russell King committed Jan 27, 2011
1 parent 6fb1b30 commit 5d046af
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
33 changes: 29 additions & 4 deletions arch/arm/mach-ep93xx/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static inline void ep93xx_gpio_int_mask(unsigned line)
gpio_int_unmasked[line >> 3] &= ~(1 << (line & 7));
}

void ep93xx_gpio_int_debounce(unsigned int irq, int enable)
static void ep93xx_gpio_int_debounce(unsigned int irq, bool enable)
{
int line = irq_to_gpio(irq);
int port = line >> 3;
Expand All @@ -75,7 +75,6 @@ void ep93xx_gpio_int_debounce(unsigned int irq, int enable)
__raw_writeb(gpio_int_debounce[port],
EP93XX_GPIO_REG(int_debounce_register_offset[port]));
}
EXPORT_SYMBOL(ep93xx_gpio_int_debounce);

static void ep93xx_gpio_ab_irq_handler(unsigned int irq, struct irq_desc *desc)
{
Expand Down Expand Up @@ -335,6 +334,20 @@ static void ep93xx_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
local_irq_restore(flags);
}

static int ep93xx_gpio_set_debounce(struct gpio_chip *chip,
unsigned offset, unsigned debounce)
{
int gpio = chip->base + offset;
int irq = gpio_to_irq(gpio);

if (irq < 0)
return -EINVAL;

ep93xx_gpio_int_debounce(irq, debounce ? true : false);

return 0;
}

static void ep93xx_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
{
struct ep93xx_gpio_chip *ep93xx_chip = to_ep93xx_gpio_chip(chip);
Expand Down Expand Up @@ -434,6 +447,18 @@ void __init ep93xx_gpio_init(void)
EP93XX_SYSCON_DEVCFG_GONIDE |
EP93XX_SYSCON_DEVCFG_HONIDE);

for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++)
gpiochip_add(&ep93xx_gpio_banks[i].chip);
for (i = 0; i < ARRAY_SIZE(ep93xx_gpio_banks); i++) {
struct gpio_chip *chip = &ep93xx_gpio_banks[i].chip;

/*
* Ports A, B, and F support input debouncing when
* used as interrupts.
*/
if (!strcmp(chip->label, "A") ||
!strcmp(chip->label, "B") ||
!strcmp(chip->label, "F"))
chip->set_debounce = ep93xx_gpio_set_debounce;

gpiochip_add(chip);
}
}
2 changes: 0 additions & 2 deletions arch/arm/mach-ep93xx/include/mach/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@
/* maximum value for irq capable line identifiers */
#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7)

extern void ep93xx_gpio_int_debounce(unsigned int irq, int enable);

/* new generic GPIO API - see Documentation/gpio.txt */

#include <asm-generic/gpio.h>
Expand Down

0 comments on commit 5d046af

Please sign in to comment.