diff options
author | Syed Rafiuddin <rafiuddin.syed@ti.com> | 2010-12-27 00:51:45 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2011-02-17 16:42:10 -0500 |
commit | 59556765cd30467ff64a391906ad8eb68f886ad3 (patch) | |
tree | 27583c30dfd43bd476a22a28b4eca3d5b047cad9 /arch | |
parent | b9b35ade88d5855de0ac3ebc3d66881f799114f9 (diff) |
OMAP4: keypad: Add the board support
-Add the platform changes for the keypad driver
-Register keyboard device with hwmod framework.
Signed-off-by: Syed Rafiuddin <rafiuddin.syed@ti.com>
Signed-off-by: Abraham Arce <x0066660@ti.com>
Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/board-4430sdp.c | 89 | ||||
-rw-r--r-- | arch/arm/mach-omap2/devices.c | 41 |
2 files changed, 130 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c index 12d99e582cd6..dcc8b27e3033 100644 --- a/arch/arm/mach-omap2/board-4430sdp.c +++ b/arch/arm/mach-omap2/board-4430sdp.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <plat/common.h> | 35 | #include <plat/common.h> |
36 | #include <plat/usb.h> | 36 | #include <plat/usb.h> |
37 | #include <plat/mmc.h> | 37 | #include <plat/mmc.h> |
38 | #include <plat/omap4-keypad.h> | ||
38 | 39 | ||
39 | #include "mux.h" | 40 | #include "mux.h" |
40 | #include "hsmmc.h" | 41 | #include "hsmmc.h" |
@@ -48,6 +49,90 @@ | |||
48 | #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184 | 49 | #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184 |
49 | #define OMAP4_SFH7741_ENABLE_GPIO 188 | 50 | #define OMAP4_SFH7741_ENABLE_GPIO 188 |
50 | 51 | ||
52 | static const int sdp4430_keymap[] = { | ||
53 | KEY(0, 0, KEY_E), | ||
54 | KEY(0, 1, KEY_R), | ||
55 | KEY(0, 2, KEY_T), | ||
56 | KEY(0, 3, KEY_HOME), | ||
57 | KEY(0, 4, KEY_F5), | ||
58 | KEY(0, 5, KEY_UNKNOWN), | ||
59 | KEY(0, 6, KEY_I), | ||
60 | KEY(0, 7, KEY_LEFTSHIFT), | ||
61 | |||
62 | KEY(1, 0, KEY_D), | ||
63 | KEY(1, 1, KEY_F), | ||
64 | KEY(1, 2, KEY_G), | ||
65 | KEY(1, 3, KEY_SEND), | ||
66 | KEY(1, 4, KEY_F6), | ||
67 | KEY(1, 5, KEY_UNKNOWN), | ||
68 | KEY(1, 6, KEY_K), | ||
69 | KEY(1, 7, KEY_ENTER), | ||
70 | |||
71 | KEY(2, 0, KEY_X), | ||
72 | KEY(2, 1, KEY_C), | ||
73 | KEY(2, 2, KEY_V), | ||
74 | KEY(2, 3, KEY_END), | ||
75 | KEY(2, 4, KEY_F7), | ||
76 | KEY(2, 5, KEY_UNKNOWN), | ||
77 | KEY(2, 6, KEY_DOT), | ||
78 | KEY(2, 7, KEY_CAPSLOCK), | ||
79 | |||
80 | KEY(3, 0, KEY_Z), | ||
81 | KEY(3, 1, KEY_KPPLUS), | ||
82 | KEY(3, 2, KEY_B), | ||
83 | KEY(3, 3, KEY_F1), | ||
84 | KEY(3, 4, KEY_F8), | ||
85 | KEY(3, 5, KEY_UNKNOWN), | ||
86 | KEY(3, 6, KEY_O), | ||
87 | KEY(3, 7, KEY_SPACE), | ||
88 | |||
89 | KEY(4, 0, KEY_W), | ||
90 | KEY(4, 1, KEY_Y), | ||
91 | KEY(4, 2, KEY_U), | ||
92 | KEY(4, 3, KEY_F2), | ||
93 | KEY(4, 4, KEY_VOLUMEUP), | ||
94 | KEY(4, 5, KEY_UNKNOWN), | ||
95 | KEY(4, 6, KEY_L), | ||
96 | KEY(4, 7, KEY_LEFT), | ||
97 | |||
98 | KEY(5, 0, KEY_S), | ||
99 | KEY(5, 1, KEY_H), | ||
100 | KEY(5, 2, KEY_J), | ||
101 | KEY(5, 3, KEY_F3), | ||
102 | KEY(5, 4, KEY_F9), | ||
103 | KEY(5, 5, KEY_VOLUMEDOWN), | ||
104 | KEY(5, 6, KEY_M), | ||
105 | KEY(5, 7, KEY_RIGHT), | ||
106 | |||
107 | KEY(6, 0, KEY_Q), | ||
108 | KEY(6, 1, KEY_A), | ||
109 | KEY(6, 2, KEY_N), | ||
110 | KEY(6, 3, KEY_BACK), | ||
111 | KEY(6, 4, KEY_BACKSPACE), | ||
112 | KEY(6, 5, KEY_UNKNOWN), | ||
113 | KEY(6, 6, KEY_P), | ||
114 | KEY(6, 7, KEY_UP), | ||
115 | |||
116 | KEY(7, 0, KEY_PROG1), | ||
117 | KEY(7, 1, KEY_PROG2), | ||
118 | KEY(7, 2, KEY_PROG3), | ||
119 | KEY(7, 3, KEY_PROG4), | ||
120 | KEY(7, 4, KEY_F4), | ||
121 | KEY(7, 5, KEY_UNKNOWN), | ||
122 | KEY(7, 6, KEY_OK), | ||
123 | KEY(7, 7, KEY_DOWN), | ||
124 | }; | ||
125 | |||
126 | static struct matrix_keymap_data sdp4430_keymap_data = { | ||
127 | .keymap = sdp4430_keymap, | ||
128 | .keymap_size = ARRAY_SIZE(sdp4430_keymap), | ||
129 | }; | ||
130 | |||
131 | static struct omap4_keypad_platform_data sdp4430_keypad_data = { | ||
132 | .keymap_data = &sdp4430_keymap_data, | ||
133 | .rows = 8, | ||
134 | .cols = 8, | ||
135 | }; | ||
51 | static struct gpio_led sdp4430_gpio_leds[] = { | 136 | static struct gpio_led sdp4430_gpio_leds[] = { |
52 | { | 137 | { |
53 | .name = "omap4:green:debug0", | 138 | .name = "omap4:green:debug0", |
@@ -593,6 +678,10 @@ static void __init omap_4430sdp_init(void) | |||
593 | spi_register_board_info(sdp4430_spi_board_info, | 678 | spi_register_board_info(sdp4430_spi_board_info, |
594 | ARRAY_SIZE(sdp4430_spi_board_info)); | 679 | ARRAY_SIZE(sdp4430_spi_board_info)); |
595 | } | 680 | } |
681 | |||
682 | status = omap4_keyboard_init(&sdp4430_keypad_data); | ||
683 | if (status) | ||
684 | pr_err("Keypad initialization failed: %d\n", status); | ||
596 | } | 685 | } |
597 | 686 | ||
598 | static void __init omap_4430sdp_map_io(void) | 687 | static void __init omap_4430sdp_map_io(void) |
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index e0f0ef952bc9..8800486f9467 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <plat/dma.h> | 30 | #include <plat/dma.h> |
31 | #include <plat/omap_hwmod.h> | 31 | #include <plat/omap_hwmod.h> |
32 | #include <plat/omap_device.h> | 32 | #include <plat/omap_device.h> |
33 | #include <plat/omap4-keypad.h> | ||
33 | 34 | ||
34 | #include "mux.h" | 35 | #include "mux.h" |
35 | #include "control.h" | 36 | #include "control.h" |
@@ -141,6 +142,46 @@ static inline void omap_init_camera(void) | |||
141 | } | 142 | } |
142 | #endif | 143 | #endif |
143 | 144 | ||
145 | struct omap_device_pm_latency omap_keyboard_latency[] = { | ||
146 | { | ||
147 | .deactivate_func = omap_device_idle_hwmods, | ||
148 | .activate_func = omap_device_enable_hwmods, | ||
149 | .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, | ||
150 | }, | ||
151 | }; | ||
152 | |||
153 | int __init omap4_keyboard_init(struct omap4_keypad_platform_data | ||
154 | *sdp4430_keypad_data) | ||
155 | { | ||
156 | struct omap_device *od; | ||
157 | struct omap_hwmod *oh; | ||
158 | struct omap4_keypad_platform_data *keypad_data; | ||
159 | unsigned int id = -1; | ||
160 | char *oh_name = "kbd"; | ||
161 | char *name = "omap4-keypad"; | ||
162 | |||
163 | oh = omap_hwmod_lookup(oh_name); | ||
164 | if (!oh) { | ||
165 | pr_err("Could not look up %s\n", oh_name); | ||
166 | return -ENODEV; | ||
167 | } | ||
168 | |||
169 | keypad_data = sdp4430_keypad_data; | ||
170 | |||
171 | od = omap_device_build(name, id, oh, keypad_data, | ||
172 | sizeof(struct omap4_keypad_platform_data), | ||
173 | omap_keyboard_latency, | ||
174 | ARRAY_SIZE(omap_keyboard_latency), 0); | ||
175 | |||
176 | if (IS_ERR(od)) { | ||
177 | WARN(1, "Cant build omap_device for %s:%s.\n", | ||
178 | name, oh->name); | ||
179 | return PTR_ERR(od); | ||
180 | } | ||
181 | |||
182 | return 0; | ||
183 | } | ||
184 | |||
144 | #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) | 185 | #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE) |
145 | 186 | ||
146 | #define MBOX_REG_SIZE 0x120 | 187 | #define MBOX_REG_SIZE 0x120 |