aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 @@
36#include <linux/mtd/physmap.h> 36#include <linux/mtd/physmap.h>
37#include <linux/smsc911x.h> 37#include <linux/smsc911x.h>
38#include <linux/sh_intc.h> 38#include <linux/sh_intc.h>
39#include <linux/tca6416_keypad.h>
39#include <linux/usb/r8a66597.h> 40#include <linux/usb/r8a66597.h>
40 41
41#include <video/sh_mobile_lcdc.h> 42#include <video/sh_mobile_lcdc.h>
@@ -413,11 +414,44 @@ static struct platform_device *mackerel_devices[] __initdata = {
413 &fsi_ak4643_device, 414 &fsi_ak4643_device,
414}; 415};
415 416
417/* Keypad Initialization */
418#define KEYPAD_BUTTON(ev_type, ev_code, act_low) \
419{ \
420 .type = ev_type, \
421 .code = ev_code, \
422 .active_low = act_low, \
423}
424
425#define KEYPAD_BUTTON_LOW(event_code) KEYPAD_BUTTON(EV_KEY, event_code, 1)
426
427static struct tca6416_button mackerel_gpio_keys[] = {
428 KEYPAD_BUTTON_LOW(KEY_HOME),
429 KEYPAD_BUTTON_LOW(KEY_MENU),
430 KEYPAD_BUTTON_LOW(KEY_BACK),
431 KEYPAD_BUTTON_LOW(KEY_POWER),
432};
433
434static struct tca6416_keys_platform_data mackerel_tca6416_keys_info = {
435 .buttons = mackerel_gpio_keys,
436 .nbuttons = ARRAY_SIZE(mackerel_gpio_keys),
437 .rep = 1,
438 .use_polling = 0,
439 .pinmask = 0x000F,
440};
441
416/* I2C */ 442/* I2C */
443#define IRQ9 evt2irq(0x0320)
444
417static struct i2c_board_info i2c0_devices[] = { 445static struct i2c_board_info i2c0_devices[] = {
418 { 446 {
419 I2C_BOARD_INFO("ak4643", 0x13), 447 I2C_BOARD_INFO("ak4643", 0x13),
420 }, 448 },
449 /* Keypad */
450 {
451 I2C_BOARD_INFO("tca6408-keys", 0x20),
452 .platform_data = &mackerel_tca6416_keys_info,
453 .irq = IRQ9,
454 },
421}; 455};
422 456
423#define IRQ21 evt2irq(0x32a0) 457#define IRQ21 evt2irq(0x32a0)
@@ -525,6 +559,10 @@ static void __init mackerel_init(void)
525 559
526 intc_set_priority(IRQ_FSI, 3); /* irq priority FSI(3) > SMSC911X(2) */ 560 intc_set_priority(IRQ_FSI, 3); /* irq priority FSI(3) > SMSC911X(2) */
527 561
562 /* enable Keypad */
563 gpio_request(GPIO_FN_IRQ9_42, NULL);
564 set_irq_type(IRQ9, IRQ_TYPE_LEVEL_HIGH);
565
528 /* enable Accelerometer */ 566 /* enable Accelerometer */
529 gpio_request(GPIO_FN_IRQ21, NULL); 567 gpio_request(GPIO_FN_IRQ21, NULL);
530 set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH); 568 set_irq_type(IRQ21, IRQ_TYPE_LEVEL_HIGH);