From: steve@sakoman.com (Steve Sakoman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/2] OMAP: Add gpio-keys support for Overo
Date: Wed, 9 Mar 2011 16:08:06 -0800 [thread overview]
Message-ID: <1299715686-3920-3-git-send-email-steve@sakoman.com> (raw)
In-Reply-To: <1299715686-3920-1-git-send-email-steve@sakoman.com>
This patch adds support for the standard push buttons available on
Overo expansion boards.
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
arch/arm/mach-omap2/board-overo.c | 42 +++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index e694ebd..1e17061 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -519,6 +519,47 @@ static void __init overo_init_led(void)
static inline void __init overo_init_led(void) { return; }
#endif
+#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
+#include <linux/input.h>
+#include <linux/gpio_keys.h>
+
+static struct gpio_keys_button gpio_buttons[] = {
+ {
+ .code = BTN_0,
+ .gpio = 23,
+ .desc = "button0",
+ .wakeup = 1,
+ },
+ {
+ .code = BTN_1,
+ .gpio = 14,
+ .desc = "button1",
+ .wakeup = 1,
+ },
+};
+
+static struct gpio_keys_platform_data gpio_keys_pdata = {
+ .buttons = gpio_buttons,
+ .nbuttons = ARRAY_SIZE(gpio_buttons),
+};
+
+static struct platform_device gpio_keys_device = {
+ .name = "gpio-keys",
+ .id = -1,
+ .dev = {
+ .platform_data = &gpio_keys_pdata,
+ },
+};
+
+static void __init overo_init_keys(void)
+{
+ platform_device_register(&gpio_keys_device);
+}
+
+#else
+static inline void __init overo_init_keys(void) { return; }
+#endif
+
static int overo_twl_gpio_setup(struct device *dev,
unsigned gpio, unsigned ngpio)
{
@@ -701,6 +742,7 @@ static void __init overo_init(void)
overo_init_smsc911x();
overo_display_init();
overo_init_led();
+ overo_init_keys();
/* Ensure SDRC pins are mux'd for self-refresh */
omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
--
1.7.0.4
next prev parent reply other threads:[~2011-03-10 0:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-10 0:08 [PATCH v2 0/2] OMAP: Overo: Add gpio-leds and gpio-keys support Steve Sakoman
2011-03-10 0:08 ` [PATCH v2 1/2] OMAP: Add gpio-leds support for Overo Steve Sakoman
2011-03-10 0:08 ` Steve Sakoman [this message]
2011-03-10 17:58 ` [PATCH v2 0/2] OMAP: Overo: Add gpio-leds and gpio-keys support Tony Lindgren
2011-03-11 13:49 ` Tomi Valkeinen
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=1299715686-3920-3-git-send-email-steve@sakoman.com \
--to=steve@sakoman.com \
--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