RE: ep93xx gpio interrupt debounce | |
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] | |
On Tuesday, April 22, 2008 2:32 PM, Lennert Buytenhek wrote:
> Cool. Go for it. Send it to the list and CC me and I'll review it
(but I won't be able to test it.)
The patch below adds debouncing support to the ep93xx GPIO interrupts.
Please review and let me know if it looks okay.
Thanks for any input or comments.
Hartley Sweeten
Index: src/working/linux-2.6.25/arch/arm/mach-ep93xx/core.c
===================================================================
--- src.orig/working/linux-2.6.25/arch/arm/mach-ep93xx/core.c
2008-04-22 19:55:09.000000000 -0700
+++ src/working/linux-2.6.25/arch/arm/mach-ep93xx/core.c
2008-04-22 20:03:08.000000000 -0700
@@ -152,12 +152,14 @@
static unsigned char gpio_int_enabled[3];
static unsigned char gpio_int_type1[3];
static unsigned char gpio_int_type2[3];
+static unsigned char gpio_int_debounce[3];
/* Port ordering is: A B F */
static const u8 int_type1_register_offset[3] = { 0x90, 0xac, 0x4c };
static const u8 int_type2_register_offset[3] = { 0x94, 0xb0, 0x50 };
static const u8 eoi_register_offset[3] = { 0x98, 0xb4, 0x54 };
static const u8 int_en_register_offset[3] = { 0x9c, 0xb8, 0x5c };
+static const u8 int_debounce_register_offset[3] = { 0xa8, 0xc4,
0x64 };
static void update_gpio_int_params(unsigned port)
{
@@ -165,6 +167,9 @@
__raw_writeb(0, EP93XX_GPIO_REG(int_en_register_offset[port]));
+ __raw_writeb(gpio_int_debounce[port],
+ EP93XX_GPIO_REG(int_debounce_register_offset[port]));
+
__raw_writeb(gpio_int_type2[port],
EP93XX_GPIO_REG(int_type2_register_offset[port]));
@@ -360,6 +365,9 @@
* gpio_int_type1 controls whether the interrupt is level (0) or
* edge (1) triggered, while gpio_int_type2 controls whether it
* triggers on low/falling (0) or high/rising (1).
+ *
+ * gpio_int_debounce controls whether debouncing of the interrupt
+ * is enabled (1) or disabled (0).
*/
static int ep93xx_gpio_irq_type(unsigned int irq, unsigned int type)
{
@@ -370,6 +378,13 @@
ep93xx_gpio_set_direction(gpio, GPIO_IN);
+ /* Check the debounce type first so we can mask it off */
+ if (type & IRQT_DEBOUNCE)
+ gpio_int_debounce[port] |= port_mask;
+ else
+ gpio_int_debounce[port] &= ~port_mask;
+ type &= ~IRQT_DEBOUNCE;
+
switch (type) {
case IRQT_RISING:
gpio_int_type1[port] |= port_mask;
Index: src/working/linux-2.6.25/include/asm-arm/irq.h
===================================================================
--- src.orig/working/linux-2.6.25/include/asm-arm/irq.h 2008-04-22
19:57:08.000000000 -0700
+++ src/working/linux-2.6.25/include/asm-arm/irq.h 2008-04-22
19:58:03.000000000 -0700
@@ -35,6 +35,7 @@
#define IRQT_LOW (__IRQT_LOWLVL)
#define IRQT_HIGH (__IRQT_HIGHLVL)
#define IRQT_PROBE IRQ_TYPE_PROBE
+#define IRQT_DEBOUNCE (1 << 5)
#ifndef __ASSEMBLY__
struct irqaction;
Attachment:
ep93xx-gpio-interrupt-debounce.patch
Description: ep93xx-gpio-interrupt-debounce.patch
------------------------------------------------------------------- List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php
[Site Home] [Fedora ARM] [IETF Annouce] [Security] [Bugtraq] [Linux] [Linux ARM Kernel] [Linux OMAP] [Linux MIPS] [ECOS] [Tools] [DDR & Rambus] [Monitors]