2 * linux/arch/arm/mach-omap2/board-apollon-keys.c
4 * Copyright (C) 2007 Samsung Electronics
5 * Author: Kyungmin Park <kyungmin.park@samsung.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/input.h>
16 #include <linux/gpio_keys.h>
18 #include <asm/arch/gpio.h>
19 #include <asm/arch/mux.h>
21 #define SW_ENTER_GPIO16 16
22 #define SW_UP_GPIO17 17
23 #define SW_DOWN_GPIO58 58
24 #define SW_LEFT_GPIO95 95
25 #define SW_RIGHT_GPIO96 96
26 #define SW_ESC_GPIO97 97
28 static struct gpio_keys_button apollon_gpio_keys_buttons[] = {
31 .gpio = SW_ENTER_GPIO16,
41 .gpio = SW_DOWN_GPIO58,
44 #ifdef CONFIG_MACH_OMAP_APOLLON_PLUS
47 .gpio = SW_LEFT_GPIO95,
52 .gpio = SW_RIGHT_GPIO96,
57 .gpio = SW_ESC_GPIO97,
63 static struct gpio_keys_platform_data apollon_gpio_keys = {
64 .buttons = apollon_gpio_keys_buttons,
65 .nbuttons = ARRAY_SIZE(apollon_gpio_keys_buttons),
68 static struct platform_device apollon_gpio_keys_device = {
72 .platform_data = &apollon_gpio_keys,
76 static void __init apollon_sw_init(void)
79 omap_cfg_reg(Y11_242X_GPIO16);
80 omap_request_gpio(SW_ENTER_GPIO16);
81 omap_set_gpio_direction(SW_ENTER_GPIO16, 1);
83 omap_cfg_reg(AA12_242X_GPIO17);
84 omap_request_gpio(SW_UP_GPIO17);
85 omap_set_gpio_direction(SW_UP_GPIO17, 1);
87 omap_cfg_reg(AA8_242X_GPIO58);
88 omap_request_gpio(SW_DOWN_GPIO58);
89 omap_set_gpio_direction(SW_DOWN_GPIO58, 1);
90 #ifdef CONFIG_MACH_OMAP_APOLLON_PLUS
92 omap_cfg_reg(P18_24XX_GPIO95);
93 omap_request_gpio(SW_LEFT_GPIO95);
94 omap_set_gpio_direction(SW_LEFT_GPIO95, 1);
96 omap_cfg_reg(M18_24XX_GPIO96);
97 omap_request_gpio(SW_RIGHT_GPIO96);
98 omap_set_gpio_direction(SW_RIGHT_GPIO96, 1);
100 omap_cfg_reg(L14_24XX_GPIO97);
101 omap_request_gpio(SW_ESC_GPIO97);
102 omap_set_gpio_direction(SW_ESC_GPIO97, 1);
106 static int __init omap_apollon_keys_init(void)
110 return platform_device_register(&apollon_gpio_keys_device);
113 arch_initcall(omap_apollon_keys_init);