From: Kevin Hilman <khilman@mvista.com>
To: linux-omap-open-source@linux.omap.com
Subject: [PATCH 1/2] ARM: OMAP: add 24xx GPIO debounce support
Date: Fri, 04 May 2007 14:40:29 -0700 [thread overview]
Message-ID: <20070504214039.205092845@mvista.com> (raw)
In-Reply-To: 20070504214028.649198901@mvista.com
[-- Attachment #1: gpio-debounce.patch --]
[-- Type: text/plain, Size: 2397 bytes --]
Signed-off-by: Kevin Hilman <khilman@mvista.com>
---
arch/arm/plat-omap/gpio.c | 39 +++++++++++++++++++++++++++++++++++++++
include/asm-arm/arch-omap/gpio.h | 5 +++++
2 files changed, 44 insertions(+)
Index: dev/arch/arm/plat-omap/gpio.c
===================================================================
--- dev.orig/arch/arm/plat-omap/gpio.c
+++ dev/arch/arm/plat-omap/gpio.c
@@ -111,6 +111,8 @@
#define OMAP24XX_GPIO_LEVELDETECT1 0x0044
#define OMAP24XX_GPIO_RISINGDETECT 0x0048
#define OMAP24XX_GPIO_FALLINGDETECT 0x004c
+#define OMAP24XX_GPIO_DEBOUNCE_EN 0x0050
+#define OMAP24XX_GPIO_DEBOUNCE_VAL 0x0054
#define OMAP24XX_GPIO_CLEARIRQENABLE1 0x0060
#define OMAP24XX_GPIO_SETIRQENABLE1 0x0064
#define OMAP24XX_GPIO_CLEARWKUENA 0x0080
@@ -484,6 +486,43 @@ static inline void set_24xx_gpio_trigger
/* FIXME: Possibly do 'set_irq_handler(j, handle_level_irq)' if only level
* triggering requested. */
}
+
+void
+omap_set_gpio_debounce(int gpio, int enable)
+{
+ struct gpio_bank *bank;
+ void __iomem *reg;
+ u32 val, l = 1 << get_gpio_index(gpio);
+
+ bank = get_gpio_bank(gpio);
+ reg = bank->base;
+
+ reg += OMAP24XX_GPIO_DEBOUNCE_EN;
+ val = __raw_readl(reg);
+
+ if (enable)
+ val |= l;
+ else
+ val &= ~l;
+
+ __raw_writel(val, reg);
+}
+EXPORT_SYMBOL(omap_set_gpio_debounce);
+
+void
+omap_set_gpio_debounce_time(int gpio, int enc_time)
+{
+ struct gpio_bank *bank;
+ void __iomem *reg;
+
+ bank = get_gpio_bank(gpio);
+ reg = bank->base;
+
+ enc_time &= 0xff;
+ reg += OMAP24XX_GPIO_DEBOUNCE_VAL;
+ __raw_writel(enc_time, reg);
+}
+EXPORT_SYMBOL(omap_set_gpio_debounce_time);
#endif
static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
Index: dev/include/asm-arm/arch-omap/gpio.h
===================================================================
--- dev.orig/include/asm-arm/arch-omap/gpio.h
+++ dev/include/asm-arm/arch-omap/gpio.h
@@ -78,6 +78,11 @@ extern int omap_get_gpio_datain(int gpio
extern void omap2_gpio_prepare_for_retention(void);
extern void omap2_gpio_resume_after_retention(void);
+#ifdef CONFIG_ARCH_OMAP24XX
+extern void omap_set_gpio_debounce(int gpio, int enable);
+extern void omap_set_gpio_debounce_time(int gpio, int enable);
+#endif
+
/*-------------------------------------------------------------------------*/
/* wrappers for "new style" GPIO calls. the old OMAP-specfic ones should
--
next prev parent reply other threads:[~2007-05-04 21:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-04 21:40 [PATCH 0/2] TSC2046 toucscreen support Kevin Hilman
2007-05-04 21:40 ` Kevin Hilman [this message]
2007-05-04 21:40 ` [PATCH 2/2] ARM: OMAP: TSC2046 touchscreen support for 2430 Kevin Hilman
2007-05-04 21:53 ` Kevin Hilman
2007-05-04 23:36 ` Tony Lindgren
2007-05-05 8:28 ` Komal Shah
2007-05-07 9:02 ` Trilok Soni
2007-05-07 10:23 ` Trilok Soni
2007-05-07 17:02 ` Kevin Hilman
[not found] ` <20070507172440.GA31968@atomide.com>
2007-05-08 5:24 ` Trilok Soni
2007-05-08 16:54 ` tony
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070504214039.205092845@mvista.com \
--to=khilman@mvista.com \
--cc=linux-omap-open-source@linux.omap.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox