summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
authorTony SIM <chinyeow.sim.xt@renesas.com>2010-12-09 02:55:55 +0100
committerPaul Mundt <lethal@linux-sh.org>2010-12-13 06:11:14 +0100
commitcd8ab0041d131e8e210c4b5ded7257da50473dcb (patch)
treedf7f2dde45753c26127ca706e785506010229965 /arch/arm/mach-shmobile
parentARM: mach-shmobile: mackerel: Add Accelerometer sensor support (diff)
downloadlinux-cd8ab0041d131e8e210c4b5ded7257da50473dcb.tar.xz
linux-cd8ab0041d131e8e210c4b5ded7257da50473dcb.zip
ARM: mach-shmobile: mackerel: Add keypad tca6408a support
This patch maps key0/key1/key2/key3 as HOME/MENU/BACK/POWER buttons on mackerel board. Signed-off-by: Tony SIM <chinyeow.sim.xt@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index a0caa9e39c5a..3e30a5250414 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -36,6 +36,7 @@
#include <linux/mtd/physmap.h>
#include <linux/smsc911x.h>
#include <linux/sh_intc.h>
+#include <linux/tca6416_keypad.h>
#include <linux/usb/r8a66597.h>
#include <video/sh_mobile_lcdc.h>
@@ -413,11 +414,44 @@ static struct platform_device *mackerel_devices[] __initdata = {
&fsi_ak4643_device,
};
+/* Keypad Initialization */
+#define KEYPAD_BUTTON(ev_type, ev_code, act_low) \
+{ \
+ .type = ev_type, \
+ .code = ev_code, \
+ .active_low = act_low, \
+}
+
+#define KEYPAD_BUTTON_LOW(event_code) KEYPAD_BUTTON(EV_KEY, event_code, 1)
+
+static struct tca6416_button mackerel_gpio_keys[] = {
+ KEYPAD_BUTTON_LOW(KEY_HOME),
+ KEYPAD_BUTTON_LOW(KEY_MENU),
+ KEYPAD_BUTTON_LOW(KEY_BACK),
+ KEYPAD_BUTTON_LOW(KEY_POWER),
+};
+
+static struct tca6416_keys_platform_data mackerel_tca6416_keys_info = {
+ .buttons = mackerel_gpio_keys,
+ .nbuttons = ARRAY_SIZE(mackerel_gpio_keys),
+ .rep = 1,
+ .use_polling = 0,
+ .pinmask = 0x000F,
+};
+
/* I2C */
+#define IRQ9 evt2irq(0x0320)
+
static struct i2c_board_info i2c0_devices[] = {
{
I2C_BOARD_INFO("ak4643", 0x13),
},
+ /* Keypad */
+ {
+ I2C_BOARD_INFO("tca6408-keys", 0x20),
+ .platform_data = &mackerel_tca6416_keys_info,
+ .irq = IRQ9,
+ },
};
#define IRQ21 evt2irq(0x32a0)
@@ -525,6 +559,10 @@ static void __init mackerel_init(void)
intc_set_priority(IRQ_FSI, 3); /* irq priority FSI(3) > SMSC911X(2) */
+ /* enable Keypad */
+ gpio_request(GPIO_FN_IRQ9_42, NULL);
+ set_irq_type(IRQ9, IRQ_TYPE_LEVEL_HIGH);
+
/* enable Accelerometer */
gpio_request(GPIO_FN_IRQ21, NULL);
set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH);