From: daniel@caiaq.de (Daniel Mack)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/17] ARM: pxa/raumfeld: add GPIO buttons
Date: Wed, 25 Nov 2009 11:42:20 +0100 [thread overview]
Message-ID: <1259145751-3331-7-git-send-email-daniel@caiaq.de> (raw)
In-Reply-To: <1259145751-3331-1-git-send-email-daniel@caiaq.de>
Signed-off-by: Daniel Mack <daniel@caiaq.de>
---
arch/arm/mach-pxa/raumfeld.c | 90 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 90 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index a2a2b18..23bf890 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -25,6 +25,7 @@
#include <linux/smsc911x.h>
#include <linux/input.h>
#include <linux/rotary_encoder.h>
+#include <linux/gpio_keys.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
@@ -176,8 +177,96 @@ static struct platform_device rotary_encoder_device = {
}
};
+/**
+ * GPIO buttons
+ */
+
+static struct gpio_keys_button gpio_keys_button[] = {
+ {
+ .code = KEY_F1,
+ .type = EV_KEY,
+ .gpio = mfp_to_gpio(GPIO_KEY1),
+ .active_low = 1,
+ .wakeup = 0,
+ .debounce_interval = 5, /* ms */
+ .desc = "Button 1",
+ },
+ {
+ .code = KEY_F2,
+ .type = EV_KEY,
+ .gpio = mfp_to_gpio(GPIO_KEY2),
+ .active_low = 1,
+ .wakeup = 0,
+ .debounce_interval = 5, /* ms */
+ .desc = "Button 2",
+ },
+ {
+ .code = KEY_F3,
+ .type = EV_KEY,
+ .gpio = mfp_to_gpio(GPIO_KEY3),
+ .active_low = 1,
+ .wakeup = 0,
+ .debounce_interval = 5, /* ms */
+ .desc = "Button 3",
+ },
+ {
+ .code = KEY_F4,
+ .type = EV_KEY,
+ .gpio = mfp_to_gpio(GPIO_RESCUE_BOOT),
+ .active_low = 0,
+ .wakeup = 0,
+ .debounce_interval = 5, /* ms */
+ .desc = "rescue boot button",
+ },
+ {
+ .code = KEY_F5,
+ .type = EV_KEY,
+ .gpio = mfp_to_gpio(GPIO_DOCK_DETECT),
+ .active_low = 0,
+ .wakeup = 0,
+ .debounce_interval = 5, /* ms */
+ .desc = "dock detect",
+ },
+ {
+ .code = KEY_F6,
+ .type = EV_KEY,
+ .gpio = mfp_to_gpio(GPIO_ON_OFF),
+ .active_low = 0,
+ .wakeup = 0,
+ .debounce_interval = 5, /* ms */
+ .desc = "on/off button",
+ },
+};
+
+static struct gpio_keys_platform_data gpio_keys_platform_data = {
+ .buttons = gpio_keys_button,
+ .nbuttons = ARRAY_SIZE(gpio_keys_button),
+ .rep = 0,
+};
+
+static struct platform_device raumfeld_gpio_keys_device = {
+ .name = "gpio-keys",
+ .id = -1,
+ .dev = {
+ .platform_data = &gpio_keys_platform_data,
+ }
+};
+
+static struct platform_device *raumfeld_common_devices[] = {
+ &raumfeld_gpio_keys_device,
+};
+
static void __init raumfeld_common_init(void)
{
+ /* The on/off button polarity has changed after revision 1 */
+ if ((system_rev & 0xff) > 1) {
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(gpio_keys_button); i++)
+ if (!strcmp(gpio_keys_button[i].desc, "on/off button"))
+ gpio_keys_button[i].active_low = 1;
+ }
+
enable_irq_wake(IRQ_WAKEUP0);
pxa_set_ffuart_info(NULL);
@@ -193,6 +282,7 @@ static void __init raumfeld_common_init(void)
pxa3xx_mfp_config(ARRAY_AND_SIZE(raumfeld_pin_config));
pxa_set_ohci_info(&raumfeld_ohci_info);
+ platform_add_devices(ARRAY_AND_SIZE(raumfeld_common_devices));
}
static void __init raumfeld_controller_init(void)
--
1.6.5.2
next prev parent reply other threads:[~2009-11-25 10:42 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-25 10:42 ARM: pxa: add support for Raumfeld audio devices Daniel Mack
2009-11-25 10:42 ` [PATCH 01/17] ARM: pxa/raumfeld: add basic structure for devices Daniel Mack
2009-11-25 15:26 ` Mike Rapoport
2009-11-25 15:44 ` Daniel Mack
2009-11-25 16:51 ` Marek Vasut
2009-11-25 17:06 ` Russell King - ARM Linux
2009-11-25 10:42 ` [PATCH 02/17] ARM: pxa/raumfeld: add GPIO definitions Daniel Mack
2009-11-25 10:42 ` [PATCH 03/17] ARM: pxa/raumfeld: add SMSC9220 ethernet support Daniel Mack
2009-11-25 15:26 ` Mike Rapoport
2009-11-25 15:49 ` Daniel Mack
2009-11-25 16:56 ` Russell King - ARM Linux
2009-11-26 17:55 ` Daniel Mack
2009-11-25 10:42 ` [PATCH 04/17] ARM: pxa/raumfeld: add OHCI function Daniel Mack
2009-11-25 10:42 ` [PATCH 05/17] ARM: pxa/raumfeld: add rotary encoder support Daniel Mack
2009-11-25 15:26 ` Mike Rapoport
2009-11-25 15:50 ` Daniel Mack
2009-11-25 16:59 ` Russell King - ARM Linux
2009-11-25 10:42 ` Daniel Mack [this message]
2009-11-25 10:42 ` [PATCH 07/17] ARM: pxa/raumfeld: add GPIO connected LEDs Daniel Mack
2009-11-25 10:42 ` [PATCH 08/17] ARM: pxa/raumfeld: add one-wire function Daniel Mack
2009-11-25 17:02 ` Russell King - ARM Linux
2009-11-25 10:42 ` [PATCH 09/17] ARM: pxa/raumfeld: add NAND partitions Daniel Mack
2009-11-25 15:26 ` Mike Rapoport
2009-11-25 10:42 ` [PATCH 10/17] ARM: pxa/raumfeld: add framebuffer and backlight devices Daniel Mack
2009-11-25 10:42 ` [PATCH 11/17] ARM: pxa/raumfeld: add SPI controlled devices Daniel Mack
2009-11-25 10:42 ` [PATCH 12/17] ARM: pxa/raumfeld: add audio related functions Daniel Mack
2009-11-25 11:41 ` Mark Brown
2009-11-25 12:28 ` Daniel Mack
2009-11-25 13:07 ` Mark Brown
2009-11-25 13:53 ` Daniel Mack
2009-11-25 14:00 ` Mark Brown
2009-11-25 17:07 ` Russell King - ARM Linux
2009-11-25 10:42 ` [PATCH 13/17] ARM: pxa/raumfeld: add Marvell Libertas via SDIO Daniel Mack
2009-11-25 11:49 ` Mark Brown
2009-11-25 13:04 ` Daniel Mack
2009-11-25 13:36 ` Mark Brown
2009-11-25 10:42 ` [PATCH 14/17] ARM: pxa/raumfeld: add power supply framework Daniel Mack
2009-11-25 10:42 ` [PATCH 15/17] ARM: pxa/raumfeld: add support for I2C controlled devices Daniel Mack
2009-11-25 10:42 ` [PATCH 16/17] ALSA: ARM: add Raumfeld audio support Daniel Mack
2009-11-25 11:02 ` Mark Brown
2009-11-25 12:24 ` Daniel Mack
2009-11-25 13:29 ` Mark Brown
2009-11-26 17:51 ` Daniel Mack
2009-11-25 10:42 ` [PATCH 17/17] ARM: pxa/raumfeld: Add defconfig Daniel Mack
2009-11-25 11:27 ` ARM: pxa: add support for Raumfeld audio devices Mike Rapoport
2009-11-25 12:14 ` Daniel Mack
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=1259145751-3331-7-git-send-email-daniel@caiaq.de \
--to=daniel@caiaq.de \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).